From patchwork Fri Jun 8 22:56:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 10455303 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 3684A60318 for ; Fri, 8 Jun 2018 22:56:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28A4F1FF40 for ; Fri, 8 Jun 2018 22:56:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D6A02943D; Fri, 8 Jun 2018 22:56: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 9F32F1FF40 for ; Fri, 8 Jun 2018 22:56:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753126AbeFHW44 (ORCPT ); Fri, 8 Jun 2018 18:56:56 -0400 Received: from mail-bl2nam02on0052.outbound.protection.outlook.com ([104.47.38.52]:52759 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753098AbeFHW4s (ORCPT ); Fri, 8 Jun 2018 18:56: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=FWiBeBsfhf6HECtbM2qSC8HTfXeDgHwkt7ZstxlyeCY=; b=X5Wy9fF5gKziriI+ECF80zIYX4lTpA78HadAR8JspIJZfb1vISyIVEiLBuMfe0SosUqt9ujvLnwxvcPlduWgvm63bRcLI7cLXDuZvzKOrkqMa9v99Q5ANzPFeM0z1VoyVXPToon50z6eS1ezwocuzGgphDkOC0no+gHxtYkJJHU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Babu.Moger@amd.com; Received: from linux-h3ml.amd.com (165.204.77.1) by MW2PR12MB2473.namprd12.prod.outlook.com (2603:10b6:907:9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.841.14; Fri, 8 Jun 2018 22:56: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 v13 5/5] i386: Remove generic SMT thread check Date: Fri, 8 Jun 2018 18:56:21 -0400 Message-Id: <1528498581-131037-6-git-send-email-babu.moger@amd.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1528498581-131037-1-git-send-email-babu.moger@amd.com> References: <1528498581-131037-1-git-send-email-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: SN4PR0401CA0034.namprd04.prod.outlook.com (2603:10b6:803:2a::20) To MW2PR12MB2473.namprd12.prod.outlook.com (2603:10b6:907:9::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:MW2PR12MB2473; X-Microsoft-Exchange-Diagnostics: 1; MW2PR12MB2473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B3rQDWnL/NuTaWzLb2VovCbMGSRCnp2y/t3krWiJ/u3cvAhEIn68dUfaCJO9SesHxwT99r+ZkR+y+BOwreRHKEVvVyVyoPyp99C0s/wo2FtAumC3A8cFTjFHzdKVell4ykz1fYFfIVirt4/oNu+AosZxIu0/9WAVBxFd3NygL2wadXb0px+uY8WvcrBv1mCcY1s52FiFrhjLcW8lSGqXuJ46XAhwW/sdbKHXt3Xskkp9gXkyXNG7zepxAyJolpFa6YU7W7aq2Xf6ksDY0q7X84aSamgXTi4p9DmpL/R1RyYtcm1YhKaD417JkH78fu85z2ZWjZm/T7EvlDoBv+eIkXUzL; 4:cgHH5oLkE++CjuqGvM+SI0mXTqF9idikvw7LaRCCCiRH4YxIy7c18m0ZLrMrSRK6vEMIAW7bq/F/GHGukZsULZa13WuH0I3IrYKQTRqLsnvPk4WhdMpkkcwf7uZSKMk3Z9knNmIcXdGKV+fr54sPV1CL7X2S6yXqmNXukdoABZg3XDgAPNwAudp/UrGe5WygGdRyebv99tEElwXLLoekIMeGT3L+fSKGjD4PX8Gs/jhcy9gwMaqJ5hGPw6/JAIY9No8q0hii+9mcxc+kSHVG3e+SYx/Okp0llkgeftf+rPCfGrBh0K0u+KRP3V2gjG8C 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)(5005006)(8121501046)(3002001)(3231254)(944501410)(52105095)(10201501046)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:MW2PR12MB2473; BCL:0; PCL:0; RULEID:; SRVR:MW2PR12MB2473; X-Forefront-PRVS: 06973FFAD3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(376002)(39380400002)(396003)(39850400004)(366004)(189003)(199004)(956004)(7416002)(305945005)(6666003)(4720700003)(7736002)(53416004)(53936002)(48376002)(26005)(16526019)(105586002)(16586007)(106356001)(386003)(316002)(186003)(7696005)(52116002)(39060400002)(50226002)(51416003)(66066001)(47776003)(50466002)(59450400001)(446003)(8676002)(11346002)(8936002)(81166006)(81156014)(76176011)(4326008)(44832011)(486006)(2616005)(36756003)(476003)(25786009)(5660300001)(97736004)(6486002)(3846002)(6116002)(2906002)(86362001)(478600001)(68736007)(72206003)(41533002); DIR:OUT; SFP:1101; SCL:1; SRVR:MW2PR12MB2473; 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; MW2PR12MB2473; 23:/zHrIQBQ/PMK9IcPLNWnDwwMk3c99t2i5qiKROx6U?= =?us-ascii?Q?B253DdQmsbqGTSkxG5UDCh4Zlb5v+zDVLrAF6z9bv+hCClggCVPvqic3XnNP?= =?us-ascii?Q?E8z3S7oq8BSpL4LMMUxhORw0kCONjcllgJG+8pOT8xtJuY7HDimE9AdWWSxS?= =?us-ascii?Q?c9uBqEGuqG0ZS2+Bvcom+0AWQCHm59dctwm6QEWK2v8d7+pfXqPNjtOck6p4?= =?us-ascii?Q?KQ9yeEp1Dg6qG7uPUaR1I0TJyVHbWG00MguqokG156xhGc8psbe3xlQFKhJE?= =?us-ascii?Q?mnRnQJbiVWJJHF1atySTTTNW8Lqdnrno8i1/Wm/TGyGexB/YU4jbeN9E7zKt?= =?us-ascii?Q?frNUmx/t1Tn02SSfXd+vSI6tlt3vj8zrQn6SRM9fP4NXaG+tUU+bG4jAErYO?= =?us-ascii?Q?ucmaS3qkF83cgcVHpkP+AXNroDoB896aG1jaTJuMR8FOHk3o3vLq0e/L344c?= =?us-ascii?Q?65+glzTDPYHLPMFvNwfirGucjpmEXOrA26edEePbLnnusCxk8Fzy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hgnAVVEoNNboIEYw2CV8nc+UMypSSd08DuuIr/oeX11BTH9NwNe1HU8VSYshSBXB+ivyP7ESQSxPpMMuDdFzxDlE6RFalJbSm+Dk5MioiGvCsc5Eb1i1Hc2bxityNyQ1icjkLMcsTrXz8b4zZ5OPBmL63NsaRktFQ8r2M91oR7YCsuJxdRul/UmiudJYZ+yThyb8BrShRAAfFBR2NBOE9pjYdtJSNVlw; 20:XVUsFMgtjyBOP19jyOR71tyI51mFPhu85Ua2qSY01AkribOHWx1YzYhaSHuzyS19YUeZfB2vbs+x7mu+BuA3BlMoxXyAQ0GRTRE0DVVQt/5vpxvj6AmBv6uYPo88xof+XU4z/R0wfTRmXJzKImCOgS/sr2MAaw2szcOxfvPBNzmFrasRGtACzChAdytQDw6Q5NZZYFByGb5PrmDYHQwmJN72r8rfUfrDo5xVs2lONSzzEpHGnyL+kK0QXT7VTRkZ X-MS-Office365-Filtering-Correlation-Id: 4f31c159-d07a-4c56-d61a-08d5cd931b0b X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2018 22:56:43.0933 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4f31c159-d07a-4c56-d61a-08d5cd931b0b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR12MB2473 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 88bc73d..a55e501 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -4993,17 +4993,22 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp) return; } - /* 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; }