Linux-Amlogic Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/18] perf: Convert to platform remove callback returning void
@ 2023-12-15 13:59 Uwe Kleine-König
  2023-12-15 13:59 ` [PATCH 02/18] perf: amlogic: " Uwe Kleine-König
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2023-12-15 13:59 UTC (permalink / raw)
  To: Will Deacon, Mark Rutland
  Cc: Shuai Xue, linux-arm-kernel, linux-kernel, Jiucheng Xu,
	Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	linux-amlogic, Ilkka Koskinen, Suzuki K Poulose, Besar Wicaksono,
	Robin Murphy, Raag Jadav, Frank Li, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Yicong Yang, Jonathan Cameron, Andy Gross, Bjorn Andersson,
	Konrad Dybcio, linux-arm-msm, Khuong Dinh

Hello,

this series converts all drivers below drivers/perf to use
.remove_new(). See commit 5c5a7680e67b ("platform: Provide a remove
callback that returns no value") for an extended explanation and the
eventual goal. The TL;DR; is to make it harder for driver authors to
leak resources without noticing.

I based the patches on today's next, I had to revert commits 
3115ee021bfb ("arm64: perf: Include threshold control fields in
PMEVTYPER mask") and 816c26754447 ("arm64: perf: Add support for event
counting threshold") to compile test on ARCH=arm (this is a problem in
next, not in my patch series).

This is merge window material. All patches are pairwise independent of
each other so they can be applied individually. Still it would be great
to let them go in all together.

Best regards
Uwe

Uwe Kleine-König (18):
  perf: alibaba_uncore_drw: Convert to platform remove callback
    returning void
  perf: amlogic: Convert to platform remove callback returning void
  perf: arm-cci: Convert to platform remove callback returning void
  perf: arm-ccn: Convert to platform remove callback returning void
  perf: arm-cmn: Convert to platform remove callback returning void
  perf: arm_cspmu: Convert to platform remove callback returning void
  perf: arm_dmc620: Convert to platform remove callback returning void
  perf: arm_dsu: Convert to platform remove callback returning void
  perf: arm_smmuv3: Convert to platform remove callback returning void
  perf: arm_spe: Convert to platform remove callback returning void
  perf: fsl_imx8_ddr: Convert to platform remove callback returning void
  perf: fsl_imx9_ddr: Convert to platform remove callback returning void
  perf: hisilicon: Convert to platform remove callback returning void
  perf: marvell_cn10k_ddr: Convert to platform remove callback returning void
  perf: marvell_cn10k_tad: Convert to platform remove callback returning void
  perf: qcom_l2: Convert to platform remove callback returning void
  perf: thunderx2: Convert to platform remove callback returning void
  perf: xgene: Convert to platform remove callback returning void

 drivers/perf/alibaba_uncore_drw_pmu.c         | 6 ++----
 drivers/perf/amlogic/meson_g12_ddr_pmu.c      | 6 ++----
 drivers/perf/arm-cci.c                        | 8 +++-----
 drivers/perf/arm-ccn.c                        | 6 ++----
 drivers/perf/arm-cmn.c                        | 5 ++---
 drivers/perf/arm_cspmu/arm_cspmu.c            | 6 ++----
 drivers/perf/arm_dmc620_pmu.c                 | 6 ++----
 drivers/perf/arm_dsu_pmu.c                    | 6 ++----
 drivers/perf/arm_smmuv3_pmu.c                 | 6 ++----
 drivers/perf/arm_spe_pmu.c                    | 5 ++---
 drivers/perf/fsl_imx8_ddr_perf.c              | 5 ++---
 drivers/perf/fsl_imx9_ddr_perf.c              | 6 ++----
 drivers/perf/hisilicon/hisi_uncore_cpa_pmu.c  | 5 ++---
 drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c | 5 ++---
 drivers/perf/hisilicon/hisi_uncore_hha_pmu.c  | 5 ++---
 drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c  | 5 ++---
 drivers/perf/hisilicon/hisi_uncore_pa_pmu.c   | 5 ++---
 drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c | 5 ++---
 drivers/perf/marvell_cn10k_ddr_pmu.c          | 5 ++---
 drivers/perf/marvell_cn10k_tad_pmu.c          | 6 ++----
 drivers/perf/qcom_l2_pmu.c                    | 5 ++---
 drivers/perf/thunderx2_pmu.c                  | 5 ++---
 drivers/perf/xgene_pmu.c                      | 6 ++----
 23 files changed, 47 insertions(+), 81 deletions(-)

base-commit: 17cb8a20bde66a520a2ca7aad1063e1ce7382240
-- 
2.42.0


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 02/18] perf: amlogic: Convert to platform remove callback returning void
  2023-12-15 13:59 [PATCH 00/18] perf: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-12-15 13:59 ` Uwe Kleine-König
  2024-01-10  8:56 ` [PATCH 00/18] perf: " Uwe Kleine-König
  2024-02-09 18:31 ` Will Deacon
  2 siblings, 0 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2023-12-15 13:59 UTC (permalink / raw)
  To: Will Deacon, Mark Rutland
  Cc: Jiucheng Xu, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, linux-amlogic, linux-arm-kernel,
	linux-kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/perf/amlogic/meson_g12_ddr_pmu.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/perf/amlogic/meson_g12_ddr_pmu.c b/drivers/perf/amlogic/meson_g12_ddr_pmu.c
index 15d52ab3276a..99cc791892bc 100644
--- a/drivers/perf/amlogic/meson_g12_ddr_pmu.c
+++ b/drivers/perf/amlogic/meson_g12_ddr_pmu.c
@@ -355,11 +355,9 @@ static int g12_ddr_pmu_probe(struct platform_device *pdev)
 	return meson_ddr_pmu_create(pdev);
 }
 
-static int g12_ddr_pmu_remove(struct platform_device *pdev)
+static void g12_ddr_pmu_remove(struct platform_device *pdev)
 {
 	meson_ddr_pmu_remove(pdev);
-
-	return 0;
 }
 
 static const struct of_device_id meson_ddr_pmu_dt_match[] = {
@@ -381,7 +379,7 @@ MODULE_DEVICE_TABLE(of, meson_ddr_pmu_dt_match);
 
 static struct platform_driver g12_ddr_pmu_driver = {
 	.probe = g12_ddr_pmu_probe,
-	.remove = g12_ddr_pmu_remove,
+	.remove_new = g12_ddr_pmu_remove,
 
 	.driver = {
 		.name = "meson-g12-ddr-pmu",
-- 
2.42.0


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 00/18] perf: Convert to platform remove callback returning void
  2023-12-15 13:59 [PATCH 00/18] perf: Convert to platform remove callback returning void Uwe Kleine-König
  2023-12-15 13:59 ` [PATCH 02/18] perf: amlogic: " Uwe Kleine-König
@ 2024-01-10  8:56 ` Uwe Kleine-König
  2024-01-12 13:50   ` Will Deacon
  2024-02-09 18:31 ` Will Deacon
  2 siblings, 1 reply; 6+ messages in thread
From: Uwe Kleine-König @ 2024-01-10  8:56 UTC (permalink / raw)
  To: Will Deacon, Mark Rutland
  Cc: Raag Jadav, Yicong Yang, Ilkka Koskinen, Fabio Estevam,
	Jerome Brunet, Khuong Dinh, Kevin Hilman, Andy Gross,
	NXP Linux Team, linux-arm-msm, Suzuki K Poulose,
	Martin Blumenstingl, Frank Li, Sascha Hauer, Besar Wicaksono,
	Jonathan Cameron, linux-amlogic, linux-arm-kernel, Neil Armstrong,
	Jiucheng Xu, Robin Murphy, Bjorn Andersson, linux-kernel,
	Konrad Dybcio, Shuai Xue, Pengutronix Kernel Team, Shawn Guo


[-- Attachment #1.1: Type: text/plain, Size: 1208 bytes --]

Hello,

On Fri, Dec 15, 2023 at 02:59:00PM +0100, Uwe Kleine-König wrote:
> this series converts all drivers below drivers/perf to use
> .remove_new(). See commit 5c5a7680e67b ("platform: Provide a remove
> callback that returns no value") for an extended explanation and the
> eventual goal. The TL;DR; is to make it harder for driver authors to
> leak resources without noticing.
> 
> I based the patches on today's next, I had to revert commits 
> 3115ee021bfb ("arm64: perf: Include threshold control fields in
> PMEVTYPER mask") and 816c26754447 ("arm64: perf: Add support for event
> counting threshold") to compile test on ARCH=arm (this is a problem in
> next, not in my patch series).
> 
> This is merge window material. All patches are pairwise independent of
> each other so they can be applied individually. Still it would be great
> to let them go in all together.

I wonder if this series is still on someone's radar. It didn't appear in
next up to now, so I guess it's too late for 6.8-rc1?!

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 00/18] perf: Convert to platform remove callback returning void
  2024-01-10  8:56 ` [PATCH 00/18] perf: " Uwe Kleine-König
@ 2024-01-12 13:50   ` Will Deacon
  2024-01-12 18:53     ` Uwe Kleine-König
  0 siblings, 1 reply; 6+ messages in thread
From: Will Deacon @ 2024-01-12 13:50 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Mark Rutland, Raag Jadav, Yicong Yang, Ilkka Koskinen,
	Fabio Estevam, Jerome Brunet, Khuong Dinh, Kevin Hilman,
	Andy Gross, NXP Linux Team, linux-arm-msm, Suzuki K Poulose,
	Martin Blumenstingl, Frank Li, Sascha Hauer, Besar Wicaksono,
	Jonathan Cameron, linux-amlogic, linux-arm-kernel, Neil Armstrong,
	Jiucheng Xu, Robin Murphy, Bjorn Andersson, linux-kernel,
	Konrad Dybcio, Shuai Xue, Pengutronix Kernel Team, Shawn Guo

Hi Uwe,

On Wed, Jan 10, 2024 at 09:56:26AM +0100, Uwe Kleine-König wrote:
> On Fri, Dec 15, 2023 at 02:59:00PM +0100, Uwe Kleine-König wrote:
> > this series converts all drivers below drivers/perf to use
> > .remove_new(). See commit 5c5a7680e67b ("platform: Provide a remove
> > callback that returns no value") for an extended explanation and the
> > eventual goal. The TL;DR; is to make it harder for driver authors to
> > leak resources without noticing.
> > 
> > I based the patches on today's next, I had to revert commits 
> > 3115ee021bfb ("arm64: perf: Include threshold control fields in
> > PMEVTYPER mask") and 816c26754447 ("arm64: perf: Add support for event
> > counting threshold") to compile test on ARCH=arm (this is a problem in
> > next, not in my patch series).
> > 
> > This is merge window material. All patches are pairwise independent of
> > each other so they can be applied individually. Still it would be great
> > to let them go in all together.
> 
> I wonder if this series is still on someone's radar. It didn't appear in
> next up to now, so I guess it's too late for 6.8-rc1?!

This came in during the holiday period so, by the time I saw it, it was
too late to land for this merge window. I can pick it up for 6.9 in a few
weeks, though. I usually start queueing stuff at -rc3.

Will

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 00/18] perf: Convert to platform remove callback returning void
  2024-01-12 13:50   ` Will Deacon
@ 2024-01-12 18:53     ` Uwe Kleine-König
  0 siblings, 0 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2024-01-12 18:53 UTC (permalink / raw)
  To: Will Deacon
  Cc: Mark Rutland, Raag Jadav, Yicong Yang, Ilkka Koskinen,
	Fabio Estevam, Jerome Brunet, Khuong Dinh, Kevin Hilman,
	Andy Gross, NXP Linux Team, linux-arm-msm, Suzuki K Poulose,
	Martin Blumenstingl, Frank Li, Sascha Hauer, Besar Wicaksono,
	Jonathan Cameron, linux-amlogic, linux-arm-kernel, Neil Armstrong,
	Jiucheng Xu, Shawn Guo, Bjorn Andersson, linux-kernel,
	Konrad Dybcio, Shuai Xue, Pengutronix Kernel Team, Robin Murphy


[-- Attachment #1.1: Type: text/plain, Size: 1785 bytes --]

Hey Will,

On Fri, Jan 12, 2024 at 01:50:09PM +0000, Will Deacon wrote:
> On Wed, Jan 10, 2024 at 09:56:26AM +0100, Uwe Kleine-König wrote:
> > On Fri, Dec 15, 2023 at 02:59:00PM +0100, Uwe Kleine-König wrote:
> > > this series converts all drivers below drivers/perf to use
> > > .remove_new(). See commit 5c5a7680e67b ("platform: Provide a remove
> > > callback that returns no value") for an extended explanation and the
> > > eventual goal. The TL;DR; is to make it harder for driver authors to
> > > leak resources without noticing.
> > > 
> > > I based the patches on today's next, I had to revert commits 
> > > 3115ee021bfb ("arm64: perf: Include threshold control fields in
> > > PMEVTYPER mask") and 816c26754447 ("arm64: perf: Add support for event
> > > counting threshold") to compile test on ARCH=arm (this is a problem in
> > > next, not in my patch series).
> > > 
> > > This is merge window material. All patches are pairwise independent of
> > > each other so they can be applied individually. Still it would be great
> > > to let them go in all together.
> > 
> > I wonder if this series is still on someone's radar. It didn't appear in
> > next up to now, so I guess it's too late for 6.8-rc1?!
> 
> This came in during the holiday period so, by the time I saw it, it was
> too late to land for this merge window. I can pick it up for 6.9 in a few
> weeks, though. I usually start queueing stuff at -rc3.

If it's not lost I'm happy. There are still quite a few more such
changes necessary for other subsystems, so no time pressure from my
side; 6.9 is great.

Cheers
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 00/18] perf: Convert to platform remove callback returning void
  2023-12-15 13:59 [PATCH 00/18] perf: Convert to platform remove callback returning void Uwe Kleine-König
  2023-12-15 13:59 ` [PATCH 02/18] perf: amlogic: " Uwe Kleine-König
  2024-01-10  8:56 ` [PATCH 00/18] perf: " Uwe Kleine-König
@ 2024-02-09 18:31 ` Will Deacon
  2 siblings, 0 replies; 6+ messages in thread
From: Will Deacon @ 2024-02-09 18:31 UTC (permalink / raw)
  To: Uwe Kleine-König, Mark Rutland
  Cc: catalin.marinas, kernel-team, Will Deacon, Jerome Brunet,
	Shawn Guo, Jonathan Cameron, Ilkka Koskinen, Kevin Hilman,
	Bjorn Andersson, Andy Gross, Jiucheng Xu, Khuong Dinh, Raag Jadav,
	Martin Blumenstingl, linux-amlogic, linux-arm-msm, Neil Armstrong,
	Shuai Xue, Frank Li, Robin Murphy, linux-kernel, Yicong Yang,
	Suzuki K Poulose, Konrad Dybcio, Fabio Estevam, Besar Wicaksono,
	linux-arm-kernel, NXP Linux Team, Sascha Hauer,
	Pengutronix Kernel Team

On Fri, 15 Dec 2023 14:59:00 +0100, Uwe Kleine-König wrote:
> this series converts all drivers below drivers/perf to use
> .remove_new(). See commit 5c5a7680e67b ("platform: Provide a remove
> callback that returns no value") for an extended explanation and the
> eventual goal. The TL;DR; is to make it harder for driver authors to
> leak resources without noticing.
> 
> I based the patches on today's next, I had to revert commits
> 3115ee021bfb ("arm64: perf: Include threshold control fields in
> PMEVTYPER mask") and 816c26754447 ("arm64: perf: Add support for event
> counting threshold") to compile test on ARCH=arm (this is a problem in
> next, not in my patch series).
> 
> [...]

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

[01/18] perf: alibaba_uncore_drw: Convert to platform remove callback returning void
        https://git.kernel.org/will/c/3bc9d71775ee
[02/18] perf: amlogic: Convert to platform remove callback returning void
        https://git.kernel.org/will/c/94843f269abd
[03/18] perf: arm-cci: Convert to platform remove callback returning void
        https://git.kernel.org/will/c/4df3bddf8707
[04/18] perf: arm-ccn: Convert to platform remove callback returning void
        https://git.kernel.org/will/c/0767f1a48532
[05/18] perf: arm-cmn: Convert to platform remove callback returning void
        https://git.kernel.org/will/c/3909cb3b5f8d
[06/18] perf: arm_cspmu: Convert to platform remove callback returning void
        https://git.kernel.org/will/c/79dc1570b322
[07/18] perf: arm_dmc620: Convert to platform remove callback returning void
        https://git.kernel.org/will/c/ca1e01c8d34a
[08/18] perf: arm_dsu: Convert to platform remove callback returning void
        https://git.kernel.org/will/c/02d77ac1ac7e
[09/18] perf: arm_smmuv3: Convert to platform remove callback returning void
        https://git.kernel.org/will/c/d67c3a61f063
[10/18] perf: arm_spe: Convert to platform remove callback returning void
        https://git.kernel.org/will/c/e63b3aef186b
[11/18] perf: fsl_imx8_ddr: Convert to platform remove callback returning void
        https://git.kernel.org/will/c/1bb639382d3f
[12/18] perf: fsl_imx9_ddr: Convert to platform remove callback returning void
        https://git.kernel.org/will/c/78da2a93b55b
[13/18] perf: hisilicon: Convert to platform remove callback returning void
        https://git.kernel.org/will/c/e07486a832bb
[14/18] perf: marvell_cn10k_ddr: Convert to platform remove callback returning void
        https://git.kernel.org/will/c/c802bd9e354f
[15/18] perf: marvell_cn10k_tad: Convert to platform remove callback returning void
        https://git.kernel.org/will/c/86e8963f9dba
[16/18] perf: qcom_l2: Convert to platform remove callback returning void
        https://git.kernel.org/will/c/8a2e438e710c
[17/18] perf: thunderx2: Convert to platform remove callback returning void
        https://git.kernel.org/will/c/d4c5cef73b25
[18/18] perf: xgene: Convert to platform remove callback returning void
        https://git.kernel.org/will/c/b07ebe8f1428

Cheers,
-- 
Will

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

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-02-09 18:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-15 13:59 [PATCH 00/18] perf: Convert to platform remove callback returning void Uwe Kleine-König
2023-12-15 13:59 ` [PATCH 02/18] perf: amlogic: " Uwe Kleine-König
2024-01-10  8:56 ` [PATCH 00/18] perf: " Uwe Kleine-König
2024-01-12 13:50   ` Will Deacon
2024-01-12 18:53     ` Uwe Kleine-König
2024-02-09 18:31 ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox