[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANRm+Cw58Q1uOj-Upw_7KeyAg+YHv4+xMJPpx+2J-6+iFW5txw@mail.gmail.com>
Date: Tue, 2 Aug 2016 21:26:29 +0800
From: Wanpeng Li <kernellwp@...il.com>
To: Radim Krčmář <rkrcmar@...hat.com>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
kvm <kvm@...r.kernel.org>, Paolo Bonzini <pbonzini@...hat.com>,
"Lan, Tianyu" <tianyu.lan@...el.com>,
Igor Mammedov <imammedo@...hat.com>,
Jan Kiszka <jan.kiszka@....de>, Peter Xu <peterx@...hat.com>,
Yang Zhang <yang.zhang.wz@...il.com>
Subject: Re: [PATCH v3 07/14] KVM: x86: reset APIC ID when enabling LAPIC
2016-07-13 4:09 GMT+08:00 Radim Krčmář <rkrcmar@...hat.com>:
> APIC ID should be set to the initial APIC ID when enabling LAPIC.
> This only matters if the guest changes APIC ID. No sane OS does that.
>
> Signed-off-by: Radim Krčmář <rkrcmar@...hat.com>
> ---
> arch/x86/kvm/lapic.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index 41089dbeeafc..0fce77fdbe91 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -1720,9 +1720,10 @@ void kvm_lapic_set_base(struct kvm_vcpu *vcpu, u64 value)
>
> /* update jump label if enable bit changes */
> if ((old_value ^ value) & MSR_IA32_APICBASE_ENABLE) {
> - if (value & MSR_IA32_APICBASE_ENABLE)
> + if (value & MSR_IA32_APICBASE_ENABLE) {
> + kvm_apic_set_xapic_id(apic, vcpu->vcpu_id);
> static_key_slow_dec_deferred(&apic_hw_disabled);
> - else
> + } else
> static_key_slow_inc(&apic_hw_disabled.key);
> recalculate_apic_map(vcpu->kvm);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If we can drop this recalculate_apic_map() since it has already been
called by kvm_apic_set_xapic_id().
Regards,
Wanpeng Li
Powered by blists - more mailing lists