Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp4782420ooa; Tue, 14 Aug 2018 10:28:33 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzPxjN0uaJrOgvCq76ZYIl77HgudyfQcik8iJRQiWZpVvoWsVQ01Kuzs9I+PUBySNC/vNsX X-Received: by 2002:a63:fe02:: with SMTP id p2-v6mr22122018pgh.148.1534267713557; Tue, 14 Aug 2018 10:28:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534267713; cv=none; d=google.com; s=arc-20160816; b=uYDMdeVn+rP1AEVZsSzmHc6Z/JtdKKqV9eg817fEyMcJFO/6C4yjJm/JQ72uYUMHlm 1K7S33aLbVxw3GYXMKJqBxCFg3HClbit9+En4dbnzAEyHjPVxUUGAztUnTBcNj5MvQTZ IqoF6Nh1Aj/7QSuI+OUIDUTD1XbM2BioeMPab61uMSkvngmOay15/4wupIPdZaXv9Ccg F4j7Hrf/U24T2NpEcJ8hjQpTSCCBU05dEHZ78nmD5V2rDgd+rBM4D1kSSyeEi5umrm8d 7hEZ/O1fbPEyTBy+d+YJIrptfxqHCNjQ78u4s3Nu5nVR6Bl8JvxOmpRvQfZOlidFT4+C Yenw== 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=4/KsPrgd/HLEbEQgoeiq5Dw3khCURgX6fkrAgH4SMoc=; b=ydnmfT7rB8xoFW4NEEy/5DKNFtswLesFlLJIpeVZFSjFphr6yUK3d6wwBtx2sYqvu+ 5k0uvyWTn9YDn6BJKEKS1CdmXbPr7dMnoA5h2HIpSyahHpzBSj5uosPxHtyEvWXTXPhJ r8do8xRBNyI9Jeq/s6PQUmkSydtJ2YZnE8bIfXCNLwTQmWFGA7sMmToBudRoBvMlqxqK hywNctrVIb2mZ3TKKzPRyvIveP3DghqsfPKSRSglTiMqLUnJQRPs+f9sx9CJvhsYTJSS TlIlN8gvxcdf6ODxB6llJFP11ko9qQTOUmKnqdXaWNwBVGAAJWg/tRH4JjVH9Uc3z8gC Iu+w== 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 f128-v6si16065147pfg.137.2018.08.14.10.28.18; Tue, 14 Aug 2018 10:28:33 -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 S2388496AbeHNUOl (ORCPT + 99 others); Tue, 14 Aug 2018 16:14:41 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:52028 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387947AbeHNUOl (ORCPT ); Tue, 14 Aug 2018 16:14:41 -0400 Received: from localhost (unknown [194.244.16.108]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 03AC2C5C; Tue, 14 Aug 2018 17:26:33 +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 Subject: [PATCH 4.18 54/79] cpu/hotplug: Set CPU_SMT_NOT_SUPPORTED early Date: Tue, 14 Aug 2018 19:17:13 +0200 Message-Id: <20180814171339.903052703@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: Thomas Gleixner 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: 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 @@ -59,6 +59,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 @@ -178,9 +178,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 @@ -361,6 +361,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")); @@ -2115,9 +2125,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); }