Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1454405 > unrolled thread

Re: [PATCH v3 07/14] KVM: x86: reset APIC ID when enabling LAPIC

Started byWanpeng Li <kernellwp@gmail.com>
First post2016-08-02 15:40 +0200
Last post2016-08-02 16:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v3 07/14] KVM: x86: reset APIC ID when enabling LAPIC Wanpeng Li <kernellwp@gmail.com> - 2016-08-02 15:40 +0200
    Re: [PATCH v3 07/14] KVM: x86: reset APIC ID when enabling LAPIC Radim Krčmář <rkrcmar@redhat.com> - 2016-08-02 16:10 +0200

#1454405 — Re: [PATCH v3 07/14] KVM: x86: reset APIC ID when enabling LAPIC

FromWanpeng Li <kernellwp@gmail.com>
Date2016-08-02 15:40 +0200
SubjectRe: [PATCH v3 07/14] KVM: x86: reset APIC ID when enabling LAPIC
Message-ID<s1I5l-54A-101@gated-at.bofh.it>
2016-07-13 4:09 GMT+08:00 Radim Krčmář <rkrcmar@redhat.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@redhat.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

[toc] | [next] | [standalone]


#1454478

FromRadim Krčmář <rkrcmar@redhat.com>
Date2016-08-02 16:10 +0200
Message-ID<s1Iyl-5ut-3@gated-at.bofh.it>
In reply to#1454405
2016-08-02 21:26+0800, Wanpeng Li:
> 2016-07-13 4:09 GMT+08:00 Radim Krčmář <rkrcmar@redhat.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@redhat.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().

Good point.  We would need to call it in the else branch, though.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web