All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Das, Nirmoy" <nirmoy.das@amd.com>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>,
	amd-gfx@lists.freedesktop.org
Cc: Christian.Koenig@amd.com, shashank.sharma@amd.com
Subject: Re: [PATCH 1/1] drm/amdgpu: init debugfs drm driver callback
Date: Tue, 5 Oct 2021 14:58:34 +0200	[thread overview]
Message-ID: <28d796d3-47f2-4e61-56ab-1d590ff89a22@amd.com> (raw)
In-Reply-To: <b10471fb-8978-4d68-9fd0-29c851454dc7@gmail.com>


On 10/5/2021 2:41 PM, Christian König wrote:
>
>
> Am 05.10.21 um 14:20 schrieb Das, Nirmoy:
>> Hi Christian,
>>
>> On 10/5/2021 2:01 PM, Christian König wrote:
>>> Am 05.10.21 um 13:58 schrieb Nirmoy Das:
>>>> drm_dev_register() will try to init driver's debugfs using
>>>> drm_driver.debugfs_init call back function. Use that callback
>>>> also for amdgpu to intialize debugfs.
>>>
>>> Mhm, why is that useful? We rather wanted to get rid of all this DRM 
>>> midlayering.
>>
>>
>> Actually main issue I am trying to solve is:
>>
>> When user disables debugfs with CONFIG_DEBUG_FS_ALLOW_NONE, amdgpu 
>> gets EPERM and throws a DRM_ERROR even though it is not an error as 
>> this is user controllable.
>>
>> Shall I just make all debugfs error logs to DRM_WARN ?
>>
>> ref: 
>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Fdrm%2Famd%2F-%2Fissues%2F1686%23note_1052168&amp;data=04%7C01%7Cnirmoy.das%40amd.com%7C63032bdca1394c92e88808d987fd867b%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637690345246933980%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=eXyj6wlxD0YGiNsjB4smmRAm2KKGRtq%2FWiDSMzEWTo8%3D&amp;reserved=0
>
> Why not just add an "if (!root) return" at the beginning of 
> amdgpu_debugfs_init() ?


This is fine too, I will resend.


Nirmoy

>
> Regards,
> Christian.
>
>>
>> Regards,
>>
>> Nirmoy
>>
>>>
>>> Christian.
>>>
>>>>
>>>> Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
>>>> ---
>>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 10 +++++-----
>>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.h |  2 +-
>>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c     |  7 +++----
>>>>   3 files changed, 9 insertions(+), 10 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c 
>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
>>>> index 6611b3c7c149..3076742f8f85 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
>>>> @@ -1611,8 +1611,9 @@ DEFINE_DEBUGFS_ATTRIBUTE(fops_ib_preempt, NULL,
>>>>   DEFINE_DEBUGFS_ATTRIBUTE(fops_sclk_set, NULL,
>>>>               amdgpu_debugfs_sclk_set, "%llu\n");
>>>>   -int amdgpu_debugfs_init(struct amdgpu_device *adev)
>>>> +void amdgpu_debugfs_init(struct drm_minor *minor)
>>>>   {
>>>> +    struct amdgpu_device *adev = drm_to_adev(minor->dev);
>>>>       struct dentry *root = adev_to_drm(adev)->primary->debugfs_root;
>>>>       struct dentry *ent;
>>>>       int r, i;
>>>> @@ -1621,14 +1622,14 @@ int amdgpu_debugfs_init(struct 
>>>> amdgpu_device *adev)
>>>>                     &fops_ib_preempt);
>>>>       if (IS_ERR(ent)) {
>>>>           DRM_ERROR("unable to create amdgpu_preempt_ib debugsfs 
>>>> file\n");
>>>> -        return PTR_ERR(ent);
>>>> +        return;
>>>>       }
>>>>         ent = debugfs_create_file("amdgpu_force_sclk", 0200, root, 
>>>> adev,
>>>>                     &fops_sclk_set);
>>>>       if (IS_ERR(ent)) {
>>>>           DRM_ERROR("unable to create amdgpu_set_sclk debugsfs 
>>>> file\n");
>>>> -        return PTR_ERR(ent);
>>>> +        return;
>>>>       }
>>>>         /* Register debugfs entries for amdgpu_ttm */
>>>> @@ -1682,11 +1683,10 @@ int amdgpu_debugfs_init(struct 
>>>> amdgpu_device *adev)
>>>>       debugfs_create_blob("amdgpu_discovery", 0444, root,
>>>>                   &adev->debugfs_discovery_blob);
>>>>   -    return 0;
>>>>   }
>>>>     #else
>>>> -int amdgpu_debugfs_init(struct amdgpu_device *adev)
>>>> +void amdgpu_debugfs_init(struct drm_minor *minor)
>>>>   {
>>>>       return 0;
>>>>   }
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.h 
>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.h
>>>> index 371a6f0deb29..06b68e16e35d 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.h
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.h
>>>> @@ -27,7 +27,7 @@
>>>>    */
>>>>     int amdgpu_debugfs_regs_init(struct amdgpu_device *adev);
>>>> -int amdgpu_debugfs_init(struct amdgpu_device *adev);
>>>> +void amdgpu_debugfs_init(struct drm_minor *minor);
>>>>   void amdgpu_debugfs_fini(struct amdgpu_device *adev);
>>>>   void amdgpu_debugfs_fence_init(struct amdgpu_device *adev);
>>>>   void amdgpu_debugfs_firmware_init(struct amdgpu_device *adev);
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>>>> index df83b1f438b6..ceda650895db 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>>>> @@ -2012,10 +2012,6 @@ static int amdgpu_pci_probe(struct pci_dev 
>>>> *pdev,
>>>>               drm_fbdev_generic_setup(adev_to_drm(adev), 32);
>>>>       }
>>>>   -    ret = amdgpu_debugfs_init(adev);
>>>> -    if (ret)
>>>> -        DRM_ERROR("Creating debugfs files failed (%d).\n", ret);
>>>> -
>>>>       return 0;
>>>>     err_pci:
>>>> @@ -2479,6 +2475,9 @@ static const struct drm_driver 
>>>> amdgpu_kms_driver = {
>>>>       .dumb_map_offset = amdgpu_mode_dumb_mmap,
>>>>       .fops = &amdgpu_driver_kms_fops,
>>>>       .release = &amdgpu_driver_release_kms,
>>>> +#if defined(CONFIG_DEBUG_FS)
>>>> +    .debugfs_init = amdgpu_debugfs_init,
>>>> +#endif
>>>>         .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
>>>>       .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
>>>
>

  reply	other threads:[~2021-10-05 12:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-05 11:58 [PATCH 1/1] drm/amdgpu: init debugfs drm driver callback Nirmoy Das
2021-10-05 12:01 ` Christian König
2021-10-05 12:11   ` Das, Nirmoy
2021-10-05 12:20   ` Das, Nirmoy
2021-10-05 12:41     ` Christian König
2021-10-05 12:58       ` Das, Nirmoy [this message]
2021-10-05 12:02 ` Das, Nirmoy

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=28d796d3-47f2-4e61-56ab-1d590ff89a22@amd.com \
    --to=nirmoy.das@amd.com \
    --cc=Christian.Koenig@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=ckoenig.leichtzumerken@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.