mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] coresight: trbe: remove cpuhp instance node before remove cpuhp state
@ 2022-11-22  9:03 Yang Shen
  2022-11-24 11:30 ` Suzuki Kuruppassery Poulose
  0 siblings, 1 reply; 4+ messages in thread
From: Yang Shen @ 2022-11-22  9:03 UTC (permalink / raw)
  To: mathieu.poirier, suzuki.poulose, mike.leach, leo.yan
  Cc: linux-kernel, coresight

cpuhp_state_add_instance() and cpuhp_state_remove_instance() should
be used in pairs. Or there will lead to the warn on
cpuhp_remove_multi_state() since the cpuhp_step list is not empty.

The following is the error log with 'rmmod coresight-trbe':
Error: Removing state 215 which has instances left.
Call trace:
  __cpuhp_remove_state_cpuslocked+0x144/0x160
  __cpuhp_remove_state+0xac/0x100
  arm_trbe_device_remove+0x2c/0x60 [coresight_trbe]
  platform_remove+0x34/0x70
  device_remove+0x54/0x90
  device_release_driver_internal+0x1e4/0x250
  driver_detach+0x5c/0xb0
  bus_remove_driver+0x64/0xc0
  driver_unregister+0x3c/0x70
  platform_driver_unregister+0x20/0x30
  arm_trbe_exit+0x1c/0x658 [coresight_trbe]
  __arm64_sys_delete_module+0x1ac/0x24c
  invoke_syscall+0x50/0x120
  el0_svc_common.constprop.0+0x58/0x1a0
  do_el0_svc+0x38/0xd0
  el0_svc+0x2c/0xc0
  el0t_64_sync_handler+0x1ac/0x1b0
  el0t_64_sync+0x19c/0x1a0
 ---[ end trace 0000000000000000 ]---

Fixes: 3fbf7f011f24 ("coresight: sink: Add TRBE driver")
Signed-off-by: Yang Shen <shenyang39@huawei.com>
---
 drivers/hwtracing/coresight/coresight-trbe.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c
index 2b386bb848f8..1fc4fd79a1c6 100644
--- a/drivers/hwtracing/coresight/coresight-trbe.c
+++ b/drivers/hwtracing/coresight/coresight-trbe.c
@@ -1434,6 +1434,7 @@ static int arm_trbe_probe_cpuhp(struct trbe_drvdata *drvdata)

 static void arm_trbe_remove_cpuhp(struct trbe_drvdata *drvdata)
 {
+	cpuhp_state_remove_instance(drvdata->trbe_online, &drvdata->hotplug_node);
 	cpuhp_remove_multi_state(drvdata->trbe_online);
 }

--
2.24.0


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

* Re: [PATCH] coresight: trbe: remove cpuhp instance node before remove cpuhp state
  2022-11-22  9:03 [PATCH] coresight: trbe: remove cpuhp instance node before remove cpuhp state Yang Shen
@ 2022-11-24 11:30 ` Suzuki Kuruppassery Poulose
  2022-11-24 12:22   ` Anshuman Khandual
  0 siblings, 1 reply; 4+ messages in thread
From: Suzuki Kuruppassery Poulose @ 2022-11-24 11:30 UTC (permalink / raw)
  To: Yang Shen, mathieu.poirier, mike.leach, leo.yan; +Cc: linux-kernel, coresight

On 22/11/2022 09:03, Yang Shen wrote:
> cpuhp_state_add_instance() and cpuhp_state_remove_instance() should
> be used in pairs. Or there will lead to the warn on
> cpuhp_remove_multi_state() since the cpuhp_step list is not empty.
> 
> The following is the error log with 'rmmod coresight-trbe':
> Error: Removing state 215 which has instances left.
> Call trace:
>    __cpuhp_remove_state_cpuslocked+0x144/0x160
>    __cpuhp_remove_state+0xac/0x100
>    arm_trbe_device_remove+0x2c/0x60 [coresight_trbe]
>    platform_remove+0x34/0x70
>    device_remove+0x54/0x90
>    device_release_driver_internal+0x1e4/0x250
>    driver_detach+0x5c/0xb0
>    bus_remove_driver+0x64/0xc0
>    driver_unregister+0x3c/0x70
>    platform_driver_unregister+0x20/0x30
>    arm_trbe_exit+0x1c/0x658 [coresight_trbe]
>    __arm64_sys_delete_module+0x1ac/0x24c
>    invoke_syscall+0x50/0x120
>    el0_svc_common.constprop.0+0x58/0x1a0
>    do_el0_svc+0x38/0xd0
>    el0_svc+0x2c/0xc0
>    el0t_64_sync_handler+0x1ac/0x1b0
>    el0t_64_sync+0x19c/0x1a0
>   ---[ end trace 0000000000000000 ]---
> 
> Fixes: 3fbf7f011f24 ("coresight: sink: Add TRBE driver")
> Signed-off-by: Yang Shen <shenyang39@huawei.com>
> ---
>   drivers/hwtracing/coresight/coresight-trbe.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c
> index 2b386bb848f8..1fc4fd79a1c6 100644
> --- a/drivers/hwtracing/coresight/coresight-trbe.c
> +++ b/drivers/hwtracing/coresight/coresight-trbe.c
> @@ -1434,6 +1434,7 @@ static int arm_trbe_probe_cpuhp(struct trbe_drvdata *drvdata)
> 
>   static void arm_trbe_remove_cpuhp(struct trbe_drvdata *drvdata)
>   {
> +	cpuhp_state_remove_instance(drvdata->trbe_online, &drvdata->hotplug_node);
>   	cpuhp_remove_multi_state(drvdata->trbe_online);
>   }
> 

Applied to coresight next.

https://git.kernel.org/coresight/c/5fefef85b0d3

Thanks
Suzuki

> --
> 2.24.0
> 


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

* Re: [PATCH] coresight: trbe: remove cpuhp instance node before remove cpuhp state
  2022-11-24 11:30 ` Suzuki Kuruppassery Poulose
@ 2022-11-24 12:22   ` Anshuman Khandual
  2022-11-24 12:29     ` Suzuki Kuruppassery Poulose
  0 siblings, 1 reply; 4+ messages in thread
From: Anshuman Khandual @ 2022-11-24 12:22 UTC (permalink / raw)
  To: Suzuki Kuruppassery Poulose, Yang Shen, mathieu.poirier,
	mike.leach, leo.yan
  Cc: linux-kernel, coresight



On 11/24/22 17:00, Suzuki Kuruppassery Poulose wrote:
> On 22/11/2022 09:03, Yang Shen wrote:
>> cpuhp_state_add_instance() and cpuhp_state_remove_instance() should
>> be used in pairs. Or there will lead to the warn on
>> cpuhp_remove_multi_state() since the cpuhp_step list is not empty.
>>
>> The following is the error log with 'rmmod coresight-trbe':
>> Error: Removing state 215 which has instances left.
>> Call trace:
>>    __cpuhp_remove_state_cpuslocked+0x144/0x160
>>    __cpuhp_remove_state+0xac/0x100
>>    arm_trbe_device_remove+0x2c/0x60 [coresight_trbe]
>>    platform_remove+0x34/0x70
>>    device_remove+0x54/0x90
>>    device_release_driver_internal+0x1e4/0x250
>>    driver_detach+0x5c/0xb0
>>    bus_remove_driver+0x64/0xc0
>>    driver_unregister+0x3c/0x70
>>    platform_driver_unregister+0x20/0x30
>>    arm_trbe_exit+0x1c/0x658 [coresight_trbe]
>>    __arm64_sys_delete_module+0x1ac/0x24c
>>    invoke_syscall+0x50/0x120
>>    el0_svc_common.constprop.0+0x58/0x1a0
>>    do_el0_svc+0x38/0xd0
>>    el0_svc+0x2c/0xc0
>>    el0t_64_sync_handler+0x1ac/0x1b0
>>    el0t_64_sync+0x19c/0x1a0
>>   ---[ end trace 0000000000000000 ]---
>>
>> Fixes: 3fbf7f011f24 ("coresight: sink: Add TRBE driver")
>> Signed-off-by: Yang Shen <shenyang39@huawei.com>

Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>

>> ---
>>   drivers/hwtracing/coresight/coresight-trbe.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c
>> index 2b386bb848f8..1fc4fd79a1c6 100644
>> --- a/drivers/hwtracing/coresight/coresight-trbe.c
>> +++ b/drivers/hwtracing/coresight/coresight-trbe.c
>> @@ -1434,6 +1434,7 @@ static int arm_trbe_probe_cpuhp(struct trbe_drvdata *drvdata)
>>
>>   static void arm_trbe_remove_cpuhp(struct trbe_drvdata *drvdata)
>>   {
>> +    cpuhp_state_remove_instance(drvdata->trbe_online, &drvdata->hotplug_node);
>>       cpuhp_remove_multi_state(drvdata->trbe_online);
>>   }
>>
> 
> Applied to coresight next.
> 
> https://git.kernel.org/coresight/c/5fefef85b0d3

Hi Suzuki,

Could you please add the above tag for the patch. Thank you.

- Anshuman

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

* Re: [PATCH] coresight: trbe: remove cpuhp instance node before remove cpuhp state
  2022-11-24 12:22   ` Anshuman Khandual
@ 2022-11-24 12:29     ` Suzuki Kuruppassery Poulose
  0 siblings, 0 replies; 4+ messages in thread
From: Suzuki Kuruppassery Poulose @ 2022-11-24 12:29 UTC (permalink / raw)
  To: Anshuman Khandual, Yang Shen, mathieu.poirier, mike.leach, leo.yan
  Cc: linux-kernel, coresight

On 24/11/2022 12:22, Anshuman Khandual wrote:
> 
> 
> On 11/24/22 17:00, Suzuki Kuruppassery Poulose wrote:
>> On 22/11/2022 09:03, Yang Shen wrote:
>>> cpuhp_state_add_instance() and cpuhp_state_remove_instance() should
>>> be used in pairs. Or there will lead to the warn on
>>> cpuhp_remove_multi_state() since the cpuhp_step list is not empty.
>>>
>>> The following is the error log with 'rmmod coresight-trbe':
>>> Error: Removing state 215 which has instances left.
>>> Call trace:
>>>     __cpuhp_remove_state_cpuslocked+0x144/0x160
>>>     __cpuhp_remove_state+0xac/0x100
>>>     arm_trbe_device_remove+0x2c/0x60 [coresight_trbe]
>>>     platform_remove+0x34/0x70
>>>     device_remove+0x54/0x90
>>>     device_release_driver_internal+0x1e4/0x250
>>>     driver_detach+0x5c/0xb0
>>>     bus_remove_driver+0x64/0xc0
>>>     driver_unregister+0x3c/0x70
>>>     platform_driver_unregister+0x20/0x30
>>>     arm_trbe_exit+0x1c/0x658 [coresight_trbe]
>>>     __arm64_sys_delete_module+0x1ac/0x24c
>>>     invoke_syscall+0x50/0x120
>>>     el0_svc_common.constprop.0+0x58/0x1a0
>>>     do_el0_svc+0x38/0xd0
>>>     el0_svc+0x2c/0xc0
>>>     el0t_64_sync_handler+0x1ac/0x1b0
>>>     el0t_64_sync+0x19c/0x1a0
>>>    ---[ end trace 0000000000000000 ]---
>>>
>>> Fixes: 3fbf7f011f24 ("coresight: sink: Add TRBE driver")
>>> Signed-off-by: Yang Shen <shenyang39@huawei.com>
> 
> Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
> 
>>> ---
>>>    drivers/hwtracing/coresight/coresight-trbe.c | 1 +
>>>    1 file changed, 1 insertion(+)
>>>
>>> diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c
>>> index 2b386bb848f8..1fc4fd79a1c6 100644
>>> --- a/drivers/hwtracing/coresight/coresight-trbe.c
>>> +++ b/drivers/hwtracing/coresight/coresight-trbe.c
>>> @@ -1434,6 +1434,7 @@ static int arm_trbe_probe_cpuhp(struct trbe_drvdata *drvdata)
>>>
>>>    static void arm_trbe_remove_cpuhp(struct trbe_drvdata *drvdata)
>>>    {
>>> +    cpuhp_state_remove_instance(drvdata->trbe_online, &drvdata->hotplug_node);
>>>        cpuhp_remove_multi_state(drvdata->trbe_online);
>>>    }
>>>
>>
>> Applied to coresight next.
>>
>> https://git.kernel.org/coresight/c/5fefef85b0d3
> 
> Hi Suzuki,
> 
> Could you please add the above tag for the patch. Thank you.

Sorry, its too late. It is already in the upstream tree.

Suzuki


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

end of thread, other threads:[~2022-11-24 12:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-22  9:03 [PATCH] coresight: trbe: remove cpuhp instance node before remove cpuhp state Yang Shen
2022-11-24 11:30 ` Suzuki Kuruppassery Poulose
2022-11-24 12:22   ` Anshuman Khandual
2022-11-24 12:29     ` Suzuki Kuruppassery Poulose

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

all inboxes | Powered by JetHome®