On Wed, Jun 14, 2023, Alexey Kardashevskiy wrote: > On 14/6/23 09:19, Sean Christopherson wrote: > > On Fri, Jun 02, 2023, Alexey Kardashevskiy wrote: > > > > > Side topic, isn't there an existing bug regarding SEV-ES NMI windows? > > > > > KVM can't actually single-step an SEV-ES guest, but tries to set > > > > > RFLAGS.TF anyways. > > > > =20 > > > > Why is it a "bug" and what does the patch fix? Sound to me as it is > > > > pointless and the guest won't do single stepping and instead will run > > > > till it exits somehow, what do I miss? > > > > The bug is benign in the end, but it's still a bug. I'm not worried about = > > > (unrelated) Your response's encoding broke somehow and I wonder if this is > something I did or you did. Lore got it too: > > https://lore.kernel.org/all/ZIj5ms+DohcLyXHE@xxxxxxxxxx/ Huh. Guessing something I did, but I've no idea what caused it. > > fixing > > any behavior, but I dislike having dead, misleading code, especially for so= > > mething > > like this where both NMI virtualization and SEV-ES are already crazy comple= > > x and > > subtle. I think it's safe to say that I've spent more time digging through= > > SEV-ES > > and NMI virtualization than most KVM developers, and as evidenced by the nu= > > mber of > > things I got wrong below, I'm still struggling to keep track of the bigger = > > picture. > > Developers that are new to all of this need as much help as they can get. > > > > > > > Blech, and suppressing EFER.SVME in efer_trap() is a bit gross, > > > > =20 > > > > Why suppressed? svm_set_efer() sets it eventually anyway. > > > > svm_set_efer() sets SVME in hardware, but KVM's view of the guest's value t= > > hat's > > stored in vcpu->arch.efer doesn't have SVME set. E.g. from the guest's per= > > spective, > > EFER.SVME will have "Reserved Read As Zero" semantics. > > It is not zero, why? From inside the guest, rdmsrl(MSR_EFER, efer) reads > 0x1d01 from that msr where 0x1000==(1<<_EFER_SVME), _EFER_SVME==12. Oh, lame. So the guest gets to see the raw value in the VMSA. So it really comes down to the GHCB not providing support for STGI/CLGI.