qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Greg Kurz <gkurz@linux.vnet.ibm.com>
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
	qemu-ppc@nongnu.org, Alexander Graf <agraf@suse.de>
Subject: Re: [Qemu-devel] [PATCH 3/3] KVM: use KVM_CAP_MAX_VCPU_ID
Date: Fri, 27 May 2016 13:58:28 +1000	[thread overview]
Message-ID: <20160527035828.GV17226@voom.fritz.box> (raw)
In-Reply-To: <146424974323.5666.5471538288045048119.stgit@bahia.huguette.org>

[-- Attachment #1: Type: text/plain, Size: 1529 bytes --]

On Thu, May 26, 2016 at 10:02:23AM +0200, Greg Kurz wrote:
> As stated in linux/Documentation/virtual/kvm/api.txt:
> 
> The maximum possible value for max_vcpu_id can be retrieved using the
> KVM_CAP_MAX_VCPU_ID of the KVM_CHECK_EXTENSION ioctl() at run-time.
> 
> If the KVM_CAP_MAX_VCPU_ID does not exist, you should assume that
> max_vcpu_id is the same as the value returned from KVM_CAP_MAX_VCPUS.
> 
> Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  kvm-all.c |    8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/kvm-all.c b/kvm-all.c
> index e56f38527815..e74e0c6e2352 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -1459,10 +1459,16 @@ static int kvm_max_vcpus(KVMState *s)
>      return (ret) ? ret : kvm_recommended_vcpus(s);
>  }
>  
> +static int kvm_max_vcpu_id(KVMState *s)
> +{
> +    int ret = kvm_check_extension(s, KVM_CAP_MAX_VCPU_ID);
> +    return (ret) ? ret : kvm_max_vcpus(s);
> +}
> +
>  bool kvm_vcpu_id_is_valid(int vcpu_id)
>  {
>      KVMState *s = KVM_STATE(current_machine->accelerator);
> -    return vcpu_id >= 0 && vcpu_id < kvm_max_vcpus(s);
> +    return vcpu_id >= 0 && vcpu_id < kvm_max_vcpu_id(s);
>  }
>  
>  static int kvm_init(MachineState *ms)
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2016-05-27  3:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-26  8:02 [Qemu-devel] [PATCH 0/3] PPC/KVM support higher vCPU ids Greg Kurz
2016-05-26  8:02 ` [Qemu-devel] [PATCH 1/3] PPC/KVM: early validation of vcpu id Greg Kurz
2016-05-27  3:58   ` David Gibson
2016-05-26  8:02 ` [Qemu-devel] [PATCH 2/3] linux-headers: update to Linux 4.6 Greg Kurz
2016-05-26  8:02 ` [Qemu-devel] [PATCH 3/3] KVM: use KVM_CAP_MAX_VCPU_ID Greg Kurz
2016-05-27  3:58   ` David Gibson [this message]
2016-05-27 11:16     ` Greg Kurz
2016-06-07  8:42       ` Greg Kurz
2016-06-13  8:42       ` Greg Kurz
2016-06-13 11:25         ` Paolo Bonzini

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=20160527035828.GV17226@voom.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=agraf@suse.de \
    --cc=gkurz@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /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;
as well as URLs for NNTP newsgroup(s).