From: "Das, Nirmoy" <nirmoy.das@amd.com>
To: "Sharma, Shashank" <shashank.sharma@amd.com>,
amd-gfx@lists.freedesktop.org
Cc: Christian.Koenig@amd.com
Subject: Re: [PATCH 2/2] drm/amdgpu: cleanup debugfs for amdgpu rings
Date: Wed, 8 Sep 2021 10:54:20 +0200 [thread overview]
Message-ID: <a586086a-13de-eb90-ffc3-40ffb0cae255@amd.com> (raw)
In-Reply-To: <2cc7ef01-0871-457c-6f85-6ac78220b3ff@amd.com>
On 9/6/2021 6:45 PM, Sharma, Shashank wrote:
>
>
> On 9/5/2021 5:01 PM, Das, Nirmoy wrote:
>>
>> On 9/5/2021 10:03 AM, Sharma, Shashank wrote:
>>>
>>>
>>> On 9/3/2021 9:44 PM, Das, Nirmoy wrote:
>>>> Hi Shashank,
>>>>
>>>> On 9/3/2021 5:51 PM, Das, Nirmoy wrote:
>>>>>
>>>>> On 9/3/2021 5:26 PM, Sharma, Shashank wrote:
>>>>>>
>>>>>>
>>>>>> On 9/3/2021 1:39 PM, Das, Nirmoy wrote:
>>>>>>>
>>>>>>> On 9/3/2021 8:36 AM, Sharma, Shashank wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>> On 9/2/2021 5:14 PM, Nirmoy Das wrote:
>>>>>>>>> Use debugfs_create_file_size API for creating ring debugfs
>>>>>>>>> file, also cleanup surrounding code.
>>>>>>>>>
>>>>>>>>> Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
>>>>>>>>> ---
>>>>>>>>> drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 4 +---
>>>>>>>>> drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 16
>>>>>>>>> +++++-----------
>>>>>>>>> drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 8 +-------
>>>>>>>>> 3 files changed, 7 insertions(+), 21 deletions(-)
>>>>>>>>>
>>>>>>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
>>>>>>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
>>>>>>>>> index 077f9baf74fe..dee56ab19a8f 100644
>>>>>>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
>>>>>>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
>>>>>>>>> @@ -1734,9 +1734,7 @@ int amdgpu_debugfs_init(struct
>>>>>>>>> amdgpu_device *adev)
>>>>>>>>> if (!ring)
>>>>>>>>> continue;
>>>>>>>>> - if (amdgpu_debugfs_ring_init(adev, ring)) {
>>>>>>>>> - DRM_ERROR("Failed to register debugfs file for
>>>>>>>>> rings !\n");
>>>>>>>>> - }
>>>>>>>>> + amdgpu_debugfs_ring_init(adev, ring);
>>>>>>>>> }
>>>>>>>>> amdgpu_ras_debugfs_create_all(adev);
>>>>>>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
>>>>>>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
>>>>>>>>> index f40753e1a60d..968521d80514 100644
>>>>>>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
>>>>>>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
>>>>>>>>> @@ -415,26 +415,20 @@ static const struct file_operations
>>>>>>>>> amdgpu_debugfs_ring_fops = {
>>>>>>>>> #endif
>>>>>>>>> -int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
>>>>>>>>> +void amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
>>>>>>>>> struct amdgpu_ring *ring)
>>>>>>>>> {
>>>>>>>>> #if defined(CONFIG_DEBUG_FS)
>>>>>>>>> struct drm_minor *minor = adev_to_drm(adev)->primary;
>>>>>>>>> - struct dentry *ent, *root = minor->debugfs_root;
>>>>>>>>> + struct dentry *root = minor->debugfs_root;
>>>>>>>>> char name[32];
>>>>>>>>> sprintf(name, "amdgpu_ring_%s", ring->name);
>>>>>>>>> - ent = debugfs_create_file(name,
>>>>>>>>> - S_IFREG | S_IRUGO, root,
>>>>>>>>> - ring, &amdgpu_debugfs_ring_fops);
>>>>>>>>> - if (IS_ERR(ent))
>>>>>>>>> - return -ENOMEM;
>>>>>>>>
>>>>>>>> Why are we doing this ? Why to make it void from int ?
>>>>>>>
>>>>>>>
>>>>>>> We tend to ignore debugfs return values as those are not serious
>>>>>>> errors. This to sync with rest of our
>>>>>>>
>>>>>>> debugfs calls.
>>>>>>>
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> Nirmoy
>>>>>>>
>>>>>>
>>>>>>
>>>>>> I am not suere if completely removing the provision of return
>>>>>> value is a good way of doing it, we can always ignore it at the
>>>>>> caller side, isn't it ?
>>>>
>>>>
>>>>
>>>> I just realized while making the change debugfs_create_file_size()
>>>> is void return, so we don't have anything useful to return in
>>>> amdgpu_debugfs_ring_init()
>>>>
>>>>
>>>
>>> Ah, it makes better sense now. Probably just a mention in the body
>>> of the message that we are moving from debugfs_create_file() to
>>> debugfs_create_file_size(), will make this change of return type
>>> more logical.
>>
>>
>> Yes, I have that "Use debugfs_create_file_size API for creating ring
>> debugfs file,..."
>>
>>
>
> My bad, I was too focused (and a bit confused due to uasge of
> clean-up) around the code change.
>
> Suggestion for message: Use debugfs_create_file_size API for creating
> ring debugfs, and as its a NULL returning API, change the return type
> for amdgpu_debugfs_ring_init API as well.
Thanks Shashank, I pushed the change with your suggested commit message.
Nirmoy
>
> With (or even without) this change, please feel free to use:
>
> Reviewed-by: Shashank Sharma <shashank.sharma@amd.com>
>
> - Shashank
>
>> Nirmoy
>>
>>>
>>> - Shashank
>>>
>>>> Regards,
>>>>
>>>> Nirmoy
>>>>
>>>>
>>>>>
>>>>>
>>>>> Yes, we are currently throwing an error msg and ignoring it. I
>>>>> don't have a strong opinion regarding this, I will send a v2
>>>>> restoring previous behavior.
>>>>>
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Nirmoy
>>>>>
>>>>>
>>>>>>
>>>>>> - Shashank
>>>>>>
>>>>>>>>
>>>>>>>> - Shashank
>>>>>>>>
>>>>>>>>
>>>>>>>>> -
>>>>>>>>> - i_size_write(ent->d_inode, ring->ring_size + 12);
>>>>>>>>> - ring->ent = ent;
>>>>>>>>> + debugfs_create_file_size(name, S_IFREG | S_IRUGO, root,
>>>>>>>>> ring,
>>>>>>>>> + &amdgpu_debugfs_ring_fops,
>>>>>>>>> + ring->ring_size + 12);
>>>>>>>>> #endif
>>>>>>>>> - return 0;
>>>>>>>>> }
>>>>>>>>> /**
>>>>>>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
>>>>>>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
>>>>>>>>> index 88d80eb3fea1..c29fbce0a5b4 100644
>>>>>>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
>>>>>>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
>>>>>>>>> @@ -253,10 +253,6 @@ struct amdgpu_ring {
>>>>>>>>> bool has_compute_vm_bug;
>>>>>>>>> bool no_scheduler;
>>>>>>>>> int hw_prio;
>>>>>>>>> -
>>>>>>>>> -#if defined(CONFIG_DEBUG_FS)
>>>>>>>>> - struct dentry *ent;
>>>>>>>>> -#endif
>>>>>>>>> };
>>>>>>>>> #define amdgpu_ring_parse_cs(r, p, ib)
>>>>>>>>> ((r)->funcs->parse_cs((p), (ib)))
>>>>>>>>> @@ -356,8 +352,6 @@ static inline void
>>>>>>>>> amdgpu_ring_write_multiple(struct amdgpu_ring *ring,
>>>>>>>>> int amdgpu_ring_test_helper(struct amdgpu_ring *ring);
>>>>>>>>> -int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
>>>>>>>>> +void amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
>>>>>>>>> struct amdgpu_ring *ring);
>>>>>>>>> -void amdgpu_debugfs_ring_fini(struct amdgpu_ring *ring);
>>>>>>>>> -
>>>>>>>>> #endif
>>>>>>>>>
next prev parent reply other threads:[~2021-09-08 8:54 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-02 11:44 [PATCH 1/2] drm/amdgpu: use IS_ERR for debugfs APIs Nirmoy Das
2021-09-02 11:44 ` [PATCH 2/2] drm/amdgpu: cleanup debugfs for amdgpu rings Nirmoy Das
2021-09-03 6:36 ` Sharma, Shashank
2021-09-03 8:09 ` Das, Nirmoy
2021-09-03 15:26 ` Sharma, Shashank
2021-09-03 15:51 ` Das, Nirmoy
2021-09-03 16:14 ` Das, Nirmoy
2021-09-05 8:03 ` Sharma, Shashank
2021-09-05 11:31 ` Das, Nirmoy
2021-09-06 16:45 ` Sharma, Shashank
2021-09-08 8:54 ` Das, Nirmoy [this message]
2021-09-02 15:23 ` [PATCH 1/2] drm/amdgpu: use IS_ERR for debugfs APIs Sharma, Shashank
2021-09-03 7:53 ` Christian König
2021-09-03 8:13 ` Das, Nirmoy
2021-09-03 8:17 ` Christian König
2021-09-03 15:28 ` Sharma, Shashank
-- strict thread matches above, loose matches on Subject: below --
2021-09-02 13:43 [PATCH v2 " Nirmoy Das
2021-09-02 13:43 ` [PATCH 2/2] drm/amdgpu: cleanup debugfs for amdgpu rings Nirmoy Das
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a586086a-13de-eb90-ffc3-40ffb0cae255@amd.com \
--to=nirmoy.das@amd.com \
--cc=Christian.Koenig@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=shashank.sharma@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox