Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp4790634ooa; Tue, 14 Aug 2018 10:35:19 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzW0oHce8Vy6bpOisrBMSTpSENnhdgCyThso/vR4vXPZqY/Ts2ZB83jkSY5rT+jdsCBin6T X-Received: by 2002:a17:902:28a6:: with SMTP id f35-v6mr20887240plb.240.1534268119515; Tue, 14 Aug 2018 10:35:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534268119; cv=none; d=google.com; s=arc-20160816; b=UHlFbVAfpzE0JakDKNqLNQAgDuxiZsOI7qnIZMScXvjLJ/nmT5GahpbIGN5t8bANfQ PDbrI5d6EYDmXBGtp/vuAx3LyTa4IUCjvOOBoAHC461p1pamkBdvYPjZq84VJrFa6Rra I79+E8zLNACrvahsCM6aYKjbHNFeMDs56Otit0uhexF71wVZqDO7QKjLq2f2ELxU7bEE y2xSNwU9Bh8yjndzMwS+mkCrb8TSIPkzijsxRgq90hcJV1lugoQWbMClCirjufTxns14 pRgfbEjsL6uZ7Kf1C0ff85ptbiUoSPuBEruuBlbraGeJewP3luhbgjxd7V0ncC5QRSfA 7diA== 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=TGCdACBygZHW897wDNIsd48HVEBMaaTj+gb+YoGhMx0=; b=Vzz70lg3I5HGSfKkJb7cODVfo492WAxGFS5achXKMKyaXirN5bkWA7aNYvwiPVEMmv 547flgsw66iWJqMm31jFWHJY9yu9FU+scd5op8BVJlHaGmgGTreNqvnbT0VUNFVeCkrj Qm2kHW6vbj+v4hj8djtQe8LhxoqomBCHJv45ZRmI5+zOrZ6aqOQzOdDiqSmRoz76i+F5 i17N6kR5HtbPlzqSwKf8G+OhsJnqfUEdIgAndeYqGqcWj2aTGfWVljEq5tCoi5MLg2bw ebvC1kPrauqyUBD+fjd5Z+jKwxEpfeMWb61Qi3/iax6iJoUUF+yjBU3vzC+bBV36RIJ5 kcbg== 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 w14-v6si17335802pgv.462.2018.08.14.10.35.04; Tue, 14 Aug 2018 10:35:19 -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 S2388580AbeHNUPA (ORCPT + 99 others); Tue, 14 Aug 2018 16:15:00 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:52118 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387702AbeHNUO7 (ORCPT ); Tue, 14 Aug 2018 16:14:59 -0400 Received: from localhost (unknown [194.244.16.108]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 1E5ECC5C; Tue, 14 Aug 2018 17:26:52 +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 Subject: [PATCH 4.18 60/79] cpu/hotplug: detect SMT disabled by BIOS Date: Tue, 14 Aug 2018 19:17:19 +0200 Message-Id: <20180814171340.186243659@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180814171336.799314117@linuxfoundation.org> References: <20180814171336.799314117@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Josh Poimboeuf 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: Greg Kroah-Hartman --- kernel/cpu.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -2125,6 +2125,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); }