From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:32814) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1StGFi-0002VA-RV for qemu-devel@nongnu.org; Mon, 23 Jul 2012 06:52:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1StGFg-00018i-CS for qemu-devel@nongnu.org; Mon, 23 Jul 2012 06:52:38 -0400 Received: from cantor2.suse.de ([195.135.220.15]:47534 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1StGFg-00014v-2p for qemu-devel@nongnu.org; Mon, 23 Jul 2012 06:52:36 -0400 Message-ID: <500D2CEF.2080805@suse.de> Date: Mon, 23 Jul 2012 12:52:31 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1343040455-30206-1-git-send-email-riegamaths@gmail.com> In-Reply-To: <1343040455-30206-1-git-send-email-riegamaths@gmail.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] pc: Fix max_cpus List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: riegamaths@gmail.com Cc: Anthony Liguori , qemu-devel , Stefan Hajnoczi Am 23.07.2012 12:47, schrieb riegamaths@gmail.com: > From: Dunrong Huang >=20 > 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. >=20 > 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= . >=20 > Signed-off-by: Dunrong Huang > --- > hw/pc_piix.c | 28 +++++++++++++++++++--------- > 1 files changed, 19 insertions(+), 9 deletions(-) >=20 > 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 @@ > =20 > #define MAX_IDE_BUS 2 > =20 > +#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] =3D { 0x1f0, 0x170 }; > static const int ide_iobase2[MAX_IDE_BUS] =3D { 0x3f6, 0x376 }; > static const int ide_irq[MAX_IDE_BUS] =3D { 14, 15 }; > @@ -354,7 +364,7 @@ static QEMUMachine pc_machine_v1_2 =3D { > .alias =3D "pc", > .desc =3D "Standard PC", > .init =3D pc_init_pci, > - .max_cpus =3D 255, > + .max_cpus =3D MAX_VCPUS, > .is_default =3D 1, > }; > =20 [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 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg