From patchwork Tue Dec 4 03:11:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 203541 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 EF7982C008E for ; Tue, 4 Dec 2012 14:10:13 +1100 (EST) Received: from localhost ([::1]:40935 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tfitg-00075y-3i for incoming@patchwork.ozlabs.org; Mon, 03 Dec 2012 22:10:12 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52659) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfitT-000714-WE for qemu-devel@nongnu.org; Mon, 03 Dec 2012 22:10:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TfitR-0001f8-5j for qemu-devel@nongnu.org; Mon, 03 Dec 2012 22:09:59 -0500 Received: from e23smtp08.au.ibm.com ([202.81.31.141]:56460) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfitQ-0001dc-La for qemu-devel@nongnu.org; Mon, 03 Dec 2012 22:09:57 -0500 Received: from /spool/local by e23smtp08.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 4 Dec 2012 13:08:42 +1000 Received: from d23dlp03.au.ibm.com (202.81.31.214) by e23smtp08.au.ibm.com (202.81.31.205) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 4 Dec 2012 13:08:39 +1000 Received: from d23relay03.au.ibm.com (d23relay03.au.ibm.com [9.190.235.21]) by d23dlp03.au.ibm.com (Postfix) with ESMTP id A1573357804B; Tue, 4 Dec 2012 14:09:47 +1100 (EST) Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id qB439ldh65994864; Tue, 4 Dec 2012 14:09:47 +1100 Received: from d23av04.au.ibm.com (loopback [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id qB439ll9027396; Tue, 4 Dec 2012 14:09:47 +1100 Received: from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.190.163.12]) by d23av04.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id qB439kgj027389; Tue, 4 Dec 2012 14:09:47 +1100 Received: by ozlabs.au.ibm.com (Postfix, from userid 1010) id CC961A025D; Tue, 4 Dec 2012 14:09:46 +1100 (EST) Date: Tue, 4 Dec 2012 14:11:45 +1100 From: David Gibson To: agraf@suse.de Message-ID: <20121204031145.GG4293@truffula.fritz.box> References: <1354588937-27122-1-git-send-email-david@gibson.dropbear.id.au> <1354588937-27122-14-git-send-email-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1354588937-27122-14-git-send-email-david@gibson.dropbear.id.au> User-Agent: Mutt/1.5.21 (2010-09-15) X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12120403-5140-0000-0000-0000027623E8 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 202.81.31.141 Cc: Mike Qiu , qemu-ppc@nongnu.org, qemu-devel@nongnu.org Subject: Re: [Qemu-devel] [PATCH 13/13] 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 On Tue, Dec 04, 2012 at 01:42:17PM +1100, David Gibson wrote: > From: Mike Qiu Oops, messed this one up, build error for user only builds. Fixed version below. From d2cc6bcee4737647c4bbbf65d3c0129d4a119dd3 Mon Sep 17 00:00:00 2001 From: Mike Qiu Date: Tue, 4 Dec 2012 10:52:14 +1100 Subject: [PATCH] target-ppc: Give a meaningful error if too many threads are specified 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 --- 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 dba572f..bb054a7 100644 --- a/target-ppc/translate_init.c +++ b/target-ppc/translate_init.c @@ -28,6 +28,7 @@ #include #include "kvm_ppc.h" #include "arch_init.h" +#include "cpus.h" //#define PPC_DUMP_CPU //#define PPC_DEBUG_SPR @@ -10037,6 +10038,10 @@ static int ppc_fixup_cpu(CPUPPCState *env) int cpu_ppc_register_internal (CPUPPCState *env, const ppc_def_t *def) { +#if !defined(CONFIG_USER_ONLY) + int max_smt = kvmppc_smt_threads(); +#endif + env->msr_mask = def->msr_mask; env->mmu_model = def->mmu_model; env->excp_model = def->excp_model; @@ -10046,6 +10051,13 @@ int cpu_ppc_register_internal (CPUPPCState *env, const ppc_def_t *def) env->flags = def->flags; env->bfd_mach = def->bfd_mach; env->check_pow = def->check_pow; +#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 defined(TARGET_PPC64) if (def->sps)