Skip to content

RFC xapic: make sure x2APIC -> xapic transition correctly

Emanuele Giuseppe Esposito kvm linux-kselftest lkml 1 version Applied

Status from this message: Applied to kvm-x86 apic, with the tweak of only stuffing the APIC_ID if the

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest2 patches 8 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/2KVM: x86: update APIC_ID also when disabling x2APIC in kvm_lapic_set_basearch/x86/kvm/lapic.c+6 -26 replies
2/2KVM: selftests: APIC_ID must be correctly updated when disabling x2apictools/testing/selftests/kvm/x86_64/xapic_state_test.c+64 -01 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/2] xapic: make sure x2APIC -> xapic transition correctly

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(-)
Signature · 1 line
2.31.1