[tip: perf/core] perf/x86/intel: Replace deprecated CPU-hotplug functions.

From: tip-bot2 for Sebastian Andrzej Siewior
Date: Tue Aug 10 2021 - 09:04:46 EST


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@xxxxxxxxxxxxx>
AuthorDate: Tue, 03 Aug 2021 16:15:53 +02:00
Committer: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
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@xxxxxxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Link: https://lore.kernel.org/r/20210803141621.780504-11-bigeasy@xxxxxxxxxxxxx

---
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);