From patchwork Thu Jan 8 06:10:14 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: 426515 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 EFAD41400DE for ; Thu, 8 Jan 2015 17:13:38 +1100 (AEDT) Received: from localhost ([::1]:44243 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y96Lg-0006q0-RQ for incoming@patchwork.ozlabs.org; Thu, 08 Jan 2015 01:13:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45965) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y96JB-0001zv-2M for qemu-devel@nongnu.org; Thu, 08 Jan 2015 01:11:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y96J1-0006g8-Bi for qemu-devel@nongnu.org; Thu, 08 Jan 2015 01:11:01 -0500 Received: from e28smtp03.in.ibm.com ([122.248.162.3]:58990) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y96J0-0006f7-Mp for qemu-devel@nongnu.org; Thu, 08 Jan 2015 01:10:51 -0500 Received: from /spool/local by e28smtp03.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Jan 2015 11:40:45 +0530 Received: from d28dlp03.in.ibm.com (9.184.220.128) by e28smtp03.in.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 Jan 2015 11:40:44 +0530 Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id B763D125805B for ; Thu, 8 Jan 2015 11:41:26 +0530 (IST) Received: from d28av03.in.ibm.com (d28av03.in.ibm.com [9.184.220.65]) by d28relay03.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t086AavO60752110 for ; Thu, 8 Jan 2015 11:40:36 +0530 Received: from d28av03.in.ibm.com (localhost [127.0.0.1]) by d28av03.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t086AeY4032041 for ; Thu, 8 Jan 2015 11:40:40 +0530 Received: from bharata.in.ibm.com ([9.124.35.246]) by d28av03.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t086AcWZ031729; Thu, 8 Jan 2015 11:40:39 +0530 From: Bharata B Rao To: qemu-devel@nongnu.org Date: Thu, 8 Jan 2015 11:40:14 +0530 Message-Id: <1420697420-16053-8-git-send-email-bharata@linux.vnet.ibm.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1420697420-16053-1-git-send-email-bharata@linux.vnet.ibm.com> References: <1420697420-16053-1-git-send-email-bharata@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15010806-0009-0000-0000-00000367704A X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 122.248.162.3 Cc: imammedo@redhat.com, Bharata B Rao , mdroth@linux.vnet.ibm.com, agraf@suse.de Subject: [Qemu-devel] [RFC PATCH v1 07/13] spapr: Start all the threads of CPU core when core is hotplugged 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 PowerPC kernel adds or removes CPUs in core granularity and hence onlines/offlines all the SMT threads of a core during hot plug/unplug. Support this notion by starting all SMT threads of a core when a core is hotplugged. Signed-off-by: Bharata B Rao --- hw/ppc/spapr.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index a293a59..4347471 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1376,6 +1376,8 @@ static void spapr_drc_reset(void *opaque) } } +static const char *current_cpu_model; + /* pSeries LPAR / sPAPR hardware init */ static void ppc_spapr_init(MachineState *machine) { @@ -1473,6 +1475,8 @@ static void ppc_spapr_init(MachineState *machine) } } + current_cpu_model = cpu_model; + /* allocate RAM */ spapr->ram_limit = ram_size; spapr->maxram_limit = machine->maxram_size; @@ -1912,10 +1916,31 @@ static void spapr_cpu_plug(HotplugHandler *hotplug_dev, DeviceState *dev, PowerPCCPU *cpu = POWERPC_CPU(cs); sPAPRDRConnector *drc = spapr_dr_connector_by_id(SPAPR_DR_CONNECTOR_TYPE_CPU, cpu->cpu_dt_id); + int id = ppc_get_vcpu_dt_id(cpu); + int smt = kvmppc_smt_threads(); + int i; + + /* + * SMT threads return from here, only main thread (core) will + * continue, create threads and signal hotplug event to the guest. + */ + if ((id % smt) != 0) { + return; + } /* TODO: Check if DR is enabled ? */ g_assert(drc); + /* Start rest of the SMT threads of the hot plugged core */ + for (i = 1; i < smp_threads; i++) { + cpu = cpu_ppc_init(current_cpu_model); + if (cpu == NULL) { + fprintf(stderr, "Unable to find PowerPC CPU definition\n"); + exit(1); + } + spapr_cpu_reset(cpu); + } + spapr_cpu_reset(POWERPC_CPU(CPU(dev))); spapr_cpu_hotplug_add(dev, cs); spapr_hotplug_req_add_event(drc);