public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Paul Mackerras <paulus@samba.org>
Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, agraf@suse.de,
	gleb@kernel.org, pbonzini@redhat.com, benh@kernel.crashing.org,
	mpe@ellerman.id.au
Subject: Re: [PATCH] KVM: PPC: Book3S HV: Replace kvmppc_find_vcpu() with kvm_get_vcpu()
Date: Fri, 8 May 2015 10:19:04 +0200	[thread overview]
Message-ID: <20150508101904.509c629a@thh440s> (raw)
In-Reply-To: <20150507230718.GA9410@iris.ozlabs.ibm.com>

On Fri, 8 May 2015 09:07:18 +1000
Paul Mackerras <paulus@samba.org> 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

  reply	other threads:[~2015-05-08  8:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-07 15:49 [PATCH] KVM: PPC: Book3S HV: Replace kvmppc_find_vcpu() with kvm_get_vcpu() Thomas Huth
2015-05-07 23:07 ` Paul Mackerras
2015-05-08  8:19   ` Thomas Huth [this message]
2015-05-08  9:01     ` Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150508101904.509c629a@thh440s \
    --to=thuth@redhat.com \
    --cc=agraf@suse.de \
    --cc=benh@kernel.crashing.org \
    --cc=gleb@kernel.org \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox