On Mon, Jun 06, 2022 at 12:28:32PM +0100, Marc Zyngier wrote: > Mark Brown <broonie@xxxxxxxxxx> 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.
Attachment:
signature.asc
Description: PGP signature