From patchwork Fri Sep 6 19:13:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 11135873 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CFC9615E6 for ; Fri, 6 Sep 2019 19:23:18 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A689820838 for ; Fri, 6 Sep 2019 19:23:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="WR/Ug7e1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A689820838 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:59624 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i6JpF-0005mv-5h for patchwork-qemu-devel@patchwork.kernel.org; Fri, 06 Sep 2019 15:23:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42688) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i6Jfo-0003tA-QF for qemu-devel@nongnu.org; Fri, 06 Sep 2019 15:13:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i6Jfn-0004Zj-LI for qemu-devel@nongnu.org; Fri, 06 Sep 2019 15:13:32 -0400 Received: from mail-eopbgr700062.outbound.protection.outlook.com ([40.107.70.62]:10552 helo=NAM04-SN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i6Jfn-0004ZH-Fa for qemu-devel@nongnu.org; Fri, 06 Sep 2019 15:13:31 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BOEb2mnDsN+irN1znsOAkSeUxcHHH/uE0OXOG6iY0gN0Y1gHIMqxibCambAhiii8Mu9cztKs4o9Epwm3SpL2M8OsxXOiSbQK5Rtx8Pg7qfkTnYbIFAUhVcmnSE4wFVnrhxKlzmiYHkH63WMjjmds57gljFQHNVMZHXP5HTMveHqbMi7uVV5os3yJ4ZP6Yrv80z0CaHycJIHclsEjy0wWklaHoVf5WtnAthv6w2N3AOP6lZ8g+NEvQSa803PLfrtzNsQ44FMb5d22Lkfya1RGkjEQDbMcfBPVVDP93d4c6Ki4dv0gjg/lUSdg/ZugirmjprToMJBaRsPOWuNhKp8gGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=a1PIcKzOCO1p1zNeOrGP8T7QDfn+OE+3K39YM6SXfbE=; b=YQBaoLfQEsWFATHhzHtOOYm+ySAlzZXlT2xOaJt6b9I4VTso3UdZQGMHlPHk50MzyVcu1W9yMmlH0bf40Bn0V+RLRxgUtRbwCm6ogTLR4aWjpCD/kpHXhHyxaJRhh/t+PnQYxDi5jwfYmM3018SGFZmoIZRkR1ZjRU4VJ1XjBBaE5eiS43F2fVx84dW2QmrFIMmW7AGg0hVl8G/133ln92ne6Uy2jTFw0znRIvVYubhzPgQ63le4pkBQdP1sLEEUxcbB6Q8TMNFGcrWkqSzjaIpmdDjhvc5rJ2tsOLvKe6SuslhosIGpqBBMSupBuGoBZpWjKUx2eFNY6EIAD1jang== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=a1PIcKzOCO1p1zNeOrGP8T7QDfn+OE+3K39YM6SXfbE=; b=WR/Ug7e1KMLkKF/+WT9NerPktGYDvFVdAF7HV/NQpam31W+lhcWkx7DTfA2W0QEoKoOYUurnClKfuDcG1SZCWYFuJa926FqVEp6uZh8kHb2TTBzIxDiWo1MdomPeTH+pLOmp1xvR7iMGk1+EGo/vVBnjE/rYlYwmTMwK8Qt7FgM= Received: from DM5PR12MB2471.namprd12.prod.outlook.com (52.132.141.138) by DM5PR12MB1145.namprd12.prod.outlook.com (10.168.238.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2241.14; Fri, 6 Sep 2019 19:13:29 +0000 Received: from DM5PR12MB2471.namprd12.prod.outlook.com ([fe80::6c7c:4b6d:f136:1bf8]) by DM5PR12MB2471.namprd12.prod.outlook.com ([fe80::6c7c:4b6d:f136:1bf8%3]) with mapi id 15.20.2220.022; Fri, 6 Sep 2019 19:13:29 +0000 From: "Moger, Babu" To: ssg.sos.staff , "ehabkost@redhat.com" , "marcel.apfelbaum@gmail.com" , "mst@redhat.com" , "pbonzini@redhat.com" , "rth@twiddle.net" , "eblake@redhat.com" , "armbru@redhat.com" , "imammedo@redhat.com" Thread-Topic: [RFC 2 PATCH 16/16] hw/core: Fix up the machine_set_cpu_numa_node for epyc Thread-Index: AQHVZOcq5DENcdpQ5EuQmZjh98ITLw== Date: Fri, 6 Sep 2019 19:13:29 +0000 Message-ID: <156779720803.21957.8389712174989601936.stgit@localhost.localdomain> References: <156779689013.21957.1631551572950676212.stgit@localhost.localdomain> In-Reply-To: <156779689013.21957.1631551572950676212.stgit@localhost.localdomain> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SN1PR12CA0082.namprd12.prod.outlook.com (2603:10b6:802:21::17) To DM5PR12MB2471.namprd12.prod.outlook.com (2603:10b6:4:b5::10) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Babu.Moger@amd.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [165.204.78.1] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1f7e3218-fe2d-4c6f-8d16-08d732fe4d25 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:DM5PR12MB1145; x-ms-traffictypediagnostic: DM5PR12MB1145: x-ld-processed: 3dd8961f-e488-4e60-8e11-a82d994e183d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-forefront-prvs: 0152EBA40F x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(396003)(366004)(39860400002)(136003)(346002)(199004)(189003)(2201001)(71190400001)(305945005)(7736002)(9686003)(52116002)(86362001)(71200400001)(6116002)(8936002)(6512007)(3846002)(6436002)(11346002)(103116003)(99286004)(6506007)(6486002)(26005)(4326008)(14454004)(5660300002)(386003)(476003)(102836004)(2906002)(25786009)(76176011)(2501003)(53936002)(8676002)(66446008)(446003)(186003)(66556008)(486006)(66946007)(66476007)(64756008)(110136005)(81166006)(81156014)(478600001)(14444005)(66066001)(256004)(316002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR12MB1145; H:DM5PR12MB2471.namprd12.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 7Vv6gNO/CrEZ4v1xI45DXm3EIBMNyYSwztSZ69oEPpdNfG+3Z9aDJ/BNhjSSKAIFOuxDkoF2ZKO3L2EIpZnl0K5WgBblUveMUOgyZpv7EwfaMbGfjwREGhjJCIKFVswTIR3YH2jsubKw4F+X3hq+WEqXEoPy7DjMRDLqWSddow0IE9aRIT5//8kF+Y3YJ77JSaL7efDdNG+jJ6dTY+kNMGQZJBPM4DcTABT1pgI77VvoKjXPeFV9Gzw4vWgElkX0HI4ps9pfHMYt09I8+jONuhgTvDbxq6NVCfT1bP8Y+dAzGnBT39eUjSq9HQIRjK0a13NYBizgd4A6ZyjllBMz+APPSX2otGPlVd/dDTwf2MvRmQn75R68Aob6UrJvi2duko1sLzGB261olxEXvtwkkjhyUJ3b8Z8C6RoLKkNHRCM= Content-ID: MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1f7e3218-fe2d-4c6f-8d16-08d732fe4d25 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Sep 2019 19:13:29.4512 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: LaAgdygmr9HRTs6tnhnw1ej2q+XPWi0yI5O7y78IHRxKbrMUHINe0bjlkDh7jQx7 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1145 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.70.62 Subject: [Qemu-devel] [RFC 2 PATCH 16/16] hw/core: Fix up the machine_set_cpu_numa_node for epyc X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "qemu-devel@nongnu.org" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Current topology id match will not work for epyc mode when setting the node id. In epyc mode, ids like smt_id, thread_id, core_id, ccx_id, socket_id can be same for more than one CPUs with across two numa nodes. For example, we can have two CPUs with following ids on two different node. 1. smt_id=0, thread_id=0, core_id=0, ccx_id=0, socket_id=0, node_id=0 2. smt_id=0, thread_id=0, core_id=0, ccx_id=0, socket_id=0, node_id=1 The function machine_set_cpu_numa_node will fail to find a match to assign the node. Added new function machine_set_cpu_numa_node_epyc to set the node_id directly in epyc mode. Signed-off-by: Babu Moger --- hw/core/machine.c | 24 ++++++++++++++++++++++++ hw/core/numa.c | 6 +++++- include/hw/boards.h | 4 ++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index 9a8586cf30..6bceefc6f3 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -741,6 +741,30 @@ void machine_set_cpu_numa_node(MachineState *machine, } } +void machine_set_cpu_numa_node_epyc(MachineState *machine, + const CpuInstanceProperties *props, + unsigned index, + Error **errp) +{ + MachineClass *mc = MACHINE_GET_CLASS(machine); + CPUArchId *slot; + + if (!mc->possible_cpu_arch_ids) { + error_setg(errp, "mapping of CPUs to NUMA node is not supported"); + return; + } + + /* disabling node mapping is not supported, forbid it */ + assert(props->has_node_id); + + /* force board to initialize possible_cpus if it hasn't been done yet */ + mc->possible_cpu_arch_ids(machine); + + slot = &machine->possible_cpus->cpus[index]; + slot->props.node_id = props->node_id; + slot->props.has_node_id = props->has_node_id; +} + static void smp_parse(MachineState *ms, QemuOpts *opts) { if (opts) { diff --git a/hw/core/numa.c b/hw/core/numa.c index 27fa6b5e1d..a9e835aea6 100644 --- a/hw/core/numa.c +++ b/hw/core/numa.c @@ -247,7 +247,11 @@ void set_numa_node_options(MachineState *ms, NumaOptions *object, Error **errp) props = mc->cpu_index_to_instance_props(ms, cpus->value); props.node_id = nodenr; props.has_node_id = true; - machine_set_cpu_numa_node(ms, &props, &err); + if (ms->epyc) { + machine_set_cpu_numa_node_epyc(ms, &props, cpus->value, &err); + } else { + machine_set_cpu_numa_node(ms, &props, &err); + } if (err) { error_propagate(errp, err); return; diff --git a/include/hw/boards.h b/include/hw/boards.h index 0001d42e50..ec1b1c5a85 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -74,6 +74,10 @@ HotpluggableCPUList *machine_query_hotpluggable_cpus(MachineState *machine); void machine_set_cpu_numa_node(MachineState *machine, const CpuInstanceProperties *props, Error **errp); +void machine_set_cpu_numa_node_epyc(MachineState *machine, + const CpuInstanceProperties *props, + unsigned index, + Error **errp); void machine_class_allow_dynamic_sysbus_dev(MachineClass *mc, const char *type);