Re: [PATCH v2 1/7] KVM: x86: Move kvm_rebooting to x86

Dave Hansen
2026-01-05T17:48:56Z

On 12/5/25 17:10, Sean Christopherson wrote:
> Move kvm_rebooting, which is only read by x86, to KVM x86 so that it can
> be moved again to core x86 code. Add a "shutdown" arch hook to facilate
> setting the flag in KVM x86.

For the pure code move:

Acked-by: Dave Hansen <dave.hansen@linux.intel.com>

That said, I wouldn't mind some clarification around 'kvm_rebooting' and
a small bit of documentation about what kvm_arch_shutdown() is conceptually.

It doesn't have to be in this set, but maybe:

/*
* Override this to make global, arch-specific changes which
* prepare the system to disable hardware virtualization support.
*/
__weak void kvm_arch_shutdown(void)
{
}

and something like:

void kvm_arch_shutdown(void)
{
/*
* Indicate that hardware virtualization support will soon be
* disabled asynchronously. Attempts to use hardware
* virtualization will start generating errors and exceptions.
*
* Start being more tolerant of those conditions.
*/
kvm_rebooting = true;
smp_wmb();
}

The barrier is almost certainly not needed in practice. But I do find it
helpful as an indicator that other CPUs are going to be reading this
thing and we have zero clue what they're doing.