Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp4801839ooa; Tue, 14 Aug 2018 10:44:53 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyF/2CvJt1kHa1vfGoWKasqp0NKY6MGN+WzytH528HiZA+qlTCVbdSLLk5MVsmQJvYO9HPE X-Received: by 2002:a63:5624:: with SMTP id k36-v6mr22262742pgb.146.1534268693014; Tue, 14 Aug 2018 10:44:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534268692; cv=none; d=google.com; s=arc-20160816; b=oXyJnxFO4HS/fkYvpYnl0KeXgNT22o++QUrMrztlDFLqK6ujO5pcrwModrkw68VKUo A+E59OQ4tcKxvkMVTiixkaY8mggLH1CTFZCQfHY7fqOAiv80eaxD2ZZMxopTYgKYl+r9 0oWNTZMyxCr5FpugS6ROswOVxVHnm5dsE5DIgLBJeHeSUvv6dNYq9kG3F5KZjHT/K7jE wKiY01qiVo+TGNQEayP8g6neZkvaQl+3zx0IBCf5MLN9rrJYXxQGjTg0q18dpS/5Frk6 MFgg4OUElMDAvOma0299faXE2a5mhAUyNRJ9hBHeRkNDcoVO+AZMi1YswQdkXZF9F/mV w6bg== 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=eXRNKX3bzt5r7wB5oRJU6S7VtESyYp4zWtxOlFh0x+s=; b=N7N/ssKXuWgZwQlUd9EtXe3AtEToKbbVrf5SioZKGpb0NsE4yTZrt7BRWgGx6oxibg bPRxYaHlWcGhAvyTysyrrDDGxqOiKtXXW1DuUzyX8QE9KnozvUnMIg1hk1WtwEAeVax+ VKfbFi/lInUcf4RyqiatkUi7f3k1jA7aJwV7iqxvwH7hO03xCPk5W5ibl/grobYDz5Ok mF7miQB4BBCnk707cn48gH+8SOLyMdL9S2h44H2SnbKkxAf+qspmuTunTHfzO+2+LbjK X5cvMSo86oM8wouxRGvfX8cTxB4jtZlXBrI8P/C8r9YtT/rKiQh9tU70rdTNiD8lwnL1 jaIg== 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 a8-v6si17707164plm.75.2018.08.14.10.44.38; Tue, 14 Aug 2018 10:44:52 -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 S2390636AbeHNUcB (ORCPT + 99 others); Tue, 14 Aug 2018 16:32:01 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:59904 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728642AbeHNUcA (ORCPT ); Tue, 14 Aug 2018 16:32:00 -0400 Received: from localhost (unknown [194.244.16.108]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id F290F40B; Tue, 14 Aug 2018 17:43:48 +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 , David Woodhouse Subject: [PATCH 4.9 082/107] cpu/hotplug: detect SMT disabled by BIOS Date: Tue, 14 Aug 2018 19:17:45 +0200 Message-Id: <20180814171525.784747037@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180814171520.883143803@linuxfoundation.org> References: <20180814171520.883143803@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.9-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: David Woodhouse Signed-off-by: Greg Kroah-Hartman --- kernel/cpu.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -2063,6 +2063,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); }