public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] xapic: make sure x2APIC -> xapic transition correctly
@ 2023-01-09 13:06 Emanuele Giuseppe Esposito
  2023-01-09 13:06 ` [RFC PATCH 1/2] KVM: x86: update APIC_ID also when disabling x2APIC in kvm_lapic_set_base Emanuele Giuseppe Esposito
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Emanuele Giuseppe Esposito @ 2023-01-09 13:06 UTC (permalink / raw)
  To: kvm
  Cc: Sean Christopherson, Paolo Bonzini, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, Shuah Khan,
	Gautam Menghani, Emanuele Giuseppe Esposito, Zeng Guang,
	Krish Sadhukhan, Jim Mattson, linux-kernel, linux-kselftest

The root cause is kvm_lapic_set_base() failing to handle x2APIC -> xapic ID
switch, which is addressed by patch 1.
Patch 2 provides a selftest to verify this behavior.

This serie is an RFC because I think that commit ef40757743b47 already tries to
fix one such effect of the error made in kvm_lapic_set_base, but I am not sure
how such error described in the commit message is triggered, nor how to
reproduce it using a selftest. I don't think one can enable/disable x2APIC using
KVM_SET_LAPIC, and kvm_lapic_set_base() in kvm_apic_set_state() just takes care
of updating apic->base_address, since value == old_value.
The test in patch 2 fails with the fix in ef40757743b47.

Thank you,
Emanuele

Emanuele Giuseppe Esposito (2):
  KVM: x86: update APIC_ID also when disabling x2APIC in
    kvm_lapic_set_base
  KVM: selftests: APIC_ID must be correctly updated when disabling
    x2apic

 arch/x86/kvm/lapic.c                          |  8 ++-
 .../selftests/kvm/x86_64/xapic_state_test.c   | 64 +++++++++++++++++++
 2 files changed, 70 insertions(+), 2 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-02-02  0:41 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-09 13:06 [RFC PATCH 0/2] xapic: make sure x2APIC -> xapic transition correctly Emanuele Giuseppe Esposito
2023-01-09 13:06 ` [RFC PATCH 1/2] KVM: x86: update APIC_ID also when disabling x2APIC in kvm_lapic_set_base Emanuele Giuseppe Esposito
2023-01-09 13:37   ` Maxim Levitsky
2023-01-09 16:23     ` Sean Christopherson
2023-01-10 12:16       ` Emanuele Giuseppe Esposito
2023-01-10 14:07         ` Paolo Bonzini
2023-01-10 15:29           ` Emanuele Giuseppe Esposito
2023-01-10 19:07           ` [RFC PATCH 1/2] KVM: x86: update APIC_ID also when disabling x2APIC in kvm_lapic_set_baseg Sean Christopherson
2023-01-09 13:06 ` [RFC PATCH 2/2] KVM: selftests: APIC_ID must be correctly updated when disabling x2apic Emanuele Giuseppe Esposito
2023-02-02  0:37   ` Sean Christopherson
2023-02-02  0:40 ` [RFC PATCH 0/2] xapic: make sure x2APIC -> xapic transition correctly Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox