* [PATCH 0/2] perf: Fix some hotplug callbask leaks
@ 2022-11-14 13:33 Shang XiaoJing
2022-11-14 13:33 ` [PATCH 1/2] perf/arm_dmc620: Fix hotplug callback leak in dmc620_pmu_init() Shang XiaoJing
2022-11-14 13:33 ` [PATCH 2/2] perf/smmuv3: Fix hotplug callback leak in arm_smmu_pmu_init() Shang XiaoJing
0 siblings, 2 replies; 6+ messages in thread
From: Shang XiaoJing @ 2022-11-14 13:33 UTC (permalink / raw)
To: will, mark.rutland, robin.murphy, tuanphan,
shameerali.kolothum.thodi, nleeder, linux-arm-kernel
Cc: shangxiaojing
There are some potential leaked hotplug callbacks that were found, and
will be fixed by this patch.
Shang XiaoJing (2):
perf/arm_dmc620: Fix hotplug callback leak in dmc620_pmu_init()
perf/smmuv3: Fix hotplug callback leak in arm_smmu_pmu_init()
drivers/perf/arm_dmc620_pmu.c | 10 +++++++++-
drivers/perf/arm_smmuv3_pmu.c | 10 +++++++++-
2 files changed, 18 insertions(+), 2 deletions(-)
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] perf/arm_dmc620: Fix hotplug callback leak in dmc620_pmu_init()
2022-11-14 13:33 [PATCH 0/2] perf: Fix some hotplug callbask leaks Shang XiaoJing
@ 2022-11-14 13:33 ` Shang XiaoJing
2022-11-15 10:53 ` Punit Agrawal
2022-11-14 13:33 ` [PATCH 2/2] perf/smmuv3: Fix hotplug callback leak in arm_smmu_pmu_init() Shang XiaoJing
1 sibling, 1 reply; 6+ messages in thread
From: Shang XiaoJing @ 2022-11-14 13:33 UTC (permalink / raw)
To: will, mark.rutland, robin.murphy, tuanphan,
shameerali.kolothum.thodi, nleeder, linux-arm-kernel
Cc: shangxiaojing
dmc620_pmu_init() won't remove the callback added by
cpuhp_setup_state_multi() when platform_driver_register() failed. Remove
the callback by cpuhp_remove_multi_state() in fail path.
Similar to the handling of arm_ccn_init() in commit 26242b330093 ("bus:
arm-ccn: Prevent hotplug callback leak")
Fixes: 53c218da220c ("driver/perf: Add PMU driver for the ARM DMC-620 memory controller")
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
---
drivers/perf/arm_dmc620_pmu.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/perf/arm_dmc620_pmu.c b/drivers/perf/arm_dmc620_pmu.c
index 280a6ae3e27c..d07054a05861 100644
--- a/drivers/perf/arm_dmc620_pmu.c
+++ b/drivers/perf/arm_dmc620_pmu.c
@@ -725,6 +725,8 @@ static struct platform_driver dmc620_pmu_driver = {
static int __init dmc620_pmu_init(void)
{
+ int ret;
+
cpuhp_state_num = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN,
DMC620_DRVNAME,
NULL,
@@ -732,7 +734,13 @@ static int __init dmc620_pmu_init(void)
if (cpuhp_state_num < 0)
return cpuhp_state_num;
- return platform_driver_register(&dmc620_pmu_driver);
+ ret = platform_driver_register(&dmc620_pmu_driver);
+ if (ret) {
+ cpuhp_remove_multi_state(cpuhp_state_num);
+ return ret;
+ }
+
+ return 0;
}
static void __exit dmc620_pmu_exit(void)
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH 1/2] perf/arm_dmc620: Fix hotplug callback leak in dmc620_pmu_init()
2022-11-14 13:33 ` [PATCH 1/2] perf/arm_dmc620: Fix hotplug callback leak in dmc620_pmu_init() Shang XiaoJing
@ 2022-11-15 10:53 ` Punit Agrawal
2022-11-15 11:36 ` shangxiaojing
0 siblings, 1 reply; 6+ messages in thread
From: Punit Agrawal @ 2022-11-15 10:53 UTC (permalink / raw)
To: Shang XiaoJing
Cc: will, mark.rutland, robin.murphy, tuanphan,
shameerali.kolothum.thodi, nleeder, linux-arm-kernel
Shang XiaoJing <shangxiaojing@huawei.com> writes:
> dmc620_pmu_init() won't remove the callback added by
> cpuhp_setup_state_multi() when platform_driver_register() failed. Remove
> the callback by cpuhp_remove_multi_state() in fail path.
>
> Similar to the handling of arm_ccn_init() in commit 26242b330093 ("bus:
> arm-ccn: Prevent hotplug callback leak")
>
> Fixes: 53c218da220c ("driver/perf: Add PMU driver for the ARM DMC-620 memory controller")
> Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
> ---
> drivers/perf/arm_dmc620_pmu.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/perf/arm_dmc620_pmu.c b/drivers/perf/arm_dmc620_pmu.c
> index 280a6ae3e27c..d07054a05861 100644
> --- a/drivers/perf/arm_dmc620_pmu.c
> +++ b/drivers/perf/arm_dmc620_pmu.c
> @@ -725,6 +725,8 @@ static struct platform_driver dmc620_pmu_driver = {
>
> static int __init dmc620_pmu_init(void)
> {
> + int ret;
> +
> cpuhp_state_num = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN,
> DMC620_DRVNAME,
> NULL,
> @@ -732,7 +734,13 @@ static int __init dmc620_pmu_init(void)
> if (cpuhp_state_num < 0)
> return cpuhp_state_num;
>
> - return platform_driver_register(&dmc620_pmu_driver);
> + ret = platform_driver_register(&dmc620_pmu_driver);
> + if (ret) {
> + cpuhp_remove_multi_state(cpuhp_state_num);
> + return ret;
> + }
> +
> + return 0;
Nit: There's no need for two separate returns. Just return "ret" at the
bottom of the function.
With the change,
Reviewed-by: Punit Agrawal <punit.agrawal@bytedance.com>.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 1/2] perf/arm_dmc620: Fix hotplug callback leak in dmc620_pmu_init()
2022-11-15 10:53 ` Punit Agrawal
@ 2022-11-15 11:36 ` shangxiaojing
0 siblings, 0 replies; 6+ messages in thread
From: shangxiaojing @ 2022-11-15 11:36 UTC (permalink / raw)
To: Punit Agrawal
Cc: will, mark.rutland, robin.murphy, tuanphan,
shameerali.kolothum.thodi, nleeder, linux-arm-kernel
On 2022/11/15 18:53, Punit Agrawal wrote:
> Shang XiaoJing <shangxiaojing@huawei.com> writes:
>
>> dmc620_pmu_init() won't remove the callback added by
>> cpuhp_setup_state_multi() when platform_driver_register() failed. Remove
>> the callback by cpuhp_remove_multi_state() in fail path.
>>
>> Similar to the handling of arm_ccn_init() in commit 26242b330093 ("bus:
>> arm-ccn: Prevent hotplug callback leak")
>>
>> Fixes: 53c218da220c ("driver/perf: Add PMU driver for the ARM DMC-620 memory controller")
>> Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
>> ---
>> drivers/perf/arm_dmc620_pmu.c | 10 +++++++++-
>> 1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/perf/arm_dmc620_pmu.c b/drivers/perf/arm_dmc620_pmu.c
>> index 280a6ae3e27c..d07054a05861 100644
>> --- a/drivers/perf/arm_dmc620_pmu.c
>> +++ b/drivers/perf/arm_dmc620_pmu.c
>> @@ -725,6 +725,8 @@ static struct platform_driver dmc620_pmu_driver = {
>>
>> static int __init dmc620_pmu_init(void)
>> {
>> + int ret;
>> +
>> cpuhp_state_num = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN,
>> DMC620_DRVNAME,
>> NULL,
>> @@ -732,7 +734,13 @@ static int __init dmc620_pmu_init(void)
>> if (cpuhp_state_num < 0)
>> return cpuhp_state_num;
>>
>> - return platform_driver_register(&dmc620_pmu_driver);
>> + ret = platform_driver_register(&dmc620_pmu_driver);
>> + if (ret) {
>> + cpuhp_remove_multi_state(cpuhp_state_num);
>> + return ret;
>> + }
>> +
>> + return 0;
>
> Nit: There's no need for two separate returns. Just return "ret" at the
> bottom of the function.
>
> With the change,
>
> Reviewed-by: Punit Agrawal <punit.agrawal@bytedance.com>.
Will be fixed in v2.
Thanks,
--
Shang XiaoJing
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] perf/smmuv3: Fix hotplug callback leak in arm_smmu_pmu_init()
2022-11-14 13:33 [PATCH 0/2] perf: Fix some hotplug callbask leaks Shang XiaoJing
2022-11-14 13:33 ` [PATCH 1/2] perf/arm_dmc620: Fix hotplug callback leak in dmc620_pmu_init() Shang XiaoJing
@ 2022-11-14 13:33 ` Shang XiaoJing
2022-11-15 10:53 ` Punit Agrawal
1 sibling, 1 reply; 6+ messages in thread
From: Shang XiaoJing @ 2022-11-14 13:33 UTC (permalink / raw)
To: will, mark.rutland, robin.murphy, tuanphan,
shameerali.kolothum.thodi, nleeder, linux-arm-kernel
Cc: shangxiaojing
arm_smmu_pmu_init() won't remove the callback added by
cpuhp_setup_state_multi() when platform_driver_register() failed. Remove
the callback by cpuhp_remove_multi_state() in fail path.
Similar to the handling of arm_ccn_init() in commit 26242b330093 ("bus:
arm-ccn: Prevent hotplug callback leak")
Fixes: 7d839b4b9e00 ("perf/smmuv3: Add arm64 smmuv3 pmu driver")
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
---
drivers/perf/arm_smmuv3_pmu.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c
index 00d4c45a8017..82622861ec44 100644
--- a/drivers/perf/arm_smmuv3_pmu.c
+++ b/drivers/perf/arm_smmuv3_pmu.c
@@ -959,6 +959,8 @@ static struct platform_driver smmu_pmu_driver = {
static int __init arm_smmu_pmu_init(void)
{
+ int ret;
+
cpuhp_state_num = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN,
"perf/arm/pmcg:online",
NULL,
@@ -966,7 +968,13 @@ static int __init arm_smmu_pmu_init(void)
if (cpuhp_state_num < 0)
return cpuhp_state_num;
- return platform_driver_register(&smmu_pmu_driver);
+ ret = platform_driver_register(&smmu_pmu_driver);
+ if (ret) {
+ cpuhp_remove_multi_state(cpuhp_state_num);
+ return ret;
+ }
+
+ return 0;
}
module_init(arm_smmu_pmu_init);
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH 2/2] perf/smmuv3: Fix hotplug callback leak in arm_smmu_pmu_init()
2022-11-14 13:33 ` [PATCH 2/2] perf/smmuv3: Fix hotplug callback leak in arm_smmu_pmu_init() Shang XiaoJing
@ 2022-11-15 10:53 ` Punit Agrawal
0 siblings, 0 replies; 6+ messages in thread
From: Punit Agrawal @ 2022-11-15 10:53 UTC (permalink / raw)
To: Shang XiaoJing
Cc: will, mark.rutland, robin.murphy, tuanphan,
shameerali.kolothum.thodi, nleeder, linux-arm-kernel
Shang XiaoJing <shangxiaojing@huawei.com> writes:
> arm_smmu_pmu_init() won't remove the callback added by
> cpuhp_setup_state_multi() when platform_driver_register() failed. Remove
> the callback by cpuhp_remove_multi_state() in fail path.
>
> Similar to the handling of arm_ccn_init() in commit 26242b330093 ("bus:
> arm-ccn: Prevent hotplug callback leak")
>
> Fixes: 7d839b4b9e00 ("perf/smmuv3: Add arm64 smmuv3 pmu driver")
> Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
> ---
> drivers/perf/arm_smmuv3_pmu.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c
> index 00d4c45a8017..82622861ec44 100644
> --- a/drivers/perf/arm_smmuv3_pmu.c
> +++ b/drivers/perf/arm_smmuv3_pmu.c
> @@ -959,6 +959,8 @@ static struct platform_driver smmu_pmu_driver = {
>
> static int __init arm_smmu_pmu_init(void)
> {
> + int ret;
> +
> cpuhp_state_num = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN,
> "perf/arm/pmcg:online",
> NULL,
> @@ -966,7 +968,13 @@ static int __init arm_smmu_pmu_init(void)
> if (cpuhp_state_num < 0)
> return cpuhp_state_num;
>
> - return platform_driver_register(&smmu_pmu_driver);
> + ret = platform_driver_register(&smmu_pmu_driver);
> + if (ret) {
> + cpuhp_remove_multi_state(cpuhp_state_num);
> + return ret;
> + }
> +
> + return 0;
Same comment as the previous patch.
With the changes,
Reviewed-by: Punit Agrawal <punit.agrawal@bytedance.com>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-11-15 11:38 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-14 13:33 [PATCH 0/2] perf: Fix some hotplug callbask leaks Shang XiaoJing
2022-11-14 13:33 ` [PATCH 1/2] perf/arm_dmc620: Fix hotplug callback leak in dmc620_pmu_init() Shang XiaoJing
2022-11-15 10:53 ` Punit Agrawal
2022-11-15 11:36 ` shangxiaojing
2022-11-14 13:33 ` [PATCH 2/2] perf/smmuv3: Fix hotplug callback leak in arm_smmu_pmu_init() Shang XiaoJing
2022-11-15 10:53 ` Punit Agrawal
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).