projects
/
platform
/
kernel
/
linux-amlogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
59b723c
)
drivers: perf: Fix wrong put_cpu() placement
author
Alexandre Ghiti
<alexghiti@rivosinc.com>
Tue, 12 Nov 2024 11:34:22 +0000
(12:34 +0100)
committer
Palmer Dabbelt
<palmer@rivosinc.com>
Tue, 12 Nov 2024 15:34:27 +0000
(07:34 -0800)
Unfortunately, the wrong patch version was merged which places the
put_cpu() after enabling a static key, which is not safe as pointed by
Will [1], so move put_cpu() before to avoid this.
Fixes: 2840dadf0dde ("drivers: perf: Fix smp_processor_id() use in preemptible code")
Reported-by: Atish Patra <atishp@rivosinc.com>
Link:
https://lore.kernel.org/all/20240827125335.GD4772@willie-the-truck/
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Link:
https://lore.kernel.org/r/20241112113422.617954-1-alexghiti@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
drivers/perf/riscv_pmu_sbi.c
patch
|
blob
|
history
diff --git
a/drivers/perf/riscv_pmu_sbi.c
b/drivers/perf/riscv_pmu_sbi.c
index 391ca1422caec15b69b747bc8bcaef3c9faead23..1aa303f76cc7afc3949a2bcee26821034b4e80de 100644
(file)
--- a/
drivers/perf/riscv_pmu_sbi.c
+++ b/
drivers/perf/riscv_pmu_sbi.c
@@
-1393,8
+1393,9
@@
static int pmu_sbi_device_probe(struct platform_device *pdev)
goto out_unregister;
cpu = get_cpu();
-
ret = pmu_sbi_snapshot_setup(pmu, cpu);
+ put_cpu();
+
if (ret) {
/* Snapshot is an optional feature. Continue if not available */
pmu_sbi_snapshot_free(pmu);
@@
-1408,7
+1409,6
@@
static int pmu_sbi_device_probe(struct platform_device *pdev)
*/
static_branch_enable(&sbi_pmu_snapshot_available);
}
- put_cpu();
}
register_sysctl("kernel", sbi_pmu_sysctl_table);