From patchwork Mon Nov 27 06:25:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 10075847 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D96BE602BD for ; Mon, 27 Nov 2017 06:26:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C41D228D4C for ; Mon, 27 Nov 2017 06:26:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6F3E28D62; Mon, 27 Nov 2017 06:26:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1C41428D4C for ; Mon, 27 Nov 2017 06:26:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AQmmICVDf1j4ViEE+714vXxI71IMYoOUH/Bq1I2wpfg=; b=n1ZFTgD4moHUNx FL0je1p74bS/RYr7p+dIfIldOWcMGvQ8rGEaW511kvEdlvzwXyu843cVct7EmsS0TYjYl0WS4AOOx DGwoh8vxSDB8B2AZJqt9+EQhVkVooNRrCHv8ZrGYOApqmVeNHWwNiXlg6P4YeJOeB3QVQsC5W5I+w xLh11m4aosL86diTMKWQLOZXjzcWVfbQLZcTWqeutroRQg3xhFm85x7ux1unCslgoHNmCIu5DTUKK Ll63v7kY33pgdbx4Q9KwYWQb9GVm9GFoJw8MU3lDka1qkl8EMUi7gDKBZhVtl6ydTQ33p/ujso9KU AlJdRj/PLz/WrN8JUXlA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eJCsG-0007OZ-Mj; Mon, 27 Nov 2017 06:26:36 +0000 Received: from mail-dm3nam03on0046.outbound.protection.outlook.com ([104.47.41.46] helo=NAM03-DM3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eJCsD-0007Gj-Er for linux-arm-kernel@lists.infradead.org; Mon, 27 Nov 2017 06:26:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=mlDhG1YbxGthhk3y6TQJr4r6YzKJUqWwxyUhPe9rwLs=; b=Q80yakgXgndiumzSsAc5dyLsjwn8pjtr3KDZ4hyNjA/aEi1C0ukwaSpUTGjMNz3q+WiPSOVaeDDA21VJUfUXlBw8aT2Wt8seIn7Hy7W99rCIk00fIG/ukIFCWZAS3TNKTyE/ciwXF31goIC8rgMdVCKWCflW4uNPei1T0720GPA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@cavium.com; Received: from localhost (42.106.45.171) by DM5PR0701MB3829.namprd07.prod.outlook.com (2603:10b6:4:7f::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.260.4; Mon, 27 Nov 2017 06:26:10 +0000 Date: Mon, 27 Nov 2017 09:25:57 +0300 From: Yury Norov To: Christoffer Dall Subject: Re: [PATCH 08/37] KVM: arm64: Defer restoring host VFP state to vcpu_put Message-ID: <20171126201352.yjcexe235azk3sdf@yury-thinkpad> References: <20171012104141.26902-1-christoffer.dall@linaro.org> <20171012104141.26902-9-christoffer.dall@linaro.org> <20171125075221.oj5euwo7hnktxxsj@yury-thinkpad> <20171126161716.GK28855@cbox> <20171126185852.bjte7raycorctft2@yury-thinkpad> <20171126191834.GN28855@cbox> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20171126191834.GN28855@cbox> User-Agent: NeoMutt/20170113 (1.7.2) X-Originating-IP: [42.106.45.171] X-ClientProxiedBy: VI1P189CA0008.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::21) To DM5PR0701MB3829.namprd07.prod.outlook.com (2603:10b6:4:7f::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 82ff7844-fb35-43cb-469b-08d5355fc0b1 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603258); SRVR:DM5PR0701MB3829; X-Microsoft-Exchange-Diagnostics: 1; DM5PR0701MB3829; 3:i+9HZSG4AULccydQ9txA8+A0ylFppOI9eyQ9yxy8oW4KCloz0id5vD8uuQxHId8zWm4DjDS5kLFs9pHkhxI6X31DC//PgcPz1ZKAlpcDdM7evEP5cJ+nYD0MlH+97sVQF+ClqA3YD5GW/p7eX0do4jnqTcKKABDx4tMR26XkG1OZPTm8MsvYh/G0qyiMASNA/wASSPxqO5Jt/ueCEf+R/gm1U4OgyeXFa4KWxGPdavTaBqUdnU9+qFDe6RJZSBcb; 25:INRkxVu8tdlxWquYAtJqZTUQBW85+1QTenXb0KpVdiRmzrrvJNFN7CREx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wGDwQi8SCrC9A8Kny0+Aui8d7X03pugk2OBIkaBhATBXwMh8unfMjwdO4Cihleokwou4HJ9SbilaO8siPXcaI1oKwvuKFPuWmn4wE9qPGLSYhc+q4SJ69xXNmr3Ip/cbKK9m0=; 4:upcWk4SvWnXWUrtrrYOMWKX4tZ+jKP+JKfN58p7h7dGnv9XiLYxiu6W4X6+TUf4szI30q+5AyM/HO8lli4v9Sf2hj6VT94oZENDr9lOK6TjX3tdjTx55s+sgaiCZFBbCuIWJOtz/9tGgZ+p8KSwLGFbDRFL3shIZ1LeAJI8h1VUP8sLpLfr96AAj6IDliW/ab3O83tMDxYcowZp2QZR2wUGcQkqXAlQsww3EK58cSQCwT3kZaPbzwwGxEVPEmVqvrHjyciCwGbuIz+qNYKTYA/+NBUIqEnNJsiM6nngRd29G8hQGvGm1pGtn3HRvG57v X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(17755550239193); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(5005006)(8121501046)(93006095)(10201501046)(3002001)(3231022)(6041248)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123564025)(20161123560025)(20161123562025)(6072148)(201708071742011); SRVR:DM5PR0701MB3829; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DM5PR0701MB3829; X-Forefront-PRVS: 0504F29D72 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(6009001)(7916004)(376002)(346002)(366004)(51444003)(189002)(199003)(24454002)(6116002)(33646002)(3846002)(1076002)(23726003)(106356001)(101416001)(5009440100003)(105586002)(53936002)(76506005)(97736004)(50466002)(47776003)(6246003)(66066001)(4326008)(76176999)(7736002)(54356999)(2950100002)(9686003)(72206003)(478600001)(58126008)(83506002)(189998001)(25786009)(305945005)(50986999)(6666003)(6486002)(229853002)(316002)(6916009)(2906002)(8676002)(33716001)(42882006)(68736007)(8936002)(81166006)(16586007)(6496006)(5660300001)(16526018)(93886005)(52116002)(54906003)(81156014); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR0701MB3829; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR0701MB3829; 23:xf+s4X+yFMKENuwDlemRx39t+DTNkb0fDG1LMp4?= =?us-ascii?Q?DZckX5BJzWTKmOEP8Olzkyf2uic9InsV4ISpWW29k6V8Potawp6r3ihG89lV?= =?us-ascii?Q?wL5qC5mMxhtRijmY1oCz3pN2m963yPHoUmK8J825LixbcD7QXm+YIC1szfET?= =?us-ascii?Q?2lKjbOCXHDuEQ3zynoov9E+S3zrErNvDCeVBEJDl1KUl2hc9P/z1Xr7ppoNu?= =?us-ascii?Q?R8WPsU31aORQ50laTqdZZiBaqFtxLbhwaAqyRs5mT01ZaY1/txdH5mOVqenb?= =?us-ascii?Q?psfETJH7rbD5f50RhJzAp3mP498ZTQaimgqKiVzZBgsd2qAQ9c9NOPVjCt/n?= =?us-ascii?Q?ZYYqcnD5KPLpUeguPaSh6v5L07xTnzGyshcNhfDu6kTJ/5j6KtCPCa0IWiZG?= =?us-ascii?Q?YaQDkK6L4yAmsFuJal0buSH+cPiGpcLBNzDI7qe7wbC4wEpMtXyftOhe1oH/?= =?us-ascii?Q?crflou2a7Es/0Y/0BBt1xSVUviUIC0K7I6fwxNcLgZ+f4ZBgIGeOLm9mKtx9?= =?us-ascii?Q?kX5Vxg7jeez/faT58zQSTX0ARCyRYLk6cjIQTrqEyo9uvy/mQAMaM/C2CDwl?= =?us-ascii?Q?Ga6cTBFI/DKiU3JrrRzGImUcpTPgthuPQDu2Sj5S+WoDPeQ8CgmKTp6tod9w?= =?us-ascii?Q?cNqYMFfAYr576Eb6FB/p3hXRYeCwYM27CrCrSywMexhpExnK4E+DF4n4G8yW?= =?us-ascii?Q?Fmer+qG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f/b5BTvMf9bEINxln90uBx6FLjeW0OUIScFQoOCGhqQxTCeuOC2AtGy8PooN2GCTP8KBkrcFJj2Wn1JH0UIhEo+82o8Z+83yehPK7CMirZsiHcLHvvO3MX9XTRTb+gl6Aof9ZaSbEaCL13K55NgC5YzAOX4y0LJOaneqivl98wHG0=; 5:gl/5O0VCRBcAeuAlJnbEnLuVIu2nV+ggEwGNhODhYehgPpmpS7xWzFifGNbF0U9eZdm83pGRkIeEu0KFAX0mn/2RC9vLBga6FPljBX525nND0QK6J8Mu/knVnMvz8eYMulDkgnAKyTBAeJElGEqANnXL6e6sgXcWtbUxWSfWq/Q=; 24:hsWH9xNVK1hyQSy8CMjk7P98Pk161EIVxK8A8pf4WiXF2zJXzUjwApQ9uIkuZQ6jMme0Jd0a3XhrzPrbV6JpWK67lHVL1xdskYRF/0+wEaI=; 7:pioqq5QMeX7Q/WXWcVrAaNTgFX5ae5b0PZmTEevk6f1WwfA9DY9HpvXJ/byUG3VClESfdIioBnv2duxgQyiSh2mW6oJvINO6+s5zyDA8TS0+70M0NaTZFhzcaLa662SoDllDz6bI5DlVYRz1a+zmSUwbGkHU4Ijgnwscv2F/5z0Tt9P07kfd0oYwBBWFtGuhE5ndsZIG3mT554+/mcw+iZGoZnBDNKc0Udm+i4hZ++JUaePsrn2pj69gj/XwKWXV SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2017 06:26:10.2395 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 82ff7844-fb35-43cb-469b-08d5355fc0b1 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR0701MB3829 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171126_222633_655352_B1E2F0A5 X-CRM114-Status: GOOD ( 33.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvm@vger.kernel.org, Marc Zyngier , Christoffer Dall , Shih-Wei Li , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On Sun, Nov 26, 2017 at 08:18:34PM +0100, Christoffer Dall wrote: > On Sun, Nov 26, 2017 at 09:58:52PM +0300, Yury Norov wrote: > > On Sun, Nov 26, 2017 at 05:17:16PM +0100, Christoffer Dall wrote: > > > Hi Yury, > > > > > > On Sat, Nov 25, 2017 at 10:52:21AM +0300, Yury Norov wrote: > > > > > > > > On Thu, Oct 12, 2017 at 12:41:12PM +0200, Christoffer Dall wrote: > > > > > Avoid saving the guest VFP registers and restoring the host VFP > > > > > registers on every exit from the VM. Only when we're about to run > > > > > userspace or other threads in the kernel do we really have to switch the > > > > > state back to the host state. > > > > > > > > > > We still initially configure the VFP registers to trap when entering the > > > > > VM, but the difference is that we now leave the guest state in the > > > > > hardware registers while running the VM. > > > > > > > > > > Signed-off-by: Christoffer Dall > > > > > --- > > > > > arch/arm64/include/asm/kvm_emulate.h | 5 ++++ > > > > > arch/arm64/include/asm/kvm_host.h | 3 +++ > > > > > arch/arm64/kernel/asm-offsets.c | 1 + > > > > > arch/arm64/kvm/hyp/entry.S | 3 +++ > > > > > arch/arm64/kvm/hyp/switch.c | 47 +++++++++++------------------------- > > > > > arch/arm64/kvm/hyp/sysreg-sr.c | 21 +++++++++++++--- > > > > > 6 files changed, 44 insertions(+), 36 deletions(-) > > > > > > > > > > diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h > > > > > index 1fbfe96..630dd60 100644 > > > > > --- a/arch/arm64/include/asm/kvm_emulate.h > > > > > +++ b/arch/arm64/include/asm/kvm_emulate.h > > > > > @@ -56,6 +56,11 @@ static inline unsigned long *vcpu_hcr(struct kvm_vcpu *vcpu) > > > > > return (unsigned long *)&vcpu->arch.hcr_el2; > > > > > } > > > > > > > > > > +static inline bool vcpu_el1_is_32bit(struct kvm_vcpu *vcpu) > > > > > +{ > > > > > + return (!(vcpu->arch.hcr_el2 & HCR_RW)); > > > > > +} > > > > > + > > > > > static inline unsigned long *vcpu_pc(const struct kvm_vcpu *vcpu) > > > > > { > > > > > return (unsigned long *)&vcpu_gp_regs(vcpu)->regs.pc; > > > > > diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h > > > > > index 7d3bfa7..5e09eb9 100644 > > > > > --- a/arch/arm64/include/asm/kvm_host.h > > > > > +++ b/arch/arm64/include/asm/kvm_host.h > > > > > @@ -210,6 +210,9 @@ struct kvm_vcpu_arch { > > > > > /* Guest debug state */ > > > > > u64 debug_flags; > > > > > > > > > > + /* 1 if the guest VFP state is loaded into the hardware */ > > > > > + u64 guest_vfp_loaded; > > > > > > > > May it be just u8/bool? > > > > > > > This particular field is accessed from assembly code, and I'm not sure > > > what guarantees the compiler makes in terms of how a u8/bool is > > > allocated with respect to padding and alignment, and I think that's why > > > we've been using u64 fields in the past. > > > > > > I don't actually remember the details, but I'd rather err on the side of > > > caution than trying to save a few bytes. However, if someone can > > > convince me there's a completely safe way to do this, then I'm happy to > > > change it. > > > > 'strb w0, [x3, #VCPU_GUEST_VFP_LOADED]' would work. See > > C6.6.181 STRB (register) in ARM64 ARM. > > I'm well aware of this instruction. Thank you though. > > The concern was that we haven't done this in the past. I think that was > because the size of a _Bool is not well-defined and we really didn't > care about a couple of handful of bytes when talking about vcpu > structures. Really. > > A u8 should work though, but probably this will all be moot if I combine > the flags into a single field. > > > > > The only thing I would recommend is to reorder fields in kvm_vcpu_arch > > to avoid unneeded holes in the structure. It already spend 10 bytes for > > nothing in 3 holes. > > > Patches are welcome. Heh :) I meant reordering only this field if it is changed. If you want me to reorder the whole structure and remove all holes... Patches of that sort (I mean moving fields here and there just to save couple of bytes) are looking weird. At most because there is general assumption that the hole exists because author prefers to have clean logic in field order even with the cost of few holes. But if you give me indulgence... Nevertheless, for this specific structure: Before: /* size: 8176, cachelines: 128, members: 23 */ /* sum members: 8152, holes: 3, sum holes: 10 */ /* padding: 14 */ /* last cacheline: 48 bytes */ After: /* size: 8160, cachelines: 128, members: 23 */ /* padding: 8 */ /* last cacheline: 32 bytes */ The patch is below. Yury diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index dcded44b4180..3739471c39ac 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -200,10 +200,6 @@ typedef struct kvm_cpu_context kvm_cpu_context_t; struct kvm_vcpu_arch { struct kvm_cpu_context ctxt; - /* HYP configuration */ - u64 hcr_el2; - u32 mdcr_el2; - /* Exception Information */ struct kvm_vcpu_fault_info fault; @@ -249,6 +245,20 @@ struct kvm_vcpu_arch { * here. */ + /* IO related fields */ + struct kvm_decode mmio_decode; + + /* Cache some mmu pages needed inside spinlock regions */ + struct kvm_mmu_memory_cache mmu_page_cache; + + /* HYP configuration */ + u64 hcr_el2; + u32 mdcr_el2; + + /* Target CPU and feature flags */ + int target; + DECLARE_BITMAP(features, KVM_VCPU_MAX_FEATURES); + /* * Guest registers we preserve during guest debugging. * @@ -266,16 +276,6 @@ struct kvm_vcpu_arch { /* Don't run the guest (internal implementation need) */ bool pause; - /* IO related fields */ - struct kvm_decode mmio_decode; - - /* Cache some mmu pages needed inside spinlock regions */ - struct kvm_mmu_memory_cache mmu_page_cache; - - /* Target CPU and feature flags */ - int target; - DECLARE_BITMAP(features, KVM_VCPU_MAX_FEATURES); - /* Detect first run of a vcpu */ bool has_run_once;