Re: [RFC PATCH v1 5/5] KVM: Remove kvm_rebooting and its references

Sean Christopherson
2025-09-17T23:02:12Z

On Wed, Sep 17, 2025, Xin Li wrote:
> On 9/16/2025 10:56 AM, Sean Christopherson wrote:
> > On Tue, Sep 09, 2025, Xin Li (Intel) wrote:
> > > Drop kvm_rebooting and all related uses. Virtualization is now disabled
> > > immediately before a CPU shuts down, eliminating any chance of executing
> > > virtualization instructions during reboot.
> >
> > Wrong. KVM clears EFER.SVME in reponse to kvm_shutdown(), and thus can trip
> > #UDs on e.g. VMRUN.
> >
>
> This patch assumes that AMD SVM enable/disable has been moved to the CPU

Ah, that wasn't exactly obvious.

> startup and shutdown routines. Accordingly, kvm_shutdown() no longer clears
> EFER.SVME, and the patch demonstrates the resulting simplification from
> removing kvm_rebooting. However, as noted in the cover letter, no actual
> modifications were made to AMD SVM.

Heh, yeah, that's what's wrong.