Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp4794440ooa; Tue, 14 Aug 2018 10:38:29 -0700 (PDT) X-Google-Smtp-Source: AA+uWPx0mUrOE70AVhJg7w5PBSIRqjLnLIvx3CterGn55FI1kD4kBdcQ4FXfbO/80MCBmtKlhVcZ X-Received: by 2002:a17:902:778e:: with SMTP id o14-v6mr21211062pll.198.1534268309849; Tue, 14 Aug 2018 10:38:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534268309; cv=none; d=google.com; s=arc-20160816; b=VFhDna5lcRbXj6BlyBR8hUKfxu+OoLvpvzHNsjVV8NWAUSJZSSgwUq4dDWd7OVtz19 7h+tHZqgRuor5Dg26G2bgGPYH4W+OmtM6E47qHafZXzQ70rrcqKAn65hP/kWB8Ef3702 6zvlOp/i2/hDLgNwa4jc9Bef1ywBXGj+hbPy9suQi32a26p6VNRcPCGxv1smABcwsyDz nH+Hkrxv3UbNF+d+Pi/1+kiNeDED4Zc0Jhi2HQEekGaUeQ8stJNwOApW/xF+6QEvZ9iN IyoJpMi0WBfUl8D5DvvxMyW6WPXCNGJ8qnkCf3ghkRG97urKbrscDlR++CYvOG6SArgU K+yg== 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=+39TJSgo4BEJhAqn0qv4jNdu6wghTF0MrwVrTfnFND0=; b=rw2w16RbQpU//eVt+Hb//ELZnh5yJQBkWIUiG11tTpSqQ6w0nOmU6r7zBV0G5yElCt gwnLV9P5eyxd06oIyt9mcEHaGrQiaKDvNmIknA5h2ak/6FNb+HrYY2FDvJYZI9F3QrwO ImAkrxygtNANOTQsAVNwWkUivWiVcpahNqp/sY/ePiVteElIqYXN/dkW8z4KY+RqX8x7 1BNdMLt92r9K7TpjvRvZihr4e5NJ9xo/YSG1LcbNwefgmJXWiNYEiLh273qMJKNga4OV efYpI8w7X+tbiuquyx9H14Q+a43woi99WkxQem6FAByr5p+VC0Kc9LsuGhI4NqL5jmve CFPQ== 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 z127-v6si21814976pgb.455.2018.08.14.10.38.14; Tue, 14 Aug 2018 10:38:29 -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 S1731218AbeHNUYw (ORCPT + 99 others); Tue, 14 Aug 2018 16:24:52 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:57516 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730771AbeHNUYw (ORCPT ); Tue, 14 Aug 2018 16:24:52 -0400 Received: from localhost (unknown [194.244.16.108]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 88C2BDDE; Tue, 14 Aug 2018 17:36:42 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner Subject: [PATCH 4.14 066/104] cpu/hotplug: Online siblings when SMT control is turned on Date: Tue, 14 Aug 2018 19:17:20 +0200 Message-Id: <20180814171519.595515714@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: Thomas Gleixner commit 215af5499d9e2b55f111d2431ea20218115f29b3 upstream Writing 'off' to /sys/devices/system/cpu/smt/control offlines all SMT siblings. Writing 'on' merily enables the abilify to online them, but does not online them automatically. Make 'on' more useful by onlining all offline siblings. Signed-off-by: Thomas Gleixner Signed-off-by: Greg Kroah-Hartman --- kernel/cpu.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -1991,6 +1991,15 @@ static void cpuhp_offline_cpu_device(uns kobject_uevent(&dev->kobj, KOBJ_OFFLINE); } +static void cpuhp_online_cpu_device(unsigned int cpu) +{ + struct device *dev = get_cpu_device(cpu); + + dev->offline = false; + /* Tell user space about the state change */ + kobject_uevent(&dev->kobj, KOBJ_ONLINE); +} + static int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval) { int cpu, ret = 0; @@ -2023,11 +2032,24 @@ static int cpuhp_smt_disable(enum cpuhp_ return ret; } -static void cpuhp_smt_enable(void) +static int cpuhp_smt_enable(void) { + int cpu, ret = 0; + cpu_maps_update_begin(); cpu_smt_control = CPU_SMT_ENABLED; + for_each_present_cpu(cpu) { + /* Skip online CPUs and CPUs on offline nodes */ + if (cpu_online(cpu) || !node_online(cpu_to_node(cpu))) + continue; + ret = _cpu_up(cpu, 0, CPUHP_ONLINE); + if (ret) + break; + /* See comment in cpuhp_smt_disable() */ + cpuhp_online_cpu_device(cpu); + } cpu_maps_update_done(); + return ret; } static ssize_t @@ -2058,7 +2080,7 @@ store_smt_control(struct device *dev, st if (ctrlval != cpu_smt_control) { switch (ctrlval) { case CPU_SMT_ENABLED: - cpuhp_smt_enable(); + ret = cpuhp_smt_enable(); break; case CPU_SMT_DISABLED: case CPU_SMT_FORCE_DISABLED: