All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] perf: Fix some hotplug callbask leaks
@ 2022-11-15 11:55 Shang XiaoJing
  2022-11-15 11:55 ` [PATCH v2 1/2] perf/arm_dmc620: Fix hotplug callback leak in dmc620_pmu_init() Shang XiaoJing
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Shang XiaoJing @ 2022-11-15 11:55 UTC (permalink / raw)
  To: will, mark.rutland, punit.agrawal, 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()
---
changes in v2:
- use one instead of two separate returns.
---
 drivers/perf/arm_dmc620_pmu.c | 9 ++++++++-
 drivers/perf/arm_smmuv3_pmu.c | 9 ++++++++-
 2 files changed, 16 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] 4+ messages in thread

* [PATCH v2 1/2] perf/arm_dmc620: Fix hotplug callback leak in dmc620_pmu_init()
  2022-11-15 11:55 [PATCH v2 0/2] perf: Fix some hotplug callbask leaks Shang XiaoJing
@ 2022-11-15 11:55 ` Shang XiaoJing
  2022-11-15 11:55 ` [PATCH v2 2/2] perf/smmuv3: Fix hotplug callback leak in arm_smmu_pmu_init() Shang XiaoJing
  2022-11-15 18:32 ` [PATCH v2 0/2] perf: Fix some hotplug callbask leaks Will Deacon
  2 siblings, 0 replies; 4+ messages in thread
From: Shang XiaoJing @ 2022-11-15 11:55 UTC (permalink / raw)
  To: will, mark.rutland, punit.agrawal, 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>
Reviewed-by: Punit Agrawal <punit.agrawal@bytedance.com>
---
changes in v2:
- use one instead of two separate returns.
---
 drivers/perf/arm_dmc620_pmu.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/perf/arm_dmc620_pmu.c b/drivers/perf/arm_dmc620_pmu.c
index 280a6ae3e27c..54aa4658fb36 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,11 @@ 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;
 }
 
 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] 4+ messages in thread

* [PATCH v2 2/2] perf/smmuv3: Fix hotplug callback leak in arm_smmu_pmu_init()
  2022-11-15 11:55 [PATCH v2 0/2] perf: Fix some hotplug callbask leaks Shang XiaoJing
  2022-11-15 11:55 ` [PATCH v2 1/2] perf/arm_dmc620: Fix hotplug callback leak in dmc620_pmu_init() Shang XiaoJing
@ 2022-11-15 11:55 ` Shang XiaoJing
  2022-11-15 18:32 ` [PATCH v2 0/2] perf: Fix some hotplug callbask leaks Will Deacon
  2 siblings, 0 replies; 4+ messages in thread
From: Shang XiaoJing @ 2022-11-15 11:55 UTC (permalink / raw)
  To: will, mark.rutland, punit.agrawal, 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>
Reviewed-by: Punit Agrawal <punit.agrawal@bytedance.com>
---
changes in v2:
- use one instead of two separate returns.
---
 drivers/perf/arm_smmuv3_pmu.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c
index 00d4c45a8017..25a269d431e4 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,11 @@ 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;
 }
 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] 4+ messages in thread

* Re: [PATCH v2 0/2] perf: Fix some hotplug callbask leaks
  2022-11-15 11:55 [PATCH v2 0/2] perf: Fix some hotplug callbask leaks Shang XiaoJing
  2022-11-15 11:55 ` [PATCH v2 1/2] perf/arm_dmc620: Fix hotplug callback leak in dmc620_pmu_init() Shang XiaoJing
  2022-11-15 11:55 ` [PATCH v2 2/2] perf/smmuv3: Fix hotplug callback leak in arm_smmu_pmu_init() Shang XiaoJing
@ 2022-11-15 18:32 ` Will Deacon
  2 siblings, 0 replies; 4+ messages in thread
From: Will Deacon @ 2022-11-15 18:32 UTC (permalink / raw)
  To: mark.rutland, Shang XiaoJing, nleeder, shameerali.kolothum.thodi,
	tuanphan, punit.agrawal, linux-arm-kernel, robin.murphy
  Cc: catalin.marinas, kernel-team, Will Deacon

On Tue, 15 Nov 2022 19:55:38 +0800, Shang XiaoJing wrote:
> 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()
> 
> [...]

Applied to will (for-next/perf), thanks!

[1/2] perf/arm_dmc620: Fix hotplug callback leak in dmc620_pmu_init()
      https://git.kernel.org/will/c/d9f564c966e6
[2/2] perf/smmuv3: Fix hotplug callback leak in arm_smmu_pmu_init()
      https://git.kernel.org/will/c/6f2d566b4643

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

_______________________________________________
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] 4+ messages in thread

end of thread, other threads:[~2022-11-15 18:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-15 11:55 [PATCH v2 0/2] perf: Fix some hotplug callbask leaks Shang XiaoJing
2022-11-15 11:55 ` [PATCH v2 1/2] perf/arm_dmc620: Fix hotplug callback leak in dmc620_pmu_init() Shang XiaoJing
2022-11-15 11:55 ` [PATCH v2 2/2] perf/smmuv3: Fix hotplug callback leak in arm_smmu_pmu_init() Shang XiaoJing
2022-11-15 18:32 ` [PATCH v2 0/2] perf: Fix some hotplug callbask leaks Will Deacon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.