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 307A8C43334 for ; Mon, 6 Jun 2022 12:18:22 +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-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=795OxWv/33NVvn8mfOS79PEGpKIdfrJgIrCRkOefCRQ=; b=0NDmVDFHUkSpKnuR6PXKXQV7wI P1VTc3/XqVHmXbWZwObi/Rh/LkZ6OsiGOVwmaZ5qXkO8BuMJwCL1eBxs61/mC7d+zen5E+i/VjtDw oTVrxUwr5ZWiICwNAiB/PMJ4r6G/BgTUdWy3qm+QLPBHScXmJcOgrKm/DXC4RzGS3WF2CKF0y1yPX pgKsFcByCnhhXXoPGfHnwEGp0Jj22ZmFR6k0UnmCTcFlwsyut9S/NFN1PeeksdHACiU8k0d0HrH8D Vl5DiwB7sfdp0Y6NLzliHzLgUUrsVh6dK7nwO5Bp/v4WZMZOOWk6j+GPWECY0DfNLSrbxWGBzlXWV 0KbwV+rw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyBfJ-001ACZ-14; Mon, 06 Jun 2022 12:17:01 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyBfG-001ABl-79 for linux-arm-kernel@lists.infradead.org; Mon, 06 Jun 2022 12:16:59 +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 sin.source.kernel.org (Postfix) with ESMTPS id 49E82CE1A91; Mon, 6 Jun 2022 12:16:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE360C34119; Mon, 6 Jun 2022 12:16:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654517814; bh=DbMgnzFRDeClTcRHZKl9h6of7GFtoGX1BaOdzUKuVpM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=B7z7FHJhSOsxG0qlrZKrOsoSS0uQvLJlGQZEVqpzl9lgWj/QKHPYxDbBXCkm4m7vN 3UPBWK5UUxcCS9dIdcVwFkn1w66aFkXyQVjUHTJQvU4VRheyvpMZ3yOnNGThcpMCXD CqBoIe+Lg8zvxsW2Zh4v06JNQUgtrdcUQkMlzp9PE6CYNeL5loiRQCMzD2M0isBP7b qbCpIv6eP3tzuJ1LA+citjUdU8c2lAHs98cf30MTjA/hsijoZPHXx3mr9RBMDPU4z2 5QK6wKQkbFOmY9S3XZ2aDkyIA2MUaw+8LLcD8dnpxwN7VIqVHjj73B896O/GS8f9ih l3GfBYwo+i8hQ== Date: Mon, 6 Jun 2022 13:16:48 +0100 From: Mark Brown To: Marc Zyngier Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, James Morse , Suzuki K Poulose , Alexandru Elisei , Oliver Upton , Will Deacon , Fuad Tabba , Quentin Perret , kernel-team@android.com, stable@vger.kernel.org Subject: Re: [PATCH 01/18] KVM: arm64: Always start with clearing SVE flag on load Message-ID: References: <20220528113829.1043361-1-maz@kernel.org> <20220528113829.1043361-2-maz@kernel.org> <87y1ya3uan.wl-maz@kernel.org> MIME-Version: 1.0 In-Reply-To: <87y1ya3uan.wl-maz@kernel.org> X-Cookie: Bedfellows make strange politicians. X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220606_051658_636170_44C44BFF X-CRM114-Status: GOOD ( 26.66 ) 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: multipart/mixed; boundary="===============6380907840825677066==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============6380907840825677066== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="B+OWqsOhQgqxaqa/" Content-Disposition: inline --B+OWqsOhQgqxaqa/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Jun 06, 2022 at 12:28:32PM +0100, Marc Zyngier wrote: > Mark Brown wrote: > > On Sat, May 28, 2022 at 12:38:11PM +0100, Marc Zyngier wrote: > > > We probably never saw the issue because no VMM uses SVE, but > > > that's still pretty bad. Unconditionally clearing the flag > > > on vcpu load addresses the issue. > > Unless I'm missing something since we currently always disable > > SVE on syscall even if the VMM were using SVE for some reason > > (SVE memcpy()?) we should already have disabled SVE for EL0 in > > sve_user_discard() during kernel entry so EL0 access to SVE > > should be disabled in the system register by the time we get > > here. > Indeed. And this begs the question: what is this code actually doing? > Is there any way we can end-up running a guest with any valid host SVE > state? > I remember being >this< close to removing that code some time ago, and > only stopped because I vaguely remembered Dave Martin convincing me at > some point that it was necessary. I'm unable to piece the argument > together again though. I've stared at that code a few times as well, I think I'd ended up assuming it was some path to do with preempting and context switching but in that case I've never been clear why there'd be anything left that we'd need to preserve, or if we do why we don't just force a fpsimd_save(). It's possible this was from some earlier stage in review where the ABI didn't allow us to discard the SVE register state, or that it's there as defensive programming so for future work where we don't just disable on entry. Conicidentally I am going to post some patches later today or tomorrow which leave SVE enabled on syscall, they still have the hook for disabling it when entering KVM though so we'd still not need to save the EL0 state and the above should still apply. --B+OWqsOhQgqxaqa/ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmKd8C8ACgkQJNaLcl1U h9AuDQf/VtGwAYDRDXwCU0D9tcpQJP64CtZ/QTytBLvoK2LGjER1sF9NO52CsDv2 LKMCVNLg64qR5K+eB9ruX6ER3XOtEP1ttwQNvNVkZxmx7uHi2zZA/8FVdy+5RHYH 651Hye9Gxe0Pq/dUj5H0Ij4eauwvOYahcpvoI+XDHNyM5DGjayLuqJX2BOFhfMvp bSYpgzr63deaSi/Hm7d+zD/EFupGNoMcKJ2aYFbRx29AUeriEe+q2yR7wAiwXhbG ZB6s+YX23A75vW7S1G3ujaPKAVenINEhfg8hGZ2G9GeJUw8iT6ckCm2CYAp6hurz b8rnsx2vN0U9BYAo+aQrx24rn8sz0Q== =8N3B -----END PGP SIGNATURE----- --B+OWqsOhQgqxaqa/-- --===============6380907840825677066== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============6380907840825677066==--