Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp4781759ooa; Tue, 14 Aug 2018 10:27:57 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzv65GAr4DZgLrdDjnh7Cec+mRaPu5rztuEn9MsOAGHFBVid2zc9MZUrHcBG+f9uIxvGmwv X-Received: by 2002:a62:8d84:: with SMTP id p4-v6mr24725118pfk.251.1534267677655; Tue, 14 Aug 2018 10:27:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534267677; cv=none; d=google.com; s=arc-20160816; b=TZhx4xNWcfumKMac2DuMybz/FwbMRrD64CSyDWEPEpttdIBYpmvktEZ4eH0AxmCfro VeTzjHANwtMMHJlyfvFpud+bKMjczPqt/CdGTVZqRu2gekvaOX5F5iR4OljhYexZ9bHL 3DrZnncelRaQ5FjYEtKkfi5PDePt9BD76mNGPSmDyvj7S0UipFgFxjEOf/nA6CJBICE2 gbtkj7JiVeCVX0R1tkdGb2SlZS6JUlbLimlXEAXQAfEG7I6lWTQMP4g8pm/wvJwqpcYf OV4v30ITO4ddxAVW5CRSUT0NsSboYHcFBYzqerzPjn9FQxy2ZhPdjIIEXpePIV9xILhi /BhQ== 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=w39g+ub2nwZRoLizGy1mRtXtGbEvavC0UaUNXYdz6q4=; b=FY1p15VvGSiPUYfwP0pjjS0EeSTpHVbsldiYEKefP0xSBOSmvpKl1Rbl0lW7x91/ek 0gj2+TwRTvfP6mCxmp/LRRUyndooc9+MOZzb+i00UHJC2v165WZPFd1JEMej3Om6AQS/ /bZl1wPSZDzGZhdWsyfeuJvMoxN42OirASU/BFoy+YWFkOhAtWxRAjBufRJh28OmrYtz j+GxF1Xjk0ae92TXhcaDHRYkJwpE+fqkKZKQB11tkoHoyaqsmY2CbZzczW0IdguqPlbd pRiZRVe7shibx+yMvfu6Mki5TBqby+i9l7i0nRC2ecMOJJqnl+BsQKN+ccsZNJs2LMEK dRfQ== 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 a140-v6si23025758pfd.35.2018.08.14.10.27.42; Tue, 14 Aug 2018 10:27:57 -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 S2388357AbeHNUOJ (ORCPT + 99 others); Tue, 14 Aug 2018 16:14:09 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:51878 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387440AbeHNUOJ (ORCPT ); Tue, 14 Aug 2018 16:14:09 -0400 Received: from localhost (unknown [194.244.16.108]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id CF65FD1D; Tue, 14 Aug 2018 17:26:02 +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.18 45/79] cpu/hotplug: Online siblings when SMT control is turned on Date: Tue, 14 Aug 2018 19:17:04 +0200 Message-Id: <20180814171338.612867224@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 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 @@ -1979,6 +1979,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; @@ -2011,11 +2020,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 @@ -2046,7 +2068,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: