Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp4802099ooa; Tue, 14 Aug 2018 10:45:06 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxBXan5FIjaJw10sQSFeN+8IqrfI+SVB2XQTjrJeQgSN9UNfBwQyvBwoYt3tZdX9XEmGt3D X-Received: by 2002:a17:902:4a0c:: with SMTP id w12-v6mr21496881pld.289.1534268706281; Tue, 14 Aug 2018 10:45:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534268706; cv=none; d=google.com; s=arc-20160816; b=0V0Mx4JhzA7kK4tMHF2xEOPAl1rCrcgCvrC5Tm3lvpHAwB/P3oOXaACa1GWVlyrgpV UN0Ps9B3goZGRK+OXjVSp59Bbghy/1/kn6BQIDLDIuJWAGV1XUSWGRKlUowf0HvZTTJN sNpMcrov/0ZHts0HcJb0IMmy9dgXuv0Yk3jcl/bPoXmnwXUGceuYnc9F+9zAPKENsAIg Vm8M9HBXRAMSvaFrkQw0uAQKV2qnr/RVgrdwvkgGhdmZdPYVsyYyx7fv/s9mPUk066OQ LtxL971WSJTEpAnvn5YOs4Dk5fLPjhL0cOEkrWY0lR0rkv5cBijyPHX0eHLLUu64bV+G OriA== 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=Xr9aqGfu2IF/4vpUy9PKFSqn7/d/46HXB0OuhDvTJHA=; b=0GPEW/10J/hEGcRp445LANNyai6v5SmC4zzCapoeRfDSD+IulXArDuznSPD3frKz2s pW5hF+ZTu/nm3KFUKSEySuCEoOSgmXZjy4gE7Oc2DVX4jzJas3VNVTiHrqAkwoeDpC0M PXxqA3Yf0eeZe3wA6sEgGbLUvD168K1Z5aoX7zsWH44LWTOknQA5Nvc7UtqcBgOifnIN IpvKnWB7lrIDDiktwmwbiwvy+FNBVdRXMEy5d5/ZoZsAgFuXRafIKhbHP42+pQVThSEi eLW+co0AhxOy0IdNgFVEZfBgLpeg/oukldsdU7leIDvIpi0XUP40Yx81BvzOJtmWcPGJ rpbQ== 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 v6-v6si17308842plo.264.2018.08.14.10.44.51; Tue, 14 Aug 2018 10:45:06 -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 S2390571AbeHNUbk (ORCPT + 99 others); Tue, 14 Aug 2018 16:31:40 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:59836 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728642AbeHNUbj (ORCPT ); Tue, 14 Aug 2018 16:31:39 -0400 Received: from localhost (unknown [194.244.16.108]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id DE407AF3; Tue, 14 Aug 2018 17:43:27 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Jiri Kosina , Josh Poimboeuf , David Woodhouse Subject: [PATCH 4.9 077/107] cpu/hotplug: Set CPU_SMT_NOT_SUPPORTED early Date: Tue, 14 Aug 2018 19:17:40 +0200 Message-Id: <20180814171525.478448255@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: Thomas Gleixner commit fee0aede6f4739c87179eca76136f83210953b86 upstream The CPU_SMT_NOT_SUPPORTED state is set (if the processor does not support SMT) when the sysfs SMT control file is initialized. That was fine so far as this was only required to make the output of the control file correct and to prevent writes in that case. With the upcoming l1tf command line parameter, this needs to be set up before the L1TF mitigation selection and command line parsing happens. Signed-off-by: Thomas Gleixner Tested-by: Jiri Kosina Reviewed-by: Greg Kroah-Hartman Reviewed-by: Josh Poimboeuf Link: https://lkml.kernel.org/r/20180713142323.121795971@linutronix.de Signed-off-by: David Woodhouse Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/bugs.c | 6 ++++++ include/linux/cpu.h | 2 ++ kernel/cpu.c | 13 ++++++++++--- 3 files changed, 18 insertions(+), 3 deletions(-) --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -57,6 +57,12 @@ void __init check_bugs(void) { identify_boot_cpu(); + /* + * identify_boot_cpu() initialized SMT support information, let the + * core code know. + */ + cpu_smt_check_topology(); + if (!IS_ENABLED(CONFIG_SMP)) { pr_info("CPU: "); print_cpu_info(&boot_cpu_data); --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@ -267,9 +267,11 @@ enum cpuhp_smt_control { #if defined(CONFIG_SMP) && defined(CONFIG_HOTPLUG_SMT) extern enum cpuhp_smt_control cpu_smt_control; extern void cpu_smt_disable(bool force); +extern void cpu_smt_check_topology(void); #else # define cpu_smt_control (CPU_SMT_ENABLED) static inline void cpu_smt_disable(bool force) { } +static inline void cpu_smt_check_topology(void) { } #endif #endif /* _LINUX_CPU_H_ */ --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -374,6 +374,16 @@ void __init cpu_smt_disable(bool force) } } +/* + * The decision whether SMT is supported can only be done after the full + * CPU identification. Called from architecture code. + */ +void __init cpu_smt_check_topology(void) +{ + if (!topology_smt_supported()) + cpu_smt_control = CPU_SMT_NOT_SUPPORTED; +} + static int __init smt_cmdline_disable(char *str) { cpu_smt_disable(str && !strcmp(str, "force")); @@ -2053,9 +2063,6 @@ static const struct attribute_group cpuh static int __init cpu_smt_state_init(void) { - if (!topology_smt_supported()) - cpu_smt_control = CPU_SMT_NOT_SUPPORTED; - return sysfs_create_group(&cpu_subsys.dev_root->kobj, &cpuhp_smt_attr_group); }