KVM: x86: Snapshot the host's DEBUGCTL after disabling IRQs

Snapshot the host's DEBUGCTL after disabling IRQs, as perf can toggle
debugctl bits from IRQ context, e.g. when enabling/disabling events via
smp_call_function_single(). Taking the snapshot (long) before IRQs are
disabled could result in KVM effectively clobbering DEBUGCTL due to using
a stale snapshot.

Cc: stable@vger.kernel.org
Reviewed-and-tested-by: Ravi Bangoria <ravi.bangoria@amd.com>
Link: https://lore.kernel.org/r/20250227222411.3490595-6-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

+2 -1
+2 -1
arch/x86/kvm/x86.c
··· 4968 4969 /* Save host pkru register if supported */ 4970 vcpu->arch.host_pkru = read_pkru(); 4971 - vcpu->arch.host_debugctl = get_debugctlmsr(); 4972 4973 /* Apply any externally detected TSC adjustments (due to suspend) */ 4974 if (unlikely(vcpu->arch.tsc_offset_adjustment)) { ··· 10967 } else if (unlikely(hw_breakpoint_active())) { 10968 set_debugreg(0, 7); 10969 } 10970 10971 guest_timing_enter_irqoff(); 10972
··· 4968 4969 /* Save host pkru register if supported */ 4970 vcpu->arch.host_pkru = read_pkru(); 4971 4972 /* Apply any externally detected TSC adjustments (due to suspend) */ 4973 if (unlikely(vcpu->arch.tsc_offset_adjustment)) { ··· 10968 } else if (unlikely(hw_breakpoint_active())) { 10969 set_debugreg(0, 7); 10970 } 10971 + 10972 + vcpu->arch.host_debugctl = get_debugctlmsr(); 10973 10974 guest_timing_enter_irqoff(); 10975