diff mbox series

[2/2] drm/ttm: Use debugfs_remove_recursive to remove ttm directory

Message ID 20230113053416.2175988-2-Jun.Ma2@amd.com (mailing list archive)
State New, archived
Headers show
Series [1/2] drm/ttm: Check ttm_debugfs_root before creating files under it | expand

Commit Message

Ma Jun Jan. 13, 2023, 5:34 a.m. UTC
Use debugfs_remove_recursive to remove the /sys/kernel/debug/ttm
directory for better compatibility. Becuase debugfs_remove fails
on older kernel.

Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
---
 drivers/gpu/drm/ttm/ttm_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christian König Jan. 13, 2023, 9:38 a.m. UTC | #1
Am 13.01.23 um 06:34 schrieb Ma Jun:
> Use debugfs_remove_recursive to remove the /sys/kernel/debug/ttm
> directory for better compatibility. Becuase debugfs_remove fails
> on older kernel.

Again NAK for upstreaming.

The upstream kernel is made for the newest kernel version and should not 
contain any compatibility handling for older kernels.

Christian.

>
> Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
> ---
>   drivers/gpu/drm/ttm/ttm_device.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_device.c b/drivers/gpu/drm/ttm/ttm_device.c
> index 967bc2244df3..590297123bb2 100644
> --- a/drivers/gpu/drm/ttm/ttm_device.c
> +++ b/drivers/gpu/drm/ttm/ttm_device.c
> @@ -55,7 +55,7 @@ static void ttm_global_release(void)
>   		goto out;
>   
>   	ttm_pool_mgr_fini();
> -	debugfs_remove(ttm_debugfs_root);
> +	debugfs_remove_recursive(ttm_debugfs_root);
>   
>   	__free_page(glob->dummy_read_page);
>   	memset(glob, 0, sizeof(*glob));
Ma, Jun Jan. 16, 2023, 2:44 a.m. UTC | #2
On 1/13/2023 5:38 PM, Christian König wrote:
> Am 13.01.23 um 06:34 schrieb Ma Jun:
>> Use debugfs_remove_recursive to remove the /sys/kernel/debug/ttm
>> directory for better compatibility. Becuase debugfs_remove fails
>> on older kernel.
> 
> Again NAK for upstreaming.
> 
> The upstream kernel is made for the newest kernel version and should not 
> contain any compatibility handling for older kernels.
> 
Yes, generally so.

But the debugfs_remove_recursive() and debugfs_remove() are same function now.
The debugfs_remove_recursive is used here so that we don't need to make kcl patch
for it.

Regards,
Ma Jun

> Christian.
> 
>>
>> Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
>> ---
>>   drivers/gpu/drm/ttm/ttm_device.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/ttm/ttm_device.c b/drivers/gpu/drm/ttm/ttm_device.c
>> index 967bc2244df3..590297123bb2 100644
>> --- a/drivers/gpu/drm/ttm/ttm_device.c
>> +++ b/drivers/gpu/drm/ttm/ttm_device.c
>> @@ -55,7 +55,7 @@ static void ttm_global_release(void)
>>   		goto out;
>>   
>>   	ttm_pool_mgr_fini();
>> -	debugfs_remove(ttm_debugfs_root);
>> +	debugfs_remove_recursive(ttm_debugfs_root);
>>   
>>   	__free_page(glob->dummy_read_page);
>>   	memset(glob, 0, sizeof(*glob));
>
Christian König Jan. 16, 2023, 11:06 a.m. UTC | #3
Am 16.01.23 um 03:44 schrieb Ma, Jun:
> On 1/13/2023 5:38 PM, Christian König wrote:
>> Am 13.01.23 um 06:34 schrieb Ma Jun:
>>> Use debugfs_remove_recursive to remove the /sys/kernel/debug/ttm
>>> directory for better compatibility. Becuase debugfs_remove fails
>>> on older kernel.
>> Again NAK for upstreaming.
>>
>> The upstream kernel is made for the newest kernel version and should not
>> contain any compatibility handling for older kernels.
>>
> Yes, generally so.
>
> But the debugfs_remove_recursive() and debugfs_remove() are same function now.
> The debugfs_remove_recursive is used here so that we don't need to make kcl patch
> for it.

Well making our internal kcl simpler is not a valid justification for 
upstreaming code.

My educated guess is that either debugfs_remove or 
debugfs_remove_recursive will go away in the near future, so it can 
happen that we will revert this again then.

What you could do is double checking with Greg what his preferences 
regarding debugfs_remove/debugfs_remove_recursive is.

You could then write something like "Replace debugfs_remove with 
debugfs_remove_recursive to better document what actually happens here. 
Also makes our internal KCL code simpler to maintain since 
debugfs_remove might go away in the future.".

Regards,
Christian.

>
> Regards,
> Ma Jun
>
>> Christian.
>>
>>> Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
>>> ---
>>>    drivers/gpu/drm/ttm/ttm_device.c | 2 +-
>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/ttm/ttm_device.c b/drivers/gpu/drm/ttm/ttm_device.c
>>> index 967bc2244df3..590297123bb2 100644
>>> --- a/drivers/gpu/drm/ttm/ttm_device.c
>>> +++ b/drivers/gpu/drm/ttm/ttm_device.c
>>> @@ -55,7 +55,7 @@ static void ttm_global_release(void)
>>>    		goto out;
>>>    
>>>    	ttm_pool_mgr_fini();
>>> -	debugfs_remove(ttm_debugfs_root);
>>> +	debugfs_remove_recursive(ttm_debugfs_root);
>>>    
>>>    	__free_page(glob->dummy_read_page);
>>>    	memset(glob, 0, sizeof(*glob));
diff mbox series

Patch

diff --git a/drivers/gpu/drm/ttm/ttm_device.c b/drivers/gpu/drm/ttm/ttm_device.c
index 967bc2244df3..590297123bb2 100644
--- a/drivers/gpu/drm/ttm/ttm_device.c
+++ b/drivers/gpu/drm/ttm/ttm_device.c
@@ -55,7 +55,7 @@  static void ttm_global_release(void)
 		goto out;
 
 	ttm_pool_mgr_fini();
-	debugfs_remove(ttm_debugfs_root);
+	debugfs_remove_recursive(ttm_debugfs_root);
 
 	__free_page(glob->dummy_read_page);
 	memset(glob, 0, sizeof(*glob));