From patchwork Thu Jun 14 01:18:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 10463149 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 36E8F603EE for ; Thu, 14 Jun 2018 01:18:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2829428C3E for ; Thu, 14 Jun 2018 01:18:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1CF9928C5A; Thu, 14 Jun 2018 01:18:54 +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 93AD228C3E for ; Thu, 14 Jun 2018 01:18:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935881AbeFNBSv (ORCPT ); Wed, 13 Jun 2018 21:18:51 -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 S935616AbeFNBSs (ORCPT ); Wed, 13 Jun 2018 21:18:48 -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=xREWvCqYLa7qefFJlezsIHRXGET6NenmC7oMO9tiGSs=; b=WxlQ04TrKjrTZ/DvezZnq5Yak4pVCp/AreSG0Fdk6AFADof07HU2gt8fMM0N6BpdO9PTigDxiJXZIfxMm28Koa6wW+3KVLMqMRfmqqyraju797TpqTIiu1taP9lkH+u9zcxa1JnR5/mBNCO0Bu0PC5Fa+2ECdxSAKUa6HjPK3xc= 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:43 +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 6/6] i386: Remove generic SMT thread check Date: Wed, 13 Jun 2018 21:18:27 -0400 Message-Id: <1528939107-17193-7-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: 4edbba48-0b42-4389-fe17-08d5d194c56d 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); SR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dZoxb/EAK1L5FJEmmYDrUbNrZ27IZytMXrkiWBPaLPhUJOW8cBdEmRYawP32BxAHNrQDMxu74HahqRGQx+w5wq1IGmZLNh6IqFidK8FAu5bsyLsJYPj6H1bQEa+et5bGo9fXk7O2ouqpZw0iNJaUSOzFQYncQ9p0zajIKs5PEwDf9KqSYgiwj1pDQMdzAOnJMe7eJetdNyEbhUuRp0RebJFgjDR2GCk3pZXbmk5CqnuWLos9y2Z2+xrMA+3AT35wJ18uPdWndBUQOCZ+T9RCzZfGYy6Mp5KtjC0XoDmOhUtpS6zYPc5p0MhZ/4+HtFlx2/Voh3cw7wY53Nc7XVtl4R+y2bJtBvUutPyplSplUfUqRCe85eR3HdXm6tcDMSBBb7AoPDVlvXZ8TdPrP8+TePtDp; 4:oBo+ZLbOEJ3sWQGT3T0dtNdP9te5U9lD/GyrakDrnOXFqFV9OZbimHoFSWJGWu39mDvMAWimjIwzLBUL9Ewr1NxxMdp89UvC0X4sbz7VdwpcqjhwG3h6hgJbuBY1E1L3v2VlUWna6nCYGsFFGvrFoXO0vyAmrk94BIQ1+h4FYHjkA9GCwnc6uhSQ1cMFJwkA1rDjEwH/OYl8wZwsnkHiN4O49GaBc1+l5a82ILlhhImpHZwlO2fpq+9uKsl9oRT327Yjb2k4/cnTQ3939TGw+duwOSL9kzx/KYkiK6ai3zhMU75afKs/lpiNXMz0kvNf 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)(41533002); 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:V8oowyv5HdwI1Sje4nKMk8WJN/R5mhJ6qcGbCzbCc?= =?us-ascii?Q?iqCo9609zh/wkqa73PoA1oCEusuXK4FeTSR2RXhHZVnx7DWi9nSHS7l7GIhC?= =?us-ascii?Q?GDkn44/O8GTU3uH4gWRHRLfOTlvJ9u5XplKY2Bg1ffbbc4r4cHCtF7VxBGOy?= =?us-ascii?Q?j5mG2v8sCM2DFs3032vKhgPEJC0zBZ/ZwyxrWbPW44OQ79iRRSI1Dp4JX2qw?= =?us-ascii?Q?eq7MUFtqeA7uDke2X43sncPRAoyh2AJf6Mv9nYRIj1dNSje3V9wTSyk45Ura?= =?us-ascii?Q?yEjD5cfcY/Qw4YR5BBepMYruAzmJPAUzO0FckIrCZWVR6YIVYZHrZ8gAxEQt?= =?us-ascii?Q?NNJAtvIGWBb3FJpaumEvVrBwSk2nDAV5BSE0NyIjrwPp0wvndC78WBrO0BoX?= =?us-ascii?Q?sZQ3AvI5eZyJs2mv7epU3uQJjrElZ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FfENsCRhoZ5CaGXbob0k04tH7cgBWQ2?= X-Microsoft-Antispam-Message-Info: kblggfW8bMir+Gnfh3wg32vINH+KAF0ZxQiIhUOy4ApkNYaJ482xvO8TpJRvL7nE/NQAFQ4Zyfop+1GL7fUPR1L2NBN/6QAJ0dc4XMzjy3+3oVSH2AKR9BsjmNAY3eL7tcAR3GiyR24xe7kz/KHublteSHT6lbkGFU9ygTcQZCi0hpttoM7xJkUu54/f+Q07 X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB2480; 6:1ukGUaqwnwtYUNmp6sPKi/5ejzYlhns7kiiDAW28hrIjSzZLzxc8uV+pGKl/4Bu1hKNUPEzxshevqNmVoFyE//Hh24hSRWn7LVarbpTQ1s0HK015neqVCY3AgQ/Vr3G/Z94hJTcvmO4GMI/0cgv4TbT+pKFtFH6Q7JrJ+Prfu85O6feAUvvS1l9uCCJ5CVB35v/NqhOMUcbQ9PGE1NHEgg2+W1qKH2b5tdO3uUJ6xesAp640hGy2fFEUFzmAF+3y+qlD8omF6vGERqdJT4E+CuI7gZWaGmYDGB2MhnmpJL2Fjdcge64Txvcq6q2tZnGR5Gn2M4Z5Gv1Inksnm7eWgupJfmDvLB63F4lWh1ZITCxnEbRkdot8uGkH4zXz5yq6dr0nqCE9/bRKF205DpknHFCXNM54iAtFaN44qut1frUERLl0h2+PsjDNAqXyfv8WERzS5/GpEU4NC68iCtkMaQ==; 5:AXQmWou6/WUAnWFe4/biRfex/RXox0LlADuY62IpJn7/xCoRV0GiLj6WVvshRh18daN+sn4FGebDUxpsZELUNtjl2Jufp+7GmYuCMvP4ns8JujrSU8Ni1TuI9uNL4QSxGDU3ow1NP5d8fQ4XVhqbZScxqHXz7N69r72M6IXWkr4=; 24:AIMSwBxGszlMvBsbrCy1VLijM/30ws0LJ3okPbe2Lf+weVYOGUhhhkzvhtmB951L979BNcHXCt3cC0ERBcm1qcFSDLVCwrlW4SEM85Ut6bY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB2480; 7:J4ovE/Jp26zl5xeNwCW5jhEFgjDrH4VT1lbndZX2MY4mLKagJw/ai9Ij864YKl6fkoKBl2iwfb6F+Nf9uyW2MbdN0A5wJRIYK35tIZBp8ra8GOj2SqdDJyqSkyJG0wAasj6SHwtzVo2T9LuF05QiEBuKFPBwt2Bc5bzQGz8jrrCJ8Oi9cESzPYvyCf794twK1hvQTD6adZOpkNcBIhtBjDWfm90GrHeTC5DE8Z7e1blOSuJM+dbJo0wR5dyLLZag; 20:OIvo4ymD/wOVaiAXzpd7q2umobWLsHpxdeg/Bm+hI0bbr9pQtUS/VpJdotSU5ycmkBPwmMY0D0KN9QDmCSIQkuAg9bLtx4jyMDdCIVd2D9EpmACqRxriqWuBPUhU7f7pDRQJnONJUvjwdfp+9MmI8+IX4RwHsYhYDXSY7LmHiIRECzRNEDgyTMNyAwb+lVifHX8OWh1kXZNp9sVdxN1kblq2Qiv3iRaavc/dm+WXdXkj+rbIfXyx858NTO68bKs3 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2018 01:18:43.7125 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4edbba48-0b42-4389-fe17-08d5d194c56d 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 Remove generic non-intel check while validating hyperthreading support. Certain AMD CPUs can support hyperthreading now. CPU family with TOPOEXT feature can support hyperthreading now. Signed-off-by: Babu Moger Tested-by: Geoffrey McRae Reviewed-by: Eduardo Habkost --- target/i386/cpu.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 637d8eb..6783305 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -4963,17 +4963,22 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp) qemu_init_vcpu(cs); - /* Only Intel CPUs support hyperthreading. Even though QEMU fixes this - * issue by adjusting CPUID_0000_0001_EBX and CPUID_8000_0008_ECX - * based on inputs (sockets,cores,threads), it is still better to gives + /* + * Most Intel and certain AMD CPUs support hyperthreading. Even though QEMU + * fixes this issue by adjusting CPUID_0000_0001_EBX and CPUID_8000_0008_ECX + * based on inputs (sockets,cores,threads), it is still better to give * users a warning. * * NOTE: the following code has to follow qemu_init_vcpu(). Otherwise * cs->nr_threads hasn't be populated yet and the checking is incorrect. */ - if (!IS_INTEL_CPU(env) && cs->nr_threads > 1 && !ht_warned) { - error_report("AMD CPU doesn't support hyperthreading. Please configure" - " -smp options properly."); + if (IS_AMD_CPU(env) && + !(env->features[FEAT_8000_0001_ECX] & CPUID_EXT3_TOPOEXT) && + cs->nr_threads > 1 && !ht_warned) { + error_report("This family of AMD CPU doesn't support " + "hyperthreading(%d). Please configure -smp " + "options properly or try enabling topoext feature.", + cs->nr_threads); ht_warned = true; }