[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] kvm: apic: save and restore x2APIC LDR
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH] kvm: apic: save and restore x2APIC LDR |
Date: |
Wed, 22 Nov 2017 20:26:14 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 |
On 22/11/2017 19:09, Radim Krčmář wrote:
> QEMU saves only 8 bits of APIC LDR, which means that it does not support
> x2APIC. The correct way of fixing this would be to save and restore the
> full 32 bit register, but because x2APIC LDR is a function of x2APIC ID,
> we can also compute it and keep the migration format untouched.
>
> KVM always expected the LDR format to follow the xAPIC/x2APIC standard,
> but pre 4.1 KVMs used non-standard x2APIC ID in case the OS changed
> xAPIC ID before switching to x2APIC, which means that QEMU has to use
> the kvm_x2apic_api feature to derive the x2APIC ID.
>
> This bug has also been addressed on the KVM side with patch 5849d75a5c9b
> ("KVM: lapic: Fixup LDR on load in x2apic").
> + if (s->apicbase & MSR_IA32_APICBASE_EXTD) {
> + kvm_apic_set_reg(kapic, 0xd, kvm_apic_calc_x2apic_ldr(s));
Is this correct if the kernel doesn't support the new-style x2APIC API?
In the end, it seems simpler to just fix it in the kernel.
Paolo
> + } else {
> + kvm_apic_set_reg(kapic, 0xd, s->log_dest << 24);
> + }