Re: [PATCH 8/8] KVM: x86: simplify kvm_apic_map

2015-01-30 Thread Radim Krčmář
2015-01-30 16:23+0100, Paolo Bonzini: On 30/01/2015 16:14, Radim Krčmář wrote: + case KVM_APIC_MODE_XAPIC_FLAT: + *cid = 0; + *lid = ldr 0xff; + return true; + case KVM_APIC_MODE_XAPIC_CLUSTER: + *cid =

Re: [PATCH 8/8] KVM: x86: simplify kvm_apic_map

2015-01-30 Thread Paolo Bonzini
On 30/01/2015 16:14, Radim Krčmář wrote: + case KVM_APIC_MODE_XAPIC_FLAT: + *cid = 0; + *lid = ldr 0xff; + return true; + case KVM_APIC_MODE_XAPIC_CLUSTER: + *cid = (ldr 4) 0xf; + *lid = ldr 0xf; + return true; + case

Re: [PATCH 8/8] KVM: x86: simplify kvm_apic_map

2015-01-30 Thread Radim Krčmář
2015-01-30 10:18+0100, Paolo Bonzini: On 29/01/2015 22:48, Radim Krčmář wrote: +static inline bool +apic_logical_id(struct kvm_apic_map *map, u32 ldr, u16 *cid, u16 *lid) { + switch (map-mode) { + case KVM_APIC_MODE_XAPIC_FLAT: + *cid = 0; + *lid = ldr

Re: [PATCH 8/8] KVM: x86: simplify kvm_apic_map

2015-01-30 Thread Paolo Bonzini
On 30/01/2015 17:57, Radim Krčmář wrote: As optimizations go, we could drop the on cid as cid 16 is checked later, so mode=4 practically does nothing ... Not the best for future bugs, but still pretty safe -- only x2APIC can set a value that would require the and it can't have valid XAPIC

Re: [PATCH 8/8] KVM: x86: simplify kvm_apic_map

2015-01-30 Thread Paolo Bonzini
On 29/01/2015 22:48, Radim Krčmář wrote: recalculate_apic_map() uses two passes over all VCPUs. This is a relic from time when we selected a global mode in the first pass and set up the optimized table in the second pass (to have a consistent mode). Recent changes made mixed mode

[PATCH 8/8] KVM: x86: simplify kvm_apic_map

2015-01-29 Thread Radim Krčmář
recalculate_apic_map() uses two passes over all VCPUs. This is a relic from time when we selected a global mode in the first pass and set up the optimized table in the second pass (to have a consistent mode). Recent changes made mixed mode unoptimized and we can do it in one pass. Format of