linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/38] Replace deprecated CPU-hotplug
@ 2021-08-03 14:15 Sebastian Andrzej Siewior
  2021-08-03 14:15 ` [PATCH 01/38] Documentation: Replace deprecated CPU-hotplug functions Sebastian Andrzej Siewior
                   ` (39 more replies)
  0 siblings, 40 replies; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Alexander Shishkin, Amit Kucheria,
	Andrew Morton, Andy Lutomirski, Arnaldo Carvalho de Melo,
	Arnd Bergmann, Benjamin Herrenschmidt, Ben Segall,
	Borislav Petkov, cgroups, Christian Borntraeger, coresight,
	Daniel Bristot de Oliveira, Daniel Jordan, Daniel Lezcano,
	Dave Hansen, Davidlohr Bueso, David S. Miller, Dietmar Eggemann,
	Gonglei, Greg Kroah-Hartman, Guenter Roeck, Hans de Goede,
	Heiko Carstens, Herbert Xu, H. Peter Anvin, Ingo Molnar,
	Ingo Molnar, Jakub Kicinski, Jason Wang, Jean Delvare,
	Jiri Kosina, Jiri Olsa, Joe Lawrence, Joel Fernandes,
	Johannes Weiner, John Stultz, Jonathan Corbet, Josh Poimboeuf,
	Josh Triplett, Julian Wiedmann, Juri Lelli, Karol Herbst,
	Karsten Graul, kvm-ppc, Lai Jiangshan, Len Brown, Len Brown,
	Leo Yan, linux-acpi, linux-arm-kernel, linux-crypto, linux-doc,
	linux-edac, linux-hwmon, linux-mips, linux-mm, linux-pm,
	linuxppc-dev, linux-raid, linux-s390, live-patching, Mark Gross,
	Mark Rutland, Mathieu Desnoyers, Mathieu Poirier, Mel Gorman,
	Michael Ellerman, Michael S. Tsirkin, Mike Leach, Mike Travis,
	Miroslav Benes, Namhyung Kim, netdev, nouveau, Paul E. McKenney,
	Paul Mackerras, Pavel Machek, Pekka Paalanen, Petr Mladek,
	platform-driver-x86, Rafael J. Wysocki, rcu, Robin Holt,
	Song Liu, Srinivas Pandruvada, Steffen Klassert, Stephen Boyd,
	Steven Rostedt, Steve Wahl, Stuart Hayes, Suzuki K Poulose,
	Tejun Heo, Thomas Bogendoerfer, Tony Luck, Vasily Gorbik,
	Vincent Guittot, Viresh Kumar, virtualization, x86, Zefan Li,
	Zhang Rui

This is a tree wide replacement of the deprecated CPU hotplug functions
which are only wrappers around the actual functions.

Each patch is independent and can be picked up by the relevant maintainer.

Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Amit Kucheria <amitk@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Ben Segall <bsegall@google.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: cgroups@vger.kernel.org
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: coresight@lists.linaro.org
Cc: Daniel Bristot de Oliveira <bristot@redhat.com>
Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Gonglei <arei.gonglei@huawei.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Jean Delvare <jdelvare@suse.com>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Joe Lawrence <joe.lawrence@redhat.com>
Cc: Joel Fernandes <joel@joelfernandes.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Julian Wiedmann <jwi@linux.ibm.com>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Karol Herbst <karolherbst@gmail.com>
Cc: Karsten Graul <kgraul@linux.ibm.com>
Cc: kvm-ppc@vger.kernel.org
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Len Brown <len.brown@intel.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: linux-acpi@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-crypto@vger.kernel.org
Cc: linux-doc@vger.kernel.org
Cc: linux-edac@vger.kernel.org
Cc: linux-hwmon@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@vger.kernel.org
Cc: linux-mm@kvack.org
Cc: linux-pm@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-raid@vger.kernel.org
Cc: linux-s390@vger.kernel.org
Cc: live-patching@vger.kernel.org
Cc: Mark Gross <mgross@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Mike Travis <mike.travis@hpe.com>
Cc: Miroslav Benes <mbenes@suse.cz>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: netdev@vger.kernel.org
Cc: nouveau@lists.freedesktop.org
Cc: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Pekka Paalanen <ppaalanen@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Petr Mladek <pmladek@suse.com>
Cc: platform-driver-x86@vger.kernel.org
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: rcu@vger.kernel.org
Cc: Robin Holt <robinmholt@gmail.com>
Cc: Song Liu <song@kernel.org>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Steve Wahl <steve.wahl@hpe.com>
Cc: Stuart Hayes <stuart.w.hayes@gmail.com>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: virtualization@lists.linux-foundation.org
Cc: x86@kernel.org
Cc: Zefan Li <lizefan.x@bytedance.com>
Cc: Zhang Rui <rui.zhang@intel.com>

Sebastian


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 01/38] Documentation: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
@ 2021-08-03 14:15 ` Sebastian Andrzej Siewior
  2021-08-27 23:53   ` [tip: smp/core] " tip-bot2 for Sebastian Andrzej Siewior
  2021-08-03 14:15 ` [PATCH 02/38] MIPS: " Sebastian Andrzej Siewior
                   ` (38 subsequent siblings)
  39 siblings, 1 reply; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior, Jonathan Corbet,
	Steven Rostedt, Ingo Molnar, linux-doc

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Update the documentation accordingly.

Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: linux-doc@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 Documentation/core-api/cpu_hotplug.rst | 2 +-
 Documentation/trace/ftrace.rst         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/core-api/cpu_hotplug.rst b/Documentation/core-api/cpu_hotplug.rst
index a2c96bec5ee8d..1122cd3044c0e 100644
--- a/Documentation/core-api/cpu_hotplug.rst
+++ b/Documentation/core-api/cpu_hotplug.rst
@@ -220,7 +220,7 @@ goes online (offline) and during initial setup (shutdown) of the driver. However
 each registration and removal function is also available with a ``_nocalls``
 suffix which does not invoke the provided callbacks if the invocation of the
 callbacks is not desired. During the manual setup (or teardown) the functions
-``get_online_cpus()`` and ``put_online_cpus()`` should be used to inhibit CPU
+``cpus_read_lock()`` and ``cpus_read_unlock()`` should be used to inhibit CPU
 hotplug operations.
 
 
diff --git a/Documentation/trace/ftrace.rst b/Documentation/trace/ftrace.rst
index cfc81e98e0b8a..4e5b26f03d5b1 100644
--- a/Documentation/trace/ftrace.rst
+++ b/Documentation/trace/ftrace.rst
@@ -2762,7 +2762,7 @@ A list of available functions that you can add to these files is
   put_prev_task_idle
   kmem_cache_create
   pick_next_task_rt
-  get_online_cpus
+  cpus_read_lock
   pick_next_task_fair
   mutex_lock
   [...]
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 02/38] MIPS: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
  2021-08-03 14:15 ` [PATCH 01/38] Documentation: Replace deprecated CPU-hotplug functions Sebastian Andrzej Siewior
@ 2021-08-03 14:15 ` Sebastian Andrzej Siewior
  2021-08-05  9:02   ` Thomas Bogendoerfer
  2021-08-03 14:15 ` [PATCH 03/38] powerpc: " Sebastian Andrzej Siewior
                   ` (37 subsequent siblings)
  39 siblings, 1 reply; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior,
	Thomas Bogendoerfer, linux-mips

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: linux-mips@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 arch/mips/kernel/mips-mt-fpaff.c | 10 +++++-----
 arch/mips/kernel/process.c       |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/mips/kernel/mips-mt-fpaff.c b/arch/mips/kernel/mips-mt-fpaff.c
index 6c590ef276482..67e130d3f0385 100644
--- a/arch/mips/kernel/mips-mt-fpaff.c
+++ b/arch/mips/kernel/mips-mt-fpaff.c
@@ -76,13 +76,13 @@ asmlinkage long mipsmt_sys_sched_setaffinity(pid_t pid, unsigned int len,
 	if (copy_from_user(&new_mask, user_mask_ptr, sizeof(new_mask)))
 		return -EFAULT;
 
-	get_online_cpus();
+	cpus_read_lock();
 	rcu_read_lock();
 
 	p = find_process_by_pid(pid);
 	if (!p) {
 		rcu_read_unlock();
-		put_online_cpus();
+		cpus_read_unlock();
 		return -ESRCH;
 	}
 
@@ -147,7 +147,7 @@ asmlinkage long mipsmt_sys_sched_setaffinity(pid_t pid, unsigned int len,
 	free_cpumask_var(cpus_allowed);
 out_put_task:
 	put_task_struct(p);
-	put_online_cpus();
+	cpus_read_unlock();
 	return retval;
 }
 
@@ -166,7 +166,7 @@ asmlinkage long mipsmt_sys_sched_getaffinity(pid_t pid, unsigned int len,
 	if (len < real_len)
 		return -EINVAL;
 
-	get_online_cpus();
+	cpus_read_lock();
 	rcu_read_lock();
 
 	retval = -ESRCH;
@@ -182,7 +182,7 @@ asmlinkage long mipsmt_sys_sched_getaffinity(pid_t pid, unsigned int len,
 
 out_unlock:
 	rcu_read_unlock();
-	put_online_cpus();
+	cpus_read_unlock();
 	if (retval)
 		return retval;
 	if (copy_to_user(user_mask_ptr, &mask, real_len))
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 73c8e7990a973..95aa86fa60778 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -859,10 +859,10 @@ int mips_set_process_fp_mode(struct task_struct *task, unsigned int value)
 	 * scheduled in then it will already have picked up the new FP mode
 	 * whilst doing so.
 	 */
-	get_online_cpus();
+	cpus_read_lock();
 	for_each_cpu_and(cpu, &process_cpus, cpu_online_mask)
 		work_on_cpu(cpu, prepare_for_fp_mode_switch, NULL);
-	put_online_cpus();
+	cpus_read_unlock();
 
 	return 0;
 }
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 03/38] powerpc: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
  2021-08-03 14:15 ` [PATCH 01/38] Documentation: Replace deprecated CPU-hotplug functions Sebastian Andrzej Siewior
  2021-08-03 14:15 ` [PATCH 02/38] MIPS: " Sebastian Andrzej Siewior
@ 2021-08-03 14:15 ` Sebastian Andrzej Siewior
  2021-08-03 14:15 ` [PATCH 04/38] s390: " Sebastian Andrzej Siewior
                   ` (36 subsequent siblings)
  39 siblings, 0 replies; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior,
	Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
	linuxppc-dev, kvm-ppc

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: kvm-ppc@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 arch/powerpc/kernel/rtasd.c               |  4 ++--
 arch/powerpc/kvm/book3s_hv_builtin.c      | 10 +++++-----
 arch/powerpc/platforms/powernv/idle.c     |  4 ++--
 arch/powerpc/platforms/powernv/opal-imc.c |  8 ++++----
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/arch/powerpc/kernel/rtasd.c b/arch/powerpc/kernel/rtasd.c
index 8561dfb33f241..32ee17753eb4a 100644
--- a/arch/powerpc/kernel/rtasd.c
+++ b/arch/powerpc/kernel/rtasd.c
@@ -429,7 +429,7 @@ static void rtas_event_scan(struct work_struct *w)
 
 	do_event_scan();
 
-	get_online_cpus();
+	cpus_read_lock();
 
 	/* raw_ OK because just using CPU as starting point. */
 	cpu = cpumask_next(raw_smp_processor_id(), cpu_online_mask);
@@ -451,7 +451,7 @@ static void rtas_event_scan(struct work_struct *w)
 	schedule_delayed_work_on(cpu, &event_scan_work,
 		__round_jiffies_relative(event_scan_delay, cpu));
 
-	put_online_cpus();
+	cpus_read_unlock();
 }
 
 #ifdef CONFIG_PPC64
diff --git a/arch/powerpc/kvm/book3s_hv_builtin.c b/arch/powerpc/kvm/book3s_hv_builtin.c
index be8ef1c5b1bfb..fcf4760a3a0ea 100644
--- a/arch/powerpc/kvm/book3s_hv_builtin.c
+++ b/arch/powerpc/kvm/book3s_hv_builtin.c
@@ -137,23 +137,23 @@ long int kvmppc_rm_h_confer(struct kvm_vcpu *vcpu, int target,
  * exist in the system. We use a counter of VMs to track this.
  *
  * One of the operations we need to block is onlining of secondaries, so we
- * protect hv_vm_count with get/put_online_cpus().
+ * protect hv_vm_count with cpus_read_lock/unlock().
  */
 static atomic_t hv_vm_count;
 
 void kvm_hv_vm_activated(void)
 {
-	get_online_cpus();
+	cpus_read_lock();
 	atomic_inc(&hv_vm_count);
-	put_online_cpus();
+	cpus_read_unlock();
 }
 EXPORT_SYMBOL_GPL(kvm_hv_vm_activated);
 
 void kvm_hv_vm_deactivated(void)
 {
-	get_online_cpus();
+	cpus_read_lock();
 	atomic_dec(&hv_vm_count);
-	put_online_cpus();
+	cpus_read_unlock();
 }
 EXPORT_SYMBOL_GPL(kvm_hv_vm_deactivated);
 
diff --git a/arch/powerpc/platforms/powernv/idle.c b/arch/powerpc/platforms/powernv/idle.c
index 528a7e0cf83aa..aa27689b832db 100644
--- a/arch/powerpc/platforms/powernv/idle.c
+++ b/arch/powerpc/platforms/powernv/idle.c
@@ -199,12 +199,12 @@ static ssize_t store_fastsleep_workaround_applyonce(struct device *dev,
 	 */
 	power7_fastsleep_workaround_exit = false;
 
-	get_online_cpus();
+	cpus_read_lock();
 	primary_thread_mask = cpu_online_cores_map();
 	on_each_cpu_mask(&primary_thread_mask,
 				pnv_fastsleep_workaround_apply,
 				&err, 1);
-	put_online_cpus();
+	cpus_read_unlock();
 	if (err) {
 		pr_err("fastsleep_workaround_applyonce change failed while running pnv_fastsleep_workaround_apply");
 		goto fail;
diff --git a/arch/powerpc/platforms/powernv/opal-imc.c b/arch/powerpc/platforms/powernv/opal-imc.c
index 7824cc364bc40..ba02a75c14102 100644
--- a/arch/powerpc/platforms/powernv/opal-imc.c
+++ b/arch/powerpc/platforms/powernv/opal-imc.c
@@ -186,7 +186,7 @@ static void disable_nest_pmu_counters(void)
 	int nid, cpu;
 	const struct cpumask *l_cpumask;
 
-	get_online_cpus();
+	cpus_read_lock();
 	for_each_node_with_cpus(nid) {
 		l_cpumask = cpumask_of_node(nid);
 		cpu = cpumask_first_and(l_cpumask, cpu_online_mask);
@@ -195,7 +195,7 @@ static void disable_nest_pmu_counters(void)
 		opal_imc_counters_stop(OPAL_IMC_COUNTERS_NEST,
 				       get_hard_smp_processor_id(cpu));
 	}
-	put_online_cpus();
+	cpus_read_unlock();
 }
 
 static void disable_core_pmu_counters(void)
@@ -203,7 +203,7 @@ static void disable_core_pmu_counters(void)
 	cpumask_t cores_map;
 	int cpu, rc;
 
-	get_online_cpus();
+	cpus_read_lock();
 	/* Disable the IMC Core functions */
 	cores_map = cpu_online_cores_map();
 	for_each_cpu(cpu, &cores_map) {
@@ -213,7 +213,7 @@ static void disable_core_pmu_counters(void)
 			pr_err("%s: Failed to stop Core (cpu = %d)\n",
 				__FUNCTION__, cpu);
 	}
-	put_online_cpus();
+	cpus_read_unlock();
 }
 
 int get_max_nest_dev(void)
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 04/38] s390: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (2 preceding siblings ...)
  2021-08-03 14:15 ` [PATCH 03/38] powerpc: " Sebastian Andrzej Siewior
@ 2021-08-03 14:15 ` Sebastian Andrzej Siewior
  2021-08-03 15:40   ` Heiko Carstens
  2021-08-03 14:15 ` [PATCH 05/38] s390/sclp: " Sebastian Andrzej Siewior
                   ` (35 subsequent siblings)
  39 siblings, 1 reply; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior, linux-s390,
	Heiko Carstens, Vasily Gorbik, Christian Borntraeger

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: linux-s390@vger.kernel.org
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 arch/s390/hypfs/hypfs_diag0c.c  | 10 +++++-----
 arch/s390/kernel/diag.c         |  4 ++--
 arch/s390/kernel/irq.c          |  4 ++--
 arch/s390/kernel/perf_cpum_cf.c |  4 ++--
 arch/s390/kernel/processor.c    |  4 ++--
 arch/s390/kernel/smp.c          |  8 ++++----
 arch/s390/kernel/topology.c     |  4 ++--
 arch/s390/mm/maccess.c          |  4 ++--
 8 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/arch/s390/hypfs/hypfs_diag0c.c b/arch/s390/hypfs/hypfs_diag0c.c
index 6c43d2ba20797..5cd3d8478ac18 100644
--- a/arch/s390/hypfs/hypfs_diag0c.c
+++ b/arch/s390/hypfs/hypfs_diag0c.c
@@ -33,12 +33,12 @@ static void *diag0c_store(unsigned int *count)
 	unsigned int cpu_count, cpu, i;
 	void **cpu_vec;
 
-	get_online_cpus();
+	cpus_read_lock();
 	cpu_count = num_online_cpus();
 	cpu_vec = kmalloc_array(num_possible_cpus(), sizeof(*cpu_vec),
 				GFP_KERNEL);
 	if (!cpu_vec)
-		goto fail_put_online_cpus;
+		goto fail_unlock_cpus;
 	/* Note: Diag 0c needs 8 byte alignment and real storage */
 	diag0c_data = kzalloc(struct_size(diag0c_data, entry, cpu_count),
 			      GFP_KERNEL | GFP_DMA);
@@ -54,13 +54,13 @@ static void *diag0c_store(unsigned int *count)
 	on_each_cpu(diag0c_fn, cpu_vec, 1);
 	*count = cpu_count;
 	kfree(cpu_vec);
-	put_online_cpus();
+	cpus_read_unlock();
 	return diag0c_data;
 
 fail_kfree_cpu_vec:
 	kfree(cpu_vec);
-fail_put_online_cpus:
-	put_online_cpus();
+fail_unlock_cpus:
+	cpus_read_unlock();
 	return ERR_PTR(-ENOMEM);
 }
 
diff --git a/arch/s390/kernel/diag.c b/arch/s390/kernel/diag.c
index a3f47464c3f17..4c2ac7ceef94a 100644
--- a/arch/s390/kernel/diag.c
+++ b/arch/s390/kernel/diag.c
@@ -59,7 +59,7 @@ static int show_diag_stat(struct seq_file *m, void *v)
 	unsigned long n = (unsigned long) v - 1;
 	int cpu, prec, tmp;
 
-	get_online_cpus();
+	cpus_read_lock();
 	if (n == 0) {
 		seq_puts(m, "         ");
 
@@ -78,7 +78,7 @@ static int show_diag_stat(struct seq_file *m, void *v)
 		}
 		seq_printf(m, "    %s\n", diag_map[n-1].name);
 	}
-	put_online_cpus();
+	cpus_read_unlock();
 	return 0;
 }
 
diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c
index 234d085257eb1..3a3145c4a3ba4 100644
--- a/arch/s390/kernel/irq.c
+++ b/arch/s390/kernel/irq.c
@@ -228,7 +228,7 @@ int show_interrupts(struct seq_file *p, void *v)
 	int index = *(loff_t *) v;
 	int cpu, irq;
 
-	get_online_cpus();
+	cpus_read_lock();
 	if (index == 0) {
 		seq_puts(p, "           ");
 		for_each_online_cpu(cpu)
@@ -258,7 +258,7 @@ int show_interrupts(struct seq_file *p, void *v)
 		seq_putc(p, '\n');
 	}
 out:
-	put_online_cpus();
+	cpus_read_unlock();
 	return 0;
 }
 
diff --git a/arch/s390/kernel/perf_cpum_cf.c b/arch/s390/kernel/perf_cpum_cf.c
index d7dc36ec0a60e..2e3bb633acf6c 100644
--- a/arch/s390/kernel/perf_cpum_cf.c
+++ b/arch/s390/kernel/perf_cpum_cf.c
@@ -1138,7 +1138,7 @@ static long cfset_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
 	int ret;
 
-	get_online_cpus();
+	cpus_read_lock();
 	mutex_lock(&cfset_ctrset_mutex);
 	switch (cmd) {
 	case S390_HWCTR_START:
@@ -1155,7 +1155,7 @@ static long cfset_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 		break;
 	}
 	mutex_unlock(&cfset_ctrset_mutex);
-	put_online_cpus();
+	cpus_read_unlock();
 	return ret;
 }
 
diff --git a/arch/s390/kernel/processor.c b/arch/s390/kernel/processor.c
index 82df39b17bb55..d8089a79b3f65 100644
--- a/arch/s390/kernel/processor.c
+++ b/arch/s390/kernel/processor.c
@@ -210,7 +210,7 @@ static inline void *c_update(loff_t *pos)
 
 static void *c_start(struct seq_file *m, loff_t *pos)
 {
-	get_online_cpus();
+	cpus_read_lock();
 	return c_update(pos);
 }
 
@@ -222,7 +222,7 @@ static void *c_next(struct seq_file *m, void *v, loff_t *pos)
 
 static void c_stop(struct seq_file *m, void *v)
 {
-	put_online_cpus();
+	cpus_read_unlock();
 }
 
 const struct seq_operations cpuinfo_op = {
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 8984711f72ede..b18cab79c370a 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -793,7 +793,7 @@ static int __smp_rescan_cpus(struct sclp_core_info *info, bool early)
 	u16 core_id;
 	int nr, i;
 
-	get_online_cpus();
+	cpus_read_lock();
 	mutex_lock(&smp_cpu_state_mutex);
 	nr = 0;
 	cpumask_xor(&avail, cpu_possible_mask, cpu_present_mask);
@@ -816,7 +816,7 @@ static int __smp_rescan_cpus(struct sclp_core_info *info, bool early)
 		nr += smp_add_core(&info->core[i], &avail, configured, early);
 	}
 	mutex_unlock(&smp_cpu_state_mutex);
-	put_online_cpus();
+	cpus_read_unlock();
 	return nr;
 }
 
@@ -1055,7 +1055,7 @@ static ssize_t cpu_configure_store(struct device *dev,
 		return -EINVAL;
 	if (val != 0 && val != 1)
 		return -EINVAL;
-	get_online_cpus();
+	cpus_read_lock();
 	mutex_lock(&smp_cpu_state_mutex);
 	rc = -EBUSY;
 	/* disallow configuration changes of online cpus and cpu 0 */
@@ -1104,7 +1104,7 @@ static ssize_t cpu_configure_store(struct device *dev,
 	}
 out:
 	mutex_unlock(&smp_cpu_state_mutex);
-	put_online_cpus();
+	cpus_read_unlock();
 	return rc ? rc : count;
 }
 static DEVICE_ATTR(configure, 0644, cpu_configure_show, cpu_configure_store);
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index 26aa2614ee352..d2458a29618fa 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -406,7 +406,7 @@ static ssize_t dispatching_store(struct device *dev,
 	if (val != 0 && val != 1)
 		return -EINVAL;
 	rc = 0;
-	get_online_cpus();
+	cpus_read_lock();
 	mutex_lock(&smp_cpu_state_mutex);
 	if (cpu_management == val)
 		goto out;
@@ -417,7 +417,7 @@ static ssize_t dispatching_store(struct device *dev,
 	topology_expect_change();
 out:
 	mutex_unlock(&smp_cpu_state_mutex);
-	put_online_cpus();
+	cpus_read_unlock();
 	return rc ? rc : count;
 }
 static DEVICE_ATTR_RW(dispatching);
diff --git a/arch/s390/mm/maccess.c b/arch/s390/mm/maccess.c
index a0f54bd5e98ab..9663ce3625bcd 100644
--- a/arch/s390/mm/maccess.c
+++ b/arch/s390/mm/maccess.c
@@ -228,7 +228,7 @@ void *xlate_dev_mem_ptr(phys_addr_t addr)
 	void *bounce = (void *) addr;
 	unsigned long size;
 
-	get_online_cpus();
+	cpus_read_lock();
 	preempt_disable();
 	if (is_swapped(addr)) {
 		size = PAGE_SIZE - (addr & ~PAGE_MASK);
@@ -237,7 +237,7 @@ void *xlate_dev_mem_ptr(phys_addr_t addr)
 			memcpy_absolute(bounce, (void *) addr, size);
 	}
 	preempt_enable();
-	put_online_cpus();
+	cpus_read_unlock();
 	return bounce;
 }
 
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 05/38] s390/sclp: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (3 preceding siblings ...)
  2021-08-03 14:15 ` [PATCH 04/38] s390: " Sebastian Andrzej Siewior
@ 2021-08-03 14:15 ` Sebastian Andrzej Siewior
  2021-08-03 15:40   ` Heiko Carstens
  2021-08-03 14:15 ` [PATCH 06/38] x86/mmiotrace: " Sebastian Andrzej Siewior
                   ` (34 subsequent siblings)
  39 siblings, 1 reply; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior, Heiko Carstens,
	Vasily Gorbik, Christian Borntraeger, linux-s390

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: linux-s390@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/s390/char/sclp_config.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/s390/char/sclp_config.c b/drivers/s390/char/sclp_config.c
index 039b2074db7e5..c365110f2daec 100644
--- a/drivers/s390/char/sclp_config.c
+++ b/drivers/s390/char/sclp_config.c
@@ -50,12 +50,12 @@ static void sclp_cpu_capability_notify(struct work_struct *work)
 
 	s390_update_cpu_mhz();
 	pr_info("CPU capability may have changed\n");
-	get_online_cpus();
+	cpus_read_lock();
 	for_each_online_cpu(cpu) {
 		dev = get_cpu_device(cpu);
 		kobject_uevent(&dev->kobj, KOBJ_CHANGE);
 	}
-	put_online_cpus();
+	cpus_read_unlock();
 }
 
 static void __ref sclp_cpu_change_notify(struct work_struct *work)
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 06/38] x86/mmiotrace: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (4 preceding siblings ...)
  2021-08-03 14:15 ` [PATCH 05/38] s390/sclp: " Sebastian Andrzej Siewior
@ 2021-08-03 14:15 ` Sebastian Andrzej Siewior
  2021-08-03 15:03   ` [Nouveau] " Karol Herbst
                     ` (2 more replies)
  2021-08-03 14:15 ` [PATCH 07/38] x86/mtrr: " Sebastian Andrzej Siewior
                   ` (33 subsequent siblings)
  39 siblings, 3 replies; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior, Steven Rostedt,
	Ingo Molnar, Karol Herbst, Pekka Paalanen, Dave Hansen,
	Andy Lutomirski, Borislav Petkov, x86, H. Peter Anvin, nouveau

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Karol Herbst <karolherbst@gmail.com>
Cc: Pekka Paalanen <ppaalanen@gmail.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Borislav Petkov <bp@alien8.de>
Cc: x86@kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: nouveau@lists.freedesktop.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 arch/x86/mm/mmio-mod.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c
index cd768dafca9e9..933a2ebad471b 100644
--- a/arch/x86/mm/mmio-mod.c
+++ b/arch/x86/mm/mmio-mod.c
@@ -376,12 +376,12 @@ static void enter_uniprocessor(void)
 		goto out;
 	}
 
-	get_online_cpus();
+	cpus_read_lock();
 	cpumask_copy(downed_cpus, cpu_online_mask);
 	cpumask_clear_cpu(cpumask_first(cpu_online_mask), downed_cpus);
 	if (num_online_cpus() > 1)
 		pr_notice("Disabling non-boot CPUs...\n");
-	put_online_cpus();
+	cpus_read_unlock();
 
 	for_each_cpu(cpu, downed_cpus) {
 		err = remove_cpu(cpu);
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 07/38] x86/mtrr: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (5 preceding siblings ...)
  2021-08-03 14:15 ` [PATCH 06/38] x86/mmiotrace: " Sebastian Andrzej Siewior
@ 2021-08-03 14:15 ` Sebastian Andrzej Siewior
  2021-08-10 12:52   ` [tip: x86/cleanups] " tip-bot2 for Sebastian Andrzej Siewior
  2021-08-03 14:15 ` [PATCH 08/38] x86/microcode: " Sebastian Andrzej Siewior
                   ` (32 subsequent siblings)
  39 siblings, 1 reply; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior, Ingo Molnar,
	Borislav Petkov, x86, H. Peter Anvin

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: x86@kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 arch/x86/kernel/cpu/mtrr/mtrr.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/cpu/mtrr/mtrr.c b/arch/x86/kernel/cpu/mtrr/mtrr.c
index a76694bffe86a..2746cac9d8a94 100644
--- a/arch/x86/kernel/cpu/mtrr/mtrr.c
+++ b/arch/x86/kernel/cpu/mtrr/mtrr.c
@@ -336,7 +336,7 @@ int mtrr_add_page(unsigned long base, unsigned long size,
 	replace = -1;
 
 	/* No CPU hotplug when we change MTRR entries */
-	get_online_cpus();
+	cpus_read_lock();
 
 	/* Search for existing MTRR  */
 	mutex_lock(&mtrr_mutex);
@@ -398,7 +398,7 @@ int mtrr_add_page(unsigned long base, unsigned long size,
 	error = i;
  out:
 	mutex_unlock(&mtrr_mutex);
-	put_online_cpus();
+	cpus_read_unlock();
 	return error;
 }
 
@@ -485,7 +485,7 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size)
 
 	max = num_var_ranges;
 	/* No CPU hotplug when we change MTRR entries */
-	get_online_cpus();
+	cpus_read_lock();
 	mutex_lock(&mtrr_mutex);
 	if (reg < 0) {
 		/*  Search for existing MTRR  */
@@ -520,7 +520,7 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size)
 	error = reg;
  out:
 	mutex_unlock(&mtrr_mutex);
-	put_online_cpus();
+	cpus_read_unlock();
 	return error;
 }
 
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 08/38] x86/microcode: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (6 preceding siblings ...)
  2021-08-03 14:15 ` [PATCH 07/38] x86/mtrr: " Sebastian Andrzej Siewior
@ 2021-08-03 14:15 ` Sebastian Andrzej Siewior
  2021-08-10 12:52   ` [tip: x86/cleanups] " tip-bot2 for Sebastian Andrzej Siewior
  2021-08-03 14:15 ` [PATCH 09/38] x86/mce/inject: " Sebastian Andrzej Siewior
                   ` (31 subsequent siblings)
  39 siblings, 1 reply; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior, Borislav Petkov,
	Ingo Molnar, x86, H. Peter Anvin

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: Borislav Petkov <bp@alien8.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: x86@kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 arch/x86/kernel/cpu/microcode/core.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index 6a6318e9590c8..efb69be41ab18 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -55,7 +55,7 @@ LIST_HEAD(microcode_cache);
  * All non cpu-hotplug-callback call sites use:
  *
  * - microcode_mutex to synchronize with each other;
- * - get/put_online_cpus() to synchronize with
+ * - cpus_read_lock/unlock() to synchronize with
  *   the cpu-hotplug-callback call sites.
  *
  * We guarantee that only a single cpu is being
@@ -431,7 +431,7 @@ static ssize_t microcode_write(struct file *file, const char __user *buf,
 		return ret;
 	}
 
-	get_online_cpus();
+	cpus_read_lock();
 	mutex_lock(&microcode_mutex);
 
 	if (do_microcode_update(buf, len) == 0)
@@ -441,7 +441,7 @@ static ssize_t microcode_write(struct file *file, const char __user *buf,
 		perf_check_microcode();
 
 	mutex_unlock(&microcode_mutex);
-	put_online_cpus();
+	cpus_read_unlock();
 
 	return ret;
 }
@@ -629,7 +629,7 @@ static ssize_t reload_store(struct device *dev,
 	if (val != 1)
 		return size;
 
-	get_online_cpus();
+	cpus_read_lock();
 
 	ret = check_online_cpus();
 	if (ret)
@@ -644,7 +644,7 @@ static ssize_t reload_store(struct device *dev,
 	mutex_unlock(&microcode_mutex);
 
 put:
-	put_online_cpus();
+	cpus_read_unlock();
 
 	if (ret == 0)
 		ret = size;
@@ -853,14 +853,14 @@ static int __init microcode_init(void)
 	if (IS_ERR(microcode_pdev))
 		return PTR_ERR(microcode_pdev);
 
-	get_online_cpus();
+	cpus_read_lock();
 	mutex_lock(&microcode_mutex);
 
 	error = subsys_interface_register(&mc_cpu_interface);
 	if (!error)
 		perf_check_microcode();
 	mutex_unlock(&microcode_mutex);
-	put_online_cpus();
+	cpus_read_unlock();
 
 	if (error)
 		goto out_pdev;
@@ -892,13 +892,13 @@ static int __init microcode_init(void)
 			   &cpu_root_microcode_group);
 
  out_driver:
-	get_online_cpus();
+	cpus_read_lock();
 	mutex_lock(&microcode_mutex);
 
 	subsys_interface_unregister(&mc_cpu_interface);
 
 	mutex_unlock(&microcode_mutex);
-	put_online_cpus();
+	cpus_read_unlock();
 
  out_pdev:
 	platform_device_unregister(microcode_pdev);
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 09/38] x86/mce/inject: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (7 preceding siblings ...)
  2021-08-03 14:15 ` [PATCH 08/38] x86/microcode: " Sebastian Andrzej Siewior
@ 2021-08-03 14:15 ` Sebastian Andrzej Siewior
  2021-08-10 12:52   ` [tip: x86/cleanups] " tip-bot2 for Sebastian Andrzej Siewior
  2021-08-03 14:15 ` [PATCH 10/38] perf/x86/intel: " Sebastian Andrzej Siewior
                   ` (30 subsequent siblings)
  39 siblings, 1 reply; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior, Tony Luck,
	Borislav Petkov, Ingo Molnar, x86, H. Peter Anvin, linux-edac

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: Tony Luck <tony.luck@intel.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: x86@kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: linux-edac@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 arch/x86/kernel/cpu/mce/inject.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/cpu/mce/inject.c b/arch/x86/kernel/cpu/mce/inject.c
index 4e86d97f96530..0bfc14041bbb4 100644
--- a/arch/x86/kernel/cpu/mce/inject.c
+++ b/arch/x86/kernel/cpu/mce/inject.c
@@ -235,7 +235,7 @@ static void __maybe_unused raise_mce(struct mce *m)
 		unsigned long start;
 		int cpu;
 
-		get_online_cpus();
+		cpus_read_lock();
 		cpumask_copy(mce_inject_cpumask, cpu_online_mask);
 		cpumask_clear_cpu(get_cpu(), mce_inject_cpumask);
 		for_each_online_cpu(cpu) {
@@ -269,7 +269,7 @@ static void __maybe_unused raise_mce(struct mce *m)
 		}
 		raise_local();
 		put_cpu();
-		put_online_cpus();
+		cpus_read_unlock();
 	} else {
 		preempt_disable();
 		raise_local();
@@ -529,7 +529,7 @@ static void do_inject(void)
 		cpu = get_nbc_for_node(topology_die_id(cpu));
 	}
 
-	get_online_cpus();
+	cpus_read_lock();
 	if (!cpu_online(cpu))
 		goto err;
 
@@ -553,7 +553,7 @@ static void do_inject(void)
 	}
 
 err:
-	put_online_cpus();
+	cpus_read_unlock();
 
 }
 
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 10/38] perf/x86/intel: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (8 preceding siblings ...)
  2021-08-03 14:15 ` [PATCH 09/38] x86/mce/inject: " Sebastian Andrzej Siewior
@ 2021-08-03 14:15 ` Sebastian Andrzej Siewior
  2021-08-10 13:04   ` [tip: perf/core] " tip-bot2 for Sebastian Andrzej Siewior
  2021-08-26  8:09   ` tip-bot2 for Sebastian Andrzej Siewior
  2021-08-03 14:15 ` [PATCH 11/38] perf/hw_breakpoint: " Sebastian Andrzej Siewior
                   ` (29 subsequent siblings)
  39 siblings, 2 replies; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Borislav Petkov, x86, H. Peter Anvin

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Borislav Petkov <bp@alien8.de>
Cc: x86@kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 arch/x86/events/intel/core.c | 8 ++++----
 arch/x86/events/intel/pt.c   | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index fca7a6e2242fe..a7b04c8ae4f69 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -5026,9 +5026,9 @@ static ssize_t freeze_on_smi_store(struct device *cdev,
 
 	x86_pmu.attr_freeze_on_smi = val;
 
-	get_online_cpus();
+	cpus_read_lock();
 	on_each_cpu(flip_smm_bit, &val, 1);
-	put_online_cpus();
+	cpus_read_unlock();
 done:
 	mutex_unlock(&freeze_on_smi_mutex);
 
@@ -5071,9 +5071,9 @@ static ssize_t set_sysctl_tfa(struct device *cdev,
 
 	allow_tsx_force_abort = val;
 
-	get_online_cpus();
+	cpus_read_lock();
 	on_each_cpu(update_tfa_sched, NULL, 1);
-	put_online_cpus();
+	cpus_read_unlock();
 
 	return count;
 }
diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c
index 915847655c065..0369a238cdfb1 100644
--- a/arch/x86/events/intel/pt.c
+++ b/arch/x86/events/intel/pt.c
@@ -1708,7 +1708,7 @@ static __init int pt_init(void)
 	if (!boot_cpu_has(X86_FEATURE_INTEL_PT))
 		return -ENODEV;
 
-	get_online_cpus();
+	cpus_read_lock();
 	for_each_online_cpu(cpu) {
 		u64 ctl;
 
@@ -1716,7 +1716,7 @@ static __init int pt_init(void)
 		if (!ret && (ctl & RTIT_CTL_TRACEEN))
 			prior_warn++;
 	}
-	put_online_cpus();
+	cpus_read_unlock();
 
 	if (prior_warn) {
 		x86_add_exclusive(x86_lbr_exclusive_pt);
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 11/38] perf/hw_breakpoint: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (9 preceding siblings ...)
  2021-08-03 14:15 ` [PATCH 10/38] perf/x86/intel: " Sebastian Andrzej Siewior
@ 2021-08-03 14:15 ` Sebastian Andrzej Siewior
  2021-08-10 13:04   ` [tip: perf/core] " tip-bot2 for Sebastian Andrzej Siewior
  2021-08-26  8:09   ` tip-bot2 for Sebastian Andrzej Siewior
  2021-08-03 14:15 ` [PATCH 12/38] crypto: virtio: " Sebastian Andrzej Siewior
                   ` (28 subsequent siblings)
  39 siblings, 2 replies; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 kernel/events/hw_breakpoint.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c
index 835973444a1e7..f32320ac02fd8 100644
--- a/kernel/events/hw_breakpoint.c
+++ b/kernel/events/hw_breakpoint.c
@@ -568,7 +568,7 @@ register_wide_hw_breakpoint(struct perf_event_attr *attr,
 	if (!cpu_events)
 		return (void __percpu __force *)ERR_PTR(-ENOMEM);
 
-	get_online_cpus();
+	cpus_read_lock();
 	for_each_online_cpu(cpu) {
 		bp = perf_event_create_kernel_counter(attr, cpu, NULL,
 						      triggered, context);
@@ -579,7 +579,7 @@ register_wide_hw_breakpoint(struct perf_event_attr *attr,
 
 		per_cpu(*cpu_events, cpu) = bp;
 	}
-	put_online_cpus();
+	cpus_read_unlock();
 
 	if (likely(!err))
 		return cpu_events;
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 12/38] crypto: virtio: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (10 preceding siblings ...)
  2021-08-03 14:15 ` [PATCH 11/38] perf/hw_breakpoint: " Sebastian Andrzej Siewior
@ 2021-08-03 14:15 ` Sebastian Andrzej Siewior
  2021-08-12 11:36   ` Herbert Xu
  2021-08-03 14:15 ` [PATCH 13/38] hwmon: " Sebastian Andrzej Siewior
                   ` (27 subsequent siblings)
  39 siblings, 1 reply; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior, Gonglei,
	Michael S. Tsirkin, Jason Wang, Herbert Xu, David S. Miller,
	virtualization, linux-crypto

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: Gonglei <arei.gonglei@huawei.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: virtualization@lists.linux-foundation.org
Cc: linux-crypto@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/crypto/virtio/virtio_crypto_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/virtio/virtio_crypto_core.c b/drivers/crypto/virtio/virtio_crypto_core.c
index 080955a1dd9c0..e2375d9923087 100644
--- a/drivers/crypto/virtio/virtio_crypto_core.c
+++ b/drivers/crypto/virtio/virtio_crypto_core.c
@@ -187,9 +187,9 @@ static int virtcrypto_init_vqs(struct virtio_crypto *vi)
 	if (ret)
 		goto err_free;
 
-	get_online_cpus();
+	cpus_read_lock();
 	virtcrypto_set_affinity(vi);
-	put_online_cpus();
+	cpus_read_unlock();
 
 	return 0;
 
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 13/38] hwmon: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (11 preceding siblings ...)
  2021-08-03 14:15 ` [PATCH 12/38] crypto: virtio: " Sebastian Andrzej Siewior
@ 2021-08-03 14:15 ` Sebastian Andrzej Siewior
  2021-08-03 15:29   ` Guenter Roeck
  2021-08-03 14:15 ` [PATCH 14/38] coresight: " Sebastian Andrzej Siewior
                   ` (26 subsequent siblings)
  39 siblings, 1 reply; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior, Jean Delvare,
	Guenter Roeck, linux-hwmon

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: Jean Delvare <jdelvare@suse.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/hwmon/dell-smm-hwmon.c | 4 ++--
 drivers/hwmon/fam15h_power.c   | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c
index f2221ca0aa7be..c3600266e0e91 100644
--- a/drivers/hwmon/dell-smm-hwmon.c
+++ b/drivers/hwmon/dell-smm-hwmon.c
@@ -228,9 +228,9 @@ static int i8k_smm(struct smm_regs *regs)
 {
 	int ret;
 
-	get_online_cpus();
+	cpus_read_lock();
 	ret = smp_call_on_cpu(0, i8k_smm_func, regs, true);
-	put_online_cpus();
+	cpus_read_unlock();
 
 	return ret;
 }
diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c
index 29f5fed28c2a7..521534d5c1e5f 100644
--- a/drivers/hwmon/fam15h_power.c
+++ b/drivers/hwmon/fam15h_power.c
@@ -166,7 +166,7 @@ static int read_registers(struct fam15h_power_data *data)
 
 	memset(data->cu_on, 0, sizeof(int) * MAX_CUS);
 
-	get_online_cpus();
+	cpus_read_lock();
 
 	/*
 	 * Choose the first online core of each compute unit, and then
@@ -190,7 +190,7 @@ static int read_registers(struct fam15h_power_data *data)
 
 	on_each_cpu_mask(mask, do_read_registers_on_cu, data, true);
 
-	put_online_cpus();
+	cpus_read_unlock();
 	free_cpumask_var(mask);
 
 	return 0;
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 14/38] coresight: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (12 preceding siblings ...)
  2021-08-03 14:15 ` [PATCH 13/38] hwmon: " Sebastian Andrzej Siewior
@ 2021-08-03 14:15 ` Sebastian Andrzej Siewior
  2021-08-03 15:52   ` Mathieu Poirier
  2021-08-03 14:15 ` [PATCH 15/38] md/raid5: " Sebastian Andrzej Siewior
                   ` (25 subsequent siblings)
  39 siblings, 1 reply; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior, Mathieu Poirier,
	Suzuki K Poulose, Mike Leach, Leo Yan, Alexander Shishkin,
	coresight, linux-arm-kernel

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: coresight@lists.linaro.org
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/hwtracing/coresight/coresight-cpu-debug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-cpu-debug.c b/drivers/hwtracing/coresight/coresight-cpu-debug.c
index 9731d3a960735..00de46565bc40 100644
--- a/drivers/hwtracing/coresight/coresight-cpu-debug.c
+++ b/drivers/hwtracing/coresight/coresight-cpu-debug.c
@@ -588,11 +588,11 @@ static int debug_probe(struct amba_device *adev, const struct amba_id *id)
 
 	drvdata->base = base;
 
-	get_online_cpus();
+	cpus_read_lock();
 	per_cpu(debug_drvdata, drvdata->cpu) = drvdata;
 	ret = smp_call_function_single(drvdata->cpu, debug_init_arch_data,
 				       drvdata, 1);
-	put_online_cpus();
+	cpus_read_unlock();
 
 	if (ret) {
 		dev_err(dev, "CPU%d debug arch init failed\n", drvdata->cpu);
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 15/38] md/raid5: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (13 preceding siblings ...)
  2021-08-03 14:15 ` [PATCH 14/38] coresight: " Sebastian Andrzej Siewior
@ 2021-08-03 14:15 ` Sebastian Andrzej Siewior
  2021-08-05 16:20   ` Song Liu
  2021-08-27 23:53   ` [tip: smp/core] " tip-bot2 for Sebastian Andrzej Siewior
  2021-08-03 14:15 ` [PATCH 16/38] sgi-xpc: " Sebastian Andrzej Siewior
                   ` (24 subsequent siblings)
  39 siblings, 2 replies; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior, Song Liu, linux-raid

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: Song Liu <song@kernel.org>
Cc: linux-raid@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/md/raid5.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index b8436e4930ed8..02ed53b20654c 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -2437,7 +2437,7 @@ static int resize_chunks(struct r5conf *conf, int new_disks, int new_sectors)
 	    conf->scribble_sectors >= new_sectors)
 		return 0;
 	mddev_suspend(conf->mddev);
-	get_online_cpus();
+	cpus_read_lock();
 
 	for_each_present_cpu(cpu) {
 		struct raid5_percpu *percpu;
@@ -2449,7 +2449,7 @@ static int resize_chunks(struct r5conf *conf, int new_disks, int new_sectors)
 			break;
 	}
 
-	put_online_cpus();
+	cpus_read_unlock();
 	mddev_resume(conf->mddev);
 	if (!err) {
 		conf->scribble_disks = new_disks;
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 16/38] sgi-xpc: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (14 preceding siblings ...)
  2021-08-03 14:15 ` [PATCH 15/38] md/raid5: " Sebastian Andrzej Siewior
@ 2021-08-03 14:15 ` Sebastian Andrzej Siewior
  2021-08-03 15:54   ` Steve Wahl
  2021-08-03 21:30   ` Robin Holt
  2021-08-03 14:16 ` [PATCH 17/38] platform/x86: " Sebastian Andrzej Siewior
                   ` (23 subsequent siblings)
  39 siblings, 2 replies; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior, Robin Holt,
	Steve Wahl, Mike Travis, Arnd Bergmann, Greg Kroah-Hartman

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: Robin Holt <robinmholt@gmail.com>
Cc: Steve Wahl <steve.wahl@hpe.com>
Cc: Mike Travis <mike.travis@hpe.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/misc/sgi-xp/xpc_uv.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c
index 7791bde81a368..ba9ae0e2df0fe 100644
--- a/drivers/misc/sgi-xp/xpc_uv.c
+++ b/drivers/misc/sgi-xp/xpc_uv.c
@@ -1742,7 +1742,7 @@ xpc_init_mq_node(int nid)
 {
 	int cpu;
 
-	get_online_cpus();
+	cpus_read_lock();
 
 	for_each_cpu(cpu, cpumask_of_node(nid)) {
 		xpc_activate_mq_uv =
@@ -1753,7 +1753,7 @@ xpc_init_mq_node(int nid)
 			break;
 	}
 	if (IS_ERR(xpc_activate_mq_uv)) {
-		put_online_cpus();
+		cpus_read_unlock();
 		return PTR_ERR(xpc_activate_mq_uv);
 	}
 
@@ -1767,11 +1767,11 @@ xpc_init_mq_node(int nid)
 	}
 	if (IS_ERR(xpc_notify_mq_uv)) {
 		xpc_destroy_gru_mq_uv(xpc_activate_mq_uv);
-		put_online_cpus();
+		cpus_read_unlock();
 		return PTR_ERR(xpc_notify_mq_uv);
 	}
 
-	put_online_cpus();
+	cpus_read_unlock();
 	return 0;
 }
 
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 17/38] platform/x86: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (15 preceding siblings ...)
  2021-08-03 14:15 ` [PATCH 16/38] sgi-xpc: " Sebastian Andrzej Siewior
@ 2021-08-03 14:16 ` Sebastian Andrzej Siewior
  2021-08-06 13:36   ` Hans de Goede
  2021-08-03 14:16 ` [PATCH 18/38] powercap: intel_rapl: " Sebastian Andrzej Siewior
                   ` (22 subsequent siblings)
  39 siblings, 1 reply; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior, Stuart Hayes,
	Hans de Goede, Mark Gross, platform-driver-x86

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: Stuart Hayes <stuart.w.hayes@gmail.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Mark Gross <mgross@linux.intel.com>
Cc: platform-driver-x86@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/platform/x86/dell/dcdbas.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/dell/dcdbas.c b/drivers/platform/x86/dell/dcdbas.c
index 28447c180be88..5e63d62250481 100644
--- a/drivers/platform/x86/dell/dcdbas.c
+++ b/drivers/platform/x86/dell/dcdbas.c
@@ -278,9 +278,9 @@ int dcdbas_smi_request(struct smi_cmd *smi_cmd)
 	}
 
 	/* SMI requires CPU 0 */
-	get_online_cpus();
+	cpus_read_lock();
 	ret = smp_call_on_cpu(0, raise_smi, smi_cmd, true);
-	put_online_cpus();
+	cpus_read_unlock();
 
 	return ret;
 }
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 18/38] powercap: intel_rapl: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (16 preceding siblings ...)
  2021-08-03 14:16 ` [PATCH 17/38] platform/x86: " Sebastian Andrzej Siewior
@ 2021-08-03 14:16 ` Sebastian Andrzej Siewior
  2021-08-04 18:14   ` Rafael J. Wysocki
  2021-08-03 14:16 ` [PATCH 19/38] thermal: " Sebastian Andrzej Siewior
                   ` (21 subsequent siblings)
  39 siblings, 1 reply; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior,
	Rafael J. Wysocki, linux-pm

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: linux-pm@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/powercap/intel_rapl_common.c | 50 ++++++++++++++--------------
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/drivers/powercap/intel_rapl_common.c b/drivers/powercap/intel_rapl_common.c
index 73cf68af97700..7c0099e7a6d72 100644
--- a/drivers/powercap/intel_rapl_common.c
+++ b/drivers/powercap/intel_rapl_common.c
@@ -158,16 +158,16 @@ static int get_energy_counter(struct powercap_zone *power_zone,
 	/* prevent CPU hotplug, make sure the RAPL domain does not go
 	 * away while reading the counter.
 	 */
-	get_online_cpus();
+	cpus_read_lock();
 	rd = power_zone_to_rapl_domain(power_zone);
 
 	if (!rapl_read_data_raw(rd, ENERGY_COUNTER, true, &energy_now)) {
 		*energy_raw = energy_now;
-		put_online_cpus();
+		cpus_read_unlock();
 
 		return 0;
 	}
-	put_online_cpus();
+	cpus_read_unlock();
 
 	return -EIO;
 }
@@ -216,11 +216,11 @@ static int set_domain_enable(struct powercap_zone *power_zone, bool mode)
 	if (rd->state & DOMAIN_STATE_BIOS_LOCKED)
 		return -EACCES;
 
-	get_online_cpus();
+	cpus_read_lock();
 	rapl_write_data_raw(rd, PL1_ENABLE, mode);
 	if (rapl_defaults->set_floor_freq)
 		rapl_defaults->set_floor_freq(rd, mode);
-	put_online_cpus();
+	cpus_read_unlock();
 
 	return 0;
 }
@@ -234,13 +234,13 @@ static int get_domain_enable(struct powercap_zone *power_zone, bool *mode)
 		*mode = false;
 		return 0;
 	}
-	get_online_cpus();
+	cpus_read_lock();
 	if (rapl_read_data_raw(rd, PL1_ENABLE, true, &val)) {
-		put_online_cpus();
+		cpus_read_unlock();
 		return -EIO;
 	}
 	*mode = val;
-	put_online_cpus();
+	cpus_read_unlock();
 
 	return 0;
 }
@@ -317,7 +317,7 @@ static int set_power_limit(struct powercap_zone *power_zone, int cid,
 	int ret = 0;
 	int id;
 
-	get_online_cpus();
+	cpus_read_lock();
 	rd = power_zone_to_rapl_domain(power_zone);
 	id = contraint_to_pl(rd, cid);
 	if (id < 0) {
@@ -350,7 +350,7 @@ static int set_power_limit(struct powercap_zone *power_zone, int cid,
 	if (!ret)
 		package_power_limit_irq_save(rp);
 set_exit:
-	put_online_cpus();
+	cpus_read_unlock();
 	return ret;
 }
 
@@ -363,7 +363,7 @@ static int get_current_power_limit(struct powercap_zone *power_zone, int cid,
 	int ret = 0;
 	int id;
 
-	get_online_cpus();
+	cpus_read_lock();
 	rd = power_zone_to_rapl_domain(power_zone);
 	id = contraint_to_pl(rd, cid);
 	if (id < 0) {
@@ -382,7 +382,7 @@ static int get_current_power_limit(struct powercap_zone *power_zone, int cid,
 		prim = POWER_LIMIT4;
 		break;
 	default:
-		put_online_cpus();
+		cpus_read_unlock();
 		return -EINVAL;
 	}
 	if (rapl_read_data_raw(rd, prim, true, &val))
@@ -391,7 +391,7 @@ static int get_current_power_limit(struct powercap_zone *power_zone, int cid,
 		*data = val;
 
 get_exit:
-	put_online_cpus();
+	cpus_read_unlock();
 
 	return ret;
 }
@@ -403,7 +403,7 @@ static int set_time_window(struct powercap_zone *power_zone, int cid,
 	int ret = 0;
 	int id;
 
-	get_online_cpus();
+	cpus_read_lock();
 	rd = power_zone_to_rapl_domain(power_zone);
 	id = contraint_to_pl(rd, cid);
 	if (id < 0) {
@@ -423,7 +423,7 @@ static int set_time_window(struct powercap_zone *power_zone, int cid,
 	}
 
 set_time_exit:
-	put_online_cpus();
+	cpus_read_unlock();
 	return ret;
 }
 
@@ -435,7 +435,7 @@ static int get_time_window(struct powercap_zone *power_zone, int cid,
 	int ret = 0;
 	int id;
 
-	get_online_cpus();
+	cpus_read_lock();
 	rd = power_zone_to_rapl_domain(power_zone);
 	id = contraint_to_pl(rd, cid);
 	if (id < 0) {
@@ -458,14 +458,14 @@ static int get_time_window(struct powercap_zone *power_zone, int cid,
 		val = 0;
 		break;
 	default:
-		put_online_cpus();
+		cpus_read_unlock();
 		return -EINVAL;
 	}
 	if (!ret)
 		*data = val;
 
 get_time_exit:
-	put_online_cpus();
+	cpus_read_unlock();
 
 	return ret;
 }
@@ -491,7 +491,7 @@ static int get_max_power(struct powercap_zone *power_zone, int id, u64 *data)
 	int prim;
 	int ret = 0;
 
-	get_online_cpus();
+	cpus_read_lock();
 	rd = power_zone_to_rapl_domain(power_zone);
 	switch (rd->rpl[id].prim_id) {
 	case PL1_ENABLE:
@@ -504,7 +504,7 @@ static int get_max_power(struct powercap_zone *power_zone, int id, u64 *data)
 		prim = MAX_POWER;
 		break;
 	default:
-		put_online_cpus();
+		cpus_read_unlock();
 		return -EINVAL;
 	}
 	if (rapl_read_data_raw(rd, prim, true, &val))
@@ -516,7 +516,7 @@ static int get_max_power(struct powercap_zone *power_zone, int id, u64 *data)
 	if (rd->rpl[id].prim_id == PL4_ENABLE)
 		*data = *data * 2;
 
-	put_online_cpus();
+	cpus_read_unlock();
 
 	return ret;
 }
@@ -1358,7 +1358,7 @@ static void power_limit_state_save(void)
 	struct rapl_domain *rd;
 	int nr_pl, ret, i;
 
-	get_online_cpus();
+	cpus_read_lock();
 	list_for_each_entry(rp, &rapl_packages, plist) {
 		if (!rp->power_zone)
 			continue;
@@ -1390,7 +1390,7 @@ static void power_limit_state_save(void)
 			}
 		}
 	}
-	put_online_cpus();
+	cpus_read_unlock();
 }
 
 static void power_limit_state_restore(void)
@@ -1399,7 +1399,7 @@ static void power_limit_state_restore(void)
 	struct rapl_domain *rd;
 	int nr_pl, i;
 
-	get_online_cpus();
+	cpus_read_lock();
 	list_for_each_entry(rp, &rapl_packages, plist) {
 		if (!rp->power_zone)
 			continue;
@@ -1425,7 +1425,7 @@ static void power_limit_state_restore(void)
 			}
 		}
 	}
-	put_online_cpus();
+	cpus_read_unlock();
 }
 
 static int rapl_pm_callback(struct notifier_block *nb,
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 19/38] thermal: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (17 preceding siblings ...)
  2021-08-03 14:16 ` [PATCH 18/38] powercap: intel_rapl: " Sebastian Andrzej Siewior
@ 2021-08-03 14:16 ` Sebastian Andrzej Siewior
  2021-08-14 10:52   ` Daniel Lezcano
  2021-09-10 22:45   ` [tip: smp/urgent] " tip-bot2 for Sebastian Andrzej Siewior
  2021-08-03 14:16 ` [PATCH 20/38] mm: " Sebastian Andrzej Siewior
                   ` (20 subsequent siblings)
  39 siblings, 2 replies; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior, Zhang Rui,
	Daniel Lezcano, Amit Kucheria, linux-pm

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Amit Kucheria <amitk@kernel.org>
Cc: linux-pm@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/thermal/intel/intel_powerclamp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/thermal/intel/intel_powerclamp.c b/drivers/thermal/intel/intel_powerclamp.c
index b0eb5ece9243b..a5b58ea89cc6d 100644
--- a/drivers/thermal/intel/intel_powerclamp.c
+++ b/drivers/thermal/intel/intel_powerclamp.c
@@ -528,7 +528,7 @@ static int start_power_clamp(void)
 
 	set_target_ratio = clamp(set_target_ratio, 0U, MAX_TARGET_RATIO - 1);
 	/* prevent cpu hotplug */
-	get_online_cpus();
+	cpus_read_lock();
 
 	/* prefer BSP */
 	control_cpu = 0;
@@ -542,7 +542,7 @@ static int start_power_clamp(void)
 	for_each_online_cpu(cpu) {
 		start_power_clamp_worker(cpu);
 	}
-	put_online_cpus();
+	cpus_read_unlock();
 
 	return 0;
 }
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 20/38] mm: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (18 preceding siblings ...)
  2021-08-03 14:16 ` [PATCH 19/38] thermal: " Sebastian Andrzej Siewior
@ 2021-08-03 14:16 ` Sebastian Andrzej Siewior
  2021-08-27 23:53   ` [tip: smp/core] " tip-bot2 for Sebastian Andrzej Siewior
  2021-08-03 14:16 ` [PATCH 21/38] virtio_net: " Sebastian Andrzej Siewior
                   ` (19 subsequent siblings)
  39 siblings, 1 reply; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior, Andrew Morton, linux-mm

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 mm/swap_slots.c |  4 ++--
 mm/vmstat.c     | 12 ++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/mm/swap_slots.c b/mm/swap_slots.c
index a66f3e0ec9733..16f706c55d925 100644
--- a/mm/swap_slots.c
+++ b/mm/swap_slots.c
@@ -70,9 +70,9 @@ void disable_swap_slots_cache_lock(void)
 	swap_slot_cache_enabled = false;
 	if (swap_slot_cache_initialized) {
 		/* serialize with cpu hotplug operations */
-		get_online_cpus();
+		cpus_read_lock();
 		__drain_swap_slots_cache(SLOTS_CACHE|SLOTS_CACHE_RET);
-		put_online_cpus();
+		cpus_read_unlock();
 	}
 }
 
diff --git a/mm/vmstat.c b/mm/vmstat.c
index b0534e068166c..a7ed56ac4c0b4 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -129,9 +129,9 @@ static void sum_vm_events(unsigned long *ret)
 */
 void all_vm_events(unsigned long *ret)
 {
-	get_online_cpus();
+	cpus_read_lock();
 	sum_vm_events(ret);
-	put_online_cpus();
+	cpus_read_unlock();
 }
 EXPORT_SYMBOL_GPL(all_vm_events);
 
@@ -1948,7 +1948,7 @@ static void vmstat_shepherd(struct work_struct *w)
 {
 	int cpu;
 
-	get_online_cpus();
+	cpus_read_lock();
 	/* Check processors whose vmstat worker threads have been disabled */
 	for_each_online_cpu(cpu) {
 		struct delayed_work *dw = &per_cpu(vmstat_work, cpu);
@@ -1958,7 +1958,7 @@ static void vmstat_shepherd(struct work_struct *w)
 
 		cond_resched();
 	}
-	put_online_cpus();
+	cpus_read_unlock();
 
 	schedule_delayed_work(&shepherd,
 		round_jiffies_relative(sysctl_stat_interval));
@@ -2037,9 +2037,9 @@ void __init init_mm_internals(void)
 	if (ret < 0)
 		pr_err("vmstat: failed to register 'online' hotplug state\n");
 
-	get_online_cpus();
+	cpus_read_lock();
 	init_cpu_node_state();
-	put_online_cpus();
+	cpus_read_unlock();
 
 	start_shepherd_timer();
 #endif
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 21/38] virtio_net: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (19 preceding siblings ...)
  2021-08-03 14:16 ` [PATCH 20/38] mm: " Sebastian Andrzej Siewior
@ 2021-08-03 14:16 ` Sebastian Andrzej Siewior
  2021-08-04 22:41   ` Jakub Kicinski
  2021-08-03 14:16 ` [PATCH 22/38] net/af_iucv: " Sebastian Andrzej Siewior
                   ` (18 subsequent siblings)
  39 siblings, 1 reply; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior,
	Michael S. Tsirkin, Jason Wang, David S. Miller, Jakub Kicinski,
	virtualization, netdev

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: virtualization@lists.linux-foundation.org
Cc: netdev@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/net/virtio_net.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 56c3f85190938..ea551ac9e08db 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -2208,14 +2208,14 @@ static int virtnet_set_channels(struct net_device *dev,
 	if (vi->rq[0].xdp_prog)
 		return -EINVAL;
 
-	get_online_cpus();
+	cpus_read_lock();
 	err = _virtnet_set_queues(vi, queue_pairs);
 	if (err) {
-		put_online_cpus();
+		cpus_read_unlock();
 		goto err;
 	}
 	virtnet_set_affinity(vi);
-	put_online_cpus();
+	cpus_read_unlock();
 
 	netif_set_real_num_tx_queues(dev, queue_pairs);
 	netif_set_real_num_rx_queues(dev, queue_pairs);
@@ -2970,9 +2970,9 @@ static int init_vqs(struct virtnet_info *vi)
 	if (ret)
 		goto err_free;
 
-	get_online_cpus();
+	cpus_read_lock();
 	virtnet_set_affinity(vi);
-	put_online_cpus();
+	cpus_read_unlock();
 
 	return 0;
 
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 22/38] net/af_iucv: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (20 preceding siblings ...)
  2021-08-03 14:16 ` [PATCH 21/38] virtio_net: " Sebastian Andrzej Siewior
@ 2021-08-03 14:16 ` Sebastian Andrzej Siewior
  2021-08-04  6:36   ` Julian Wiedmann
  2021-08-03 14:16 ` [PATCH 23/38] net: " Sebastian Andrzej Siewior
                   ` (17 subsequent siblings)
  39 siblings, 1 reply; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior, Julian Wiedmann,
	Karsten Graul, David S. Miller, Jakub Kicinski, linux-s390,
	netdev

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: Julian Wiedmann <jwi@linux.ibm.com>
Cc: Karsten Graul <kgraul@linux.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: linux-s390@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 net/iucv/iucv.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/net/iucv/iucv.c b/net/iucv/iucv.c
index e6795d5a546a0..2b29e55a09b92 100644
--- a/net/iucv/iucv.c
+++ b/net/iucv/iucv.c
@@ -500,14 +500,14 @@ static void iucv_setmask_mp(void)
 {
 	int cpu;
 
-	get_online_cpus();
+	cpus_read_lock();
 	for_each_online_cpu(cpu)
 		/* Enable all cpus with a declared buffer. */
 		if (cpumask_test_cpu(cpu, &iucv_buffer_cpumask) &&
 		    !cpumask_test_cpu(cpu, &iucv_irq_cpumask))
 			smp_call_function_single(cpu, iucv_allow_cpu,
 						 NULL, 1);
-	put_online_cpus();
+	cpus_read_unlock();
 }
 
 /**
@@ -540,7 +540,7 @@ static int iucv_enable(void)
 	size_t alloc_size;
 	int cpu, rc;
 
-	get_online_cpus();
+	cpus_read_lock();
 	rc = -ENOMEM;
 	alloc_size = iucv_max_pathid * sizeof(struct iucv_path);
 	iucv_path_table = kzalloc(alloc_size, GFP_KERNEL);
@@ -553,12 +553,12 @@ static int iucv_enable(void)
 	if (cpumask_empty(&iucv_buffer_cpumask))
 		/* No cpu could declare an iucv buffer. */
 		goto out;
-	put_online_cpus();
+	cpus_read_unlock();
 	return 0;
 out:
 	kfree(iucv_path_table);
 	iucv_path_table = NULL;
-	put_online_cpus();
+	cpus_read_unlock();
 	return rc;
 }
 
@@ -571,11 +571,11 @@ static int iucv_enable(void)
  */
 static void iucv_disable(void)
 {
-	get_online_cpus();
+	cpus_read_lock();
 	on_each_cpu(iucv_retrieve_cpu, NULL, 1);
 	kfree(iucv_path_table);
 	iucv_path_table = NULL;
-	put_online_cpus();
+	cpus_read_unlock();
 }
 
 static int iucv_cpu_dead(unsigned int cpu)
@@ -784,7 +784,7 @@ static int iucv_reboot_event(struct notifier_block *this,
 	if (cpumask_empty(&iucv_irq_cpumask))
 		return NOTIFY_DONE;
 
-	get_online_cpus();
+	cpus_read_lock();
 	on_each_cpu_mask(&iucv_irq_cpumask, iucv_block_cpu, NULL, 1);
 	preempt_disable();
 	for (i = 0; i < iucv_max_pathid; i++) {
@@ -792,7 +792,7 @@ static int iucv_reboot_event(struct notifier_block *this,
 			iucv_sever_pathid(i, NULL);
 	}
 	preempt_enable();
-	put_online_cpus();
+	cpus_read_unlock();
 	iucv_disable();
 	return NOTIFY_DONE;
 }
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 23/38] net: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (21 preceding siblings ...)
  2021-08-03 14:16 ` [PATCH 22/38] net/af_iucv: " Sebastian Andrzej Siewior
@ 2021-08-03 14:16 ` Sebastian Andrzej Siewior
  2021-08-03 14:16 ` [PATCH 24/38] cgroup: " Sebastian Andrzej Siewior
                   ` (16 subsequent siblings)
  39 siblings, 0 replies; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior, David S. Miller,
	Jakub Kicinski, netdev

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 net/core/dev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 8f1a47ad6781a..5ea4d0b34c8c9 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5876,7 +5876,7 @@ static void flush_all_backlogs(void)
 	 */
 	ASSERT_RTNL();
 
-	get_online_cpus();
+	cpus_read_lock();
 
 	cpumask_clear(&flush_cpus);
 	for_each_online_cpu(cpu) {
@@ -5894,7 +5894,7 @@ static void flush_all_backlogs(void)
 	for_each_cpu(cpu, &flush_cpus)
 		flush_work(per_cpu_ptr(&flush_works, cpu));
 
-	put_online_cpus();
+	cpus_read_unlock();
 }
 
 /* Pass the currently batched GRO_NORMAL SKBs up to the stack. */
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 24/38] cgroup: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (22 preceding siblings ...)
  2021-08-03 14:16 ` [PATCH 23/38] net: " Sebastian Andrzej Siewior
@ 2021-08-03 14:16 ` Sebastian Andrzej Siewior
  2021-08-09 22:37   ` Tejun Heo
  2021-08-03 14:16 ` [PATCH 25/38] genirq/affinity: " Sebastian Andrzej Siewior
                   ` (15 subsequent siblings)
  39 siblings, 1 reply; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior, Zefan Li,
	Tejun Heo, Johannes Weiner, cgroups

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: Zefan Li <lizefan.x@bytedance.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: cgroups@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 kernel/cgroup/cpuset.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index adb5190c44296..bd2b998249e8b 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -979,7 +979,7 @@ partition_and_rebuild_sched_domains(int ndoms_new, cpumask_var_t doms_new[],
  * 'cpus' is removed, then call this routine to rebuild the
  * scheduler's dynamic sched domains.
  *
- * Call with cpuset_mutex held.  Takes get_online_cpus().
+ * Call with cpuset_mutex held.  Takes cpus_read_lock().
  */
 static void rebuild_sched_domains_locked(void)
 {
@@ -1040,11 +1040,11 @@ static void rebuild_sched_domains_locked(void)
 
 void rebuild_sched_domains(void)
 {
-	get_online_cpus();
+	cpus_read_lock();
 	percpu_down_write(&cpuset_rwsem);
 	rebuild_sched_domains_locked();
 	percpu_up_write(&cpuset_rwsem);
-	put_online_cpus();
+	cpus_read_unlock();
 }
 
 /**
@@ -2282,7 +2282,7 @@ static int cpuset_write_u64(struct cgroup_subsys_state *css, struct cftype *cft,
 	cpuset_filetype_t type = cft->private;
 	int retval = 0;
 
-	get_online_cpus();
+	cpus_read_lock();
 	percpu_down_write(&cpuset_rwsem);
 	if (!is_cpuset_online(cs)) {
 		retval = -ENODEV;
@@ -2320,7 +2320,7 @@ static int cpuset_write_u64(struct cgroup_subsys_state *css, struct cftype *cft,
 	}
 out_unlock:
 	percpu_up_write(&cpuset_rwsem);
-	put_online_cpus();
+	cpus_read_unlock();
 	return retval;
 }
 
@@ -2331,7 +2331,7 @@ static int cpuset_write_s64(struct cgroup_subsys_state *css, struct cftype *cft,
 	cpuset_filetype_t type = cft->private;
 	int retval = -ENODEV;
 
-	get_online_cpus();
+	cpus_read_lock();
 	percpu_down_write(&cpuset_rwsem);
 	if (!is_cpuset_online(cs))
 		goto out_unlock;
@@ -2346,7 +2346,7 @@ static int cpuset_write_s64(struct cgroup_subsys_state *css, struct cftype *cft,
 	}
 out_unlock:
 	percpu_up_write(&cpuset_rwsem);
-	put_online_cpus();
+	cpus_read_unlock();
 	return retval;
 }
 
@@ -2385,7 +2385,7 @@ static ssize_t cpuset_write_resmask(struct kernfs_open_file *of,
 	kernfs_break_active_protection(of->kn);
 	flush_work(&cpuset_hotplug_work);
 
-	get_online_cpus();
+	cpus_read_lock();
 	percpu_down_write(&cpuset_rwsem);
 	if (!is_cpuset_online(cs))
 		goto out_unlock;
@@ -2411,7 +2411,7 @@ static ssize_t cpuset_write_resmask(struct kernfs_open_file *of,
 	free_cpuset(trialcs);
 out_unlock:
 	percpu_up_write(&cpuset_rwsem);
-	put_online_cpus();
+	cpus_read_unlock();
 	kernfs_unbreak_active_protection(of->kn);
 	css_put(&cs->css);
 	flush_workqueue(cpuset_migrate_mm_wq);
@@ -2542,7 +2542,7 @@ static ssize_t sched_partition_write(struct kernfs_open_file *of, char *buf,
 		return -EINVAL;
 
 	css_get(&cs->css);
-	get_online_cpus();
+	cpus_read_lock();
 	percpu_down_write(&cpuset_rwsem);
 	if (!is_cpuset_online(cs))
 		goto out_unlock;
@@ -2550,7 +2550,7 @@ static ssize_t sched_partition_write(struct kernfs_open_file *of, char *buf,
 	retval = update_prstate(cs, val);
 out_unlock:
 	percpu_up_write(&cpuset_rwsem);
-	put_online_cpus();
+	cpus_read_unlock();
 	css_put(&cs->css);
 	return retval ?: nbytes;
 }
@@ -2756,7 +2756,7 @@ static int cpuset_css_online(struct cgroup_subsys_state *css)
 	if (!parent)
 		return 0;
 
-	get_online_cpus();
+	cpus_read_lock();
 	percpu_down_write(&cpuset_rwsem);
 
 	set_bit(CS_ONLINE, &cs->flags);
@@ -2809,7 +2809,7 @@ static int cpuset_css_online(struct cgroup_subsys_state *css)
 	spin_unlock_irq(&callback_lock);
 out_unlock:
 	percpu_up_write(&cpuset_rwsem);
-	put_online_cpus();
+	cpus_read_unlock();
 	return 0;
 }
 
@@ -2828,7 +2828,7 @@ static void cpuset_css_offline(struct cgroup_subsys_state *css)
 {
 	struct cpuset *cs = css_cs(css);
 
-	get_online_cpus();
+	cpus_read_lock();
 	percpu_down_write(&cpuset_rwsem);
 
 	if (is_partition_root(cs))
@@ -2849,7 +2849,7 @@ static void cpuset_css_offline(struct cgroup_subsys_state *css)
 	clear_bit(CS_ONLINE, &cs->flags);
 
 	percpu_up_write(&cpuset_rwsem);
-	put_online_cpus();
+	cpus_read_unlock();
 }
 
 static void cpuset_css_free(struct cgroup_subsys_state *css)
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 25/38] genirq/affinity: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (23 preceding siblings ...)
  2021-08-03 14:16 ` [PATCH 24/38] cgroup: " Sebastian Andrzej Siewior
@ 2021-08-03 14:16 ` Sebastian Andrzej Siewior
  2021-08-10 12:58   ` [tip: irq/core] " tip-bot2 for Sebastian Andrzej Siewior
  2021-08-03 14:16 ` [PATCH 26/38] livepatch: " Sebastian Andrzej Siewior
                   ` (14 subsequent siblings)
  39 siblings, 1 reply; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 kernel/irq/affinity.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c
index 4d89ad4fae3bb..f7ff8919dc9bb 100644
--- a/kernel/irq/affinity.c
+++ b/kernel/irq/affinity.c
@@ -355,7 +355,7 @@ static int irq_build_affinity_masks(unsigned int startvec, unsigned int numvecs,
 		goto fail_npresmsk;
 
 	/* Stabilize the cpumasks */
-	get_online_cpus();
+	cpus_read_lock();
 	build_node_to_cpumask(node_to_cpumask);
 
 	/* Spread on present CPUs starting from affd->pre_vectors */
@@ -384,7 +384,7 @@ static int irq_build_affinity_masks(unsigned int startvec, unsigned int numvecs,
 		nr_others = ret;
 
  fail_build_affinity:
-	put_online_cpus();
+	cpus_read_unlock();
 
 	if (ret >= 0)
 		WARN_ON(nr_present + nr_others < numvecs);
@@ -505,9 +505,9 @@ unsigned int irq_calc_affinity_vectors(unsigned int minvec, unsigned int maxvec,
 	if (affd->calc_sets) {
 		set_vecs = maxvec - resv;
 	} else {
-		get_online_cpus();
+		cpus_read_lock();
 		set_vecs = cpumask_weight(cpu_possible_mask);
-		put_online_cpus();
+		cpus_read_unlock();
 	}
 
 	return resv + min(set_vecs, maxvec - resv);
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 26/38] livepatch: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (24 preceding siblings ...)
  2021-08-03 14:16 ` [PATCH 25/38] genirq/affinity: " Sebastian Andrzej Siewior
@ 2021-08-03 14:16 ` Sebastian Andrzej Siewior
  2021-08-04  7:52   ` Petr Mladek
  2021-08-03 14:16 ` [PATCH 27/38] padata: " Sebastian Andrzej Siewior
                   ` (13 subsequent siblings)
  39 siblings, 1 reply; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior, Josh Poimboeuf,
	Jiri Kosina, Miroslav Benes, Petr Mladek, Joe Lawrence,
	live-patching

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Miroslav Benes <mbenes@suse.cz>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Joe Lawrence <joe.lawrence@redhat.com>
Cc: live-patching@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 kernel/livepatch/transition.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/livepatch/transition.c b/kernel/livepatch/transition.c
index 3a4beb9395c48..291b857a6e201 100644
--- a/kernel/livepatch/transition.c
+++ b/kernel/livepatch/transition.c
@@ -411,7 +411,7 @@ void klp_try_complete_transition(void)
 	/*
 	 * Ditto for the idle "swapper" tasks.
 	 */
-	get_online_cpus();
+	cpus_read_lock();
 	for_each_possible_cpu(cpu) {
 		task = idle_task(cpu);
 		if (cpu_online(cpu)) {
@@ -423,7 +423,7 @@ void klp_try_complete_transition(void)
 			task->patch_state = klp_target_state;
 		}
 	}
-	put_online_cpus();
+	cpus_read_unlock();
 
 	if (!complete) {
 		if (klp_signals_cnt && !(klp_signals_cnt % SIGNALS_TIMEOUT))
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 27/38] padata: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (25 preceding siblings ...)
  2021-08-03 14:16 ` [PATCH 26/38] livepatch: " Sebastian Andrzej Siewior
@ 2021-08-03 14:16 ` Sebastian Andrzej Siewior
  2021-08-04 14:52   ` Daniel Jordan
  2021-08-12 11:36   ` Herbert Xu
  2021-08-03 14:16 ` [PATCH 28/38] cpufreq: " Sebastian Andrzej Siewior
                   ` (12 subsequent siblings)
  39 siblings, 2 replies; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior,
	Steffen Klassert, Daniel Jordan, linux-crypto

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: Steffen Klassert <steffen.klassert@secunet.com>
Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
Cc: linux-crypto@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 kernel/padata.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/kernel/padata.c b/kernel/padata.c
index d4d3ba6e1728a..0b0b6e8917d10 100644
--- a/kernel/padata.c
+++ b/kernel/padata.c
@@ -733,7 +733,7 @@ int padata_set_cpumask(struct padata_instance *pinst, int cpumask_type,
 	struct cpumask *serial_mask, *parallel_mask;
 	int err = -EINVAL;
 
-	get_online_cpus();
+	cpus_read_lock();
 	mutex_lock(&pinst->lock);
 
 	switch (cpumask_type) {
@@ -753,7 +753,7 @@ int padata_set_cpumask(struct padata_instance *pinst, int cpumask_type,
 
 out:
 	mutex_unlock(&pinst->lock);
-	put_online_cpus();
+	cpus_read_unlock();
 
 	return err;
 }
@@ -992,7 +992,7 @@ struct padata_instance *padata_alloc(const char *name)
 	if (!pinst->parallel_wq)
 		goto err_free_inst;
 
-	get_online_cpus();
+	cpus_read_lock();
 
 	pinst->serial_wq = alloc_workqueue("%s_serial", WQ_MEM_RECLAIM |
 					   WQ_CPU_INTENSIVE, 1, name);
@@ -1026,7 +1026,7 @@ struct padata_instance *padata_alloc(const char *name)
 						    &pinst->cpu_dead_node);
 #endif
 
-	put_online_cpus();
+	cpus_read_unlock();
 
 	return pinst;
 
@@ -1036,7 +1036,7 @@ struct padata_instance *padata_alloc(const char *name)
 err_free_serial_wq:
 	destroy_workqueue(pinst->serial_wq);
 err_put_cpus:
-	put_online_cpus();
+	cpus_read_unlock();
 	destroy_workqueue(pinst->parallel_wq);
 err_free_inst:
 	kfree(pinst);
@@ -1074,9 +1074,9 @@ struct padata_shell *padata_alloc_shell(struct padata_instance *pinst)
 
 	ps->pinst = pinst;
 
-	get_online_cpus();
+	cpus_read_lock();
 	pd = padata_alloc_pd(ps);
-	put_online_cpus();
+	cpus_read_unlock();
 
 	if (!pd)
 		goto out_free_ps;
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 28/38] cpufreq: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (26 preceding siblings ...)
  2021-08-03 14:16 ` [PATCH 27/38] padata: " Sebastian Andrzej Siewior
@ 2021-08-03 14:16 ` Sebastian Andrzej Siewior
  2021-08-04 18:19   ` Rafael J. Wysocki
  2021-08-03 14:16 ` [PATCH 29/38] ACPI: processor: " Sebastian Andrzej Siewior
                   ` (11 subsequent siblings)
  39 siblings, 1 reply; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior, linux-pm,
	Rafael J. Wysocki, Viresh Kumar, Srinivas Pandruvada, Len Brown,
	Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: linux-pm@vger.kernel.org
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/cpufreq/acpi-cpufreq.c     | 4 ++--
 drivers/cpufreq/cpufreq.c          | 6 +++---
 drivers/cpufreq/cpufreq_ondemand.c | 4 ++--
 drivers/cpufreq/intel_pstate.c     | 4 ++--
 drivers/cpufreq/powernow-k8.c      | 6 +++---
 drivers/cpufreq/powernv-cpufreq.c  | 4 ++--
 6 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
index 7e7450453714d..b49612895c786 100644
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -163,9 +163,9 @@ static ssize_t store_cpb(struct cpufreq_policy *policy, const char *buf,
 	if (ret || val > 1)
 		return -EINVAL;
 
-	get_online_cpus();
+	cpus_read_lock();
 	set_boost(policy, val);
-	put_online_cpus();
+	cpus_read_unlock();
 
 	return count;
 }
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 45f3416988f1a..06c526d66dd38 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2654,18 +2654,18 @@ int cpufreq_boost_trigger_state(int state)
 	cpufreq_driver->boost_enabled = state;
 	write_unlock_irqrestore(&cpufreq_driver_lock, flags);
 
-	get_online_cpus();
+	cpus_read_lock();
 	for_each_active_policy(policy) {
 		ret = cpufreq_driver->set_boost(policy, state);
 		if (ret)
 			goto err_reset_state;
 	}
-	put_online_cpus();
+	cpus_read_unlock();
 
 	return 0;
 
 err_reset_state:
-	put_online_cpus();
+	cpus_read_unlock();
 
 	write_lock_irqsave(&cpufreq_driver_lock, flags);
 	cpufreq_driver->boost_enabled = !state;
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index ac361a8b1d3bb..eb4320b619c9c 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -418,7 +418,7 @@ static void od_set_powersave_bias(unsigned int powersave_bias)
 	default_powersave_bias = powersave_bias;
 	cpumask_clear(&done);
 
-	get_online_cpus();
+	cpus_read_lock();
 	for_each_online_cpu(cpu) {
 		struct cpufreq_policy *policy;
 		struct policy_dbs_info *policy_dbs;
@@ -442,7 +442,7 @@ static void od_set_powersave_bias(unsigned int powersave_bias)
 		od_tuners = dbs_data->tuners;
 		od_tuners->powersave_bias = default_powersave_bias;
 	}
-	put_online_cpus();
+	cpus_read_unlock();
 }
 
 void od_register_powersave_bias_handler(unsigned int (*f)
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index bb4549959b113..2d83a9f9651b0 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -2969,7 +2969,7 @@ static void intel_pstate_driver_cleanup(void)
 {
 	unsigned int cpu;
 
-	get_online_cpus();
+	cpus_read_lock();
 	for_each_online_cpu(cpu) {
 		if (all_cpu_data[cpu]) {
 			if (intel_pstate_driver == &intel_pstate)
@@ -2979,7 +2979,7 @@ static void intel_pstate_driver_cleanup(void)
 			all_cpu_data[cpu] = NULL;
 		}
 	}
-	put_online_cpus();
+	cpus_read_unlock();
 
 	intel_pstate_driver = NULL;
 }
diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c
index b9ccb6a3dad98..12ab4014af712 100644
--- a/drivers/cpufreq/powernow-k8.c
+++ b/drivers/cpufreq/powernow-k8.c
@@ -1180,7 +1180,7 @@ static int powernowk8_init(void)
 	if (!x86_match_cpu(powernow_k8_ids))
 		return -ENODEV;
 
-	get_online_cpus();
+	cpus_read_lock();
 	for_each_online_cpu(i) {
 		smp_call_function_single(i, check_supported_cpu, &ret, 1);
 		if (!ret)
@@ -1188,10 +1188,10 @@ static int powernowk8_init(void)
 	}
 
 	if (supported_cpus != num_online_cpus()) {
-		put_online_cpus();
+		cpus_read_unlock();
 		return -ENODEV;
 	}
-	put_online_cpus();
+	cpus_read_unlock();
 
 	ret = cpufreq_register_driver(&cpufreq_amd64_driver);
 	if (ret)
diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c
index 005600cef2730..23a06cba392cd 100644
--- a/drivers/cpufreq/powernv-cpufreq.c
+++ b/drivers/cpufreq/powernv-cpufreq.c
@@ -918,7 +918,7 @@ static void powernv_cpufreq_work_fn(struct work_struct *work)
 	unsigned int cpu;
 	cpumask_t mask;
 
-	get_online_cpus();
+	cpus_read_lock();
 	cpumask_and(&mask, &chip->mask, cpu_online_mask);
 	smp_call_function_any(&mask,
 			      powernv_cpufreq_throttle_check, NULL, 0);
@@ -939,7 +939,7 @@ static void powernv_cpufreq_work_fn(struct work_struct *work)
 		cpufreq_cpu_put(policy);
 	}
 out:
-	put_online_cpus();
+	cpus_read_unlock();
 }
 
 static int powernv_cpufreq_occ_msg(struct notifier_block *nb,
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 29/38] ACPI: processor: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (27 preceding siblings ...)
  2021-08-03 14:16 ` [PATCH 28/38] cpufreq: " Sebastian Andrzej Siewior
@ 2021-08-03 14:16 ` Sebastian Andrzej Siewior
  2021-08-04 18:27   ` Rafael J. Wysocki
  2021-08-03 14:16 ` [PATCH 30/38] ACPI: PM: s2idle: " Sebastian Andrzej Siewior
                   ` (10 subsequent siblings)
  39 siblings, 1 reply; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior,
	Rafael J. Wysocki, Len Brown, linux-acpi

The functions cpu_hotplug_begin, cpu_hotplug_done, get_online_cpus() and
put_online_cpus() have been deprecated during the CPU hotplug rework. They map
directly to cpus_write_lock(), cpus_write_unlock, cpus_read_lock() and
cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/acpi/acpi_pad.c       | 4 ++--
 drivers/acpi/acpi_processor.c | 8 ++++----
 drivers/acpi/processor_idle.c | 4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c
index df4adeb335b24..f45979aa2d648 100644
--- a/drivers/acpi/acpi_pad.c
+++ b/drivers/acpi/acpi_pad.c
@@ -249,12 +249,12 @@ static void set_power_saving_task_num(unsigned int num)
 
 static void acpi_pad_idle_cpus(unsigned int num_cpus)
 {
-	get_online_cpus();
+	cpus_read_lock();
 
 	num_cpus = min_t(unsigned int, num_cpus, num_online_cpus());
 	set_power_saving_task_num(num_cpus);
 
-	put_online_cpus();
+	cpus_read_unlock();
 }
 
 static uint32_t acpi_pad_idle_cpus_num(void)
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
index 2d5bd2a6ddcef..6737b1cbf6d69 100644
--- a/drivers/acpi/acpi_processor.c
+++ b/drivers/acpi/acpi_processor.c
@@ -182,7 +182,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
 		return -ENODEV;
 
 	cpu_maps_update_begin();
-	cpu_hotplug_begin();
+	cpus_write_lock();
 
 	ret = acpi_map_cpu(pr->handle, pr->phys_id, pr->acpi_id, &pr->id);
 	if (ret)
@@ -203,7 +203,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
 	pr->flags.need_hotplug_init = 1;
 
 out:
-	cpu_hotplug_done();
+	cpus_write_unlock();
 	cpu_maps_update_done();
 	return ret;
 }
@@ -454,13 +454,13 @@ static void acpi_processor_remove(struct acpi_device *device)
 	per_cpu(processors, pr->id) = NULL;
 
 	cpu_maps_update_begin();
-	cpu_hotplug_begin();
+	cpus_write_lock();
 
 	/* Remove the CPU. */
 	arch_unregister_cpu(pr->id);
 	acpi_unmap_cpu(pr->id);
 
-	cpu_hotplug_done();
+	cpus_write_unlock();
 	cpu_maps_update_done();
 
 	try_offline_node(cpu_to_node(pr->id));
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 095c8aca141eb..f37fba9e5ba0b 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -1301,7 +1301,7 @@ int acpi_processor_power_state_has_changed(struct acpi_processor *pr)
 	if (pr->id == 0 && cpuidle_get_driver() == &acpi_idle_driver) {
 
 		/* Protect against cpu-hotplug */
-		get_online_cpus();
+		cpus_read_lock();
 		cpuidle_pause_and_lock();
 
 		/* Disable all cpuidle devices */
@@ -1330,7 +1330,7 @@ int acpi_processor_power_state_has_changed(struct acpi_processor *pr)
 			}
 		}
 		cpuidle_resume_and_unlock();
-		put_online_cpus();
+		cpus_read_unlock();
 	}
 
 	return 0;
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 30/38] ACPI: PM: s2idle: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (28 preceding siblings ...)
  2021-08-03 14:16 ` [PATCH 29/38] ACPI: processor: " Sebastian Andrzej Siewior
@ 2021-08-03 14:16 ` Sebastian Andrzej Siewior
  2021-08-04 18:20   ` Rafael J. Wysocki
  2021-08-03 14:16 ` [PATCH 31/38] rcu: " Sebastian Andrzej Siewior
                   ` (9 subsequent siblings)
  39 siblings, 1 reply; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior,
	Rafael J. Wysocki, Pavel Machek, Len Brown, linux-pm

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Len Brown <len.brown@intel.com>
Cc: linux-pm@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 kernel/power/suspend.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index d8cae434f9eb5..eb75f394a0590 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -96,7 +96,7 @@ static void s2idle_enter(void)
 	s2idle_state = S2IDLE_STATE_ENTER;
 	raw_spin_unlock_irq(&s2idle_lock);
 
-	get_online_cpus();
+	cpus_read_lock();
 	cpuidle_resume();
 
 	/* Push all the CPUs into the idle loop. */
@@ -106,7 +106,7 @@ static void s2idle_enter(void)
 		    s2idle_state == S2IDLE_STATE_WAKE);
 
 	cpuidle_pause();
-	put_online_cpus();
+	cpus_read_unlock();
 
 	raw_spin_lock_irq(&s2idle_lock);
 
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 31/38] rcu: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (29 preceding siblings ...)
  2021-08-03 14:16 ` [PATCH 30/38] ACPI: PM: s2idle: " Sebastian Andrzej Siewior
@ 2021-08-03 14:16 ` Sebastian Andrzej Siewior
  2021-08-03 16:00   ` Paul E. McKenney
  2021-08-03 14:16 ` [PATCH 32/38] sched: " Sebastian Andrzej Siewior
                   ` (8 subsequent siblings)
  39 siblings, 1 reply; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior,
	Paul E. McKenney, Josh Triplett, Steven Rostedt,
	Mathieu Desnoyers, Lai Jiangshan, Joel Fernandes, rcu

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Cc: Joel Fernandes <joel@joelfernandes.org>
Cc: rcu@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 kernel/rcu/tree.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 51f24ecd94b26..f116ce58f4e68 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -4050,7 +4050,7 @@ void rcu_barrier(void)
 	 */
 	init_completion(&rcu_state.barrier_completion);
 	atomic_set(&rcu_state.barrier_cpu_count, 2);
-	get_online_cpus();
+	cpus_read_lock();
 
 	/*
 	 * Force each CPU with callbacks to register a new callback.
@@ -4081,7 +4081,7 @@ void rcu_barrier(void)
 					  rcu_state.barrier_sequence);
 		}
 	}
-	put_online_cpus();
+	cpus_read_unlock();
 
 	/*
 	 * Now that we have an rcu_barrier_callback() callback on each
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 32/38] sched: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (30 preceding siblings ...)
  2021-08-03 14:16 ` [PATCH 31/38] rcu: " Sebastian Andrzej Siewior
@ 2021-08-03 14:16 ` Sebastian Andrzej Siewior
  2021-08-10 12:58   ` [tip: sched/core] " tip-bot2 for Sebastian Andrzej Siewior
  2021-08-03 14:16 ` [PATCH 33/38] smpboot: " Sebastian Andrzej Siewior
                   ` (7 subsequent siblings)
  39 siblings, 1 reply; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior, Ingo Molnar,
	Juri Lelli, Vincent Guittot, Dietmar Eggemann, Steven Rostedt,
	Ben Segall, Mel Gorman, Daniel Bristot de Oliveira

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ben Segall <bsegall@google.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Daniel Bristot de Oliveira <bristot@redhat.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 kernel/sched/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 2d9ff40f46619..721b2c9201f6d 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -9824,7 +9824,7 @@ static int tg_set_cfs_bandwidth(struct task_group *tg, u64 period, u64 quota,
 	 * Prevent race between setting of cfs_rq->runtime_enabled and
 	 * unthrottle_offline_cfs_rqs().
 	 */
-	get_online_cpus();
+	cpus_read_lock();
 	mutex_lock(&cfs_constraints_mutex);
 	ret = __cfs_schedulable(tg, period, quota);
 	if (ret)
@@ -9868,7 +9868,7 @@ static int tg_set_cfs_bandwidth(struct task_group *tg, u64 period, u64 quota,
 		cfs_bandwidth_usage_dec();
 out_unlock:
 	mutex_unlock(&cfs_constraints_mutex);
-	put_online_cpus();
+	cpus_read_unlock();
 
 	return ret;
 }
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 33/38] smpboot: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (31 preceding siblings ...)
  2021-08-03 14:16 ` [PATCH 32/38] sched: " Sebastian Andrzej Siewior
@ 2021-08-03 14:16 ` Sebastian Andrzej Siewior
  2021-08-10 13:04   ` [tip: smp/core] " tip-bot2 for Sebastian Andrzej Siewior
  2021-08-03 14:16 ` [PATCH 34/38] clocksource: " Sebastian Andrzej Siewior
                   ` (6 subsequent siblings)
  39 siblings, 1 reply; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 kernel/smpboot.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/smpboot.c b/kernel/smpboot.c
index cf6acab785384..f6bc0bc8a2aab 100644
--- a/kernel/smpboot.c
+++ b/kernel/smpboot.c
@@ -291,7 +291,7 @@ int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread)
 	unsigned int cpu;
 	int ret = 0;
 
-	get_online_cpus();
+	cpus_read_lock();
 	mutex_lock(&smpboot_threads_lock);
 	for_each_online_cpu(cpu) {
 		ret = __smpboot_create_thread(plug_thread, cpu);
@@ -304,7 +304,7 @@ int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread)
 	list_add(&plug_thread->list, &hotplug_threads);
 out:
 	mutex_unlock(&smpboot_threads_lock);
-	put_online_cpus();
+	cpus_read_unlock();
 	return ret;
 }
 EXPORT_SYMBOL_GPL(smpboot_register_percpu_thread);
@@ -317,12 +317,12 @@ EXPORT_SYMBOL_GPL(smpboot_register_percpu_thread);
  */
 void smpboot_unregister_percpu_thread(struct smp_hotplug_thread *plug_thread)
 {
-	get_online_cpus();
+	cpus_read_lock();
 	mutex_lock(&smpboot_threads_lock);
 	list_del(&plug_thread->list);
 	smpboot_destroy_threads(plug_thread);
 	mutex_unlock(&smpboot_threads_lock);
-	put_online_cpus();
+	cpus_read_unlock();
 }
 EXPORT_SYMBOL_GPL(smpboot_unregister_percpu_thread);
 
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 34/38] clocksource: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (32 preceding siblings ...)
  2021-08-03 14:16 ` [PATCH 33/38] smpboot: " Sebastian Andrzej Siewior
@ 2021-08-03 14:16 ` Sebastian Andrzej Siewior
  2021-08-10 12:58   ` [tip: timers/core] " tip-bot2 for Sebastian Andrzej Siewior
  2021-08-03 14:16 ` [PATCH 35/38] torture: " Sebastian Andrzej Siewior
                   ` (5 subsequent siblings)
  39 siblings, 1 reply; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior, John Stultz,
	Stephen Boyd

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: John Stultz <john.stultz@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 kernel/time/clocksource.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index b89c76e1c02c4..b8a14d2fb5ba6 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -306,12 +306,12 @@ void clocksource_verify_percpu(struct clocksource *cs)
 		return;
 	cpumask_clear(&cpus_ahead);
 	cpumask_clear(&cpus_behind);
-	get_online_cpus();
+	cpus_read_lock();
 	preempt_disable();
 	clocksource_verify_choose_cpus();
 	if (cpumask_weight(&cpus_chosen) == 0) {
 		preempt_enable();
-		put_online_cpus();
+		cpus_read_unlock();
 		pr_warn("Not enough CPUs to check clocksource '%s'.\n", cs->name);
 		return;
 	}
@@ -337,7 +337,7 @@ void clocksource_verify_percpu(struct clocksource *cs)
 			cs_nsec_min = cs_nsec;
 	}
 	preempt_enable();
-	put_online_cpus();
+	cpus_read_unlock();
 	if (!cpumask_empty(&cpus_ahead))
 		pr_warn("        CPUs %*pbl ahead of CPU %d for clocksource %s.\n",
 			cpumask_pr_args(&cpus_ahead), testcpu, cs->name);
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 35/38] torture: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (33 preceding siblings ...)
  2021-08-03 14:16 ` [PATCH 34/38] clocksource: " Sebastian Andrzej Siewior
@ 2021-08-03 14:16 ` Sebastian Andrzej Siewior
  2021-08-03 14:16 ` [PATCH 36/38] tracing: " Sebastian Andrzej Siewior
                   ` (4 subsequent siblings)
  39 siblings, 0 replies; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior, Davidlohr Bueso,
	Paul E. McKenney, Josh Triplett

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 kernel/torture.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/torture.c b/kernel/torture.c
index 0a315c387bedb..bb8f411c974b8 100644
--- a/kernel/torture.c
+++ b/kernel/torture.c
@@ -521,11 +521,11 @@ static void torture_shuffle_tasks(void)
 	struct shuffle_task *stp;
 
 	cpumask_setall(shuffle_tmp_mask);
-	get_online_cpus();
+	cpus_read_lock();
 
 	/* No point in shuffling if there is only one online CPU (ex: UP) */
 	if (num_online_cpus() == 1) {
-		put_online_cpus();
+		cpus_read_unlock();
 		return;
 	}
 
@@ -541,7 +541,7 @@ static void torture_shuffle_tasks(void)
 		set_cpus_allowed_ptr(stp->st_t, shuffle_tmp_mask);
 	mutex_unlock(&shuffle_task_mutex);
 
-	put_online_cpus();
+	cpus_read_unlock();
 }
 
 /* Shuffle tasks across CPUs, with the intent of allowing each CPU in the
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 36/38] tracing: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (34 preceding siblings ...)
  2021-08-03 14:16 ` [PATCH 35/38] torture: " Sebastian Andrzej Siewior
@ 2021-08-03 14:16 ` Sebastian Andrzej Siewior
  2021-08-03 15:16   ` Daniel Bristot de Oliveira
  2021-08-04  2:26   ` Steven Rostedt
  2021-08-03 14:16 ` [PATCH 37/38] workqueue: " Sebastian Andrzej Siewior
                   ` (3 subsequent siblings)
  39 siblings, 2 replies; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior, Steven Rostedt,
	Ingo Molnar

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 kernel/trace/ring_buffer.c   |  8 ++++----
 kernel/trace/trace_hwlat.c   | 28 ++++++++++++++--------------
 kernel/trace/trace_osnoise.c | 16 ++++++++--------
 3 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index e592d1df6f888..c5a3fbf19617e 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -2111,7 +2111,7 @@ int ring_buffer_resize(struct trace_buffer *buffer, unsigned long size,
 			}
 		}
 
-		get_online_cpus();
+		cpus_read_lock();
 		/*
 		 * Fire off all the required work handlers
 		 * We can't schedule on offline CPUs, but it's not necessary
@@ -2143,7 +2143,7 @@ int ring_buffer_resize(struct trace_buffer *buffer, unsigned long size,
 			cpu_buffer->nr_pages_to_update = 0;
 		}
 
-		put_online_cpus();
+		cpus_read_unlock();
 	} else {
 		cpu_buffer = buffer->buffers[cpu_id];
 
@@ -2171,7 +2171,7 @@ int ring_buffer_resize(struct trace_buffer *buffer, unsigned long size,
 			goto out_err;
 		}
 
-		get_online_cpus();
+		cpus_read_lock();
 
 		/* Can't run something on an offline CPU. */
 		if (!cpu_online(cpu_id))
@@ -2183,7 +2183,7 @@ int ring_buffer_resize(struct trace_buffer *buffer, unsigned long size,
 		}
 
 		cpu_buffer->nr_pages_to_update = 0;
-		put_online_cpus();
+		cpus_read_unlock();
 	}
 
  out:
diff --git a/kernel/trace/trace_hwlat.c b/kernel/trace/trace_hwlat.c
index a6c0cdaf4b878..172948ead25c0 100644
--- a/kernel/trace/trace_hwlat.c
+++ b/kernel/trace/trace_hwlat.c
@@ -325,10 +325,10 @@ static void move_to_next_cpu(void)
 	if (!cpumask_equal(current_mask, current->cpus_ptr))
 		goto change_mode;
 
-	get_online_cpus();
+	cpus_read_lock();
 	cpumask_and(current_mask, cpu_online_mask, tr->tracing_cpumask);
 	next_cpu = cpumask_next(smp_processor_id(), current_mask);
-	put_online_cpus();
+	cpus_read_unlock();
 
 	if (next_cpu >= nr_cpu_ids)
 		next_cpu = cpumask_first(current_mask);
@@ -398,7 +398,7 @@ static void stop_single_kthread(void)
 	struct hwlat_kthread_data *kdata = get_cpu_data();
 	struct task_struct *kthread;
 
-	get_online_cpus();
+	cpus_read_lock();
 	kthread = kdata->kthread;
 
 	if (!kthread)
@@ -408,7 +408,7 @@ static void stop_single_kthread(void)
 	kdata->kthread = NULL;
 
 out_put_cpus:
-	put_online_cpus();
+	cpus_read_unlock();
 }
 
 
@@ -425,14 +425,14 @@ static int start_single_kthread(struct trace_array *tr)
 	struct task_struct *kthread;
 	int next_cpu;
 
-	get_online_cpus();
+	cpus_read_lock();
 	if (kdata->kthread)
 		goto out_put_cpus;
 
 	kthread = kthread_create(kthread_fn, NULL, "hwlatd");
 	if (IS_ERR(kthread)) {
 		pr_err(BANNER "could not start sampling thread\n");
-		put_online_cpus();
+		cpus_read_unlock();
 		return -ENOMEM;
 	}
 
@@ -452,7 +452,7 @@ static int start_single_kthread(struct trace_array *tr)
 	wake_up_process(kthread);
 
 out_put_cpus:
-	put_online_cpus();
+	cpus_read_unlock();
 	return 0;
 }
 
@@ -479,10 +479,10 @@ static void stop_per_cpu_kthreads(void)
 {
 	unsigned int cpu;
 
-	get_online_cpus();
+	cpus_read_lock();
 	for_each_online_cpu(cpu)
 		stop_cpu_kthread(cpu);
-	put_online_cpus();
+	cpus_read_unlock();
 }
 
 /*
@@ -515,7 +515,7 @@ static void hwlat_hotplug_workfn(struct work_struct *dummy)
 
 	mutex_lock(&trace_types_lock);
 	mutex_lock(&hwlat_data.lock);
-	get_online_cpus();
+	cpus_read_lock();
 
 	if (!hwlat_busy || hwlat_data.thread_mode != MODE_PER_CPU)
 		goto out_unlock;
@@ -526,7 +526,7 @@ static void hwlat_hotplug_workfn(struct work_struct *dummy)
 	start_cpu_kthread(cpu);
 
 out_unlock:
-	put_online_cpus();
+	cpus_read_unlock();
 	mutex_unlock(&hwlat_data.lock);
 	mutex_unlock(&trace_types_lock);
 }
@@ -582,7 +582,7 @@ static int start_per_cpu_kthreads(struct trace_array *tr)
 	unsigned int cpu;
 	int retval;
 
-	get_online_cpus();
+	cpus_read_lock();
 	/*
 	 * Run only on CPUs in which hwlat is allowed to run.
 	 */
@@ -596,12 +596,12 @@ static int start_per_cpu_kthreads(struct trace_array *tr)
 		if (retval)
 			goto out_error;
 	}
-	put_online_cpus();
+	cpus_read_unlock();
 
 	return 0;
 
 out_error:
-	put_online_cpus();
+	cpus_read_unlock();
 	stop_per_cpu_kthreads();
 	return retval;
 }
diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
index a7e3c24dee13f..ec0015f8a64ce 100644
--- a/kernel/trace/trace_osnoise.c
+++ b/kernel/trace/trace_osnoise.c
@@ -1444,12 +1444,12 @@ static void stop_per_cpu_kthreads(void)
 {
 	int cpu;
 
-	get_online_cpus();
+	cpus_read_lock();
 
 	for_each_online_cpu(cpu)
 		stop_kthread(cpu);
 
-	put_online_cpus();
+	cpus_read_unlock();
 }
 
 /*
@@ -1497,7 +1497,7 @@ static int start_per_cpu_kthreads(struct trace_array *tr)
 	int retval;
 	int cpu;
 
-	get_online_cpus();
+	cpus_read_lock();
 	/*
 	 * Run only on CPUs in which trace and osnoise are allowed to run.
 	 */
@@ -1518,7 +1518,7 @@ static int start_per_cpu_kthreads(struct trace_array *tr)
 		}
 	}
 
-	put_online_cpus();
+	cpus_read_unlock();
 
 	return 0;
 }
@@ -1536,7 +1536,7 @@ static void osnoise_hotplug_workfn(struct work_struct *dummy)
 		goto out_unlock_trace;
 
 	mutex_lock(&interface_lock);
-	get_online_cpus();
+	cpus_read_lock();
 
 	if (!cpumask_test_cpu(cpu, &osnoise_cpumask))
 		goto out_unlock;
@@ -1547,7 +1547,7 @@ static void osnoise_hotplug_workfn(struct work_struct *dummy)
 	start_kthread(cpu);
 
 out_unlock:
-	put_online_cpus();
+	cpus_read_unlock();
 	mutex_unlock(&interface_lock);
 out_unlock_trace:
 	mutex_unlock(&trace_types_lock);
@@ -1689,11 +1689,11 @@ osnoise_cpus_write(struct file *filp, const char __user *ubuf, size_t count,
 	/*
 	 * osnoise_cpumask is read by CPU hotplug operations.
 	 */
-	get_online_cpus();
+	cpus_read_lock();
 
 	cpumask_copy(&osnoise_cpumask, osnoise_cpumask_new);
 
-	put_online_cpus();
+	cpus_read_unlock();
 	mutex_unlock(&interface_lock);
 
 	if (running)
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 37/38] workqueue: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (35 preceding siblings ...)
  2021-08-03 14:16 ` [PATCH 36/38] tracing: " Sebastian Andrzej Siewior
@ 2021-08-03 14:16 ` Sebastian Andrzej Siewior
  2021-08-04  1:36   ` Lai Jiangshan
  2021-08-09 22:33   ` Tejun Heo
  2021-08-03 14:16 ` [PATCH 38/38] cpu/hotplug: Remove " Sebastian Andrzej Siewior
                   ` (2 subsequent siblings)
  39 siblings, 2 replies; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior, Tejun Heo,
	Lai Jiangshan

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: Tejun Heo <tj@kernel.org>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 kernel/workqueue.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index f148eacda55a9..f967aa4050d08 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -3293,7 +3293,7 @@ int schedule_on_each_cpu(work_func_t func)
 	if (!works)
 		return -ENOMEM;
 
-	get_online_cpus();
+	cpus_read_lock();
 
 	for_each_online_cpu(cpu) {
 		struct work_struct *work = per_cpu_ptr(works, cpu);
@@ -3305,7 +3305,7 @@ int schedule_on_each_cpu(work_func_t func)
 	for_each_online_cpu(cpu)
 		flush_work(per_cpu_ptr(works, cpu));
 
-	put_online_cpus();
+	cpus_read_unlock();
 	free_percpu(works);
 	return 0;
 }
@@ -4016,14 +4016,14 @@ static void apply_wqattrs_commit(struct apply_wqattrs_ctx *ctx)
 static void apply_wqattrs_lock(void)
 {
 	/* CPUs should stay stable across pwq creations and installations */
-	get_online_cpus();
+	cpus_read_lock();
 	mutex_lock(&wq_pool_mutex);
 }
 
 static void apply_wqattrs_unlock(void)
 {
 	mutex_unlock(&wq_pool_mutex);
-	put_online_cpus();
+	cpus_read_unlock();
 }
 
 static int apply_workqueue_attrs_locked(struct workqueue_struct *wq,
@@ -4068,7 +4068,7 @@ static int apply_workqueue_attrs_locked(struct workqueue_struct *wq,
  *
  * Performs GFP_KERNEL allocations.
  *
- * Assumes caller has CPU hotplug read exclusion, i.e. get_online_cpus().
+ * Assumes caller has CPU hotplug read exclusion, i.e. cpus_read_lock().
  *
  * Return: 0 on success and -errno on failure.
  */
@@ -4196,7 +4196,7 @@ static int alloc_and_link_pwqs(struct workqueue_struct *wq)
 		return 0;
 	}
 
-	get_online_cpus();
+	cpus_read_lock();
 	if (wq->flags & __WQ_ORDERED) {
 		ret = apply_workqueue_attrs(wq, ordered_wq_attrs[highpri]);
 		/* there should only be single pwq for ordering guarantee */
@@ -4206,7 +4206,7 @@ static int alloc_and_link_pwqs(struct workqueue_struct *wq)
 	} else {
 		ret = apply_workqueue_attrs(wq, unbound_std_wq_attrs[highpri]);
 	}
-	put_online_cpus();
+	cpus_read_unlock();
 
 	return ret;
 }
@@ -5168,10 +5168,10 @@ long work_on_cpu_safe(int cpu, long (*fn)(void *), void *arg)
 {
 	long ret = -ENODEV;
 
-	get_online_cpus();
+	cpus_read_lock();
 	if (cpu_online(cpu))
 		ret = work_on_cpu(cpu, fn, arg);
-	put_online_cpus();
+	cpus_read_unlock();
 	return ret;
 }
 EXPORT_SYMBOL_GPL(work_on_cpu_safe);
@@ -5443,7 +5443,7 @@ static ssize_t wq_pool_ids_show(struct device *dev,
 	const char *delim = "";
 	int node, written = 0;
 
-	get_online_cpus();
+	cpus_read_lock();
 	rcu_read_lock();
 	for_each_node(node) {
 		written += scnprintf(buf + written, PAGE_SIZE - written,
@@ -5453,7 +5453,7 @@ static ssize_t wq_pool_ids_show(struct device *dev,
 	}
 	written += scnprintf(buf + written, PAGE_SIZE - written, "\n");
 	rcu_read_unlock();
-	put_online_cpus();
+	cpus_read_unlock();
 
 	return written;
 }
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [PATCH 38/38] cpu/hotplug: Remove deprecated CPU-hotplug functions.
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (36 preceding siblings ...)
  2021-08-03 14:16 ` [PATCH 37/38] workqueue: " Sebastian Andrzej Siewior
@ 2021-08-03 14:16 ` Sebastian Andrzej Siewior
  2021-09-10 22:45   ` [tip: smp/urgent] " tip-bot2 for Sebastian Andrzej Siewior
  2021-08-03 15:30 ` [PATCH 00/38] Replace deprecated CPU-hotplug Hans de Goede
  2021-08-18 13:38 ` (subset) " Michael Ellerman
  39 siblings, 1 reply; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 14:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: tglx, Peter Zijlstra, Sebastian Andrzej Siewior

No users in tree use the deprecated CPU-hotplug functions.

Remove them.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 include/linux/cpu.h | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 94a578a962022..9cf51e41e6972 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -143,12 +143,6 @@ static inline int remove_cpu(unsigned int cpu) { return -EPERM; }
 static inline void smp_shutdown_nonboot_cpus(unsigned int primary_cpu) { }
 #endif	/* !CONFIG_HOTPLUG_CPU */
 
-/* Wrappers which go away once all code is converted */
-static inline void cpu_hotplug_begin(void) { cpus_write_lock(); }
-static inline void cpu_hotplug_done(void) { cpus_write_unlock(); }
-static inline void get_online_cpus(void) { cpus_read_lock(); }
-static inline void put_online_cpus(void) { cpus_read_unlock(); }
-
 #ifdef CONFIG_PM_SLEEP_SMP
 extern int freeze_secondary_cpus(int primary);
 extern void thaw_secondary_cpus(void);
-- 
2.32.0


^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [Nouveau] [PATCH 06/38] x86/mmiotrace: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 ` [PATCH 06/38] x86/mmiotrace: " Sebastian Andrzej Siewior
@ 2021-08-03 15:03   ` Karol Herbst
  2021-08-04  1:07   ` Steven Rostedt
  2021-08-10 12:52   ` [tip: x86/cleanups] " tip-bot2 for Sebastian Andrzej Siewior
  2 siblings, 0 replies; 94+ messages in thread
From: Karol Herbst @ 2021-08-03 15:03 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: LKML, Thomas Gleixner, Peter Zijlstra, Steven Rostedt,
	Ingo Molnar, Karol Herbst, Pekka Paalanen, Dave Hansen,
	Andy Lutomirski, Borislav Petkov,
	maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
	H. Peter Anvin, nouveau

On Tue, Aug 3, 2021 at 4:25 PM Sebastian Andrzej Siewior
<bigeasy@linutronix.de> wrote:
>
> The functions get_online_cpus() and put_online_cpus() have been
> deprecated during the CPU hotplug rework. They map directly to
> cpus_read_lock() and cpus_read_unlock().
>
> Replace deprecated CPU-hotplug functions with the official version.
> The behavior remains unchanged.
>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Karol Herbst <karolherbst@gmail.com>
> Cc: Pekka Paalanen <ppaalanen@gmail.com>
> Cc: Dave Hansen <dave.hansen@linux.intel.com>
> Cc: Andy Lutomirski <luto@kernel.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: x86@kernel.org
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: nouveau@lists.freedesktop.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>  arch/x86/mm/mmio-mod.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c
> index cd768dafca9e9..933a2ebad471b 100644
> --- a/arch/x86/mm/mmio-mod.c
> +++ b/arch/x86/mm/mmio-mod.c
> @@ -376,12 +376,12 @@ static void enter_uniprocessor(void)
>                 goto out;
>         }
>
> -       get_online_cpus();
> +       cpus_read_lock();
>         cpumask_copy(downed_cpus, cpu_online_mask);
>         cpumask_clear_cpu(cpumask_first(cpu_online_mask), downed_cpus);
>         if (num_online_cpus() > 1)
>                 pr_notice("Disabling non-boot CPUs...\n");
> -       put_online_cpus();
> +       cpus_read_unlock();
>
>         for_each_cpu(cpu, downed_cpus) {
>                 err = remove_cpu(cpu);
> --
> 2.32.0
>

Reviewed-by: Karol Herbst <kherbst@redhat.com>


^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 36/38] tracing: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:16 ` [PATCH 36/38] tracing: " Sebastian Andrzej Siewior
@ 2021-08-03 15:16   ` Daniel Bristot de Oliveira
  2021-08-04  2:26   ` Steven Rostedt
  1 sibling, 0 replies; 94+ messages in thread
From: Daniel Bristot de Oliveira @ 2021-08-03 15:16 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior, linux-kernel
  Cc: tglx, Peter Zijlstra, Steven Rostedt, Ingo Molnar

On 8/3/21 4:16 PM, Sebastian Andrzej Siewior wrote:
> The functions get_online_cpus() and put_online_cpus() have been
> deprecated during the CPU hotplug rework. They map directly to
> cpus_read_lock() and cpus_read_unlock().
> 
> Replace deprecated CPU-hotplug functions with the official version.
> The behavior remains unchanged.
> 
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

osnoise/timerlat/hwlat tested and it looks good to me.

Acked-by: Daniel Bristot de Oliveira <bristot@kernel.org>

Thanks
-- Daniel

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 13/38] hwmon: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 ` [PATCH 13/38] hwmon: " Sebastian Andrzej Siewior
@ 2021-08-03 15:29   ` Guenter Roeck
  0 siblings, 0 replies; 94+ messages in thread
From: Guenter Roeck @ 2021-08-03 15:29 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: linux-kernel, tglx, Peter Zijlstra, Jean Delvare, linux-hwmon

On Tue, Aug 03, 2021 at 04:15:56PM +0200, Sebastian Andrzej Siewior wrote:
> The functions get_online_cpus() and put_online_cpus() have been
> deprecated during the CPU hotplug rework. They map directly to
> cpus_read_lock() and cpus_read_unlock().
> 
> Replace deprecated CPU-hotplug functions with the official version.
> The behavior remains unchanged.
> 
> Cc: Jean Delvare <jdelvare@suse.com>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: linux-hwmon@vger.kernel.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/dell-smm-hwmon.c | 4 ++--
>  drivers/hwmon/fam15h_power.c   | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c
> index f2221ca0aa7be..c3600266e0e91 100644
> --- a/drivers/hwmon/dell-smm-hwmon.c
> +++ b/drivers/hwmon/dell-smm-hwmon.c
> @@ -228,9 +228,9 @@ static int i8k_smm(struct smm_regs *regs)
>  {
>  	int ret;
>  
> -	get_online_cpus();
> +	cpus_read_lock();
>  	ret = smp_call_on_cpu(0, i8k_smm_func, regs, true);
> -	put_online_cpus();
> +	cpus_read_unlock();
>  
>  	return ret;
>  }
> diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c
> index 29f5fed28c2a7..521534d5c1e5f 100644
> --- a/drivers/hwmon/fam15h_power.c
> +++ b/drivers/hwmon/fam15h_power.c
> @@ -166,7 +166,7 @@ static int read_registers(struct fam15h_power_data *data)
>  
>  	memset(data->cu_on, 0, sizeof(int) * MAX_CUS);
>  
> -	get_online_cpus();
> +	cpus_read_lock();
>  
>  	/*
>  	 * Choose the first online core of each compute unit, and then
> @@ -190,7 +190,7 @@ static int read_registers(struct fam15h_power_data *data)
>  
>  	on_each_cpu_mask(mask, do_read_registers_on_cu, data, true);
>  
> -	put_online_cpus();
> +	cpus_read_unlock();
>  	free_cpumask_var(mask);
>  
>  	return 0;

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 00/38] Replace deprecated CPU-hotplug
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (37 preceding siblings ...)
  2021-08-03 14:16 ` [PATCH 38/38] cpu/hotplug: Remove " Sebastian Andrzej Siewior
@ 2021-08-03 15:30 ` Hans de Goede
  2021-08-03 16:10   ` Sebastian Andrzej Siewior
  2021-08-18 13:38 ` (subset) " Michael Ellerman
  39 siblings, 1 reply; 94+ messages in thread
From: Hans de Goede @ 2021-08-03 15:30 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior, linux-kernel
  Cc: tglx, Peter Zijlstra, Alexander Shishkin, Amit Kucheria,
	Andrew Morton, Andy Lutomirski, Arnaldo Carvalho de Melo,
	Arnd Bergmann, Benjamin Herrenschmidt, Ben Segall,
	Borislav Petkov, cgroups, Christian Borntraeger, coresight,
	Daniel Bristot de Oliveira, Daniel Jordan, Daniel Lezcano,
	Dave Hansen, Davidlohr Bueso, David S. Miller, Dietmar Eggemann,
	Gonglei, Greg Kroah-Hartman, Guenter Roeck, Heiko Carstens,
	Herbert Xu, H. Peter Anvin, Ingo Molnar, Ingo Molnar,
	Jakub Kicinski, Jason Wang, Jean Delvare, Jiri Kosina, Jiri Olsa,
	Joe Lawrence, Joel Fernandes, Johannes Weiner, John Stultz,
	Jonathan Corbet, Josh Poimboeuf, Josh Triplett, Julian Wiedmann,
	Juri Lelli, Karol Herbst, Karsten Graul, kvm-ppc, Lai Jiangshan,
	Len Brown, Len Brown, Leo Yan, linux-acpi, linux-arm-kernel,
	linux-crypto, linux-doc, linux-edac, linux-hwmon, linux-mips,
	linux-mm, linux-pm, linuxppc-dev, linux-raid, linux-s390,
	live-patching, Mark Gross, Mark Rutland, Mathieu Desnoyers,
	Mathieu Poirier, Mel Gorman, Michael Ellerman,
	Michael S. Tsirkin, Mike Leach, Mike Travis, Miroslav Benes,
	Namhyung Kim, netdev, nouveau, Paul E. McKenney, Paul Mackerras,
	Pavel Machek, Pekka Paalanen, Petr Mladek, platform-driver-x86,
	Rafael J. Wysocki, rcu, virtualization, x86

Hi Sebastien,

On 8/3/21 4:15 PM, Sebastian Andrzej Siewior wrote:
> This is a tree wide replacement of the deprecated CPU hotplug functions
> which are only wrappers around the actual functions.
> 
> Each patch is independent and can be picked up by the relevant maintainer.

Ok; and I take it that then also is the plan for merging these ?

FWIW I'm fine with the drivers/platform/x86 patch going upstream
through some other tree if its easier to keep the set together ...

Regards,

Hans



> 
> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> Cc: Amit Kucheria <amitk@kernel.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Andy Lutomirski <luto@kernel.org>
> Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Ben Segall <bsegall@google.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: cgroups@vger.kernel.org
> Cc: Christian Borntraeger <borntraeger@de.ibm.com>
> Cc: coresight@lists.linaro.org
> Cc: Daniel Bristot de Oliveira <bristot@redhat.com>
> Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> Cc: Dave Hansen <dave.hansen@linux.intel.com>
> Cc: Davidlohr Bueso <dave@stgolabs.net>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
> Cc: Gonglei <arei.gonglei@huawei.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Hans de Goede <hdegoede@redhat.com>
> Cc: Heiko Carstens <hca@linux.ibm.com>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: Jean Delvare <jdelvare@suse.com>
> Cc: Jiri Kosina <jikos@kernel.org>
> Cc: Jiri Olsa <jolsa@redhat.com>
> Cc: Joe Lawrence <joe.lawrence@redhat.com>
> Cc: Joel Fernandes <joel@joelfernandes.org>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Cc: John Stultz <john.stultz@linaro.org>
> Cc: Jonathan Corbet <corbet@lwn.net>
> Cc: Josh Poimboeuf <jpoimboe@redhat.com>
> Cc: Josh Triplett <josh@joshtriplett.org>
> Cc: Julian Wiedmann <jwi@linux.ibm.com>
> Cc: Juri Lelli <juri.lelli@redhat.com>
> Cc: Karol Herbst <karolherbst@gmail.com>
> Cc: Karsten Graul <kgraul@linux.ibm.com>
> Cc: kvm-ppc@vger.kernel.org
> Cc: Lai Jiangshan <jiangshanlai@gmail.com>
> Cc: Len Brown <lenb@kernel.org>
> Cc: Len Brown <len.brown@intel.com>
> Cc: Leo Yan <leo.yan@linaro.org>
> Cc: linux-acpi@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-crypto@vger.kernel.org
> Cc: linux-doc@vger.kernel.org
> Cc: linux-edac@vger.kernel.org
> Cc: linux-hwmon@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-mips@vger.kernel.org
> Cc: linux-mm@kvack.org
> Cc: linux-pm@vger.kernel.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: linux-raid@vger.kernel.org
> Cc: linux-s390@vger.kernel.org
> Cc: live-patching@vger.kernel.org
> Cc: Mark Gross <mgross@linux.intel.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Cc: Mel Gorman <mgorman@suse.de>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: Mike Leach <mike.leach@linaro.org>
> Cc: Mike Travis <mike.travis@hpe.com>
> Cc: Miroslav Benes <mbenes@suse.cz>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: netdev@vger.kernel.org
> Cc: nouveau@lists.freedesktop.org
> Cc: "Paul E. McKenney" <paulmck@kernel.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Pavel Machek <pavel@ucw.cz>
> Cc: Pekka Paalanen <ppaalanen@gmail.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Petr Mladek <pmladek@suse.com>
> Cc: platform-driver-x86@vger.kernel.org
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> Cc: rcu@vger.kernel.org
> Cc: Robin Holt <robinmholt@gmail.com>
> Cc: Song Liu <song@kernel.org>
> Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> Cc: Steffen Klassert <steffen.klassert@secunet.com>
> Cc: Stephen Boyd <sboyd@kernel.org>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Steve Wahl <steve.wahl@hpe.com>
> Cc: Stuart Hayes <stuart.w.hayes@gmail.com>
> Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
> Cc: Tejun Heo <tj@kernel.org>
> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Tony Luck <tony.luck@intel.com>
> Cc: Vasily Gorbik <gor@linux.ibm.com>
> Cc: Vincent Guittot <vincent.guittot@linaro.org>
> Cc: Viresh Kumar <viresh.kumar@linaro.org>
> Cc: virtualization@lists.linux-foundation.org
> Cc: x86@kernel.org
> Cc: Zefan Li <lizefan.x@bytedance.com>
> Cc: Zhang Rui <rui.zhang@intel.com>
> 
> Sebastian
> 


^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 04/38] s390: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 ` [PATCH 04/38] s390: " Sebastian Andrzej Siewior
@ 2021-08-03 15:40   ` Heiko Carstens
  0 siblings, 0 replies; 94+ messages in thread
From: Heiko Carstens @ 2021-08-03 15:40 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: linux-kernel, tglx, Peter Zijlstra, linux-s390, Vasily Gorbik,
	Christian Borntraeger

On Tue, Aug 03, 2021 at 04:15:47PM +0200, Sebastian Andrzej Siewior wrote:
> The functions get_online_cpus() and put_online_cpus() have been
> deprecated during the CPU hotplug rework. They map directly to
> cpus_read_lock() and cpus_read_unlock().
> 
> Replace deprecated CPU-hotplug functions with the official version.
> The behavior remains unchanged.
> 
> Cc: linux-s390@vger.kernel.org
> Cc: Heiko Carstens <hca@linux.ibm.com>
> Cc: Vasily Gorbik <gor@linux.ibm.com>
> Cc: Christian Borntraeger <borntraeger@de.ibm.com>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>  arch/s390/hypfs/hypfs_diag0c.c  | 10 +++++-----
>  arch/s390/kernel/diag.c         |  4 ++--
>  arch/s390/kernel/irq.c          |  4 ++--
>  arch/s390/kernel/perf_cpum_cf.c |  4 ++--
>  arch/s390/kernel/processor.c    |  4 ++--
>  arch/s390/kernel/smp.c          |  8 ++++----
>  arch/s390/kernel/topology.c     |  4 ++--
>  arch/s390/mm/maccess.c          |  4 ++--
>  8 files changed, 21 insertions(+), 21 deletions(-)

Applied, thanks!

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 05/38] s390/sclp: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 ` [PATCH 05/38] s390/sclp: " Sebastian Andrzej Siewior
@ 2021-08-03 15:40   ` Heiko Carstens
  0 siblings, 0 replies; 94+ messages in thread
From: Heiko Carstens @ 2021-08-03 15:40 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: linux-kernel, tglx, Peter Zijlstra, Vasily Gorbik,
	Christian Borntraeger, linux-s390

On Tue, Aug 03, 2021 at 04:15:48PM +0200, Sebastian Andrzej Siewior wrote:
> The functions get_online_cpus() and put_online_cpus() have been
> deprecated during the CPU hotplug rework. They map directly to
> cpus_read_lock() and cpus_read_unlock().
> 
> Replace deprecated CPU-hotplug functions with the official version.
> The behavior remains unchanged.
> 
> Cc: Heiko Carstens <hca@linux.ibm.com>
> Cc: Vasily Gorbik <gor@linux.ibm.com>
> Cc: Christian Borntraeger <borntraeger@de.ibm.com>
> Cc: linux-s390@vger.kernel.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>  drivers/s390/char/sclp_config.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied, thanks!

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 14/38] coresight: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 ` [PATCH 14/38] coresight: " Sebastian Andrzej Siewior
@ 2021-08-03 15:52   ` Mathieu Poirier
  0 siblings, 0 replies; 94+ messages in thread
From: Mathieu Poirier @ 2021-08-03 15:52 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: linux-kernel, tglx, Peter Zijlstra, Suzuki K Poulose, Mike Leach,
	Leo Yan, Alexander Shishkin, coresight, linux-arm-kernel

On Tue, Aug 03, 2021 at 04:15:57PM +0200, Sebastian Andrzej Siewior wrote:
> The functions get_online_cpus() and put_online_cpus() have been
> deprecated during the CPU hotplug rework. They map directly to
> cpus_read_lock() and cpus_read_unlock().
> 
> Replace deprecated CPU-hotplug functions with the official version.
> The behavior remains unchanged.
> 
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
> Cc: Mike Leach <mike.leach@linaro.org>
> Cc: Leo Yan <leo.yan@linaro.org>
> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> Cc: coresight@lists.linaro.org
> Cc: linux-arm-kernel@lists.infradead.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>  drivers/hwtracing/coresight/coresight-cpu-debug.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-cpu-debug.c b/drivers/hwtracing/coresight/coresight-cpu-debug.c
> index 9731d3a960735..00de46565bc40 100644
> --- a/drivers/hwtracing/coresight/coresight-cpu-debug.c
> +++ b/drivers/hwtracing/coresight/coresight-cpu-debug.c
> @@ -588,11 +588,11 @@ static int debug_probe(struct amba_device *adev, const struct amba_id *id)
>  
>  	drvdata->base = base;
>  
> -	get_online_cpus();
> +	cpus_read_lock();
>  	per_cpu(debug_drvdata, drvdata->cpu) = drvdata;
>  	ret = smp_call_function_single(drvdata->cpu, debug_init_arch_data,
>  				       drvdata, 1);
> -	put_online_cpus();
> +	cpus_read_unlock();
>

Applied - thanks,
Mathieu

>  	if (ret) {
>  		dev_err(dev, "CPU%d debug arch init failed\n", drvdata->cpu);
> -- 
> 2.32.0
> 

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 16/38] sgi-xpc: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 ` [PATCH 16/38] sgi-xpc: " Sebastian Andrzej Siewior
@ 2021-08-03 15:54   ` Steve Wahl
  2021-08-03 21:30   ` Robin Holt
  1 sibling, 0 replies; 94+ messages in thread
From: Steve Wahl @ 2021-08-03 15:54 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: linux-kernel, tglx, Peter Zijlstra, Robin Holt, Steve Wahl,
	Mike Travis, Arnd Bergmann, Greg Kroah-Hartman

Reviewed-by: Steve Wahl <steve.wahl@hpe.com>

On Tue, Aug 03, 2021 at 04:15:59PM +0200, Sebastian Andrzej Siewior wrote:
> The functions get_online_cpus() and put_online_cpus() have been
> deprecated during the CPU hotplug rework. They map directly to
> cpus_read_lock() and cpus_read_unlock().
> 
> Replace deprecated CPU-hotplug functions with the official version.
> The behavior remains unchanged.
> 
> Cc: Robin Holt <robinmholt@gmail.com>
> Cc: Steve Wahl <steve.wahl@hpe.com>
> Cc: Mike Travis <mike.travis@hpe.com>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>  drivers/misc/sgi-xp/xpc_uv.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c
> index 7791bde81a368..ba9ae0e2df0fe 100644
> --- a/drivers/misc/sgi-xp/xpc_uv.c
> +++ b/drivers/misc/sgi-xp/xpc_uv.c
> @@ -1742,7 +1742,7 @@ xpc_init_mq_node(int nid)
>  {
>  	int cpu;
>  
> -	get_online_cpus();
> +	cpus_read_lock();
>  
>  	for_each_cpu(cpu, cpumask_of_node(nid)) {
>  		xpc_activate_mq_uv =
> @@ -1753,7 +1753,7 @@ xpc_init_mq_node(int nid)
>  			break;
>  	}
>  	if (IS_ERR(xpc_activate_mq_uv)) {
> -		put_online_cpus();
> +		cpus_read_unlock();
>  		return PTR_ERR(xpc_activate_mq_uv);
>  	}
>  
> @@ -1767,11 +1767,11 @@ xpc_init_mq_node(int nid)
>  	}
>  	if (IS_ERR(xpc_notify_mq_uv)) {
>  		xpc_destroy_gru_mq_uv(xpc_activate_mq_uv);
> -		put_online_cpus();
> +		cpus_read_unlock();
>  		return PTR_ERR(xpc_notify_mq_uv);
>  	}
>  
> -	put_online_cpus();
> +	cpus_read_unlock();
>  	return 0;
>  }
>  
> -- 
> 2.32.0
> 

-- 
Steve Wahl, Hewlett Packard Enterprise

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 31/38] rcu: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:16 ` [PATCH 31/38] rcu: " Sebastian Andrzej Siewior
@ 2021-08-03 16:00   ` Paul E. McKenney
  2021-08-10 12:42     ` Thomas Gleixner
  0 siblings, 1 reply; 94+ messages in thread
From: Paul E. McKenney @ 2021-08-03 16:00 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: linux-kernel, tglx, Peter Zijlstra, Josh Triplett,
	Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan, Joel Fernandes,
	rcu

On Tue, Aug 03, 2021 at 04:16:14PM +0200, Sebastian Andrzej Siewior wrote:
> The functions get_online_cpus() and put_online_cpus() have been
> deprecated during the CPU hotplug rework. They map directly to
> cpus_read_lock() and cpus_read_unlock().
> 
> Replace deprecated CPU-hotplug functions with the official version.
> The behavior remains unchanged.
> 
> Cc: "Paul E. McKenney" <paulmck@kernel.org>
> Cc: Josh Triplett <josh@joshtriplett.org>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> Cc: Lai Jiangshan <jiangshanlai@gmail.com>
> Cc: Joel Fernandes <joel@joelfernandes.org>
> Cc: rcu@vger.kernel.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

I have queued this one and 35/38 (rcutorture) for v5.16.  If you would
prefer to send them some other route, please let me know and:

Acked-by: Paul E. McKenney <paulmck@kernel.org>

> ---
>  kernel/rcu/tree.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index 51f24ecd94b26..f116ce58f4e68 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -4050,7 +4050,7 @@ void rcu_barrier(void)
>  	 */
>  	init_completion(&rcu_state.barrier_completion);
>  	atomic_set(&rcu_state.barrier_cpu_count, 2);
> -	get_online_cpus();
> +	cpus_read_lock();
>  
>  	/*
>  	 * Force each CPU with callbacks to register a new callback.
> @@ -4081,7 +4081,7 @@ void rcu_barrier(void)
>  					  rcu_state.barrier_sequence);
>  		}
>  	}
> -	put_online_cpus();
> +	cpus_read_unlock();
>  
>  	/*
>  	 * Now that we have an rcu_barrier_callback() callback on each
> -- 
> 2.32.0
> 

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 00/38] Replace deprecated CPU-hotplug
  2021-08-03 15:30 ` [PATCH 00/38] Replace deprecated CPU-hotplug Hans de Goede
@ 2021-08-03 16:10   ` Sebastian Andrzej Siewior
  0 siblings, 0 replies; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-03 16:10 UTC (permalink / raw)
  To: Hans de Goede
  Cc: linux-kernel, tglx, Peter Zijlstra, Alexander Shishkin,
	Amit Kucheria, Andrew Morton, Andy Lutomirski,
	Arnaldo Carvalho de Melo, Arnd Bergmann, Benjamin Herrenschmidt,
	Ben Segall, Borislav Petkov, cgroups, Christian Borntraeger,
	coresight, Daniel Bristot de Oliveira, Daniel Jordan,
	Daniel Lezcano, Dave Hansen, Davidlohr Bueso, David S. Miller,
	Dietmar Eggemann, Gonglei, Greg Kroah-Hartman, Guenter Roeck,
	Heiko Carstens, Herbert Xu, H. Peter Anvin, Ingo Molnar,
	Ingo Molnar, Jakub Kicinski, Jason Wang, Jean Delvare,
	Jiri Kosina, Jiri Olsa, Joe Lawrence, Joel Fernandes,
	Johannes Weiner, John Stultz, Jonathan Corbet, Josh Poimboeuf,
	Josh Triplett, Julian Wiedmann, Juri Lelli, Karol Herbst,
	Karsten Graul, kvm-ppc, Lai Jiangshan, Len Brown, Len Brown,
	Leo Yan, linux-acpi, linux-arm-kernel, linux-crypto, linux-doc,
	linux-edac, linux-hwmon, linux-mips, linux-mm, linux-pm,
	linuxppc-dev, linux-raid, linux-s390, live-patching, Mark Gross,
	Mark Rutland, Mathieu Desnoyers, Mathieu Poirier, Mel Gorman,
	Michael Ellerman, Michael S. Tsirkin, Mike Leach, Mike Travis,
	Miroslav Benes, Namhyung Kim, netdev, nouveau, Paul E. McKenney,
	Paul Mackerras, Pavel Machek, Pekka Paalanen, Petr Mladek,
	platform-driver-x86, Rafael J. Wysocki, rcu, virtualization, x86

On 2021-08-03 17:30:40 [+0200], Hans de Goede wrote:
> Hi Sebastien,
Hi Hans,

> On 8/3/21 4:15 PM, Sebastian Andrzej Siewior wrote:
> > This is a tree wide replacement of the deprecated CPU hotplug functions
> > which are only wrappers around the actual functions.
> > 
> > Each patch is independent and can be picked up by the relevant maintainer.
> 
> Ok; and I take it that then also is the plan for merging these ?
> 
> FWIW I'm fine with the drivers/platform/x86 patch going upstream
> through some other tree if its easier to keep the set together ...

There is no need to keep that set together since each patch is
independent. Please merge it through your tree.

> Regards,
> 
> Hans

Sebastian

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 16/38] sgi-xpc: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 ` [PATCH 16/38] sgi-xpc: " Sebastian Andrzej Siewior
  2021-08-03 15:54   ` Steve Wahl
@ 2021-08-03 21:30   ` Robin Holt
  1 sibling, 0 replies; 94+ messages in thread
From: Robin Holt @ 2021-08-03 21:30 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: LKML, Thomas Gleixner, Peter Zijlstra, Steve Wahl, Mike Travis,
	Arnd Bergmann, Greg Kroah-Hartman

> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Robin Holt <robinmholt@gmail.com

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 06/38] x86/mmiotrace: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 ` [PATCH 06/38] x86/mmiotrace: " Sebastian Andrzej Siewior
  2021-08-03 15:03   ` [Nouveau] " Karol Herbst
@ 2021-08-04  1:07   ` Steven Rostedt
  2021-08-10 12:52   ` [tip: x86/cleanups] " tip-bot2 for Sebastian Andrzej Siewior
  2 siblings, 0 replies; 94+ messages in thread
From: Steven Rostedt @ 2021-08-04  1:07 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: linux-kernel, tglx, Peter Zijlstra, Ingo Molnar, Karol Herbst,
	Pekka Paalanen, Dave Hansen, Andy Lutomirski, Borislav Petkov,
	x86, H. Peter Anvin, nouveau

On Tue,  3 Aug 2021 16:15:49 +0200
Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:

> The functions get_online_cpus() and put_online_cpus() have been
> deprecated during the CPU hotplug rework. They map directly to
> cpus_read_lock() and cpus_read_unlock().
> 
> Replace deprecated CPU-hotplug functions with the official version.
> The behavior remains unchanged.
> 
> Cc: Steven Rostedt <rostedt@goodmis.org>

Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

-- Steve

> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Karol Herbst <karolherbst@gmail.com>
> Cc: Pekka Paalanen <ppaalanen@gmail.com>
> Cc: Dave Hansen <dave.hansen@linux.intel.com>
> Cc: Andy Lutomirski <luto@kernel.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: x86@kernel.org
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: nouveau@lists.freedesktop.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>  arch/x86/mm/mmio-mod.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c
> index cd768dafca9e9..933a2ebad471b 100644
> --- a/arch/x86/mm/mmio-mod.c
> +++ b/arch/x86/mm/mmio-mod.c
> @@ -376,12 +376,12 @@ static void enter_uniprocessor(void)
>  		goto out;
>  	}
>  
> -	get_online_cpus();
> +	cpus_read_lock();
>  	cpumask_copy(downed_cpus, cpu_online_mask);
>  	cpumask_clear_cpu(cpumask_first(cpu_online_mask), downed_cpus);
>  	if (num_online_cpus() > 1)
>  		pr_notice("Disabling non-boot CPUs...\n");
> -	put_online_cpus();
> +	cpus_read_unlock();
>  
>  	for_each_cpu(cpu, downed_cpus) {
>  		err = remove_cpu(cpu);


^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 37/38] workqueue: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:16 ` [PATCH 37/38] workqueue: " Sebastian Andrzej Siewior
@ 2021-08-04  1:36   ` Lai Jiangshan
  2021-08-09 22:33   ` Tejun Heo
  1 sibling, 0 replies; 94+ messages in thread
From: Lai Jiangshan @ 2021-08-04  1:36 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: LKML, Thomas Gleixner, Peter Zijlstra, Tejun Heo

On Tue, Aug 3, 2021 at 10:17 PM Sebastian Andrzej Siewior
<bigeasy@linutronix.de> wrote:
>
> The functions get_online_cpus() and put_online_cpus() have been
> deprecated during the CPU hotplug rework. They map directly to
> cpus_read_lock() and cpus_read_unlock().
>
> Replace deprecated CPU-hotplug functions with the official version.
> The behavior remains unchanged.
>
> Cc: Tejun Heo <tj@kernel.org>
> Cc: Lai Jiangshan <jiangshanlai@gmail.com>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---


Reviewed-by: Lai Jiangshan <jiangshanlai@gmail.com>

>  kernel/workqueue.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index f148eacda55a9..f967aa4050d08 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -3293,7 +3293,7 @@ int schedule_on_each_cpu(work_func_t func)
>         if (!works)
>                 return -ENOMEM;
>
> -       get_online_cpus();
> +       cpus_read_lock();
>
>         for_each_online_cpu(cpu) {
>                 struct work_struct *work = per_cpu_ptr(works, cpu);
> @@ -3305,7 +3305,7 @@ int schedule_on_each_cpu(work_func_t func)
>         for_each_online_cpu(cpu)
>                 flush_work(per_cpu_ptr(works, cpu));
>
> -       put_online_cpus();
> +       cpus_read_unlock();
>         free_percpu(works);
>         return 0;
>  }
> @@ -4016,14 +4016,14 @@ static void apply_wqattrs_commit(struct apply_wqattrs_ctx *ctx)
>  static void apply_wqattrs_lock(void)
>  {
>         /* CPUs should stay stable across pwq creations and installations */
> -       get_online_cpus();
> +       cpus_read_lock();
>         mutex_lock(&wq_pool_mutex);
>  }
>
>  static void apply_wqattrs_unlock(void)
>  {
>         mutex_unlock(&wq_pool_mutex);
> -       put_online_cpus();
> +       cpus_read_unlock();
>  }
>
>  static int apply_workqueue_attrs_locked(struct workqueue_struct *wq,
> @@ -4068,7 +4068,7 @@ static int apply_workqueue_attrs_locked(struct workqueue_struct *wq,
>   *
>   * Performs GFP_KERNEL allocations.
>   *
> - * Assumes caller has CPU hotplug read exclusion, i.e. get_online_cpus().
> + * Assumes caller has CPU hotplug read exclusion, i.e. cpus_read_lock().
>   *
>   * Return: 0 on success and -errno on failure.
>   */
> @@ -4196,7 +4196,7 @@ static int alloc_and_link_pwqs(struct workqueue_struct *wq)
>                 return 0;
>         }
>
> -       get_online_cpus();
> +       cpus_read_lock();
>         if (wq->flags & __WQ_ORDERED) {
>                 ret = apply_workqueue_attrs(wq, ordered_wq_attrs[highpri]);
>                 /* there should only be single pwq for ordering guarantee */
> @@ -4206,7 +4206,7 @@ static int alloc_and_link_pwqs(struct workqueue_struct *wq)
>         } else {
>                 ret = apply_workqueue_attrs(wq, unbound_std_wq_attrs[highpri]);
>         }
> -       put_online_cpus();
> +       cpus_read_unlock();
>
>         return ret;
>  }
> @@ -5168,10 +5168,10 @@ long work_on_cpu_safe(int cpu, long (*fn)(void *), void *arg)
>  {
>         long ret = -ENODEV;
>
> -       get_online_cpus();
> +       cpus_read_lock();
>         if (cpu_online(cpu))
>                 ret = work_on_cpu(cpu, fn, arg);
> -       put_online_cpus();
> +       cpus_read_unlock();
>         return ret;
>  }
>  EXPORT_SYMBOL_GPL(work_on_cpu_safe);
> @@ -5443,7 +5443,7 @@ static ssize_t wq_pool_ids_show(struct device *dev,
>         const char *delim = "";
>         int node, written = 0;
>
> -       get_online_cpus();
> +       cpus_read_lock();
>         rcu_read_lock();
>         for_each_node(node) {
>                 written += scnprintf(buf + written, PAGE_SIZE - written,
> @@ -5453,7 +5453,7 @@ static ssize_t wq_pool_ids_show(struct device *dev,
>         }
>         written += scnprintf(buf + written, PAGE_SIZE - written, "\n");
>         rcu_read_unlock();
> -       put_online_cpus();
> +       cpus_read_unlock();
>
>         return written;
>  }
> --
> 2.32.0
>

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 36/38] tracing: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:16 ` [PATCH 36/38] tracing: " Sebastian Andrzej Siewior
  2021-08-03 15:16   ` Daniel Bristot de Oliveira
@ 2021-08-04  2:26   ` Steven Rostedt
  2021-08-10 13:34     ` Sebastian Andrzej Siewior
  1 sibling, 1 reply; 94+ messages in thread
From: Steven Rostedt @ 2021-08-04  2:26 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior; +Cc: linux-kernel, tglx, Peter Zijlstra, Ingo Molnar

On Tue,  3 Aug 2021 16:16:19 +0200
Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:

> The functions get_online_cpus() and put_online_cpus() have been
> deprecated during the CPU hotplug rework. They map directly to
> cpus_read_lock() and cpus_read_unlock().
> 
> Replace deprecated CPU-hotplug functions with the official version.
> The behavior remains unchanged.
> 
> Cc: Steven Rostedt <rostedt@goodmis.org>

Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

-- Steve

> Cc: Ingo Molnar <mingo@redhat.com>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> 

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 22/38] net/af_iucv: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:16 ` [PATCH 22/38] net/af_iucv: " Sebastian Andrzej Siewior
@ 2021-08-04  6:36   ` Julian Wiedmann
  0 siblings, 0 replies; 94+ messages in thread
From: Julian Wiedmann @ 2021-08-04  6:36 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior, linux-kernel
  Cc: tglx, Peter Zijlstra, Karsten Graul, David S. Miller,
	Jakub Kicinski, linux-s390, netdev

On 03.08.21 17:16, Sebastian Andrzej Siewior wrote:
> The functions get_online_cpus() and put_online_cpus() have been
> deprecated during the CPU hotplug rework. They map directly to
> cpus_read_lock() and cpus_read_unlock().
> 
> Replace deprecated CPU-hotplug functions with the official version.
> The behavior remains unchanged.
> 
> Cc: Julian Wiedmann <jwi@linux.ibm.com>
> Cc: Karsten Graul <kgraul@linux.ibm.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Cc: linux-s390@vger.kernel.org
> Cc: netdev@vger.kernel.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>  net/iucv/iucv.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 

Applied, thanks.

I fixed up the subject to say "net/iucv: ...", as the change is in
the iucv base-layer and not the socket code.

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 26/38] livepatch: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:16 ` [PATCH 26/38] livepatch: " Sebastian Andrzej Siewior
@ 2021-08-04  7:52   ` Petr Mladek
  2021-08-19 10:01     ` Jiri Kosina
  0 siblings, 1 reply; 94+ messages in thread
From: Petr Mladek @ 2021-08-04  7:52 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: linux-kernel, tglx, Peter Zijlstra, Josh Poimboeuf, Jiri Kosina,
	Miroslav Benes, Joe Lawrence, live-patching

On Tue 2021-08-03 16:16:09, Sebastian Andrzej Siewior wrote:
> The functions get_online_cpus() and put_online_cpus() have been
> deprecated during the CPU hotplug rework. They map directly to
> cpus_read_lock() and cpus_read_unlock().
> 
> Replace deprecated CPU-hotplug functions with the official version.
> The behavior remains unchanged.
> 
> Cc: Josh Poimboeuf <jpoimboe@redhat.com>
> Cc: Jiri Kosina <jikos@kernel.org>
> Cc: Miroslav Benes <mbenes@suse.cz>
> Cc: Petr Mladek <pmladek@suse.com>
> Cc: Joe Lawrence <joe.lawrence@redhat.com>
> Cc: live-patching@vger.kernel.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Reviewed-by: Petr Mladek <pmladek@suse.com>

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 27/38] padata: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:16 ` [PATCH 27/38] padata: " Sebastian Andrzej Siewior
@ 2021-08-04 14:52   ` Daniel Jordan
  2021-08-12 11:36   ` Herbert Xu
  1 sibling, 0 replies; 94+ messages in thread
From: Daniel Jordan @ 2021-08-04 14:52 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: linux-kernel, tglx, Peter Zijlstra, Steffen Klassert, linux-crypto

On Tue, Aug 03, 2021 at 04:16:10PM +0200, Sebastian Andrzej Siewior wrote:
> The functions get_online_cpus() and put_online_cpus() have been
> deprecated during the CPU hotplug rework. They map directly to
> cpus_read_lock() and cpus_read_unlock().
> 
> Replace deprecated CPU-hotplug functions with the official version.
> The behavior remains unchanged.
> 
> Cc: Steffen Klassert <steffen.klassert@secunet.com>
> Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
> Cc: linux-crypto@vger.kernel.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Satisfying to see the old wrappers finally go away.

Acked-by: Daniel Jordan <daniel.m.jordan@oracle.com>

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 18/38] powercap: intel_rapl: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:16 ` [PATCH 18/38] powercap: intel_rapl: " Sebastian Andrzej Siewior
@ 2021-08-04 18:14   ` Rafael J. Wysocki
  0 siblings, 0 replies; 94+ messages in thread
From: Rafael J. Wysocki @ 2021-08-04 18:14 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: Linux Kernel Mailing List, Thomas Gleixner, Peter Zijlstra,
	Rafael J. Wysocki, Linux PM

On Tue, Aug 3, 2021 at 4:17 PM Sebastian Andrzej Siewior
<bigeasy@linutronix.de> wrote:
>
> The functions get_online_cpus() and put_online_cpus() have been
> deprecated during the CPU hotplug rework. They map directly to
> cpus_read_lock() and cpus_read_unlock().
>
> Replace deprecated CPU-hotplug functions with the official version.
> The behavior remains unchanged.
>
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> Cc: linux-pm@vger.kernel.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>  drivers/powercap/intel_rapl_common.c | 50 ++++++++++++++--------------
>  1 file changed, 25 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/powercap/intel_rapl_common.c b/drivers/powercap/intel_rapl_common.c
> index 73cf68af97700..7c0099e7a6d72 100644
> --- a/drivers/powercap/intel_rapl_common.c
> +++ b/drivers/powercap/intel_rapl_common.c
> @@ -158,16 +158,16 @@ static int get_energy_counter(struct powercap_zone *power_zone,
>         /* prevent CPU hotplug, make sure the RAPL domain does not go
>          * away while reading the counter.
>          */
> -       get_online_cpus();
> +       cpus_read_lock();
>         rd = power_zone_to_rapl_domain(power_zone);
>
>         if (!rapl_read_data_raw(rd, ENERGY_COUNTER, true, &energy_now)) {
>                 *energy_raw = energy_now;
> -               put_online_cpus();
> +               cpus_read_unlock();
>
>                 return 0;
>         }
> -       put_online_cpus();
> +       cpus_read_unlock();
>
>         return -EIO;
>  }
> @@ -216,11 +216,11 @@ static int set_domain_enable(struct powercap_zone *power_zone, bool mode)
>         if (rd->state & DOMAIN_STATE_BIOS_LOCKED)
>                 return -EACCES;
>
> -       get_online_cpus();
> +       cpus_read_lock();
>         rapl_write_data_raw(rd, PL1_ENABLE, mode);
>         if (rapl_defaults->set_floor_freq)
>                 rapl_defaults->set_floor_freq(rd, mode);
> -       put_online_cpus();
> +       cpus_read_unlock();
>
>         return 0;
>  }
> @@ -234,13 +234,13 @@ static int get_domain_enable(struct powercap_zone *power_zone, bool *mode)
>                 *mode = false;
>                 return 0;
>         }
> -       get_online_cpus();
> +       cpus_read_lock();
>         if (rapl_read_data_raw(rd, PL1_ENABLE, true, &val)) {
> -               put_online_cpus();
> +               cpus_read_unlock();
>                 return -EIO;
>         }
>         *mode = val;
> -       put_online_cpus();
> +       cpus_read_unlock();
>
>         return 0;
>  }
> @@ -317,7 +317,7 @@ static int set_power_limit(struct powercap_zone *power_zone, int cid,
>         int ret = 0;
>         int id;
>
> -       get_online_cpus();
> +       cpus_read_lock();
>         rd = power_zone_to_rapl_domain(power_zone);
>         id = contraint_to_pl(rd, cid);
>         if (id < 0) {
> @@ -350,7 +350,7 @@ static int set_power_limit(struct powercap_zone *power_zone, int cid,
>         if (!ret)
>                 package_power_limit_irq_save(rp);
>  set_exit:
> -       put_online_cpus();
> +       cpus_read_unlock();
>         return ret;
>  }
>
> @@ -363,7 +363,7 @@ static int get_current_power_limit(struct powercap_zone *power_zone, int cid,
>         int ret = 0;
>         int id;
>
> -       get_online_cpus();
> +       cpus_read_lock();
>         rd = power_zone_to_rapl_domain(power_zone);
>         id = contraint_to_pl(rd, cid);
>         if (id < 0) {
> @@ -382,7 +382,7 @@ static int get_current_power_limit(struct powercap_zone *power_zone, int cid,
>                 prim = POWER_LIMIT4;
>                 break;
>         default:
> -               put_online_cpus();
> +               cpus_read_unlock();
>                 return -EINVAL;
>         }
>         if (rapl_read_data_raw(rd, prim, true, &val))
> @@ -391,7 +391,7 @@ static int get_current_power_limit(struct powercap_zone *power_zone, int cid,
>                 *data = val;
>
>  get_exit:
> -       put_online_cpus();
> +       cpus_read_unlock();
>
>         return ret;
>  }
> @@ -403,7 +403,7 @@ static int set_time_window(struct powercap_zone *power_zone, int cid,
>         int ret = 0;
>         int id;
>
> -       get_online_cpus();
> +       cpus_read_lock();
>         rd = power_zone_to_rapl_domain(power_zone);
>         id = contraint_to_pl(rd, cid);
>         if (id < 0) {
> @@ -423,7 +423,7 @@ static int set_time_window(struct powercap_zone *power_zone, int cid,
>         }
>
>  set_time_exit:
> -       put_online_cpus();
> +       cpus_read_unlock();
>         return ret;
>  }
>
> @@ -435,7 +435,7 @@ static int get_time_window(struct powercap_zone *power_zone, int cid,
>         int ret = 0;
>         int id;
>
> -       get_online_cpus();
> +       cpus_read_lock();
>         rd = power_zone_to_rapl_domain(power_zone);
>         id = contraint_to_pl(rd, cid);
>         if (id < 0) {
> @@ -458,14 +458,14 @@ static int get_time_window(struct powercap_zone *power_zone, int cid,
>                 val = 0;
>                 break;
>         default:
> -               put_online_cpus();
> +               cpus_read_unlock();
>                 return -EINVAL;
>         }
>         if (!ret)
>                 *data = val;
>
>  get_time_exit:
> -       put_online_cpus();
> +       cpus_read_unlock();
>
>         return ret;
>  }
> @@ -491,7 +491,7 @@ static int get_max_power(struct powercap_zone *power_zone, int id, u64 *data)
>         int prim;
>         int ret = 0;
>
> -       get_online_cpus();
> +       cpus_read_lock();
>         rd = power_zone_to_rapl_domain(power_zone);
>         switch (rd->rpl[id].prim_id) {
>         case PL1_ENABLE:
> @@ -504,7 +504,7 @@ static int get_max_power(struct powercap_zone *power_zone, int id, u64 *data)
>                 prim = MAX_POWER;
>                 break;
>         default:
> -               put_online_cpus();
> +               cpus_read_unlock();
>                 return -EINVAL;
>         }
>         if (rapl_read_data_raw(rd, prim, true, &val))
> @@ -516,7 +516,7 @@ static int get_max_power(struct powercap_zone *power_zone, int id, u64 *data)
>         if (rd->rpl[id].prim_id == PL4_ENABLE)
>                 *data = *data * 2;
>
> -       put_online_cpus();
> +       cpus_read_unlock();
>
>         return ret;
>  }
> @@ -1358,7 +1358,7 @@ static void power_limit_state_save(void)
>         struct rapl_domain *rd;
>         int nr_pl, ret, i;
>
> -       get_online_cpus();
> +       cpus_read_lock();
>         list_for_each_entry(rp, &rapl_packages, plist) {
>                 if (!rp->power_zone)
>                         continue;
> @@ -1390,7 +1390,7 @@ static void power_limit_state_save(void)
>                         }
>                 }
>         }
> -       put_online_cpus();
> +       cpus_read_unlock();
>  }
>
>  static void power_limit_state_restore(void)
> @@ -1399,7 +1399,7 @@ static void power_limit_state_restore(void)
>         struct rapl_domain *rd;
>         int nr_pl, i;
>
> -       get_online_cpus();
> +       cpus_read_lock();
>         list_for_each_entry(rp, &rapl_packages, plist) {
>                 if (!rp->power_zone)
>                         continue;
> @@ -1425,7 +1425,7 @@ static void power_limit_state_restore(void)
>                         }
>                 }
>         }
> -       put_online_cpus();
> +       cpus_read_unlock();
>  }
>
>  static int rapl_pm_callback(struct notifier_block *nb,
> --

Applied as 5.15 material, thanks!

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 28/38] cpufreq: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:16 ` [PATCH 28/38] cpufreq: " Sebastian Andrzej Siewior
@ 2021-08-04 18:19   ` Rafael J. Wysocki
  0 siblings, 0 replies; 94+ messages in thread
From: Rafael J. Wysocki @ 2021-08-04 18:19 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: Linux Kernel Mailing List, Thomas Gleixner, Peter Zijlstra,
	Linux PM, Rafael J. Wysocki, Viresh Kumar, Srinivas Pandruvada,
	Len Brown, Michael Ellerman, Benjamin Herrenschmidt,
	Paul Mackerras

On Tue, Aug 3, 2021 at 4:17 PM Sebastian Andrzej Siewior
<bigeasy@linutronix.de> wrote:
>
> The functions get_online_cpus() and put_online_cpus() have been
> deprecated during the CPU hotplug rework. They map directly to
> cpus_read_lock() and cpus_read_unlock().
>
> Replace deprecated CPU-hotplug functions with the official version.
> The behavior remains unchanged.
>
> Cc: linux-pm@vger.kernel.org
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> Cc: Viresh Kumar <viresh.kumar@linaro.org>
> Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> Cc: Len Brown <lenb@kernel.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>  drivers/cpufreq/acpi-cpufreq.c     | 4 ++--
>  drivers/cpufreq/cpufreq.c          | 6 +++---
>  drivers/cpufreq/cpufreq_ondemand.c | 4 ++--
>  drivers/cpufreq/intel_pstate.c     | 4 ++--
>  drivers/cpufreq/powernow-k8.c      | 6 +++---
>  drivers/cpufreq/powernv-cpufreq.c  | 4 ++--
>  6 files changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
> index 7e7450453714d..b49612895c786 100644
> --- a/drivers/cpufreq/acpi-cpufreq.c
> +++ b/drivers/cpufreq/acpi-cpufreq.c
> @@ -163,9 +163,9 @@ static ssize_t store_cpb(struct cpufreq_policy *policy, const char *buf,
>         if (ret || val > 1)
>                 return -EINVAL;
>
> -       get_online_cpus();
> +       cpus_read_lock();
>         set_boost(policy, val);
> -       put_online_cpus();
> +       cpus_read_unlock();
>
>         return count;
>  }
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 45f3416988f1a..06c526d66dd38 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -2654,18 +2654,18 @@ int cpufreq_boost_trigger_state(int state)
>         cpufreq_driver->boost_enabled = state;
>         write_unlock_irqrestore(&cpufreq_driver_lock, flags);
>
> -       get_online_cpus();
> +       cpus_read_lock();
>         for_each_active_policy(policy) {
>                 ret = cpufreq_driver->set_boost(policy, state);
>                 if (ret)
>                         goto err_reset_state;
>         }
> -       put_online_cpus();
> +       cpus_read_unlock();
>
>         return 0;
>
>  err_reset_state:
> -       put_online_cpus();
> +       cpus_read_unlock();
>
>         write_lock_irqsave(&cpufreq_driver_lock, flags);
>         cpufreq_driver->boost_enabled = !state;
> diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
> index ac361a8b1d3bb..eb4320b619c9c 100644
> --- a/drivers/cpufreq/cpufreq_ondemand.c
> +++ b/drivers/cpufreq/cpufreq_ondemand.c
> @@ -418,7 +418,7 @@ static void od_set_powersave_bias(unsigned int powersave_bias)
>         default_powersave_bias = powersave_bias;
>         cpumask_clear(&done);
>
> -       get_online_cpus();
> +       cpus_read_lock();
>         for_each_online_cpu(cpu) {
>                 struct cpufreq_policy *policy;
>                 struct policy_dbs_info *policy_dbs;
> @@ -442,7 +442,7 @@ static void od_set_powersave_bias(unsigned int powersave_bias)
>                 od_tuners = dbs_data->tuners;
>                 od_tuners->powersave_bias = default_powersave_bias;
>         }
> -       put_online_cpus();
> +       cpus_read_unlock();
>  }
>
>  void od_register_powersave_bias_handler(unsigned int (*f)
> diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
> index bb4549959b113..2d83a9f9651b0 100644
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -2969,7 +2969,7 @@ static void intel_pstate_driver_cleanup(void)
>  {
>         unsigned int cpu;
>
> -       get_online_cpus();
> +       cpus_read_lock();
>         for_each_online_cpu(cpu) {
>                 if (all_cpu_data[cpu]) {
>                         if (intel_pstate_driver == &intel_pstate)
> @@ -2979,7 +2979,7 @@ static void intel_pstate_driver_cleanup(void)
>                         all_cpu_data[cpu] = NULL;
>                 }
>         }
> -       put_online_cpus();
> +       cpus_read_unlock();
>
>         intel_pstate_driver = NULL;
>  }
> diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c
> index b9ccb6a3dad98..12ab4014af712 100644
> --- a/drivers/cpufreq/powernow-k8.c
> +++ b/drivers/cpufreq/powernow-k8.c
> @@ -1180,7 +1180,7 @@ static int powernowk8_init(void)
>         if (!x86_match_cpu(powernow_k8_ids))
>                 return -ENODEV;
>
> -       get_online_cpus();
> +       cpus_read_lock();
>         for_each_online_cpu(i) {
>                 smp_call_function_single(i, check_supported_cpu, &ret, 1);
>                 if (!ret)
> @@ -1188,10 +1188,10 @@ static int powernowk8_init(void)
>         }
>
>         if (supported_cpus != num_online_cpus()) {
> -               put_online_cpus();
> +               cpus_read_unlock();
>                 return -ENODEV;
>         }
> -       put_online_cpus();
> +       cpus_read_unlock();
>
>         ret = cpufreq_register_driver(&cpufreq_amd64_driver);
>         if (ret)
> diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c
> index 005600cef2730..23a06cba392cd 100644
> --- a/drivers/cpufreq/powernv-cpufreq.c
> +++ b/drivers/cpufreq/powernv-cpufreq.c
> @@ -918,7 +918,7 @@ static void powernv_cpufreq_work_fn(struct work_struct *work)
>         unsigned int cpu;
>         cpumask_t mask;
>
> -       get_online_cpus();
> +       cpus_read_lock();
>         cpumask_and(&mask, &chip->mask, cpu_online_mask);
>         smp_call_function_any(&mask,
>                               powernv_cpufreq_throttle_check, NULL, 0);
> @@ -939,7 +939,7 @@ static void powernv_cpufreq_work_fn(struct work_struct *work)
>                 cpufreq_cpu_put(policy);
>         }
>  out:
> -       put_online_cpus();
> +       cpus_read_unlock();
>  }
>
>  static int powernv_cpufreq_occ_msg(struct notifier_block *nb,
> --

Applied as 5.15 material, thanks!

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 30/38] ACPI: PM: s2idle: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:16 ` [PATCH 30/38] ACPI: PM: s2idle: " Sebastian Andrzej Siewior
@ 2021-08-04 18:20   ` Rafael J. Wysocki
  0 siblings, 0 replies; 94+ messages in thread
From: Rafael J. Wysocki @ 2021-08-04 18:20 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: Linux Kernel Mailing List, Thomas Gleixner, Peter Zijlstra,
	Rafael J. Wysocki, Pavel Machek, Len Brown, Linux PM

On Tue, Aug 3, 2021 at 4:17 PM Sebastian Andrzej Siewior
<bigeasy@linutronix.de> wrote:
>
> The functions get_online_cpus() and put_online_cpus() have been
> deprecated during the CPU hotplug rework. They map directly to
> cpus_read_lock() and cpus_read_unlock().
>
> Replace deprecated CPU-hotplug functions with the official version.
> The behavior remains unchanged.
>
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> Cc: Pavel Machek <pavel@ucw.cz>
> Cc: Len Brown <len.brown@intel.com>
> Cc: linux-pm@vger.kernel.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>  kernel/power/suspend.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
> index d8cae434f9eb5..eb75f394a0590 100644
> --- a/kernel/power/suspend.c
> +++ b/kernel/power/suspend.c
> @@ -96,7 +96,7 @@ static void s2idle_enter(void)
>         s2idle_state = S2IDLE_STATE_ENTER;
>         raw_spin_unlock_irq(&s2idle_lock);
>
> -       get_online_cpus();
> +       cpus_read_lock();
>         cpuidle_resume();
>
>         /* Push all the CPUs into the idle loop. */
> @@ -106,7 +106,7 @@ static void s2idle_enter(void)
>                     s2idle_state == S2IDLE_STATE_WAKE);
>
>         cpuidle_pause();
> -       put_online_cpus();
> +       cpus_read_unlock();
>
>         raw_spin_lock_irq(&s2idle_lock);
>
> --

Applied as 5.15 material, but the subject changed to "PM: sleep:
s2idle: Replace deprecated CPU-hotplug functions".

Thanks!

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 29/38] ACPI: processor: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:16 ` [PATCH 29/38] ACPI: processor: " Sebastian Andrzej Siewior
@ 2021-08-04 18:27   ` Rafael J. Wysocki
  0 siblings, 0 replies; 94+ messages in thread
From: Rafael J. Wysocki @ 2021-08-04 18:27 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: Linux Kernel Mailing List, Thomas Gleixner, Peter Zijlstra,
	Rafael J. Wysocki, Len Brown, ACPI Devel Maling List

On Tue, Aug 3, 2021 at 4:17 PM Sebastian Andrzej Siewior
<bigeasy@linutronix.de> wrote:
>
> The functions cpu_hotplug_begin, cpu_hotplug_done, get_online_cpus() and
> put_online_cpus() have been deprecated during the CPU hotplug rework. They map
> directly to cpus_write_lock(), cpus_write_unlock, cpus_read_lock() and
> cpus_read_unlock().
>
> Replace deprecated CPU-hotplug functions with the official version.
> The behavior remains unchanged.
>
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> Cc: Len Brown <lenb@kernel.org>
> Cc: linux-acpi@vger.kernel.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>  drivers/acpi/acpi_pad.c       | 4 ++--
>  drivers/acpi/acpi_processor.c | 8 ++++----
>  drivers/acpi/processor_idle.c | 4 ++--
>  3 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c
> index df4adeb335b24..f45979aa2d648 100644
> --- a/drivers/acpi/acpi_pad.c
> +++ b/drivers/acpi/acpi_pad.c
> @@ -249,12 +249,12 @@ static void set_power_saving_task_num(unsigned int num)
>
>  static void acpi_pad_idle_cpus(unsigned int num_cpus)
>  {
> -       get_online_cpus();
> +       cpus_read_lock();
>
>         num_cpus = min_t(unsigned int, num_cpus, num_online_cpus());
>         set_power_saving_task_num(num_cpus);
>
> -       put_online_cpus();
> +       cpus_read_unlock();
>  }
>
>  static uint32_t acpi_pad_idle_cpus_num(void)
> diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
> index 2d5bd2a6ddcef..6737b1cbf6d69 100644
> --- a/drivers/acpi/acpi_processor.c
> +++ b/drivers/acpi/acpi_processor.c
> @@ -182,7 +182,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
>                 return -ENODEV;
>
>         cpu_maps_update_begin();
> -       cpu_hotplug_begin();
> +       cpus_write_lock();
>
>         ret = acpi_map_cpu(pr->handle, pr->phys_id, pr->acpi_id, &pr->id);
>         if (ret)
> @@ -203,7 +203,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
>         pr->flags.need_hotplug_init = 1;
>
>  out:
> -       cpu_hotplug_done();
> +       cpus_write_unlock();
>         cpu_maps_update_done();
>         return ret;
>  }
> @@ -454,13 +454,13 @@ static void acpi_processor_remove(struct acpi_device *device)
>         per_cpu(processors, pr->id) = NULL;
>
>         cpu_maps_update_begin();
> -       cpu_hotplug_begin();
> +       cpus_write_lock();
>
>         /* Remove the CPU. */
>         arch_unregister_cpu(pr->id);
>         acpi_unmap_cpu(pr->id);
>
> -       cpu_hotplug_done();
> +       cpus_write_unlock();
>         cpu_maps_update_done();
>
>         try_offline_node(cpu_to_node(pr->id));
> diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
> index 095c8aca141eb..f37fba9e5ba0b 100644
> --- a/drivers/acpi/processor_idle.c
> +++ b/drivers/acpi/processor_idle.c
> @@ -1301,7 +1301,7 @@ int acpi_processor_power_state_has_changed(struct acpi_processor *pr)
>         if (pr->id == 0 && cpuidle_get_driver() == &acpi_idle_driver) {
>
>                 /* Protect against cpu-hotplug */
> -               get_online_cpus();
> +               cpus_read_lock();
>                 cpuidle_pause_and_lock();
>
>                 /* Disable all cpuidle devices */
> @@ -1330,7 +1330,7 @@ int acpi_processor_power_state_has_changed(struct acpi_processor *pr)
>                         }
>                 }
>                 cpuidle_resume_and_unlock();
> -               put_online_cpus();
> +               cpus_read_unlock();
>         }
>
>         return 0;
> --

Applied as 5.15 material, thanks!

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 21/38] virtio_net: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:16 ` [PATCH 21/38] virtio_net: " Sebastian Andrzej Siewior
@ 2021-08-04 22:41   ` Jakub Kicinski
  0 siblings, 0 replies; 94+ messages in thread
From: Jakub Kicinski @ 2021-08-04 22:41 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: linux-kernel, tglx, Peter Zijlstra, Michael S. Tsirkin,
	Jason Wang, David S. Miller, virtualization, netdev

On Tue,  3 Aug 2021 16:16:04 +0200 Sebastian Andrzej Siewior wrote:
> The functions get_online_cpus() and put_online_cpus() have been
> deprecated during the CPU hotplug rework. They map directly to
> cpus_read_lock() and cpus_read_unlock().
> 
> Replace deprecated CPU-hotplug functions with the official version.
> The behavior remains unchanged.
> 
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Cc: virtualization@lists.linux-foundation.org
> Cc: netdev@vger.kernel.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Applied this one and 21 to net-next, thanks!

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 02/38] MIPS: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 ` [PATCH 02/38] MIPS: " Sebastian Andrzej Siewior
@ 2021-08-05  9:02   ` Thomas Bogendoerfer
  0 siblings, 0 replies; 94+ messages in thread
From: Thomas Bogendoerfer @ 2021-08-05  9:02 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior; +Cc: linux-kernel, tglx, Peter Zijlstra, linux-mips

On Tue, Aug 03, 2021 at 04:15:45PM +0200, Sebastian Andrzej Siewior wrote:
> The functions get_online_cpus() and put_online_cpus() have been
> deprecated during the CPU hotplug rework. They map directly to
> cpus_read_lock() and cpus_read_unlock().
> 
> Replace deprecated CPU-hotplug functions with the official version.
> The behavior remains unchanged.
> 
> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> Cc: linux-mips@vger.kernel.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>  arch/mips/kernel/mips-mt-fpaff.c | 10 +++++-----
>  arch/mips/kernel/process.c       |  4 ++--
>  2 files changed, 7 insertions(+), 7 deletions(-)

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 15/38] md/raid5: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 ` [PATCH 15/38] md/raid5: " Sebastian Andrzej Siewior
@ 2021-08-05 16:20   ` Song Liu
  2021-08-27 23:53   ` [tip: smp/core] " tip-bot2 for Sebastian Andrzej Siewior
  1 sibling, 0 replies; 94+ messages in thread
From: Song Liu @ 2021-08-05 16:20 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: open list, Thomas Gleixner, Peter Zijlstra, linux-raid

On Tue, Aug 3, 2021 at 7:17 AM Sebastian Andrzej Siewior
<bigeasy@linutronix.de> wrote:
>
> The functions get_online_cpus() and put_online_cpus() have been
> deprecated during the CPU hotplug rework. They map directly to
> cpus_read_lock() and cpus_read_unlock().
>
> Replace deprecated CPU-hotplug functions with the official version.
> The behavior remains unchanged.
>
> Cc: Song Liu <song@kernel.org>
> Cc: linux-raid@vger.kernel.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Acked-by: Song Liu <song@kernel.org>

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 17/38] platform/x86: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:16 ` [PATCH 17/38] platform/x86: " Sebastian Andrzej Siewior
@ 2021-08-06 13:36   ` Hans de Goede
  0 siblings, 0 replies; 94+ messages in thread
From: Hans de Goede @ 2021-08-06 13:36 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior, linux-kernel
  Cc: tglx, Peter Zijlstra, Stuart Hayes, Mark Gross, platform-driver-x86

Hi,

On 8/3/21 4:16 PM, Sebastian Andrzej Siewior wrote:
> The functions get_online_cpus() and put_online_cpus() have been
> deprecated during the CPU hotplug rework. They map directly to
> cpus_read_lock() and cpus_read_unlock().
> 
> Replace deprecated CPU-hotplug functions with the official version.
> The behavior remains unchanged.
> 
> Cc: Stuart Hayes <stuart.w.hayes@gmail.com>
> Cc: Hans de Goede <hdegoede@redhat.com>
> Cc: Mark Gross <mgross@linux.intel.com>
> Cc: platform-driver-x86@vger.kernel.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Thank you for your patch, I've applied this patch to my review-hans 
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans


> ---
>  drivers/platform/x86/dell/dcdbas.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/platform/x86/dell/dcdbas.c b/drivers/platform/x86/dell/dcdbas.c
> index 28447c180be88..5e63d62250481 100644
> --- a/drivers/platform/x86/dell/dcdbas.c
> +++ b/drivers/platform/x86/dell/dcdbas.c
> @@ -278,9 +278,9 @@ int dcdbas_smi_request(struct smi_cmd *smi_cmd)
>  	}
>  
>  	/* SMI requires CPU 0 */
> -	get_online_cpus();
> +	cpus_read_lock();
>  	ret = smp_call_on_cpu(0, raise_smi, smi_cmd, true);
> -	put_online_cpus();
> +	cpus_read_unlock();
>  
>  	return ret;
>  }
> 


^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 37/38] workqueue: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:16 ` [PATCH 37/38] workqueue: " Sebastian Andrzej Siewior
  2021-08-04  1:36   ` Lai Jiangshan
@ 2021-08-09 22:33   ` Tejun Heo
  1 sibling, 0 replies; 94+ messages in thread
From: Tejun Heo @ 2021-08-09 22:33 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: linux-kernel, tglx, Peter Zijlstra, Lai Jiangshan

On Tue, Aug 03, 2021 at 04:16:20PM +0200, Sebastian Andrzej Siewior wrote:
> The functions get_online_cpus() and put_online_cpus() have been
> deprecated during the CPU hotplug rework. They map directly to
> cpus_read_lock() and cpus_read_unlock().
> 
> Replace deprecated CPU-hotplug functions with the official version.
> The behavior remains unchanged.
> 
> Cc: Tejun Heo <tj@kernel.org>
> Cc: Lai Jiangshan <jiangshanlai@gmail.com>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Applied to cgroup/for-5.15.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 24/38] cgroup: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:16 ` [PATCH 24/38] cgroup: " Sebastian Andrzej Siewior
@ 2021-08-09 22:37   ` Tejun Heo
  0 siblings, 0 replies; 94+ messages in thread
From: Tejun Heo @ 2021-08-09 22:37 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: linux-kernel, tglx, Peter Zijlstra, Zefan Li, Johannes Weiner, cgroups

On Tue, Aug 03, 2021 at 04:16:07PM +0200, Sebastian Andrzej Siewior wrote:
> The functions get_online_cpus() and put_online_cpus() have been
> deprecated during the CPU hotplug rework. They map directly to
> cpus_read_lock() and cpus_read_unlock().
> 
> Replace deprecated CPU-hotplug functions with the official version.
> The behavior remains unchanged.
> 
> Cc: Zefan Li <lizefan.x@bytedance.com>
> Cc: Tejun Heo <tj@kernel.org>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Cc: cgroups@vger.kernel.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Applied to cgroup/for-5.15.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 31/38] rcu: Replace deprecated CPU-hotplug functions.
  2021-08-03 16:00   ` Paul E. McKenney
@ 2021-08-10 12:42     ` Thomas Gleixner
  2021-08-10 18:20       ` Paul E. McKenney
  0 siblings, 1 reply; 94+ messages in thread
From: Thomas Gleixner @ 2021-08-10 12:42 UTC (permalink / raw)
  To: paulmck, Sebastian Andrzej Siewior
  Cc: linux-kernel, Peter Zijlstra, Josh Triplett, Steven Rostedt,
	Mathieu Desnoyers, Lai Jiangshan, Joel Fernandes, rcu

On Tue, Aug 03 2021 at 09:00, Paul E. McKenney wrote:
> On Tue, Aug 03, 2021 at 04:16:14PM +0200, Sebastian Andrzej Siewior wrote:
>> The functions get_online_cpus() and put_online_cpus() have been
>> deprecated during the CPU hotplug rework. They map directly to
>> cpus_read_lock() and cpus_read_unlock().
>> 
>> Replace deprecated CPU-hotplug functions with the official version.
>> The behavior remains unchanged.
>> 
> I have queued this one and 35/38 (rcutorture) for v5.16.  If you would
> prefer to send them some other route, please let me know and:

5.15 would be appreciated so we can get rid of the old interface around
rc1.

Thanks,

        tglx

^ permalink raw reply	[flat|nested] 94+ messages in thread

* [tip: x86/cleanups] x86/mce/inject: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 ` [PATCH 09/38] x86/mce/inject: " Sebastian Andrzej Siewior
@ 2021-08-10 12:52   ` tip-bot2 for Sebastian Andrzej Siewior
  0 siblings, 0 replies; 94+ messages in thread
From: tip-bot2 for Sebastian Andrzej Siewior @ 2021-08-10 12:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Sebastian Andrzej Siewior, Thomas Gleixner, x86, linux-kernel

The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID:     8ae9e3f63865bc067c144817da9df025dbb667f2
Gitweb:        https://git.kernel.org/tip/8ae9e3f63865bc067c144817da9df025dbb667f2
Author:        Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate:    Tue, 03 Aug 2021 16:15:52 +02:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 10 Aug 2021 14:46:27 +02:00

x86/mce/inject: Replace deprecated CPU-hotplug functions.

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20210803141621.780504-10-bigeasy@linutronix.de

---
 arch/x86/kernel/cpu/mce/inject.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/cpu/mce/inject.c b/arch/x86/kernel/cpu/mce/inject.c
index 4e86d97..0bfc140 100644
--- a/arch/x86/kernel/cpu/mce/inject.c
+++ b/arch/x86/kernel/cpu/mce/inject.c
@@ -235,7 +235,7 @@ static void __maybe_unused raise_mce(struct mce *m)
 		unsigned long start;
 		int cpu;
 
-		get_online_cpus();
+		cpus_read_lock();
 		cpumask_copy(mce_inject_cpumask, cpu_online_mask);
 		cpumask_clear_cpu(get_cpu(), mce_inject_cpumask);
 		for_each_online_cpu(cpu) {
@@ -269,7 +269,7 @@ static void __maybe_unused raise_mce(struct mce *m)
 		}
 		raise_local();
 		put_cpu();
-		put_online_cpus();
+		cpus_read_unlock();
 	} else {
 		preempt_disable();
 		raise_local();
@@ -529,7 +529,7 @@ static void do_inject(void)
 		cpu = get_nbc_for_node(topology_die_id(cpu));
 	}
 
-	get_online_cpus();
+	cpus_read_lock();
 	if (!cpu_online(cpu))
 		goto err;
 
@@ -553,7 +553,7 @@ static void do_inject(void)
 	}
 
 err:
-	put_online_cpus();
+	cpus_read_unlock();
 
 }
 

^ permalink raw reply	[flat|nested] 94+ messages in thread

* [tip: x86/cleanups] x86/mtrr: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 ` [PATCH 07/38] x86/mtrr: " Sebastian Andrzej Siewior
@ 2021-08-10 12:52   ` tip-bot2 for Sebastian Andrzej Siewior
  0 siblings, 0 replies; 94+ messages in thread
From: tip-bot2 for Sebastian Andrzej Siewior @ 2021-08-10 12:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Sebastian Andrzej Siewior, Thomas Gleixner, x86, linux-kernel

The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID:     1a351eefd4acc97145903b1c07e4d8b626854b82
Gitweb:        https://git.kernel.org/tip/1a351eefd4acc97145903b1c07e4d8b626854b82
Author:        Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate:    Tue, 03 Aug 2021 16:15:50 +02:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 10 Aug 2021 14:46:27 +02:00

x86/mtrr: Replace deprecated CPU-hotplug functions.

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20210803141621.780504-8-bigeasy@linutronix.de

---
 arch/x86/kernel/cpu/mtrr/mtrr.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/cpu/mtrr/mtrr.c b/arch/x86/kernel/cpu/mtrr/mtrr.c
index a76694b..2746cac 100644
--- a/arch/x86/kernel/cpu/mtrr/mtrr.c
+++ b/arch/x86/kernel/cpu/mtrr/mtrr.c
@@ -336,7 +336,7 @@ int mtrr_add_page(unsigned long base, unsigned long size,
 	replace = -1;
 
 	/* No CPU hotplug when we change MTRR entries */
-	get_online_cpus();
+	cpus_read_lock();
 
 	/* Search for existing MTRR  */
 	mutex_lock(&mtrr_mutex);
@@ -398,7 +398,7 @@ int mtrr_add_page(unsigned long base, unsigned long size,
 	error = i;
  out:
 	mutex_unlock(&mtrr_mutex);
-	put_online_cpus();
+	cpus_read_unlock();
 	return error;
 }
 
@@ -485,7 +485,7 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size)
 
 	max = num_var_ranges;
 	/* No CPU hotplug when we change MTRR entries */
-	get_online_cpus();
+	cpus_read_lock();
 	mutex_lock(&mtrr_mutex);
 	if (reg < 0) {
 		/*  Search for existing MTRR  */
@@ -520,7 +520,7 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size)
 	error = reg;
  out:
 	mutex_unlock(&mtrr_mutex);
-	put_online_cpus();
+	cpus_read_unlock();
 	return error;
 }
 

^ permalink raw reply	[flat|nested] 94+ messages in thread

* [tip: x86/cleanups] x86/microcode: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 ` [PATCH 08/38] x86/microcode: " Sebastian Andrzej Siewior
@ 2021-08-10 12:52   ` tip-bot2 for Sebastian Andrzej Siewior
  0 siblings, 0 replies; 94+ messages in thread
From: tip-bot2 for Sebastian Andrzej Siewior @ 2021-08-10 12:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Sebastian Andrzej Siewior, Thomas Gleixner, x86, linux-kernel

The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID:     2089f34f8c5b91f7235023ec72e71e3247261ecc
Gitweb:        https://git.kernel.org/tip/2089f34f8c5b91f7235023ec72e71e3247261ecc
Author:        Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate:    Tue, 03 Aug 2021 16:15:51 +02:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 10 Aug 2021 14:46:27 +02:00

x86/microcode: Replace deprecated CPU-hotplug functions.

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20210803141621.780504-9-bigeasy@linutronix.de

---
 arch/x86/kernel/cpu/microcode/core.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index 6a6318e..efb69be 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -55,7 +55,7 @@ LIST_HEAD(microcode_cache);
  * All non cpu-hotplug-callback call sites use:
  *
  * - microcode_mutex to synchronize with each other;
- * - get/put_online_cpus() to synchronize with
+ * - cpus_read_lock/unlock() to synchronize with
  *   the cpu-hotplug-callback call sites.
  *
  * We guarantee that only a single cpu is being
@@ -431,7 +431,7 @@ static ssize_t microcode_write(struct file *file, const char __user *buf,
 		return ret;
 	}
 
-	get_online_cpus();
+	cpus_read_lock();
 	mutex_lock(&microcode_mutex);
 
 	if (do_microcode_update(buf, len) == 0)
@@ -441,7 +441,7 @@ static ssize_t microcode_write(struct file *file, const char __user *buf,
 		perf_check_microcode();
 
 	mutex_unlock(&microcode_mutex);
-	put_online_cpus();
+	cpus_read_unlock();
 
 	return ret;
 }
@@ -629,7 +629,7 @@ static ssize_t reload_store(struct device *dev,
 	if (val != 1)
 		return size;
 
-	get_online_cpus();
+	cpus_read_lock();
 
 	ret = check_online_cpus();
 	if (ret)
@@ -644,7 +644,7 @@ static ssize_t reload_store(struct device *dev,
 	mutex_unlock(&microcode_mutex);
 
 put:
-	put_online_cpus();
+	cpus_read_unlock();
 
 	if (ret == 0)
 		ret = size;
@@ -853,14 +853,14 @@ static int __init microcode_init(void)
 	if (IS_ERR(microcode_pdev))
 		return PTR_ERR(microcode_pdev);
 
-	get_online_cpus();
+	cpus_read_lock();
 	mutex_lock(&microcode_mutex);
 
 	error = subsys_interface_register(&mc_cpu_interface);
 	if (!error)
 		perf_check_microcode();
 	mutex_unlock(&microcode_mutex);
-	put_online_cpus();
+	cpus_read_unlock();
 
 	if (error)
 		goto out_pdev;
@@ -892,13 +892,13 @@ static int __init microcode_init(void)
 			   &cpu_root_microcode_group);
 
  out_driver:
-	get_online_cpus();
+	cpus_read_lock();
 	mutex_lock(&microcode_mutex);
 
 	subsys_interface_unregister(&mc_cpu_interface);
 
 	mutex_unlock(&microcode_mutex);
-	put_online_cpus();
+	cpus_read_unlock();
 
  out_pdev:
 	platform_device_unregister(microcode_pdev);

^ permalink raw reply	[flat|nested] 94+ messages in thread

* [tip: x86/cleanups] x86/mmiotrace: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 ` [PATCH 06/38] x86/mmiotrace: " Sebastian Andrzej Siewior
  2021-08-03 15:03   ` [Nouveau] " Karol Herbst
  2021-08-04  1:07   ` Steven Rostedt
@ 2021-08-10 12:52   ` tip-bot2 for Sebastian Andrzej Siewior
  2 siblings, 0 replies; 94+ messages in thread
From: tip-bot2 for Sebastian Andrzej Siewior @ 2021-08-10 12:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Sebastian Andrzej Siewior, Thomas Gleixner, Karol Herbst,
	Steven Rostedt (VMware),
	x86, linux-kernel

The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID:     77ad320cfb2ac172eeba32a77a388281b003ec17
Gitweb:        https://git.kernel.org/tip/77ad320cfb2ac172eeba32a77a388281b003ec17
Author:        Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate:    Tue, 03 Aug 2021 16:15:49 +02:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 10 Aug 2021 14:46:27 +02:00

x86/mmiotrace: Replace deprecated CPU-hotplug functions.

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Link: https://lore.kernel.org/r/20210803141621.780504-7-bigeasy@linutronix.de

---
 arch/x86/mm/mmio-mod.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c
index cd768da..933a2eb 100644
--- a/arch/x86/mm/mmio-mod.c
+++ b/arch/x86/mm/mmio-mod.c
@@ -376,12 +376,12 @@ static void enter_uniprocessor(void)
 		goto out;
 	}
 
-	get_online_cpus();
+	cpus_read_lock();
 	cpumask_copy(downed_cpus, cpu_online_mask);
 	cpumask_clear_cpu(cpumask_first(cpu_online_mask), downed_cpus);
 	if (num_online_cpus() > 1)
 		pr_notice("Disabling non-boot CPUs...\n");
-	put_online_cpus();
+	cpus_read_unlock();
 
 	for_each_cpu(cpu, downed_cpus) {
 		err = remove_cpu(cpu);

^ permalink raw reply	[flat|nested] 94+ messages in thread

* [tip: irq/core] genirq/affinity: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:16 ` [PATCH 25/38] genirq/affinity: " Sebastian Andrzej Siewior
@ 2021-08-10 12:58   ` tip-bot2 for Sebastian Andrzej Siewior
  0 siblings, 0 replies; 94+ messages in thread
From: tip-bot2 for Sebastian Andrzej Siewior @ 2021-08-10 12:58 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Sebastian Andrzej Siewior, Thomas Gleixner, x86, linux-kernel, maz

The following commit has been merged into the irq/core branch of tip:

Commit-ID:     428e211641ed808b55cdc7d880a0ee349eff354b
Gitweb:        https://git.kernel.org/tip/428e211641ed808b55cdc7d880a0ee349eff354b
Author:        Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate:    Tue, 03 Aug 2021 16:16:08 +02:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 10 Aug 2021 14:51:26 +02:00

genirq/affinity: Replace deprecated CPU-hotplug functions.

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20210803141621.780504-26-bigeasy@linutronix.de

---
 kernel/irq/affinity.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c
index 4d89ad4..f7ff891 100644
--- a/kernel/irq/affinity.c
+++ b/kernel/irq/affinity.c
@@ -355,7 +355,7 @@ static int irq_build_affinity_masks(unsigned int startvec, unsigned int numvecs,
 		goto fail_npresmsk;
 
 	/* Stabilize the cpumasks */
-	get_online_cpus();
+	cpus_read_lock();
 	build_node_to_cpumask(node_to_cpumask);
 
 	/* Spread on present CPUs starting from affd->pre_vectors */
@@ -384,7 +384,7 @@ static int irq_build_affinity_masks(unsigned int startvec, unsigned int numvecs,
 		nr_others = ret;
 
  fail_build_affinity:
-	put_online_cpus();
+	cpus_read_unlock();
 
 	if (ret >= 0)
 		WARN_ON(nr_present + nr_others < numvecs);
@@ -505,9 +505,9 @@ unsigned int irq_calc_affinity_vectors(unsigned int minvec, unsigned int maxvec,
 	if (affd->calc_sets) {
 		set_vecs = maxvec - resv;
 	} else {
-		get_online_cpus();
+		cpus_read_lock();
 		set_vecs = cpumask_weight(cpu_possible_mask);
-		put_online_cpus();
+		cpus_read_unlock();
 	}
 
 	return resv + min(set_vecs, maxvec - resv);

^ permalink raw reply	[flat|nested] 94+ messages in thread

* [tip: sched/core] sched: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:16 ` [PATCH 32/38] sched: " Sebastian Andrzej Siewior
@ 2021-08-10 12:58   ` tip-bot2 for Sebastian Andrzej Siewior
  0 siblings, 0 replies; 94+ messages in thread
From: tip-bot2 for Sebastian Andrzej Siewior @ 2021-08-10 12:58 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Sebastian Andrzej Siewior, Thomas Gleixner, x86, linux-kernel

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     746f5ea9c4283d98353c1cd41864aec475e0edbd
Gitweb:        https://git.kernel.org/tip/746f5ea9c4283d98353c1cd41864aec475e0edbd
Author:        Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate:    Tue, 03 Aug 2021 16:16:15 +02:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 10 Aug 2021 14:53:00 +02:00

sched: Replace deprecated CPU-hotplug functions.

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20210803141621.780504-33-bigeasy@linutronix.de

---
 kernel/sched/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 433b400..d67c5dd 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -9840,7 +9840,7 @@ static int tg_set_cfs_bandwidth(struct task_group *tg, u64 period, u64 quota,
 	 * Prevent race between setting of cfs_rq->runtime_enabled and
 	 * unthrottle_offline_cfs_rqs().
 	 */
-	get_online_cpus();
+	cpus_read_lock();
 	mutex_lock(&cfs_constraints_mutex);
 	ret = __cfs_schedulable(tg, period, quota);
 	if (ret)
@@ -9884,7 +9884,7 @@ static int tg_set_cfs_bandwidth(struct task_group *tg, u64 period, u64 quota,
 		cfs_bandwidth_usage_dec();
 out_unlock:
 	mutex_unlock(&cfs_constraints_mutex);
-	put_online_cpus();
+	cpus_read_unlock();
 
 	return ret;
 }

^ permalink raw reply	[flat|nested] 94+ messages in thread

* [tip: timers/core] clocksource: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:16 ` [PATCH 34/38] clocksource: " Sebastian Andrzej Siewior
@ 2021-08-10 12:58   ` tip-bot2 for Sebastian Andrzej Siewior
  0 siblings, 0 replies; 94+ messages in thread
From: tip-bot2 for Sebastian Andrzej Siewior @ 2021-08-10 12:58 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Sebastian Andrzej Siewior, Thomas Gleixner, x86, linux-kernel

The following commit has been merged into the timers/core branch of tip:

Commit-ID:     698429f9d0e54ce3964151adff886ee5fc59714b
Gitweb:        https://git.kernel.org/tip/698429f9d0e54ce3964151adff886ee5fc59714b
Author:        Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate:    Tue, 03 Aug 2021 16:16:17 +02:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 10 Aug 2021 14:53:58 +02:00

clocksource: Replace deprecated CPU-hotplug functions.

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20210803141621.780504-35-bigeasy@linutronix.de

---
 kernel/time/clocksource.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index b89c76e..b8a14d2 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -306,12 +306,12 @@ void clocksource_verify_percpu(struct clocksource *cs)
 		return;
 	cpumask_clear(&cpus_ahead);
 	cpumask_clear(&cpus_behind);
-	get_online_cpus();
+	cpus_read_lock();
 	preempt_disable();
 	clocksource_verify_choose_cpus();
 	if (cpumask_weight(&cpus_chosen) == 0) {
 		preempt_enable();
-		put_online_cpus();
+		cpus_read_unlock();
 		pr_warn("Not enough CPUs to check clocksource '%s'.\n", cs->name);
 		return;
 	}
@@ -337,7 +337,7 @@ void clocksource_verify_percpu(struct clocksource *cs)
 			cs_nsec_min = cs_nsec;
 	}
 	preempt_enable();
-	put_online_cpus();
+	cpus_read_unlock();
 	if (!cpumask_empty(&cpus_ahead))
 		pr_warn("        CPUs %*pbl ahead of CPU %d for clocksource %s.\n",
 			cpumask_pr_args(&cpus_ahead), testcpu, cs->name);

^ permalink raw reply	[flat|nested] 94+ messages in thread

* [tip: perf/core] perf/hw_breakpoint: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 ` [PATCH 11/38] perf/hw_breakpoint: " Sebastian Andrzej Siewior
@ 2021-08-10 13:04   ` tip-bot2 for Sebastian Andrzej Siewior
  2021-08-26  8:09   ` tip-bot2 for Sebastian Andrzej Siewior
  1 sibling, 0 replies; 94+ messages in thread
From: tip-bot2 for Sebastian Andrzej Siewior @ 2021-08-10 13:04 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Sebastian Andrzej Siewior, Thomas Gleixner, x86, linux-kernel

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     b28a32083bfa485f516c8b08c5d6050ff5aef3fb
Gitweb:        https://git.kernel.org/tip/b28a32083bfa485f516c8b08c5d6050ff5aef3fb
Author:        Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate:    Tue, 03 Aug 2021 16:15:54 +02:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 10 Aug 2021 15:00:26 +02:00

perf/hw_breakpoint: Replace deprecated CPU-hotplug functions.

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20210803141621.780504-12-bigeasy@linutronix.de

---
 kernel/events/hw_breakpoint.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c
index 8359734..f32320a 100644
--- a/kernel/events/hw_breakpoint.c
+++ b/kernel/events/hw_breakpoint.c
@@ -568,7 +568,7 @@ register_wide_hw_breakpoint(struct perf_event_attr *attr,
 	if (!cpu_events)
 		return (void __percpu __force *)ERR_PTR(-ENOMEM);
 
-	get_online_cpus();
+	cpus_read_lock();
 	for_each_online_cpu(cpu) {
 		bp = perf_event_create_kernel_counter(attr, cpu, NULL,
 						      triggered, context);
@@ -579,7 +579,7 @@ register_wide_hw_breakpoint(struct perf_event_attr *attr,
 
 		per_cpu(*cpu_events, cpu) = bp;
 	}
-	put_online_cpus();
+	cpus_read_unlock();
 
 	if (likely(!err))
 		return cpu_events;

^ permalink raw reply	[flat|nested] 94+ messages in thread

* [tip: perf/core] perf/x86/intel: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 ` [PATCH 10/38] perf/x86/intel: " Sebastian Andrzej Siewior
@ 2021-08-10 13:04   ` tip-bot2 for Sebastian Andrzej Siewior
  2021-08-26  8:09   ` tip-bot2 for Sebastian Andrzej Siewior
  1 sibling, 0 replies; 94+ messages in thread
From: tip-bot2 for Sebastian Andrzej Siewior @ 2021-08-10 13:04 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Sebastian Andrzej Siewior, Thomas Gleixner, x86, linux-kernel

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     4db0d3d3eeb8e15fce529480e4e99a3776f69604
Gitweb:        https://git.kernel.org/tip/4db0d3d3eeb8e15fce529480e4e99a3776f69604
Author:        Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate:    Tue, 03 Aug 2021 16:15:53 +02:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 10 Aug 2021 15:00:26 +02:00

perf/x86/intel: Replace deprecated CPU-hotplug functions.

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20210803141621.780504-11-bigeasy@linutronix.de

---
 arch/x86/events/intel/core.c | 8 ++++----
 arch/x86/events/intel/pt.c   | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index e355db5..aa15145 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -5026,9 +5026,9 @@ static ssize_t freeze_on_smi_store(struct device *cdev,
 
 	x86_pmu.attr_freeze_on_smi = val;
 
-	get_online_cpus();
+	cpus_read_lock();
 	on_each_cpu(flip_smm_bit, &val, 1);
-	put_online_cpus();
+	cpus_read_unlock();
 done:
 	mutex_unlock(&freeze_on_smi_mutex);
 
@@ -5071,9 +5071,9 @@ static ssize_t set_sysctl_tfa(struct device *cdev,
 
 	allow_tsx_force_abort = val;
 
-	get_online_cpus();
+	cpus_read_lock();
 	on_each_cpu(update_tfa_sched, NULL, 1);
-	put_online_cpus();
+	cpus_read_unlock();
 
 	return count;
 }
diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c
index 9158476..0369a23 100644
--- a/arch/x86/events/intel/pt.c
+++ b/arch/x86/events/intel/pt.c
@@ -1708,7 +1708,7 @@ static __init int pt_init(void)
 	if (!boot_cpu_has(X86_FEATURE_INTEL_PT))
 		return -ENODEV;
 
-	get_online_cpus();
+	cpus_read_lock();
 	for_each_online_cpu(cpu) {
 		u64 ctl;
 
@@ -1716,7 +1716,7 @@ static __init int pt_init(void)
 		if (!ret && (ctl & RTIT_CTL_TRACEEN))
 			prior_warn++;
 	}
-	put_online_cpus();
+	cpus_read_unlock();
 
 	if (prior_warn) {
 		x86_add_exclusive(x86_lbr_exclusive_pt);

^ permalink raw reply	[flat|nested] 94+ messages in thread

* [tip: smp/core] smpboot: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:16 ` [PATCH 33/38] smpboot: " Sebastian Andrzej Siewior
@ 2021-08-10 13:04   ` tip-bot2 for Sebastian Andrzej Siewior
  0 siblings, 0 replies; 94+ messages in thread
From: tip-bot2 for Sebastian Andrzej Siewior @ 2021-08-10 13:04 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Sebastian Andrzej Siewior, Thomas Gleixner, x86, linux-kernel

The following commit has been merged into the smp/core branch of tip:

Commit-ID:     844d87871b6e0ac3ceb177535dcdf6e6a9f1fd4b
Gitweb:        https://git.kernel.org/tip/844d87871b6e0ac3ceb177535dcdf6e6a9f1fd4b
Author:        Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate:    Tue, 03 Aug 2021 16:16:16 +02:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 10 Aug 2021 14:57:42 +02:00

smpboot: Replace deprecated CPU-hotplug functions.

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20210803141621.780504-34-bigeasy@linutronix.de

---
 kernel/smpboot.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/smpboot.c b/kernel/smpboot.c
index cf6acab..f6bc0bc 100644
--- a/kernel/smpboot.c
+++ b/kernel/smpboot.c
@@ -291,7 +291,7 @@ int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread)
 	unsigned int cpu;
 	int ret = 0;
 
-	get_online_cpus();
+	cpus_read_lock();
 	mutex_lock(&smpboot_threads_lock);
 	for_each_online_cpu(cpu) {
 		ret = __smpboot_create_thread(plug_thread, cpu);
@@ -304,7 +304,7 @@ int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread)
 	list_add(&plug_thread->list, &hotplug_threads);
 out:
 	mutex_unlock(&smpboot_threads_lock);
-	put_online_cpus();
+	cpus_read_unlock();
 	return ret;
 }
 EXPORT_SYMBOL_GPL(smpboot_register_percpu_thread);
@@ -317,12 +317,12 @@ EXPORT_SYMBOL_GPL(smpboot_register_percpu_thread);
  */
 void smpboot_unregister_percpu_thread(struct smp_hotplug_thread *plug_thread)
 {
-	get_online_cpus();
+	cpus_read_lock();
 	mutex_lock(&smpboot_threads_lock);
 	list_del(&plug_thread->list);
 	smpboot_destroy_threads(plug_thread);
 	mutex_unlock(&smpboot_threads_lock);
-	put_online_cpus();
+	cpus_read_unlock();
 }
 EXPORT_SYMBOL_GPL(smpboot_unregister_percpu_thread);
 

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 36/38] tracing: Replace deprecated CPU-hotplug functions.
  2021-08-04  2:26   ` Steven Rostedt
@ 2021-08-10 13:34     ` Sebastian Andrzej Siewior
  2021-08-10 19:12       ` Steven Rostedt
  0 siblings, 1 reply; 94+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-08-10 13:34 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-kernel, tglx, Peter Zijlstra, Ingo Molnar

On 2021-08-03 22:26:37 [-0400], Steven Rostedt wrote:
> Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

Steven, could you please route this via your tracing tree?

> -- Steve

Sebastian

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 31/38] rcu: Replace deprecated CPU-hotplug functions.
  2021-08-10 12:42     ` Thomas Gleixner
@ 2021-08-10 18:20       ` Paul E. McKenney
  0 siblings, 0 replies; 94+ messages in thread
From: Paul E. McKenney @ 2021-08-10 18:20 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Sebastian Andrzej Siewior, linux-kernel, Peter Zijlstra,
	Josh Triplett, Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan,
	Joel Fernandes, rcu

On Tue, Aug 10, 2021 at 02:42:09PM +0200, Thomas Gleixner wrote:
> On Tue, Aug 03 2021 at 09:00, Paul E. McKenney wrote:
> > On Tue, Aug 03, 2021 at 04:16:14PM +0200, Sebastian Andrzej Siewior wrote:
> >> The functions get_online_cpus() and put_online_cpus() have been
> >> deprecated during the CPU hotplug rework. They map directly to
> >> cpus_read_lock() and cpus_read_unlock().
> >> 
> >> Replace deprecated CPU-hotplug functions with the official version.
> >> The behavior remains unchanged.
> >> 
> > I have queued this one and 35/38 (rcutorture) for v5.16.  If you would
> > prefer to send them some other route, please let me know and:
> 
> 5.15 would be appreciated so we can get rid of the old interface around
> rc1.

Fair enough!  I have rebased to pull those two patches into my v5.15 pile.

							Thanx, Paul

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 36/38] tracing: Replace deprecated CPU-hotplug functions.
  2021-08-10 13:34     ` Sebastian Andrzej Siewior
@ 2021-08-10 19:12       ` Steven Rostedt
  0 siblings, 0 replies; 94+ messages in thread
From: Steven Rostedt @ 2021-08-10 19:12 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior; +Cc: linux-kernel, tglx, Peter Zijlstra, Ingo Molnar

On Tue, 10 Aug 2021 15:34:01 +0200
Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:

> On 2021-08-03 22:26:37 [-0400], Steven Rostedt wrote:
> > Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>  
> 
> Steven, could you please route this via your tracing tree?
> 

Sure, will do.

-- Steve

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 12/38] crypto: virtio: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 ` [PATCH 12/38] crypto: virtio: " Sebastian Andrzej Siewior
@ 2021-08-12 11:36   ` Herbert Xu
  0 siblings, 0 replies; 94+ messages in thread
From: Herbert Xu @ 2021-08-12 11:36 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: linux-kernel, tglx, Peter Zijlstra, Gonglei, Michael S. Tsirkin,
	Jason Wang, David S. Miller, virtualization, linux-crypto

On Tue, Aug 03, 2021 at 04:15:55PM +0200, Sebastian Andrzej Siewior wrote:
> The functions get_online_cpus() and put_online_cpus() have been
> deprecated during the CPU hotplug rework. They map directly to
> cpus_read_lock() and cpus_read_unlock().
> 
> Replace deprecated CPU-hotplug functions with the official version.
> The behavior remains unchanged.
> 
> Cc: Gonglei <arei.gonglei@huawei.com>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: virtualization@lists.linux-foundation.org
> Cc: linux-crypto@vger.kernel.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>  drivers/crypto/virtio/virtio_crypto_core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 27/38] padata: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:16 ` [PATCH 27/38] padata: " Sebastian Andrzej Siewior
  2021-08-04 14:52   ` Daniel Jordan
@ 2021-08-12 11:36   ` Herbert Xu
  1 sibling, 0 replies; 94+ messages in thread
From: Herbert Xu @ 2021-08-12 11:36 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: linux-kernel, tglx, Peter Zijlstra, Steffen Klassert,
	Daniel Jordan, linux-crypto

On Tue, Aug 03, 2021 at 02:16:10PM +0000, Sebastian Andrzej Siewior wrote:
> The functions get_online_cpus() and put_online_cpus() have been
> deprecated during the CPU hotplug rework. They map directly to
> cpus_read_lock() and cpus_read_unlock().
> 
> Replace deprecated CPU-hotplug functions with the official version.
> The behavior remains unchanged.
> 
> Cc: Steffen Klassert <steffen.klassert@secunet.com>
> Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
> Cc: linux-crypto@vger.kernel.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>  kernel/padata.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 19/38] thermal: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:16 ` [PATCH 19/38] thermal: " Sebastian Andrzej Siewior
@ 2021-08-14 10:52   ` Daniel Lezcano
  2021-09-10 22:45   ` [tip: smp/urgent] " tip-bot2 for Sebastian Andrzej Siewior
  1 sibling, 0 replies; 94+ messages in thread
From: Daniel Lezcano @ 2021-08-14 10:52 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior, linux-kernel
  Cc: tglx, Peter Zijlstra, Zhang Rui, Amit Kucheria, linux-pm

On 03/08/2021 16:16, Sebastian Andrzej Siewior wrote:
> The functions get_online_cpus() and put_online_cpus() have been
> deprecated during the CPU hotplug rework. They map directly to
> cpus_read_lock() and cpus_read_unlock().
> 
> Replace deprecated CPU-hotplug functions with the official version.
> The behavior remains unchanged.
> 
> Cc: Zhang Rui <rui.zhang@intel.com>
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> Cc: Amit Kucheria <amitk@kernel.org>
> Cc: linux-pm@vger.kernel.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>  drivers/thermal/intel/intel_powerclamp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied.

Thanks

  -- D.

-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: (subset) [PATCH 00/38] Replace deprecated CPU-hotplug
  2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
                   ` (38 preceding siblings ...)
  2021-08-03 15:30 ` [PATCH 00/38] Replace deprecated CPU-hotplug Hans de Goede
@ 2021-08-18 13:38 ` Michael Ellerman
  39 siblings, 0 replies; 94+ messages in thread
From: Michael Ellerman @ 2021-08-18 13:38 UTC (permalink / raw)
  To: linux-kernel, Sebastian Andrzej Siewior; +Cc: linuxppc-dev

On Tue, 3 Aug 2021 16:15:43 +0200, Sebastian Andrzej Siewior wrote:
> This is a tree wide replacement of the deprecated CPU hotplug functions
> which are only wrappers around the actual functions.
> 
> Each patch is independent and can be picked up by the relevant maintainer.
> 
> [...]

Applied to powerpc/next.

[03/38] powerpc: Replace deprecated CPU-hotplug functions.
        https://git.kernel.org/powerpc/c/5ae36401ca4ea2737d779ce7c267444b16530001

cheers

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [PATCH 26/38] livepatch: Replace deprecated CPU-hotplug functions.
  2021-08-04  7:52   ` Petr Mladek
@ 2021-08-19 10:01     ` Jiri Kosina
  0 siblings, 0 replies; 94+ messages in thread
From: Jiri Kosina @ 2021-08-19 10:01 UTC (permalink / raw)
  To: Petr Mladek
  Cc: Sebastian Andrzej Siewior, linux-kernel, tglx, Peter Zijlstra,
	Josh Poimboeuf, Miroslav Benes, Joe Lawrence, live-patching

On Wed, 4 Aug 2021, Petr Mladek wrote:

> > The functions get_online_cpus() and put_online_cpus() have been
> > deprecated during the CPU hotplug rework. They map directly to
> > cpus_read_lock() and cpus_read_unlock().
> > 
> > Replace deprecated CPU-hotplug functions with the official version.
> > The behavior remains unchanged.
> > 
> > Cc: Josh Poimboeuf <jpoimboe@redhat.com>
> > Cc: Jiri Kosina <jikos@kernel.org>
> > Cc: Miroslav Benes <mbenes@suse.cz>
> > Cc: Petr Mladek <pmladek@suse.com>
> > Cc: Joe Lawrence <joe.lawrence@redhat.com>
> > Cc: live-patching@vger.kernel.org
> > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> 
> Reviewed-by: Petr Mladek <pmladek@suse.com>

As this doesn't seem to have been picked up yet, I've just applied it to 
livepatching.git#for-5.15/cpu-hotplug

Thanks,

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 94+ messages in thread

* [tip: perf/core] perf/hw_breakpoint: Replace deprecated CPU-hotplug functions
  2021-08-03 14:15 ` [PATCH 11/38] perf/hw_breakpoint: " Sebastian Andrzej Siewior
  2021-08-10 13:04   ` [tip: perf/core] " tip-bot2 for Sebastian Andrzej Siewior
@ 2021-08-26  8:09   ` tip-bot2 for Sebastian Andrzej Siewior
  1 sibling, 0 replies; 94+ messages in thread
From: tip-bot2 for Sebastian Andrzej Siewior @ 2021-08-26  8:09 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Sebastian Andrzej Siewior, Thomas Gleixner, Ingo Molnar, x86,
	linux-kernel

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     ffec09f9c7d7b21b0aff29dd5c3972f4631c0b6b
Gitweb:        https://git.kernel.org/tip/ffec09f9c7d7b21b0aff29dd5c3972f4631c0b6b
Author:        Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate:    Tue, 03 Aug 2021 16:15:54 +02:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Thu, 26 Aug 2021 09:14:36 +02:00

perf/hw_breakpoint: Replace deprecated CPU-hotplug functions

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20210803141621.780504-12-bigeasy@linutronix.de
---
 kernel/events/hw_breakpoint.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c
index 8359734..f32320a 100644
--- a/kernel/events/hw_breakpoint.c
+++ b/kernel/events/hw_breakpoint.c
@@ -568,7 +568,7 @@ register_wide_hw_breakpoint(struct perf_event_attr *attr,
 	if (!cpu_events)
 		return (void __percpu __force *)ERR_PTR(-ENOMEM);
 
-	get_online_cpus();
+	cpus_read_lock();
 	for_each_online_cpu(cpu) {
 		bp = perf_event_create_kernel_counter(attr, cpu, NULL,
 						      triggered, context);
@@ -579,7 +579,7 @@ register_wide_hw_breakpoint(struct perf_event_attr *attr,
 
 		per_cpu(*cpu_events, cpu) = bp;
 	}
-	put_online_cpus();
+	cpus_read_unlock();
 
 	if (likely(!err))
 		return cpu_events;

^ permalink raw reply	[flat|nested] 94+ messages in thread

* [tip: perf/core] perf/x86/intel: Replace deprecated CPU-hotplug functions
  2021-08-03 14:15 ` [PATCH 10/38] perf/x86/intel: " Sebastian Andrzej Siewior
  2021-08-10 13:04   ` [tip: perf/core] " tip-bot2 for Sebastian Andrzej Siewior
@ 2021-08-26  8:09   ` tip-bot2 for Sebastian Andrzej Siewior
  1 sibling, 0 replies; 94+ messages in thread
From: tip-bot2 for Sebastian Andrzej Siewior @ 2021-08-26  8:09 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Sebastian Andrzej Siewior, Thomas Gleixner, Ingo Molnar, x86,
	linux-kernel

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     eda8a2c599d1ff874a63de7684b430740e747dea
Gitweb:        https://git.kernel.org/tip/eda8a2c599d1ff874a63de7684b430740e747dea
Author:        Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate:    Tue, 03 Aug 2021 16:15:53 +02:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Thu, 26 Aug 2021 09:14:36 +02:00

perf/x86/intel: Replace deprecated CPU-hotplug functions

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20210803141621.780504-11-bigeasy@linutronix.de
---
 arch/x86/events/intel/core.c | 8 ++++----
 arch/x86/events/intel/pt.c   | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index ac6fd2d..7011e87 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -5032,9 +5032,9 @@ static ssize_t freeze_on_smi_store(struct device *cdev,
 
 	x86_pmu.attr_freeze_on_smi = val;
 
-	get_online_cpus();
+	cpus_read_lock();
 	on_each_cpu(flip_smm_bit, &val, 1);
-	put_online_cpus();
+	cpus_read_unlock();
 done:
 	mutex_unlock(&freeze_on_smi_mutex);
 
@@ -5077,9 +5077,9 @@ static ssize_t set_sysctl_tfa(struct device *cdev,
 
 	allow_tsx_force_abort = val;
 
-	get_online_cpus();
+	cpus_read_lock();
 	on_each_cpu(update_tfa_sched, NULL, 1);
-	put_online_cpus();
+	cpus_read_unlock();
 
 	return count;
 }
diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c
index b044577..7f406c1 100644
--- a/arch/x86/events/intel/pt.c
+++ b/arch/x86/events/intel/pt.c
@@ -1708,7 +1708,7 @@ static __init int pt_init(void)
 	if (!boot_cpu_has(X86_FEATURE_INTEL_PT))
 		return -ENODEV;
 
-	get_online_cpus();
+	cpus_read_lock();
 	for_each_online_cpu(cpu) {
 		u64 ctl;
 
@@ -1716,7 +1716,7 @@ static __init int pt_init(void)
 		if (!ret && (ctl & RTIT_CTL_TRACEEN))
 			prior_warn++;
 	}
-	put_online_cpus();
+	cpus_read_unlock();
 
 	if (prior_warn) {
 		x86_add_exclusive(x86_lbr_exclusive_pt);

^ permalink raw reply	[flat|nested] 94+ messages in thread

* [tip: smp/core] mm: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:16 ` [PATCH 20/38] mm: " Sebastian Andrzej Siewior
@ 2021-08-27 23:53   ` tip-bot2 for Sebastian Andrzej Siewior
  0 siblings, 0 replies; 94+ messages in thread
From: tip-bot2 for Sebastian Andrzej Siewior @ 2021-08-27 23:53 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Sebastian Andrzej Siewior, Thomas Gleixner, x86, linux-kernel

The following commit has been merged into the smp/core branch of tip:

Commit-ID:     7625eccd1852ac84d3aa6a06ffc2f710e683b3fe
Gitweb:        https://git.kernel.org/tip/7625eccd1852ac84d3aa6a06ffc2f710e683b3fe
Author:        Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate:    Tue, 03 Aug 2021 16:16:03 +02:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Sat, 28 Aug 2021 01:46:17 +02:00

mm: Replace deprecated CPU-hotplug functions.

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20210803141621.780504-21-bigeasy@linutronix.de

---
 mm/swap_slots.c |  4 ++--
 mm/vmstat.c     | 12 ++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/mm/swap_slots.c b/mm/swap_slots.c
index a66f3e0..16f706c 100644
--- a/mm/swap_slots.c
+++ b/mm/swap_slots.c
@@ -70,9 +70,9 @@ void disable_swap_slots_cache_lock(void)
 	swap_slot_cache_enabled = false;
 	if (swap_slot_cache_initialized) {
 		/* serialize with cpu hotplug operations */
-		get_online_cpus();
+		cpus_read_lock();
 		__drain_swap_slots_cache(SLOTS_CACHE|SLOTS_CACHE_RET);
-		put_online_cpus();
+		cpus_read_unlock();
 	}
 }
 
diff --git a/mm/vmstat.c b/mm/vmstat.c
index b0534e0..a7ed56a 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -129,9 +129,9 @@ static void sum_vm_events(unsigned long *ret)
 */
 void all_vm_events(unsigned long *ret)
 {
-	get_online_cpus();
+	cpus_read_lock();
 	sum_vm_events(ret);
-	put_online_cpus();
+	cpus_read_unlock();
 }
 EXPORT_SYMBOL_GPL(all_vm_events);
 
@@ -1948,7 +1948,7 @@ static void vmstat_shepherd(struct work_struct *w)
 {
 	int cpu;
 
-	get_online_cpus();
+	cpus_read_lock();
 	/* Check processors whose vmstat worker threads have been disabled */
 	for_each_online_cpu(cpu) {
 		struct delayed_work *dw = &per_cpu(vmstat_work, cpu);
@@ -1958,7 +1958,7 @@ static void vmstat_shepherd(struct work_struct *w)
 
 		cond_resched();
 	}
-	put_online_cpus();
+	cpus_read_unlock();
 
 	schedule_delayed_work(&shepherd,
 		round_jiffies_relative(sysctl_stat_interval));
@@ -2037,9 +2037,9 @@ void __init init_mm_internals(void)
 	if (ret < 0)
 		pr_err("vmstat: failed to register 'online' hotplug state\n");
 
-	get_online_cpus();
+	cpus_read_lock();
 	init_cpu_node_state();
-	put_online_cpus();
+	cpus_read_unlock();
 
 	start_shepherd_timer();
 #endif

^ permalink raw reply	[flat|nested] 94+ messages in thread

* [tip: smp/core] md/raid5: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 ` [PATCH 15/38] md/raid5: " Sebastian Andrzej Siewior
  2021-08-05 16:20   ` Song Liu
@ 2021-08-27 23:53   ` tip-bot2 for Sebastian Andrzej Siewior
  1 sibling, 0 replies; 94+ messages in thread
From: tip-bot2 for Sebastian Andrzej Siewior @ 2021-08-27 23:53 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Sebastian Andrzej Siewior, Thomas Gleixner, Song Liu, x86, linux-kernel

The following commit has been merged into the smp/core branch of tip:

Commit-ID:     252034e03f04e54acfb5f5924dd26ae638e3215e
Gitweb:        https://git.kernel.org/tip/252034e03f04e54acfb5f5924dd26ae638e3215e
Author:        Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate:    Tue, 03 Aug 2021 16:15:58 +02:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Sat, 28 Aug 2021 01:46:17 +02:00

md/raid5: Replace deprecated CPU-hotplug functions.

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20210803141621.780504-16-bigeasy@linutronix.de

---
 drivers/md/raid5.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index b8436e4..02ed53b 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -2437,7 +2437,7 @@ static int resize_chunks(struct r5conf *conf, int new_disks, int new_sectors)
 	    conf->scribble_sectors >= new_sectors)
 		return 0;
 	mddev_suspend(conf->mddev);
-	get_online_cpus();
+	cpus_read_lock();
 
 	for_each_present_cpu(cpu) {
 		struct raid5_percpu *percpu;
@@ -2449,7 +2449,7 @@ static int resize_chunks(struct r5conf *conf, int new_disks, int new_sectors)
 			break;
 	}
 
-	put_online_cpus();
+	cpus_read_unlock();
 	mddev_resume(conf->mddev);
 	if (!err) {
 		conf->scribble_disks = new_disks;

^ permalink raw reply	[flat|nested] 94+ messages in thread

* [tip: smp/core] Documentation: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:15 ` [PATCH 01/38] Documentation: Replace deprecated CPU-hotplug functions Sebastian Andrzej Siewior
@ 2021-08-27 23:53   ` tip-bot2 for Sebastian Andrzej Siewior
  0 siblings, 0 replies; 94+ messages in thread
From: tip-bot2 for Sebastian Andrzej Siewior @ 2021-08-27 23:53 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Sebastian Andrzej Siewior, Thomas Gleixner, x86, linux-kernel

The following commit has been merged into the smp/core branch of tip:

Commit-ID:     c7483d823ee0da31e42d32e51a752f667a059735
Gitweb:        https://git.kernel.org/tip/c7483d823ee0da31e42d32e51a752f667a059735
Author:        Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate:    Tue, 03 Aug 2021 16:15:44 +02:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Sat, 28 Aug 2021 01:46:17 +02:00

Documentation: Replace deprecated CPU-hotplug functions.

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Update the documentation accordingly.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20210803141621.780504-2-bigeasy@linutronix.de

---
 Documentation/core-api/cpu_hotplug.rst | 2 +-
 Documentation/trace/ftrace.rst         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/core-api/cpu_hotplug.rst b/Documentation/core-api/cpu_hotplug.rst
index a2c96be..1122cd3 100644
--- a/Documentation/core-api/cpu_hotplug.rst
+++ b/Documentation/core-api/cpu_hotplug.rst
@@ -220,7 +220,7 @@ goes online (offline) and during initial setup (shutdown) of the driver. However
 each registration and removal function is also available with a ``_nocalls``
 suffix which does not invoke the provided callbacks if the invocation of the
 callbacks is not desired. During the manual setup (or teardown) the functions
-``get_online_cpus()`` and ``put_online_cpus()`` should be used to inhibit CPU
+``cpus_read_lock()`` and ``cpus_read_unlock()`` should be used to inhibit CPU
 hotplug operations.
 
 
diff --git a/Documentation/trace/ftrace.rst b/Documentation/trace/ftrace.rst
index cfc81e9..4e5b26f 100644
--- a/Documentation/trace/ftrace.rst
+++ b/Documentation/trace/ftrace.rst
@@ -2762,7 +2762,7 @@ listed in:
   put_prev_task_idle
   kmem_cache_create
   pick_next_task_rt
-  get_online_cpus
+  cpus_read_lock
   pick_next_task_fair
   mutex_lock
   [...]

^ permalink raw reply	[flat|nested] 94+ messages in thread

* [tip: smp/urgent] cpu/hotplug: Remove deprecated CPU-hotplug functions.
  2021-08-03 14:16 ` [PATCH 38/38] cpu/hotplug: Remove " Sebastian Andrzej Siewior
@ 2021-09-10 22:45   ` tip-bot2 for Sebastian Andrzej Siewior
  0 siblings, 0 replies; 94+ messages in thread
From: tip-bot2 for Sebastian Andrzej Siewior @ 2021-09-10 22:45 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Sebastian Andrzej Siewior, Thomas Gleixner, x86, linux-kernel

The following commit has been merged into the smp/urgent branch of tip:

Commit-ID:     8c854303ce0e38e5bbedd725ff39da7e235865d8
Gitweb:        https://git.kernel.org/tip/8c854303ce0e38e5bbedd725ff39da7e235865d8
Author:        Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate:    Tue, 03 Aug 2021 16:16:21 +02:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Sat, 11 Sep 2021 00:41:21 +02:00

cpu/hotplug: Remove deprecated CPU-hotplug functions.

No users in tree use the deprecated CPU-hotplug functions anymore.

Remove them.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20210803141621.780504-39-bigeasy@linutronix.de

---
 include/linux/cpu.h | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 94a578a..9cf51e4 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -143,12 +143,6 @@ static inline int remove_cpu(unsigned int cpu) { return -EPERM; }
 static inline void smp_shutdown_nonboot_cpus(unsigned int primary_cpu) { }
 #endif	/* !CONFIG_HOTPLUG_CPU */
 
-/* Wrappers which go away once all code is converted */
-static inline void cpu_hotplug_begin(void) { cpus_write_lock(); }
-static inline void cpu_hotplug_done(void) { cpus_write_unlock(); }
-static inline void get_online_cpus(void) { cpus_read_lock(); }
-static inline void put_online_cpus(void) { cpus_read_unlock(); }
-
 #ifdef CONFIG_PM_SLEEP_SMP
 extern int freeze_secondary_cpus(int primary);
 extern void thaw_secondary_cpus(void);

^ permalink raw reply	[flat|nested] 94+ messages in thread

* [tip: smp/urgent] thermal: Replace deprecated CPU-hotplug functions.
  2021-08-03 14:16 ` [PATCH 19/38] thermal: " Sebastian Andrzej Siewior
  2021-08-14 10:52   ` Daniel Lezcano
@ 2021-09-10 22:45   ` tip-bot2 for Sebastian Andrzej Siewior
  2021-09-11 20:48     ` Daniel Lezcano
  1 sibling, 1 reply; 94+ messages in thread
From: tip-bot2 for Sebastian Andrzej Siewior @ 2021-09-10 22:45 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Sebastian Andrzej Siewior, Thomas Gleixner, x86, linux-kernel

The following commit has been merged into the smp/urgent branch of tip:

Commit-ID:     c122358ea1e510d3def876abb7872f1b2b7365c9
Gitweb:        https://git.kernel.org/tip/c122358ea1e510d3def876abb7872f1b2b7365c9
Author:        Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate:    Tue, 03 Aug 2021 16:16:02 +02:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Sat, 11 Sep 2021 00:41:21 +02:00

thermal: Replace deprecated CPU-hotplug functions.

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20210803141621.780504-20-bigeasy@linutronix.de

---
 drivers/thermal/intel/intel_powerclamp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/thermal/intel/intel_powerclamp.c b/drivers/thermal/intel/intel_powerclamp.c
index b0eb5ec..a5b58ea 100644
--- a/drivers/thermal/intel/intel_powerclamp.c
+++ b/drivers/thermal/intel/intel_powerclamp.c
@@ -528,7 +528,7 @@ static int start_power_clamp(void)
 
 	set_target_ratio = clamp(set_target_ratio, 0U, MAX_TARGET_RATIO - 1);
 	/* prevent cpu hotplug */
-	get_online_cpus();
+	cpus_read_lock();
 
 	/* prefer BSP */
 	control_cpu = 0;
@@ -542,7 +542,7 @@ static int start_power_clamp(void)
 	for_each_online_cpu(cpu) {
 		start_power_clamp_worker(cpu);
 	}
-	put_online_cpus();
+	cpus_read_unlock();
 
 	return 0;
 }

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [tip: smp/urgent] thermal: Replace deprecated CPU-hotplug functions.
  2021-09-10 22:45   ` [tip: smp/urgent] " tip-bot2 for Sebastian Andrzej Siewior
@ 2021-09-11 20:48     ` Daniel Lezcano
  2021-09-11 21:11       ` Borislav Petkov
  0 siblings, 1 reply; 94+ messages in thread
From: Daniel Lezcano @ 2021-09-11 20:48 UTC (permalink / raw)
  To: linux-kernel, linux-tip-commits, Thomas Gleixner
  Cc: Sebastian Andrzej Siewior, x86


Hi,

I have already this patch.

  -- Daniel

On 11/09/2021 00:45, tip-bot2 for Sebastian Andrzej Siewior wrote:
> The following commit has been merged into the smp/urgent branch of tip:
> 
> Commit-ID:     c122358ea1e510d3def876abb7872f1b2b7365c9
> Gitweb:        https://git.kernel.org/tip/c122358ea1e510d3def876abb7872f1b2b7365c9
> Author:        Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> AuthorDate:    Tue, 03 Aug 2021 16:16:02 +02:00
> Committer:     Thomas Gleixner <tglx@linutronix.de>
> CommitterDate: Sat, 11 Sep 2021 00:41:21 +02:00
> 
> thermal: Replace deprecated CPU-hotplug functions.
> 
> The functions get_online_cpus() and put_online_cpus() have been
> deprecated during the CPU hotplug rework. They map directly to
> cpus_read_lock() and cpus_read_unlock().
> 
> Replace deprecated CPU-hotplug functions with the official version.
> The behavior remains unchanged.
> 
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Link: https://lore.kernel.org/r/20210803141621.780504-20-bigeasy@linutronix.de
> 
> ---
>  drivers/thermal/intel/intel_powerclamp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/thermal/intel/intel_powerclamp.c b/drivers/thermal/intel/intel_powerclamp.c
> index b0eb5ec..a5b58ea 100644
> --- a/drivers/thermal/intel/intel_powerclamp.c
> +++ b/drivers/thermal/intel/intel_powerclamp.c
> @@ -528,7 +528,7 @@ static int start_power_clamp(void)
>  
>  	set_target_ratio = clamp(set_target_ratio, 0U, MAX_TARGET_RATIO - 1);
>  	/* prevent cpu hotplug */
> -	get_online_cpus();
> +	cpus_read_lock();
>  
>  	/* prefer BSP */
>  	control_cpu = 0;
> @@ -542,7 +542,7 @@ static int start_power_clamp(void)
>  	for_each_online_cpu(cpu) {
>  		start_power_clamp_worker(cpu);
>  	}
> -	put_online_cpus();
> +	cpus_read_unlock();
>  
>  	return 0;
>  }
> 


-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

^ permalink raw reply	[flat|nested] 94+ messages in thread

* Re: [tip: smp/urgent] thermal: Replace deprecated CPU-hotplug functions.
  2021-09-11 20:48     ` Daniel Lezcano
@ 2021-09-11 21:11       ` Borislav Petkov
  0 siblings, 0 replies; 94+ messages in thread
From: Borislav Petkov @ 2021-09-11 21:11 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: linux-kernel, linux-tip-commits, Thomas Gleixner,
	Sebastian Andrzej Siewior, x86

On Sat, Sep 11, 2021 at 10:48:32PM +0200, Daniel Lezcano wrote:
> I have already this patch.

Ok, I'll hold off on sending smp/urgent Linuswards tomorrow then,
especially since he's merged your pull request already.

We can recreate that tree after -rc1 is out and do the final zap of the
deprecated CPU hotplug wrappers then.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply	[flat|nested] 94+ messages in thread

end of thread, other threads:[~2021-09-11 21:11 UTC | newest]

Thread overview: 94+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-03 14:15 [PATCH 00/38] Replace deprecated CPU-hotplug Sebastian Andrzej Siewior
2021-08-03 14:15 ` [PATCH 01/38] Documentation: Replace deprecated CPU-hotplug functions Sebastian Andrzej Siewior
2021-08-27 23:53   ` [tip: smp/core] " tip-bot2 for Sebastian Andrzej Siewior
2021-08-03 14:15 ` [PATCH 02/38] MIPS: " Sebastian Andrzej Siewior
2021-08-05  9:02   ` Thomas Bogendoerfer
2021-08-03 14:15 ` [PATCH 03/38] powerpc: " Sebastian Andrzej Siewior
2021-08-03 14:15 ` [PATCH 04/38] s390: " Sebastian Andrzej Siewior
2021-08-03 15:40   ` Heiko Carstens
2021-08-03 14:15 ` [PATCH 05/38] s390/sclp: " Sebastian Andrzej Siewior
2021-08-03 15:40   ` Heiko Carstens
2021-08-03 14:15 ` [PATCH 06/38] x86/mmiotrace: " Sebastian Andrzej Siewior
2021-08-03 15:03   ` [Nouveau] " Karol Herbst
2021-08-04  1:07   ` Steven Rostedt
2021-08-10 12:52   ` [tip: x86/cleanups] " tip-bot2 for Sebastian Andrzej Siewior
2021-08-03 14:15 ` [PATCH 07/38] x86/mtrr: " Sebastian Andrzej Siewior
2021-08-10 12:52   ` [tip: x86/cleanups] " tip-bot2 for Sebastian Andrzej Siewior
2021-08-03 14:15 ` [PATCH 08/38] x86/microcode: " Sebastian Andrzej Siewior
2021-08-10 12:52   ` [tip: x86/cleanups] " tip-bot2 for Sebastian Andrzej Siewior
2021-08-03 14:15 ` [PATCH 09/38] x86/mce/inject: " Sebastian Andrzej Siewior
2021-08-10 12:52   ` [tip: x86/cleanups] " tip-bot2 for Sebastian Andrzej Siewior
2021-08-03 14:15 ` [PATCH 10/38] perf/x86/intel: " Sebastian Andrzej Siewior
2021-08-10 13:04   ` [tip: perf/core] " tip-bot2 for Sebastian Andrzej Siewior
2021-08-26  8:09   ` tip-bot2 for Sebastian Andrzej Siewior
2021-08-03 14:15 ` [PATCH 11/38] perf/hw_breakpoint: " Sebastian Andrzej Siewior
2021-08-10 13:04   ` [tip: perf/core] " tip-bot2 for Sebastian Andrzej Siewior
2021-08-26  8:09   ` tip-bot2 for Sebastian Andrzej Siewior
2021-08-03 14:15 ` [PATCH 12/38] crypto: virtio: " Sebastian Andrzej Siewior
2021-08-12 11:36   ` Herbert Xu
2021-08-03 14:15 ` [PATCH 13/38] hwmon: " Sebastian Andrzej Siewior
2021-08-03 15:29   ` Guenter Roeck
2021-08-03 14:15 ` [PATCH 14/38] coresight: " Sebastian Andrzej Siewior
2021-08-03 15:52   ` Mathieu Poirier
2021-08-03 14:15 ` [PATCH 15/38] md/raid5: " Sebastian Andrzej Siewior
2021-08-05 16:20   ` Song Liu
2021-08-27 23:53   ` [tip: smp/core] " tip-bot2 for Sebastian Andrzej Siewior
2021-08-03 14:15 ` [PATCH 16/38] sgi-xpc: " Sebastian Andrzej Siewior
2021-08-03 15:54   ` Steve Wahl
2021-08-03 21:30   ` Robin Holt
2021-08-03 14:16 ` [PATCH 17/38] platform/x86: " Sebastian Andrzej Siewior
2021-08-06 13:36   ` Hans de Goede
2021-08-03 14:16 ` [PATCH 18/38] powercap: intel_rapl: " Sebastian Andrzej Siewior
2021-08-04 18:14   ` Rafael J. Wysocki
2021-08-03 14:16 ` [PATCH 19/38] thermal: " Sebastian Andrzej Siewior
2021-08-14 10:52   ` Daniel Lezcano
2021-09-10 22:45   ` [tip: smp/urgent] " tip-bot2 for Sebastian Andrzej Siewior
2021-09-11 20:48     ` Daniel Lezcano
2021-09-11 21:11       ` Borislav Petkov
2021-08-03 14:16 ` [PATCH 20/38] mm: " Sebastian Andrzej Siewior
2021-08-27 23:53   ` [tip: smp/core] " tip-bot2 for Sebastian Andrzej Siewior
2021-08-03 14:16 ` [PATCH 21/38] virtio_net: " Sebastian Andrzej Siewior
2021-08-04 22:41   ` Jakub Kicinski
2021-08-03 14:16 ` [PATCH 22/38] net/af_iucv: " Sebastian Andrzej Siewior
2021-08-04  6:36   ` Julian Wiedmann
2021-08-03 14:16 ` [PATCH 23/38] net: " Sebastian Andrzej Siewior
2021-08-03 14:16 ` [PATCH 24/38] cgroup: " Sebastian Andrzej Siewior
2021-08-09 22:37   ` Tejun Heo
2021-08-03 14:16 ` [PATCH 25/38] genirq/affinity: " Sebastian Andrzej Siewior
2021-08-10 12:58   ` [tip: irq/core] " tip-bot2 for Sebastian Andrzej Siewior
2021-08-03 14:16 ` [PATCH 26/38] livepatch: " Sebastian Andrzej Siewior
2021-08-04  7:52   ` Petr Mladek
2021-08-19 10:01     ` Jiri Kosina
2021-08-03 14:16 ` [PATCH 27/38] padata: " Sebastian Andrzej Siewior
2021-08-04 14:52   ` Daniel Jordan
2021-08-12 11:36   ` Herbert Xu
2021-08-03 14:16 ` [PATCH 28/38] cpufreq: " Sebastian Andrzej Siewior
2021-08-04 18:19   ` Rafael J. Wysocki
2021-08-03 14:16 ` [PATCH 29/38] ACPI: processor: " Sebastian Andrzej Siewior
2021-08-04 18:27   ` Rafael J. Wysocki
2021-08-03 14:16 ` [PATCH 30/38] ACPI: PM: s2idle: " Sebastian Andrzej Siewior
2021-08-04 18:20   ` Rafael J. Wysocki
2021-08-03 14:16 ` [PATCH 31/38] rcu: " Sebastian Andrzej Siewior
2021-08-03 16:00   ` Paul E. McKenney
2021-08-10 12:42     ` Thomas Gleixner
2021-08-10 18:20       ` Paul E. McKenney
2021-08-03 14:16 ` [PATCH 32/38] sched: " Sebastian Andrzej Siewior
2021-08-10 12:58   ` [tip: sched/core] " tip-bot2 for Sebastian Andrzej Siewior
2021-08-03 14:16 ` [PATCH 33/38] smpboot: " Sebastian Andrzej Siewior
2021-08-10 13:04   ` [tip: smp/core] " tip-bot2 for Sebastian Andrzej Siewior
2021-08-03 14:16 ` [PATCH 34/38] clocksource: " Sebastian Andrzej Siewior
2021-08-10 12:58   ` [tip: timers/core] " tip-bot2 for Sebastian Andrzej Siewior
2021-08-03 14:16 ` [PATCH 35/38] torture: " Sebastian Andrzej Siewior
2021-08-03 14:16 ` [PATCH 36/38] tracing: " Sebastian Andrzej Siewior
2021-08-03 15:16   ` Daniel Bristot de Oliveira
2021-08-04  2:26   ` Steven Rostedt
2021-08-10 13:34     ` Sebastian Andrzej Siewior
2021-08-10 19:12       ` Steven Rostedt
2021-08-03 14:16 ` [PATCH 37/38] workqueue: " Sebastian Andrzej Siewior
2021-08-04  1:36   ` Lai Jiangshan
2021-08-09 22:33   ` Tejun Heo
2021-08-03 14:16 ` [PATCH 38/38] cpu/hotplug: Remove " Sebastian Andrzej Siewior
2021-09-10 22:45   ` [tip: smp/urgent] " tip-bot2 for Sebastian Andrzej Siewior
2021-08-03 15:30 ` [PATCH 00/38] Replace deprecated CPU-hotplug Hans de Goede
2021-08-03 16:10   ` Sebastian Andrzej Siewior
2021-08-18 13:38 ` (subset) " Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).