From patchwork Thu Dec 10 06:15:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bharata B Rao X-Patchwork-Id: 554995 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3B57F140E6E for ; Thu, 10 Dec 2015 17:17:36 +1100 (AEDT) Received: from localhost ([::1]:39571 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a6uXl-0003aB-RC for incoming@patchwork.ozlabs.org; Thu, 10 Dec 2015 01:17:33 -0500 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 d23dlp01.au.ibm.com (202.81.31.203) by e23smtp07.au.ibm.com (202.81.31.204) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 10 Dec 2015 16:16:49 +1000 X-IBM-Helo: d23dlp01.au.ibm.com X-IBM-MailFrom: bharata@linux.vnet.ibm.com X-IBM-RcptTo: qemu-devel@nongnu.org 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 Received: from bharata.in.ibm.com ([9.124.35.218]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id tBA6G8BZ028490; Thu, 10 Dec 2015 17:16:11 +1100 From: Bharata B Rao To: qemu-devel@nongnu.org Date: Thu, 10 Dec 2015 11:45:36 +0530 Message-Id: <1449728144-6223-2-git-send-email-bharata@linux.vnet.ibm.com> X-Mailer: git-send-email 2.1.0 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> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15121006-0025-0000-0000-0000028FA354 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 202.81.31.140 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 Subject: [Qemu-devel] [RFC PATCH v0 1/9] vl: Don't allow CPU toplogies with partially filled cores X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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) {