All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: riegamaths@gmail.com
Cc: Anthony Liguori <aliguori@us.ibm.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH] pc: Fix max_cpus
Date: Mon, 23 Jul 2012 12:52:31 +0200	[thread overview]
Message-ID: <500D2CEF.2080805@suse.de> (raw)
In-Reply-To: <1343040455-30206-1-git-send-email-riegamaths@gmail.com>

Am 23.07.2012 12:47, schrieb riegamaths@gmail.com:
> From: Dunrong Huang <riegamaths@gmail.com>
> 
> The VCPU count limit in kernel now is 254, defined by KVM_MAX_VCPUS
> in kernel's header files. But the count limit in QEMU is 255,
> so QEMU will failed to start if user passes "-enable-kvm" and "-smp 255"
> to it.
> 
> This patch intruduces a Macro MAX_VCPUS whose value is KVM_MAX_VCPUS
> if CONFIG_KVM is defined. If user do not use kvm, set it's value to 255.
> 
> Signed-off-by: Dunrong Huang <riegamaths@gmail.com>
> ---
>  hw/pc_piix.c |   28 +++++++++++++++++++---------
>  1 files changed, 19 insertions(+), 9 deletions(-)
> 
> diff --git a/hw/pc_piix.c b/hw/pc_piix.c
> index 0c0096f..49cda51 100644
> --- a/hw/pc_piix.c
> +++ b/hw/pc_piix.c
> @@ -49,6 +49,16 @@
>  
>  #define MAX_IDE_BUS 2
>  
> +#ifndef KVM_MAX_VCPUS
> +#define KVM_MAX_VCPUS 254
> +#endif
> +
> +#ifdef CONFIG_KVM
> +#define MAX_VCPUS KVM_MAX_VCPUS
> +#else
> +#define MAX_VCPUS 255
> +#endif
> +
>  static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 };
>  static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 };
>  static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
> @@ -354,7 +364,7 @@ static QEMUMachine pc_machine_v1_2 = {
>      .alias = "pc",
>      .desc = "Standard PC",
>      .init = pc_init_pci,
> -    .max_cpus = 255,
> +    .max_cpus = MAX_VCPUS,
>      .is_default = 1,
>  };
>  
[snip]

This is not so ideal: -enable-kvm is a runtime switch whereas you are
changing a compile-time limit here. Any chance to change the runtime
usage of .max_cpus instead? Possibly introducing a helper function?

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

  reply	other threads:[~2012-07-23 10:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-23 10:47 [Qemu-devel] [PATCH] pc: Fix max_cpus riegamaths
2012-07-23 10:52 ` Andreas Färber [this message]
2012-07-23 12:33   ` Dunrong Huang

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=500D2CEF.2080805@suse.de \
    --to=afaerber@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=riegamaths@gmail.com \
    --cc=stefanha@linux.vnet.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.