There is an unbalanced pm_runtime_enable() in etm4_probe_platform_dev()
when etm4_probe() fails. This problem can be observed via the coresight
etm4 module's (load -> unload -> load) sequence when etm4_probe() fails
in etm4_probe_platform_dev().
[ 63.379943] coresight-etm4x 7040000.etm: Unbalanced pm_runtime_enable!
[ 63.393630] coresight-etm4x 7140000.etm: Unbalanced pm_runtime_enable!
[ 63.407455] coresight-etm4x 7240000.etm: Unbalanced pm_runtime_enable!
[ 63.420983] coresight-etm4x 7340000.etm: Unbalanced pm_runtime_enable!
[ 63.420999] coresight-etm4x 7440000.etm: Unbalanced pm_runtime_enable!
[ 63.441209] coresight-etm4x 7540000.etm: Unbalanced pm_runtime_enable!
[ 63.454689] coresight-etm4x 7640000.etm: Unbalanced pm_runtime_enable!
[ 63.474982] coresight-etm4x 7740000.etm: Unbalanced pm_runtime_enable!
This fixes the above problem - with an explicit pm_runtime_disable() call
when etm4_probe() fails during etm4_probe_platform_dev().
Cc: Lorenzo Pieralisi <[email protected]>
Cc: Hanjun Guo <[email protected]>
Cc: Sudeep Holla <[email protected]>
Cc: "Rafael J. Wysocki" <[email protected]>
Cc: Len Brown <[email protected]>
Cc: Suzuki K Poulose <[email protected]>
Cc: Mike Leach <[email protected]>
Cc: James Clark <[email protected]>
Cc: Leo Yan <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Anshuman Khandual <[email protected]>
---
Changes in V4:
- New patch in the series
drivers/hwtracing/coresight/coresight-etm4x-core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
index ce1995a2827f..7c693b45ac05 100644
--- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
+++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
@@ -2217,6 +2217,9 @@ static int etm4_probe_platform_dev(struct platform_device *pdev)
ret = etm4_probe(&pdev->dev);
pm_runtime_put(&pdev->dev);
+ if (ret)
+ pm_runtime_disable(&pdev->dev);
+
return ret;
}
--
2.25.1
On 23/01/2024 05:45, Anshuman Khandual wrote:
> There is an unbalanced pm_runtime_enable() in etm4_probe_platform_dev()
> when etm4_probe() fails. This problem can be observed via the coresight
> etm4 module's (load -> unload -> load) sequence when etm4_probe() fails
> in etm4_probe_platform_dev().
>
> [ 63.379943] coresight-etm4x 7040000.etm: Unbalanced pm_runtime_enable!
> [ 63.393630] coresight-etm4x 7140000.etm: Unbalanced pm_runtime_enable!
> [ 63.407455] coresight-etm4x 7240000.etm: Unbalanced pm_runtime_enable!
> [ 63.420983] coresight-etm4x 7340000.etm: Unbalanced pm_runtime_enable!
> [ 63.420999] coresight-etm4x 7440000.etm: Unbalanced pm_runtime_enable!
> [ 63.441209] coresight-etm4x 7540000.etm: Unbalanced pm_runtime_enable!
> [ 63.454689] coresight-etm4x 7640000.etm: Unbalanced pm_runtime_enable!
> [ 63.474982] coresight-etm4x 7740000.etm: Unbalanced pm_runtime_enable!
>
> This fixes the above problem - with an explicit pm_runtime_disable() call
> when etm4_probe() fails during etm4_probe_platform_dev().
Fixes: 5214b563588e ("coresight: etm4x: Add support for sysreg only devices"
>
> Cc: Lorenzo Pieralisi <[email protected]>
> Cc: Hanjun Guo <[email protected]>
> Cc: Sudeep Holla <[email protected]>
> Cc: "Rafael J. Wysocki" <[email protected]>
> Cc: Len Brown <[email protected]>
> Cc: Suzuki K Poulose <[email protected]>
> Cc: Mike Leach <[email protected]>
> Cc: James Clark <[email protected]>
> Cc: Leo Yan <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Anshuman Khandual <[email protected]>
> ---
> Changes in V4:
>
> - New patch in the series
>
> drivers/hwtracing/coresight/coresight-etm4x-core.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> index ce1995a2827f..7c693b45ac05 100644
> --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
> +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> @@ -2217,6 +2217,9 @@ static int etm4_probe_platform_dev(struct platform_device *pdev)
> ret = etm4_probe(&pdev->dev);
>
> pm_runtime_put(&pdev->dev);
> + if (ret)
> + pm_runtime_disable(&pdev->dev);
> +
> return ret;
> }
>
Looks good to me. I have glanced through the other platform device
driver code in coresight subsystem and they all seem to be safe, except
for Ultrasoc-smb, which doesn't do any power managment. It may be,
because it is only supported on an ACPI system.
Suzuki
On 2/15/24 16:34, Suzuki K Poulose wrote:
> On 23/01/2024 05:45, Anshuman Khandual wrote:
>> There is an unbalanced pm_runtime_enable() in etm4_probe_platform_dev()
>> when etm4_probe() fails. This problem can be observed via the coresight
>> etm4 module's (load -> unload -> load) sequence when etm4_probe() fails
>> in etm4_probe_platform_dev().
>>
>> [ 63.379943] coresight-etm4x 7040000.etm: Unbalanced pm_runtime_enable!
>> [ 63.393630] coresight-etm4x 7140000.etm: Unbalanced pm_runtime_enable!
>> [ 63.407455] coresight-etm4x 7240000.etm: Unbalanced pm_runtime_enable!
>> [ 63.420983] coresight-etm4x 7340000.etm: Unbalanced pm_runtime_enable!
>> [ 63.420999] coresight-etm4x 7440000.etm: Unbalanced pm_runtime_enable!
>> [ 63.441209] coresight-etm4x 7540000.etm: Unbalanced pm_runtime_enable!
>> [ 63.454689] coresight-etm4x 7640000.etm: Unbalanced pm_runtime_enable!
>> [ 63.474982] coresight-etm4x 7740000.etm: Unbalanced pm_runtime_enable!
>>
>> This fixes the above problem - with an explicit pm_runtime_disable() call
>> when etm4_probe() fails during etm4_probe_platform_dev().
>
> Fixes: 5214b563588e ("coresight: etm4x: Add support for sysreg only devices"
Sure, will add this 'Fixes' tag here.
>
>>
>> Cc: Lorenzo Pieralisi <[email protected]>
>> Cc: Hanjun Guo <[email protected]>
>> Cc: Sudeep Holla <[email protected]>
>> Cc: "Rafael J. Wysocki" <[email protected]>
>> Cc: Len Brown <[email protected]>
>> Cc: Suzuki K Poulose <[email protected]>
>> Cc: Mike Leach <[email protected]>
>> Cc: James Clark <[email protected]>
>> Cc: Leo Yan <[email protected]>
>> Cc: [email protected]
>> Cc: [email protected]
>> Cc: [email protected]
>> Cc: [email protected]
>> Signed-off-by: Anshuman Khandual <[email protected]>
>> ---
>> Changes in V4:
>>
>> - New patch in the series
>>
>> drivers/hwtracing/coresight/coresight-etm4x-core.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
>> index ce1995a2827f..7c693b45ac05 100644
>> --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
>> +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
>> @@ -2217,6 +2217,9 @@ static int etm4_probe_platform_dev(struct platform_device *pdev)
>> ret = etm4_probe(&pdev->dev);
>> pm_runtime_put(&pdev->dev);
>> + if (ret)
>> + pm_runtime_disable(&pdev->dev);
>> +
>> return ret;
>> }
>>
>
> Looks good to me. I have glanced through the other platform device driver code in coresight subsystem and they all seem to be safe, except
> for Ultrasoc-smb, which doesn't do any power managment. It may be, because it is only supported on an ACPI system.
Understood.