From patchwork Thu Jun 14 01:18:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 10463153 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 03C2260329 for ; Thu, 14 Jun 2018 01:19:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E888028C3E for ; Thu, 14 Jun 2018 01:18:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DCE0728C5A; Thu, 14 Jun 2018 01:18:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C86E28C3E for ; Thu, 14 Jun 2018 01:18:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935893AbeFNBS5 (ORCPT ); Wed, 13 Jun 2018 21:18:57 -0400 Received: from mail-eopbgr700079.outbound.protection.outlook.com ([40.107.70.79]:4864 "EHLO NAM04-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S935789AbeFNBSq (ORCPT ); Wed, 13 Jun 2018 21:18:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9E8/YRt/9YGlin+m/uolgAivQ0cfwIQjJEUKLxVi0dU=; b=2V64H/NWEgsPd+2m2uGNsrbbvFy92TXDcQ0T7fVqzHlZJJoVX2ugP8AY8B6pQ4by+NU3tk4yD3HG8fEFO6OF6is0lLbKoE5dkBsN2xaFTAuYMU2IvuwxhCiqRRYw1EXo4CFXCmnsJx4FV9G50WGCNCL4aL2PhVAl294Kv3YBppg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Babu.Moger@amd.com; Received: from linux-h3ml.amd.com (165.204.77.1) by SN1PR12MB2480.namprd12.prod.outlook.com (2603:10b6:802:29::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.841.14; Thu, 14 Jun 2018 01:18:42 +0000 From: Babu Moger To: mst@redhat.com, marcel.apfelbaum@gmail.com, pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com, mtosatti@redhat.com Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, babu.moger@amd.com, kash@tripleback.net, geoff@hostfission.com Subject: [PATCH v14 5/6] i386: Disable TOPOEXT feature if it cannot be supported Date: Wed, 13 Jun 2018 21:18:26 -0400 Message-Id: <1528939107-17193-6-git-send-email-babu.moger@amd.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1528939107-17193-1-git-send-email-babu.moger@amd.com> References: <1528939107-17193-1-git-send-email-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SN4PR0201CA0064.namprd02.prod.outlook.com (2603:10b6:803:20::26) To SN1PR12MB2480.namprd12.prod.outlook.com (2603:10b6:802:29::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1265e11a-35f2-4dfd-73e0-08d5d194c508 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(711020)(48565401081)(2017052603328)(7153060)(7193020); SRVR:SN1PR12MB2480; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB2480; 3:9SZnm5CrggySOtIyYIk0sdwcC8To9oCBLWvcEoscKeJkbmcI9N8ZWC8ulMj5joK5FhDNW7GkcGevffsg5i31PdImSz49z3SbH7n0iBkXkklY2ngbPrf9++Yl5HYV0AmYRSoUC3mpe7Di5xGxe9Uc/4yELqtAYdM+P+xGtD+H4V4gV0aJEpGg/i4kmqLY7U6D6ckv2GLX+TofP3LfqmqSXz94h9YcRXMVLMEMmTFKQ7BP4cKYghu6sqNc3jVzwWUr; 25:gCHE1r8WiDdEmruFkNKXA2esHSzYx/gK5CvthgOKdOrnWGZjMEfRkbN1Wk7LwrCcJxBID4Q1tMljEVBazp+PzQE2umggjElkJQfCoyOa8jtJZEtqsvL+1ggdnA5+og+Xl6MxsstXWHBQ41gk2cBl+lWMc7KpM5Tvr3mjTWOzlYVtV0WghDo9ZPgW3k85zg20JZbDkzIhbV1BgkwxClFvWcMnHUu4RT5EpBMVe+slJ5VELILyrNizVM0fJ0gUqJ+7wtctAyq8SAP9cb9PwZ6tsCmJ1OFcSJhQtS4sGT1Ef7indipr4VSOyRG2txbOQU7W+S1yYS5HYLJgeZH1kpQMEg==; 31:Orh3w/YJjiJ76liF0dWe+tog1nDSkBF8XGjNS07GpvDoJ6TX8OXSZsrEdE9itfRNVpvuqfUVH68t+GIQrMJ813cOpIqnFm98oJGLNjT5wf5OQ1giuamsDTdNoX7A7Jtc1WfAhawlqvFPbC6RjFtDw3BQK4F/vMV5+xbrQCPWwIWTjVgva3+IyzSbCz4AsANhSgJ5nsaZjbvTimWr8yXKnxgZCRm7LOmbwNvSR2a/3As= X-MS-TrafficTypeDiagnostic: SN1PR12MB2480: X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB2480; 20:fQzOhSEALDmiwHBfwwzBi3SjMSAqlWV5drIZsTS21NuhhajkCRrS7wnc/CUT+ljT85PF7gBlJIQZcRhG4NLmzoxsEj4XwyIZKaz2ji0VQpXgARum0ucVvjhjbVNynXPzCkQNSvUB5BgBaveIpcHT2P40e+RRqP3Ob7LPEBoAAwHQRMwzIeM094V/VNlEsbYMoBkYVOgpSNBSvuIMI53BgVteMS/TIv87Sk1iT4JORx+8timOC+yIN0QfEzbHD7e+hxUI9QjYFbw1Xa8vbgnZagGZSgAcha6tBdCKiGLpdyiSli6p0WSTJAvGtr4Aj0JxCKuP+ahkA157+OauG5U5Z94cf3plzjYu4CT/nm14TkIjQNst+6OeHY5gebhO7f2g+EeuJY/0XOPYbZtlf/c1pMr5ozdy73KP11+0Yi0qxgqQSS3iTrcB6kEws2Aznma4BmV5rMrVivB0zycavDavEojbfyESqJiK8yciLgq2rYgmmUggCuerbed/CzZTiEMl; 4:yiM5mFzH9ideF/WFHAwz1O2UCoKzQUOe3fQ6dvACedbJvmYa29HrmcRExP1k0eYQ+/2D45ftLzFFHo5v3wsWhUORKgNRSe+Q6Mh4EZyfBBl3T5rVSfznVqK/Fp9pepXbefp5UeaFA6wkXUPOLZLCXFSkrs2rzzFCWx2VMvWHlQpoeIT+VtDsKZ0RkRSvaaXv2e1gD3Mlt86/1zppxeHTIaneADtwQjNeYnhWz0Fr11NbSc2FlhhmT2ja7p1xlM9GXg3Cghg07bQk6dfQpmsOxKZW96wdJ3XUNv/pqjvcnfE+8sS/W8WpKONDOqRY/b5H X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3231254)(944501410)(52105095)(3002001)(6055026)(149027)(150027)(6041310)(20161123558120)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:SN1PR12MB2480; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB2480; X-Forefront-PRVS: 0703B549E4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(396003)(39860400002)(366004)(376002)(39380400002)(189003)(199004)(68736007)(2906002)(25786009)(52116002)(7696005)(72206003)(51416003)(4720700003)(956004)(6666003)(2616005)(11346002)(44832011)(486006)(53936002)(7416002)(476003)(446003)(76176011)(6486002)(39060400002)(36756003)(478600001)(4326008)(6116002)(5660300001)(7736002)(305945005)(86362001)(8676002)(186003)(97736004)(16586007)(66066001)(3846002)(53416004)(8936002)(16526019)(316002)(386003)(48376002)(26005)(81156014)(81166006)(59450400001)(50466002)(106356001)(50226002)(47776003)(105586002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB2480; H:linux-h3ml.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR12MB2480; 23:1Nx9AgS8Mnbk5yEjOefDt7043/PHi/n6Dp3L8yVu7?= =?us-ascii?Q?JlFKyqt49tW6xeKlwhFojDQFlRpcGUShX0rQ3HWssIPu5T2XPSiuCbEoAzH2?= =?us-ascii?Q?WxPFQBkEkCfHKi8Ptp++1QefTOPFqU+MFhct9TyLhWXI0n8LUUNIj6swCI3+?= =?us-ascii?Q?TAwqZqcLD+auJlioJ2OUOAi0qDQEEgNlu8CYh0F/ss8QVNocbWWmanXjPq+O?= =?us-ascii?Q?YYPQ7AvqPFOXcyQ39X1ZPPfZX7COAELTIUUlotv7ll/JK58VwLG469gfvLl/?= =?us-ascii?Q?5zDB/ufbaz4ES9/cM1rOgjXL6jIb7JcXqqyIjaGi0UJKNn1fqW88VUwSD4pV?= =?us-ascii?Q?pwk2vkg6Fq/Tmq7RVXw0nnp9De6MpFOmOYHoa9ZLuBm+bcTrihQAL5kLAoNB?= =?us-ascii?Q?Hob4/Bcj1af+wY3GwONkB+YyDjluROJ8A+lIb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2RmsMi/wEdZSlcbw10=3D?= X-Microsoft-Antispam-Message-Info: pqzUu5wJStfY/Rq40iBRgF9bAnDuQUtpLOBUcBvR/RuQZK3pvU6Sr/TbnwcXQcv6idrPBCDKQnuD1wJ7mTmyavDebyyXAK2dfNrftYXu/2+zWLlGIm0XME2rqjcjTnekI0J2Shg30NbZi3F7a5n9KHMx73gTXjB2rNkJvW+UTLIYy95aIUK60r31tTlyzlyh X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB2480; 6:5TRuLSggi8a8SVSU5ov8db38N2FtSwqsQxr/E64+sdCrN8CuOUI6PxKdjhtOZWV4KlsErccOPEemO4gRL7AWkr/VAj5cjKYme+ZnXktDvUOZE8l2n72kjRmdcPlquRx2HimKZL32gX++R2qN9A9b6kd0OuLodcXf5cdE9ZF61MDBjiGCZh2qNNJI19T49VO86EouFy3HwN0ZkNULoEOtyG0uP+QIz3j8ZtQt+tZnBjhyIXEEMbhj58mWHzy6lxijinO6NgD7Dk74loM+7X2bqwJ1UR5sPnUZ6PyOuWw/ssHXzw3L0LCu/wHuk6bSg5VjKbL+Tq+WTuxpxoBvRWD3N73bTO1PYQxZEu+cpavC6oy0c9ZcJ4qa719usmkuqvDzW956+TwP6FNXxfub+OgyBBweZ6csB730AcH6FW2C27zAaPcR70YSri9mGZW1MxNLtMGH3NSQJOudfAgtMXSBAA==; 5:kstr/iSyVAuII10hdzMdMVdznz7uqIT6XZWSdwyY7T4bNKe+dxCqjfDwFhZhIc/E4umKqgkeeRPt3L0ZjS0QrHJ0BZ7C5MQ0c2NXtKqYzh6p+I/rSorkuTgp4f566tg1+CRArxdlqv87PAcIpYJt5PfgM3WdZ9kO/CAaIhLgQqk=; 24:utaz3NXXiFEO6H0PwzzimYcUK27zB5xsHgKWMID1JyIApt8jP/Tb27TIa7In5Y25/AyA/8NDPkt2+5xHLSVxhKZ/fhYiPmRJJl9XTp1ih9k= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB2480; 7:+rgxhGZ8WG5eab3jaHVinT4Z0VWff6GECm0L/EKGXBtASTEkxvbZsj6QDwKQ3LJxzZC2fX1q6qYcVTVxUTu2DoU7Kn70qXffRYp+9JSuKe3PJ92sSPkfJeIthjlhybejf94bs02ih/Ty6xE8DxtRmgU0bucCFFdhFoFd1oYJN7BUKXDVxoqRadLuxkiGn/DNAfm5mmE0Wdx+y5lskSkd5lKHqPOBYta9EsSAdamXRB9Qk1LTFJB8ts0kAFm1psw+; 20:kMR2wj2jmL6xz9sS/B8zGkvidiG+TDUhObyMXvo9WRVl8ejDJ+5zyB1VrEgEFF5qavNwNl0rcl3rBTQRB8HKLeP8dhfpcTr29Y2EKhM7HDTNSX6NPgdx+sBhUzqvn1Wb+hXlUMhDpNIVNlIUnyDzEciFXvg6r6QIKPyjJYlwE/yK+c1TMBSRZCJFPJHsP5gK3laSLyi13GAVptqdkiV8foj3/OUwf+iCQBDqmhlTXbWEPrQC9bnrkFRMhODbW9Av X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2018 01:18:42.8340 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1265e11a-35f2-4dfd-73e0-08d5d194c508 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2480 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Disable the TOPOEXT feature if it cannot be supported. We cannot support this feature with more than 2 nr_threads or more than 32 cores in a socket. Signed-off-by: Babu Moger --- target/i386/cpu.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 2eb26da..637d8eb 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -4765,7 +4765,7 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp) X86CPUClass *xcc = X86_CPU_GET_CLASS(dev); CPUX86State *env = &cpu->env; Error *local_err = NULL; - static bool ht_warned; + static bool ht_warned, topo_warned; if (xcc->host_cpuid_required && !accel_uses_host_cpuid()) { char *name = x86_cpu_class_get_model_name(xcc); @@ -4779,6 +4779,21 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp) return; } + /* Disable TOPOEXT if topology cannot be supported */ + if (env->features[FEAT_8000_0001_ECX] & CPUID_EXT3_TOPOEXT) { + if (!topology_supports_topoext(MAX_CORES_IN_NODE * MAX_NODES_PER_SOCKET, + 2)) { + env->features[FEAT_8000_0001_ECX] &= !CPUID_EXT3_TOPOEXT; + if (!topo_warned) { + error_report("TOPOEXT feature cannot be supported with more" + " than %d cores or more than 2 threads per socket." + " Disabling the feature.", + (MAX_CORES_IN_NODE * MAX_NODES_PER_SOCKET)); + topo_warned = true; + } + } + } + x86_cpu_expand_features(cpu, &local_err); if (local_err) { goto out;