Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp4796617ooa; Tue, 14 Aug 2018 10:40:27 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzpjk26HIdecpktwUgco7pa87zUbVWoQXqN99q25L7uSDfFRDEWc4Hz9OhyqwvrUJkl1TZC X-Received: by 2002:a63:4a61:: with SMTP id j33-v6mr22039084pgl.436.1534268427436; Tue, 14 Aug 2018 10:40:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534268427; cv=none; d=google.com; s=arc-20160816; b=W1ZThph2MROsAxUMTx1vDubpFaeWGrC/pLAiUHr/93BYFVDLWbZaqwFOy+sNMBFHq/ Ikya5/dRWYPdq1YVT32ji5kRMJd8aygK95gYdYrhlwNcEIl1fqmwU3u0ZjphBqPrm3HS UVVOBsg+MktHHLCTswIZoo6UsRQ+3E+6pI1J2oNVPIzzpB63xCpVymG3cADGXGtGItJj W6Jn2nDQE9rk0+Z7PhXixAkRfmtnUzs8JSRBygwILioBUdexwHvw+v6G9CaTAdDB1dT7 d7nlV2MFt7yQCSuPPlDg1fXyXcLtfcdN0ZUf6P1lrd2uXfZE6n2UdQrwHmBAxMxr9Lau mZaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=hoiazwKip3s59j5ROqgIiQpugdsXfN4ufda+sMD5d7Y=; b=cdt9KVZdWFcLAxQe8aF39kBOauYrwQdN1UJGKO3YWGjns/lAvdBBuBhCjr3gylC80J ROg3uyCe2sXz/YXlwQvzrtsRIZCCA+dEhFHu/L80K4+N4L7F359JlvlivsgqNhVm1t+v uwg8VFBXel0ZwpAPMhvayA0BAMAAuY9wr+80/tc92EAO1XRNFYXjQy9nEdyBMJw7LMWm RQM7Q2U/i/AmDXyNIYV/tS2HV+bcrhlwFzdq3qhzCdkRRQ+K3OEf4/StRKuNVTXk2+kS D8IBRACml87f5mKnwfRZ6aprXkOo/P16OQDFzI6MstOdUrbtIITHMy7XSwfp09kEiy7Z Amfw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y5-v6si17492561pll.89.2018.08.14.10.40.12; Tue, 14 Aug 2018 10:40:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387949AbeHNU1B (ORCPT + 99 others); Tue, 14 Aug 2018 16:27:01 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58402 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729285AbeHNU07 (ORCPT ); Tue, 14 Aug 2018 16:26:59 -0400 Received: from localhost (unknown [194.244.16.108]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 04592D83; Tue, 14 Aug 2018 17:38:49 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joe Mario , Jiri Kosina , Josh Poimboeuf , Peter Zijlstra , Thomas Gleixner Subject: [PATCH 4.14 080/104] cpu/hotplug: detect SMT disabled by BIOS Date: Tue, 14 Aug 2018 19:17:34 +0200 Message-Id: <20180814171520.421259645@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180814171515.270692185@linuxfoundation.org> References: <20180814171515.270692185@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Josh Poimboeuf commit 73d5e2b472640b1fcdb61ae8be389912ef211bda upstream If SMT is disabled in BIOS, the CPU code doesn't properly detect it. The /sys/devices/system/cpu/smt/control file shows 'on', and the 'l1tf' vulnerabilities file shows SMT as vulnerable. Fix it by forcing 'cpu_smt_control' to CPU_SMT_NOT_SUPPORTED in such a case. Unfortunately the detection can only be done after bringing all the CPUs online, so we have to overwrite any previous writes to the variable. Reported-by: Joe Mario Tested-by: Jiri Kosina Fixes: f048c399e0f7 ("x86/topology: Provide topology_smt_supported()") Signed-off-by: Josh Poimboeuf Signed-off-by: Peter Zijlstra Signed-off-by: Thomas Gleixner Signed-off-by: Greg Kroah-Hartman --- kernel/cpu.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -2137,6 +2137,15 @@ static const struct attribute_group cpuh static int __init cpu_smt_state_init(void) { + /* + * If SMT was disabled by BIOS, detect it here, after the CPUs have + * been brought online. This ensures the smt/l1tf sysfs entries are + * consistent with reality. Note this may overwrite cpu_smt_control's + * previous setting. + */ + if (topology_max_smt_threads() == 1) + cpu_smt_control = CPU_SMT_NOT_SUPPORTED; + return sysfs_create_group(&cpu_subsys.dev_root->kobj, &cpuhp_smt_attr_group); }