Re: [PATCH] KVM: PPC: Book3S HV: Replace kvmppc_find_vcpu() with kvm_get_vcpu()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 8 May 2015 09:07:18 +1000
Paul Mackerras <paulus@xxxxxxxxx> wrote:

> On Thu, May 07, 2015 at 05:49:39PM +0200, Thomas Huth wrote:
> > Both functions are doing the same thing - looking up the struct
> > kvm_vcpu pointer for a given vCPU ID.
> 
> No, kvm_get_vcpu(n) returns the n'th vcpu created, which is often
> but not necessarily the same as the vcpu with id n.  In fact, due to
> the way we do threading in HV KVM, it's quite common for userspace to
> create vcpus with ids 0, 8, 16, ..., which means that the n'th vcpu
> created does not have id n (except of course for vcpu 0).

Ah, ok, thanks a lot for the explanation ... I thought that KVM would
always put the VCPUs at the position of their ID into the array, but
looking at kvm_vm_ioctl_create_vcpu(), you're right, it's using the
amount of online CPUs as index instead:

	kvm->vcpus[atomic_read(&kvm->online_vcpus)] = vcpu;

So never mind, and sorry for the nuisance!

 Thomas
--
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




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux