Currently vcpu_id is used as an index into vcpus array and as apic id on x86. This is incorrect since apic ids not have to be continuous (they can also encode cpu hierarchy information) and may have values bigger then vcpu array in case of x2apic. This series removes use of vcpu_id as vcpus array index. Each architecture may use it how it sees fit. x86 uses it as apic id. v2: remove online_vcpus from ia64 in patch 3/4 introduce KVM_APIC_ARCHITECTURE config option Gleb Natapov (4): Introduce kvm_vcpu_is_bsp() function. Use pointer to vcpu instead of vcpu_id in timer code. Break dependency between vcpu index in vcpus array and vcpu_id. Use macro to iterate over vcpus. arch/ia64/include/asm/kvm_host.h | 1 - arch/ia64/kvm/Kconfig | 1 + arch/ia64/kvm/kvm-ia64.c | 35 +++++++---------- arch/ia64/kvm/vcpu.c | 4 +- arch/powerpc/kvm/powerpc.c | 16 +++++--- arch/s390/kvm/kvm-s390.c | 33 ++++++++-------- arch/x86/kvm/Kconfig | 1 + arch/x86/kvm/i8254.c | 13 ++---- arch/x86/kvm/i8259.c | 6 +- arch/x86/kvm/kvm_timer.h | 2 +- arch/x86/kvm/lapic.c | 9 ++-- arch/x86/kvm/mmu.c | 6 +- arch/x86/kvm/svm.c | 4 +- arch/x86/kvm/timer.c | 2 +- arch/x86/kvm/vmx.c | 6 +- arch/x86/kvm/x86.c | 29 +++++++------- include/linux/kvm.h | 2 + include/linux/kvm_host.h | 22 +++++++++++ virt/kvm/Kconfig | 3 + virt/kvm/ioapic.c | 4 +- virt/kvm/irq_comm.c | 6 +-- virt/kvm/kvm_main.c | 77 +++++++++++++++++++++---------------- 22 files changed, 158 insertions(+), 124 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html