From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44784) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a6uXC-0002WX-KM for qemu-devel@nongnu.org; Thu, 10 Dec 2015 01:16:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a6uX9-00036W-BC for qemu-devel@nongnu.org; Thu, 10 Dec 2015 01:16:58 -0500 Received: from e23smtp07.au.ibm.com ([202.81.31.140]:33193) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a6uX8-00035u-O3 for qemu-devel@nongnu.org; Thu, 10 Dec 2015 01:16:55 -0500 Received: from localhost by e23smtp07.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 10 Dec 2015 16:16:52 +1000 Received: from d23relay09.au.ibm.com (d23relay09.au.ibm.com [9.185.63.181]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id B4FB92CE8055 for ; Thu, 10 Dec 2015 17:16:48 +1100 (EST) Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay09.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id tBA6GcY929425850 for ; Thu, 10 Dec 2015 17:16:48 +1100 Received: from d23av03.au.ibm.com (localhost [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id tBA6GDvV029410 for ; Thu, 10 Dec 2015 17:16:14 +1100 From: Bharata B Rao Date: Thu, 10 Dec 2015 11:45:36 +0530 Message-Id: <1449728144-6223-2-git-send-email-bharata@linux.vnet.ibm.com> In-Reply-To: <1449728144-6223-1-git-send-email-bharata@linux.vnet.ibm.com> References: <1449728144-6223-1-git-send-email-bharata@linux.vnet.ibm.com> Subject: [Qemu-devel] [RFC PATCH v0 1/9] vl: Don't allow CPU toplogies with partially filled cores List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, ehabkost@redhat.com, Bharata B Rao , agraf@suse.de, borntraeger@de.ibm.com, imammedo@redhat.com, pbonzini@redhat.com, afaerber@suse.de, david@gibson.dropbear.id.au Prevent guests from booting with CPU topologies that have partially filled CPU cores or can result in partially filled CPU cores after CPU hotplug like -smp 15,sockets=1,cores=4,threads=4,maxcpus=16 or -smp 15,sockets=1,cores=4,threads=4,maxcpus=17 or Signed-off-by: Bharata B Rao --- vl.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/vl.c b/vl.c index 525929b..e656f53 100644 --- a/vl.c +++ b/vl.c @@ -1252,6 +1252,19 @@ static void smp_parse(QemuOpts *opts) smp_cores = cores > 0 ? cores : 1; smp_threads = threads > 0 ? threads : 1; + if (smp_cpus % smp_threads) { + error_report("cpu topology: " + "smp_cpus (%u) should be multiple of threads (%u)", + smp_cpus, smp_threads); + exit(1); + } + + if (max_cpus % smp_threads) { + error_report("cpu topology: " + "maxcpus (%u) should be multiple of threads (%u)", + max_cpus, smp_threads); + exit(1); + } } if (max_cpus == 0) { -- 2.1.0