From: Gleb Natapov Subject: [PATCH RFC v2 0/4] decouple vcpu index from apic id Date: Mon, 25 May 2009 18:50:32 +0300 Message-ID: <1243266636-16914-1-git-send-email-gleb@redhat.com> To: kvm@vger.kernel.org Return-path: Received: from mx2.redhat.com ([66.187.237.31]:57854 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752566AbZEYPug (ORCPT ); Mon, 25 May 2009 11:50:36 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n4PFocMn017674 for ; Mon, 25 May 2009 11:50:38 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n4PFobg8004492 for ; Mon, 25 May 2009 11:50:37 -0400 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n4PFoaEm032476 for ; Mon, 25 May 2009 11:50:36 -0400 Sender: kvm-owner@vger.kernel.org List-ID: 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 decouples vcpu_id and apic_id. apic_id is arbitrary 32bit value that is passed to vcpu_create ioctls. vcpu_id is kvm internal thing (that may be totally removed from x86 code). In this version vcpus[] is managed by generic code. The code still assumes that boot cpu is created first. 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/kvm/kvm-ia64.c | 37 ++++++++++++---------------- arch/ia64/kvm/vcpu.c | 2 +- arch/powerpc/kvm/powerpc.c | 16 +++++++---- arch/s390/kvm/kvm-s390.c | 55 +++++++++++++++++++++-------------------- 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_host.h | 17 +++++++++++++ virt/kvm/ioapic.c | 4 ++- virt/kvm/irq_comm.c | 6 +--- virt/kvm/kvm_main.c | 58 ++++++++++++++++++++++---------------------- 17 files changed, 143 insertions(+), 129 deletions(-)