From patchwork Thu Jan 24 03:20:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 215186 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8067A2C0079 for ; Thu, 24 Jan 2013 14:40:02 +1100 (EST) Received: from localhost ([::1]:36069 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyDL9-0001c2-MC for incoming@patchwork.ozlabs.org; Wed, 23 Jan 2013 22:18:59 -0500 Received: from eggs.gnu.org ([208.118.235.92]:39160) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyDKU-0008Ig-2r for qemu-devel@nongnu.org; Wed, 23 Jan 2013 22:18:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TyDKH-00087I-5h for qemu-devel@nongnu.org; Wed, 23 Jan 2013 22:18:17 -0500 Received: from ozlabs.org ([2402:b800:7003:1:1::1]:59306) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyDKG-00086y-Ov; Wed, 23 Jan 2013 22:18:05 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 637CA2C007E; Thu, 24 Jan 2013 14:18:02 +1100 (EST) From: David Gibson To: agraf@suse.de Date: Thu, 24 Jan 2013 14:20:38 +1100 Message-Id: <1358997643-20728-2-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1358997643-20728-1-git-send-email-david@gibson.dropbear.id.au> References: <1358997643-20728-1-git-send-email-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2402:b800:7003:1:1::1 Cc: Mike Qiu , qemu-ppc@nongnu.org, qemu-devel@nongnu.org, David Gibson Subject: [Qemu-devel] [PATCH 1/6] target-ppc: Give a meaningful error if too many threads are specified 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 From: Mike Qiu Currently the target-ppc tcg code only supports a single thread. You can specify more, but they're treated identically to multiple cores. On KVM we obviously can't support more threads than the hardware; if more are specified it will cause strange and cryptic errors. This patch clarifies the situation by giving a simple meaningful error if more threads are specified than we can support. Signed-off-by: Mike Qiu Signed-off-by: David Gibson --- v2: Make sure we never invoke kvmppc_smp_threads() if KVM is not enabled. Previously it depended on whether KVM was compiled in, which is not right. --- target-ppc/translate_init.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c index 2d78529..4f767c9 100644 --- a/target-ppc/translate_init.c +++ b/target-ppc/translate_init.c @@ -28,6 +28,7 @@ #include #include "kvm_ppc.h" #include "sysemu/arch_init.h" +#include "sysemu/cpus.h" //#define PPC_DUMP_CPU //#define PPC_DEBUG_SPR @@ -10036,6 +10037,17 @@ static void ppc_cpu_realize(Object *obj, Error **errp) PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu); ppc_def_t *def = pcc->info; Error *local_err = NULL; +#if !defined(CONFIG_USER_ONLY) + int max_smt = kvm_enabled() ? kvmppc_smt_threads() : 1; +#endif + +#if !defined(CONFIG_USER_ONLY) + if (smp_threads > max_smt) { + fprintf(stderr, "Cannot support more than %d threads on PPC with %s\n", + max_smt, kvm_enabled() ? "KVM" : "TCG"); + exit(1); + } +#endif if (kvm_enabled()) { if (kvmppc_fixup_cpu(cpu) != 0) {