Skip to content

Commit f32ed8e

Browse files
77liuqiwilldeacon
authored andcommitted
drivers/perf: Prevent forced unbinding of PMU drivers
Forcefully unbinding PMU drivers during perf sampling will lead to a kernel panic, because the perf upper-layer framework call a NULL pointer in this situation. To solve this issue, "suppress_bind_attrs" should be set to true, so that bind/unbind can be disabled via sysfs and prevent unbinding PMU drivers during perf sampling. Signed-off-by: Qi Liu <[email protected]> Reviewed-by: John Garry <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent bd024e8 commit f32ed8e

13 files changed

+13
-0
lines changed

drivers/perf/arm-cci.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1718,6 +1718,7 @@ static struct platform_driver cci_pmu_driver = {
17181718
.driver = {
17191719
.name = DRIVER_NAME,
17201720
.of_match_table = arm_cci_pmu_matches,
1721+
.suppress_bind_attrs = true,
17211722
},
17221723
.probe = cci_pmu_probe,
17231724
.remove = cci_pmu_remove,

drivers/perf/arm-ccn.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,6 +1545,7 @@ static struct platform_driver arm_ccn_driver = {
15451545
.driver = {
15461546
.name = "arm-ccn",
15471547
.of_match_table = arm_ccn_match,
1548+
.suppress_bind_attrs = true,
15481549
},
15491550
.probe = arm_ccn_probe,
15501551
.remove = arm_ccn_remove,

drivers/perf/arm_dsu_pmu.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,7 @@ static struct platform_driver dsu_pmu_driver = {
757757
.driver = {
758758
.name = DRVNAME,
759759
.of_match_table = of_match_ptr(dsu_pmu_of_match),
760+
.suppress_bind_attrs = true,
760761
},
761762
.probe = dsu_pmu_device_probe,
762763
.remove = dsu_pmu_device_remove,

drivers/perf/arm_smmuv3_pmu.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,7 @@ static void smmu_pmu_shutdown(struct platform_device *pdev)
860860
static struct platform_driver smmu_pmu_driver = {
861861
.driver = {
862862
.name = "arm-smmu-v3-pmcg",
863+
.suppress_bind_attrs = true,
863864
},
864865
.probe = smmu_pmu_probe,
865866
.remove = smmu_pmu_remove,

drivers/perf/arm_spe_pmu.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,6 +1226,7 @@ static struct platform_driver arm_spe_pmu_driver = {
12261226
.driver = {
12271227
.name = DRVNAME,
12281228
.of_match_table = of_match_ptr(arm_spe_pmu_of_match),
1229+
.suppress_bind_attrs = true,
12291230
},
12301231
.probe = arm_spe_pmu_device_probe,
12311232
.remove = arm_spe_pmu_device_remove,

drivers/perf/fsl_imx8_ddr_perf.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,7 @@ static struct platform_driver imx_ddr_pmu_driver = {
707707
.driver = {
708708
.name = "imx-ddr-pmu",
709709
.of_match_table = imx_ddr_pmu_dt_ids,
710+
.suppress_bind_attrs = true,
710711
},
711712
.probe = ddr_perf_probe,
712713
.remove = ddr_perf_remove,

drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ static struct platform_driver hisi_ddrc_pmu_driver = {
419419
.driver = {
420420
.name = "hisi_ddrc_pmu",
421421
.acpi_match_table = ACPI_PTR(hisi_ddrc_pmu_acpi_match),
422+
.suppress_bind_attrs = true,
422423
},
423424
.probe = hisi_ddrc_pmu_probe,
424425
.remove = hisi_ddrc_pmu_remove,

drivers/perf/hisilicon/hisi_uncore_hha_pmu.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ static struct platform_driver hisi_hha_pmu_driver = {
431431
.driver = {
432432
.name = "hisi_hha_pmu",
433433
.acpi_match_table = ACPI_PTR(hisi_hha_pmu_acpi_match),
434+
.suppress_bind_attrs = true,
434435
},
435436
.probe = hisi_hha_pmu_probe,
436437
.remove = hisi_hha_pmu_remove,

drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ static struct platform_driver hisi_l3c_pmu_driver = {
421421
.driver = {
422422
.name = "hisi_l3c_pmu",
423423
.acpi_match_table = ACPI_PTR(hisi_l3c_pmu_acpi_match),
424+
.suppress_bind_attrs = true,
424425
},
425426
.probe = hisi_l3c_pmu_probe,
426427
.remove = hisi_l3c_pmu_remove,

drivers/perf/qcom_l2_pmu.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,6 +1028,7 @@ static struct platform_driver l2_cache_pmu_driver = {
10281028
.driver = {
10291029
.name = "qcom-l2cache-pmu",
10301030
.acpi_match_table = ACPI_PTR(l2_cache_pmu_acpi_match),
1031+
.suppress_bind_attrs = true,
10311032
},
10321033
.probe = l2_cache_pmu_probe,
10331034
.remove = l2_cache_pmu_remove,

0 commit comments

Comments
 (0)