]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
drivers/perf: Prevent forced unbinding of PMU drivers
authorQi Liu <liuqi115@huawei.com>
Fri, 17 Jul 2020 08:49:23 +0000 (16:49 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Jul 2020 08:18:40 +0000 (10:18 +0200)
[ Upstream commit f32ed8eb0e3f0d0ef4ddb854554d60ca5863a9f9 ]

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 <liuqi115@huawei.com>
Reviewed-by: John Garry <john.garry@huawei.com>
Link: https://lore.kernel.org/r/1594975763-32966-1-git-send-email-liuqi115@huawei.com
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
13 files changed:
drivers/perf/arm-cci.c
drivers/perf/arm-ccn.c
drivers/perf/arm_dsu_pmu.c
drivers/perf/arm_smmuv3_pmu.c
drivers/perf/arm_spe_pmu.c
drivers/perf/fsl_imx8_ddr_perf.c
drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c
drivers/perf/hisilicon/hisi_uncore_hha_pmu.c
drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c
drivers/perf/qcom_l2_pmu.c
drivers/perf/qcom_l3_pmu.c
drivers/perf/thunderx2_pmu.c
drivers/perf/xgene_pmu.c

index 8f8606b9bc9ee909901b1f2ccf288dfca033c5de..aca4570f78a86c10d579faaad666906fe6c3dc90 100644 (file)
@@ -1720,6 +1720,7 @@ static struct platform_driver cci_pmu_driver = {
        .driver = {
                   .name = DRIVER_NAME,
                   .of_match_table = arm_cci_pmu_matches,
+                  .suppress_bind_attrs = true,
                  },
        .probe = cci_pmu_probe,
        .remove = cci_pmu_remove,
index 6fc0273b6129d286c111d182fb4cbf63ecda670d..336948b41bd163a024e26c37ee9bd3966c74ac8e 100644 (file)
@@ -1545,6 +1545,7 @@ static struct platform_driver arm_ccn_driver = {
        .driver = {
                .name = "arm-ccn",
                .of_match_table = arm_ccn_match,
+               .suppress_bind_attrs = true,
        },
        .probe = arm_ccn_probe,
        .remove = arm_ccn_remove,
index 70968c8c09d7f83a6cf8162c44f04d5bbf5dc528..4594e2ed13d59019204378f894cc82c6d3cc2829 100644 (file)
@@ -759,6 +759,7 @@ static struct platform_driver dsu_pmu_driver = {
        .driver = {
                .name   = DRVNAME,
                .of_match_table = of_match_ptr(dsu_pmu_of_match),
+               .suppress_bind_attrs = true,
        },
        .probe = dsu_pmu_device_probe,
        .remove = dsu_pmu_device_remove,
index f8fc1b612119c12db56d570f34cf31987318bdcc..9cdd89b29334e61900ec88aec2dd88f0d0c846ca 100644 (file)
@@ -861,6 +861,7 @@ static void smmu_pmu_shutdown(struct platform_device *pdev)
 static struct platform_driver smmu_pmu_driver = {
        .driver = {
                .name = "arm-smmu-v3-pmcg",
+               .suppress_bind_attrs = true,
        },
        .probe = smmu_pmu_probe,
        .remove = smmu_pmu_remove,
index 4e4984a55cd1b1d823bca44c840a49e7d8cf889f..079701e8de1860e70dd5b66236090726cd3ab796 100644 (file)
@@ -1228,6 +1228,7 @@ static struct platform_driver arm_spe_pmu_driver = {
        .driver = {
                .name           = DRVNAME,
                .of_match_table = of_match_ptr(arm_spe_pmu_of_match),
+               .suppress_bind_attrs = true,
        },
        .probe  = arm_spe_pmu_device_probe,
        .remove = arm_spe_pmu_device_remove,
index b241db6929c087fd8ced5bc8044fe505c8a385ea..09f44c6e2eaf666edf47b7a9c3023b3b222565fc 100644 (file)
@@ -646,6 +646,7 @@ static struct platform_driver imx_ddr_pmu_driver = {
        .driver         = {
                .name   = "imx-ddr-pmu",
                .of_match_table = imx_ddr_pmu_dt_ids,
+               .suppress_bind_attrs = true,
        },
        .probe          = ddr_perf_probe,
        .remove         = ddr_perf_remove,
index 64712cf2f99ad9657a644f2923a586258a28343b..b79c96b14328bc02497f9dfefe7367004a6c6210 100644 (file)
@@ -420,6 +420,7 @@ static struct platform_driver hisi_ddrc_pmu_driver = {
        .driver = {
                .name = "hisi_ddrc_pmu",
                .acpi_match_table = ACPI_PTR(hisi_ddrc_pmu_acpi_match),
+               .suppress_bind_attrs = true,
        },
        .probe = hisi_ddrc_pmu_probe,
        .remove = hisi_ddrc_pmu_remove,
index a4004dad6bf1c253f4736b12938fd91b8fa7906f..78865b4ac4a6f25a753700eb5513df81b8eebeee 100644 (file)
@@ -431,6 +431,7 @@ static struct platform_driver hisi_hha_pmu_driver = {
        .driver = {
                .name = "hisi_hha_pmu",
                .acpi_match_table = ACPI_PTR(hisi_hha_pmu_acpi_match),
+               .suppress_bind_attrs = true,
        },
        .probe = hisi_hha_pmu_probe,
        .remove = hisi_hha_pmu_remove,
index 2f3f291b0c2ed1ff356e9ae662d853d8d836d1e2..9dd50c3bc74ecb85fee2aec8a54df584e45b2235 100644 (file)
@@ -421,6 +421,7 @@ static struct platform_driver hisi_l3c_pmu_driver = {
        .driver = {
                .name = "hisi_l3c_pmu",
                .acpi_match_table = ACPI_PTR(hisi_l3c_pmu_acpi_match),
+               .suppress_bind_attrs = true,
        },
        .probe = hisi_l3c_pmu_probe,
        .remove = hisi_l3c_pmu_remove,
index 21d6991dbe0ba8efa054499c9695a916752336b1..4da37f650f983fe7d02cb33537475d9478d34843 100644 (file)
@@ -1028,6 +1028,7 @@ static struct platform_driver l2_cache_pmu_driver = {
        .driver = {
                .name = "qcom-l2cache-pmu",
                .acpi_match_table = ACPI_PTR(l2_cache_pmu_acpi_match),
+               .suppress_bind_attrs = true,
        },
        .probe = l2_cache_pmu_probe,
        .remove = l2_cache_pmu_remove,
index 656e830798d9e79ce9bcd050407b0df117a31ff3..9ddb577c542b5e68a94898f68eb30161966bf99f 100644 (file)
@@ -814,6 +814,7 @@ static struct platform_driver qcom_l3_cache_pmu_driver = {
        .driver = {
                .name = "qcom-l3cache-pmu",
                .acpi_match_table = ACPI_PTR(qcom_l3_cache_pmu_acpi_match),
+               .suppress_bind_attrs = true,
        },
        .probe = qcom_l3_cache_pmu_probe,
 };
index 43d76c85da56b7a4941e28f435c2877f3d512a08..9e1c3c7eeba9b6252b5fe6c5526c8de3f4d78b6f 100644 (file)
@@ -816,6 +816,7 @@ static struct platform_driver tx2_uncore_driver = {
        .driver = {
                .name           = "tx2-uncore-pmu",
                .acpi_match_table = ACPI_PTR(tx2_uncore_acpi_match),
+               .suppress_bind_attrs = true,
        },
        .probe = tx2_uncore_probe,
        .remove = tx2_uncore_remove,
index 7e328d6385c37be0344c8e9d4ca9e3d914458bec..328aea9f6be325580e2a0dd6b1b4165ea4541e6d 100644 (file)
@@ -1981,6 +1981,7 @@ static struct platform_driver xgene_pmu_driver = {
                .name           = "xgene-pmu",
                .of_match_table = xgene_pmu_of_match,
                .acpi_match_table = ACPI_PTR(xgene_pmu_acpi_match),
+               .suppress_bind_attrs = true,
        },
 };