diff options
author | Jes Sorensen <jes@sgi.com> | 2009-01-21 14:16:43 (GMT) |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-03-24 09:03:07 (GMT) |
commit | 934d534f8a5a39e20d5682b3a3a45ff351706b59 (patch) | |
tree | f1e6ce5330028a9aa942623c6706af8ca2ce2130 /arch/ia64/kvm/vcpu.c | |
parent | b7e6e4d3602c738b8f61225d9f4514945df52f07 (diff) | |
download | linux-934d534f8a5a39e20d5682b3a3a45ff351706b59.tar.xz |
KVM: ia64: dynamic nr online cpus
Account for number of online cpus and use that in loops iterating over
the list of vpus instead of scanning the full array unconditionally.
This patch is a building block to facilitate allowing to bump up
the size of MAX_VCPUS significantly.
Signed-off-by: Jes Sorensen <jes@sgi.com>
Acked-by : Xiantao Zhang <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/ia64/kvm/vcpu.c')
-rw-r--r-- | arch/ia64/kvm/vcpu.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/ia64/kvm/vcpu.c b/arch/ia64/kvm/vcpu.c index 4d8be4c..d4d2805 100644 --- a/arch/ia64/kvm/vcpu.c +++ b/arch/ia64/kvm/vcpu.c @@ -807,12 +807,15 @@ static inline void vcpu_set_itm(struct kvm_vcpu *vcpu, u64 val); static void vcpu_set_itc(struct kvm_vcpu *vcpu, u64 val) { struct kvm_vcpu *v; + struct kvm *kvm; int i; long itc_offset = val - ia64_getreg(_IA64_REG_AR_ITC); unsigned long vitv = VCPU(vcpu, itv); + kvm = (struct kvm *)KVM_VM_BASE; + if (vcpu->vcpu_id == 0) { - for (i = 0; i < KVM_MAX_VCPUS; i++) { + for (i = 0; i < kvm->arch.online_vcpus; i++) { v = (struct kvm_vcpu *)((char *)vcpu + sizeof(struct kvm_vcpu_data) * i); VMX(v, itc_offset) = itc_offset; |