From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EB416C6FA82 for ; Tue, 20 Sep 2022 18:05:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jIkk3tGXUtPydXPncFz5WjxtD3ha9Am+vlxxCxabm/w=; b=NL7qCCQcic4Ozy avkgzi9L7+TDflnikTjmXPhDuUh3JpLQ9TZWMfx7qe3mrnnl2SItcDD5fbedJbiuJzdNnqOslGQvk 4d3gXTb6W8jvr5Rm6Xw/oUbr5Wlr5OakxFMWZpst/bcS0ImGSzs09UuB2jrgjjxRadXbrDuAsRikR 6L9JBgjBcED0SHbPYZrzk6Dc464KEH1ch5fAQ9sPVRb7yuDoxdAHhwArE/U7Gw274HZOYmhIV/Qe8 9JHrGmGub+LFI/x4WlK/CmGxy/HbeIZqgfxY6lyCa0ve4DabMN9+Chv1orJujyZbJZBYBsEl6i0En UxAdvo6zqz178f6TVNKg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oahbo-005cYd-Fr; Tue, 20 Sep 2022 18:04:36 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oahbi-005cWW-No for linux-arm-kernel@lists.infradead.org; Tue, 20 Sep 2022 18:04:34 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 652A5B82B95; Tue, 20 Sep 2022 18:04:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 189E9C433D6; Tue, 20 Sep 2022 18:04:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663697068; bh=q0Q77G3eESlaWUElAJg3qfMcJbtPpE343+qLMFXLRYg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=F7O+fgu2nRycaAsrdjS8eXohA5/ul9yGibfrLiYjGtkM7k5aUBwdifwnharo8L6jR JqNcr/Yz0XbM8e9mTD7cTijA9XOVKuEmNZLS3HvdeqxuwmUoJOfO2cOpx427YkU+n5 Z7xKXest+zwEM1+WuDky5AGlmeZeGJdH0UIn/1wYcVtWjvNwWRK/kmK1O+Idadrgu4 pfGcBOmf4PCne3lZU4hcKgpPV73IOfMXm2ckllUrMaT6EzJIg4k6Qes1GLg5WN8kvU meW4DMNX5VTflla37bBhubckWJLZz/nkF8w85TcRll37D3+3PFLd22dyzpdqHpcvND 8pzG/0uqMNUDQ== Received: from 185-176-101-241.host.sccbroadband.ie ([185.176.101.241] helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1oahbd-00BT1L-Pi; Tue, 20 Sep 2022 19:04:25 +0100 Date: Tue, 20 Sep 2022 19:04:24 +0100 Message-ID: <87v8phkjmf.wl-maz@kernel.org> From: Marc Zyngier To: Mark Brown Cc: Catalin Marinas , Will Deacon , Zhang Lei , James Morse , Alexandru Elisei , Andre Przywara , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v3 4/7] arm64/fpsimd: Stop using TIF_SVE to manage register saving in KVM In-Reply-To: <20220815225529.930315-5-broonie@kernel.org> References: <20220815225529.930315-1-broonie@kernel.org> <20220815225529.930315-5-broonie@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.176.101.241 X-SA-Exim-Rcpt-To: broonie@kernel.org, catalin.marinas@arm.com, will@kernel.org, zhang.lei@jp.fujitsu.com, james.morse@arm.com, alexandru.elisei@arm.com, andre.przywara@arm.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220920_110431_096576_846D45D5 X-CRM114-Status: GOOD ( 32.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 15 Aug 2022 23:55:26 +0100, Mark Brown wrote: > > Now that we are explicitly telling the host FP code which register state > it needs to save we can remove the manipulation of TIF_SVE from the KVM > code, simplifying it and allowing us to optimise our handling of normal > tasks. Remove the manipulation of TIF_SVE from KVM and instead rely on > to_save to ensure we save the correct data for it. > > Signed-off-by: Mark Brown > --- > arch/arm64/kernel/fpsimd.c | 22 ++++------------------ > arch/arm64/kvm/fpsimd.c | 3 --- > 2 files changed, 4 insertions(+), 21 deletions(-) > > diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c > index 7be20ced2c45..aaea2dc02cbd 100644 > --- a/arch/arm64/kernel/fpsimd.c > +++ b/arch/arm64/kernel/fpsimd.c > @@ -436,8 +436,8 @@ static void task_fpsimd_load(void) > * last, if KVM is involved this may be the guest VM context rather > * than the host thread for the VM pointed to by current. This means > * that we must always reference the state storage via last rather > - * than via current, other than the TIF_ flags which KVM will > - * carefully maintain for us. > + * than via current, if we are saving KVM state then it will have > + * ensured that the type of registers to save is set in last->to_save. > */ > static void fpsimd_save(void) > { > @@ -454,27 +454,13 @@ static void fpsimd_save(void) > if (test_thread_flag(TIF_FOREIGN_FPSTATE)) > return; > > - if (test_thread_flag(TIF_SVE)) { > + if ((last->to_save == FP_STATE_TASK && test_thread_flag(TIF_SVE)) || > + last->to_save == FP_STATE_SVE) { > save_sve_regs = true; > save_ffr = true; > vl = last->sve_vl; > } > > - /* > - * For now we're just validating that the requested state is > - * consistent with what we'd otherwise work out. > - */ > - switch (last->to_save) { > - case FP_STATE_TASK: > - break; > - case FP_STATE_FPSIMD: > - WARN_ON_ONCE(save_sve_regs); > - break; > - case FP_STATE_SVE: > - WARN_ON_ONCE(!save_sve_regs); > - break; > - } > - Given how short-lived this code is, consider dropping it altogether. Actually, the previous patch would make a lot more sense if it was merged with this one. > if (system_supports_sme()) { > u64 *svcr = last->svcr; > > diff --git a/arch/arm64/kvm/fpsimd.c b/arch/arm64/kvm/fpsimd.c > index db0b2bacaeb8..8a79823fce68 100644 > --- a/arch/arm64/kvm/fpsimd.c > +++ b/arch/arm64/kvm/fpsimd.c > @@ -151,7 +151,6 @@ void kvm_arch_vcpu_ctxsync_fp(struct kvm_vcpu *vcpu) > &vcpu->arch.fp_type, fp_type); > > clear_thread_flag(TIF_FOREIGN_FPSTATE); > - update_thread_flag(TIF_SVE, vcpu_has_sve(vcpu)); > } > } > > @@ -208,7 +207,5 @@ void kvm_arch_vcpu_put_fp(struct kvm_vcpu *vcpu) > sysreg_clear_set(CPACR_EL1, CPACR_EL1_ZEN_EL0EN, 0); > } > > - update_thread_flag(TIF_SVE, 0); > - > local_irq_restore(flags); > } Thanks, M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel