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


Groups > linux.kernel > #1440636

Re: [PATCH v2 04/13] KVM: x86: dynamic kvm_apic_map

From Paolo Bonzini <pbonzini@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 04/13] KVM: x86: dynamic kvm_apic_map
Date 2016-07-11 16:20 +0200
Message-ID <rTKdY-87y-7@gated-at.bofh.it> (permalink)
References (1 earlier) <rSlhF-1y4-39@gated-at.bofh.it> <rTCzL-3d1-3@gated-at.bofh.it> <rTE8y-42b-17@gated-at.bofh.it> <rTGtH-5FU-17@gated-at.bofh.it> <rTJKV-7HY-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 11/07/2016 15:48, Radim Krčmář wrote:
>>> I guess the easiest solution is to replace kvm_apic_id with a field in
>>> struct kvm_lapic, which is already shifted right by 24 in xAPIC mode.
> 
> (I guess the fewest LOC is to look at vcpu->vcpu_id, which is equal to
>  x2apic id.  xapic id cannot be greater than 255 and all of those are
>  covered by the initial value of max_id.)

Yes, this would work too.  Or even better perhaps, look at vcpu->vcpu_id
in kvm_apic_id?

>> Or we can just simply put the assignment of apic_base to the end.
> 
> Yes, this would work, I'd also remove recalculates from
> kvm_apic_set_*apic_id() and add a compiler barrier with comment for good
> measure, even though set_virtual_x2apic_mode() serves as one.

Why a compiler barrier?

> (What makes a bit wary is that it doesn't avoid the same problem if we
>  changed KVM to reset apic id to xapic id first when disabling apic.)

Yes, this is why I prefer it fixed once and for all in kvm_apic_id...

> Races in recalculation and APIC ID changes also lead to invalid physical
> maps, which haven't been taken care of properly ...

Hmm, true, but can be fixed separately.  Probably the mutex should be
renamed so that it can be taken outside recalculate_apic_map...

Paolo

> Having apic id stored in big endian, or "0-7,8-31" format, would be
> safest.  I wanted to change the apic map to do incremental updates with
> with respect to the APIC that has changed, instead of being completely
> recomputed, so maybe the time is now. :)
> 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH v2 04/13] KVM: x86: dynamic kvm_apic_map Yang Zhang <yang.zhang.wz@gmail.com> - 2016-07-11 08:10 +0200
  Re: [PATCH v2 04/13] KVM: x86: dynamic kvm_apic_map Paolo Bonzini <pbonzini@redhat.com> - 2016-07-11 09:50 +0200
    Re: [PATCH v2 04/13] KVM: x86: dynamic kvm_apic_map Yang Zhang <yang.zhang.wz@gmail.com> - 2016-07-11 12:20 +0200
      Re: [PATCH v2 04/13] KVM: x86: dynamic kvm_apic_map Radim Krčmář <rkrcmar@redhat.com> - 2016-07-11 15:50 +0200
        Re: [PATCH v2 04/13] KVM: x86: dynamic kvm_apic_map Paolo Bonzini <pbonzini@redhat.com> - 2016-07-11 16:20 +0200
          Re: [PATCH v2 04/13] KVM: x86: dynamic kvm_apic_map Radim Krčmář <rkrcmar@redhat.com> - 2016-07-11 18:00 +0200
            Re: [PATCH v2 04/13] KVM: x86: dynamic kvm_apic_map Paolo Bonzini <pbonzini@redhat.com> - 2016-07-11 18:10 +0200
            Re: [PATCH v2 04/13] KVM: x86: dynamic kvm_apic_map Yang Zhang <yang.zhang.wz@gmail.com> - 2016-07-12 05:30 +0200

csiph-web