drm/debugfs: add client-id to the debugfs entry
Subsystems (2)
PATCH 1/1 drm/debugfs: add client-id to the debugfs entry
pid is not always the right choice for fd to track the caller and hence adding drm client-id to the print which is unique for a drm client and can be used by driver in debugging
One of the use is to further enhance debugging for amdgpu driver based on client-id.
--- drivers/gpu/drm/drm_debugfs.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_debugfs.c +5 -4
@@ -77,14 +77,15 @@ static int drm_clients_info(struct seq_file *m, void *data)kuid_t uid;seq_printf (m, -"%20s %5s %3s master a %5s %10s %*s\n" , +"%20s %5s %3s master a %5s %10s %*s %5s\n" ,"command" ,"tgid" ,"dev" ,"uid" ,"magic" ,DRM_CLIENT_NAME_MAX_LEN , -"name" ); +"name" , +"client-id" );/* dev->filelist is sorted youngest first, but we want to present * oldest first (i.e. kernel, servers, clients), so walk backwardss.
@@ -100,7 +101,7 @@ static int drm_clients_info(struct seq_file *m, void *data) pid =rcu_dereference (priv->pid); task =pid_task (pid,PIDTYPE_TGID ); uid = task ?__task_cred (task)->euid :GLOBAL_ROOT_UID ; - seq_printf(m, "%20s %5d %3d %c %c %5d %10u %*s\n", + seq_printf(m, "%20s %5d %3d %c %c %5d %10u %*s %5llu\n", task ? task->comm : "<unknown>", pid_vnr(pid), priv->minor->index,
@@ -109,7 +110,7 @@ static int drm_clients_info(struct seq_file *m, void *data)from_kuid_munged (seq_user_ns (m), uid), priv->magic,DRM_CLIENT_NAME_MAX_LEN , - priv->client_name ? priv->client_name : "<unset>"); + priv->client_name ? priv->client_name : "<unset>", priv->client_id);rcu_read_unlock ();mutex_unlock (&priv->client_name_lock); }
Signature · 1 line
2.34.1
Adding some people who worked on the client name and client id fields.
Quoted 22 lines · Sunil Khatri
pid is not always the right choice for fd to track the caller and hence adding drm client-id to the print which is unique for a drm client and can be used by driver in debugging
One of the use is to further enhance debugging for amdgpu driver based on client-id.
Signed-off-by Sunil Khatri <[email protected]>--- drivers/gpu/drm/drm_debugfs.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)drivers/gpu/drm/drm_debugfs.c +0
-1@@ -77,14 +77,15 @@ static int drm_clients_info(struct seq_file *m, void *data)kuid_t uid; seq_printf(m, - "%20s %5s %3s master a %5s %10s %*s\n",
drivers/gpu/drm/drm_debugfs.c static int drm_clients_info(struct seq_file *m, void *data) · line 88
Quoted 10 lines
drivers/gpu/drm/drm_debugfs.c +3
-1+"%20s %5s %3s master a %5s %10s %*s %5s\n" ,"command" ,"tgid" ,"dev" ,"uid" ,"magic" ,DRM_CLIENT_NAME_MAX_LEN , - "name"); +"name" , + "client-id");
It might make sense to print the client id first and then the name.
Apart from that looks sane to me.
Regards,
Christian.
Quoted 21 lines
drivers/gpu/drm/drm_debugfs.c +2
-2/* dev->filelist is sorted youngest first, but we want to present * oldest first (i.e. kernel, servers, clients), so walk backwardss. @@ -100,7 +101,7 @@ static int drm_clients_info(struct seq_file *m, void *data) pid =rcu_dereference (priv->pid); task =pid_task (pid,PIDTYPE_TGID ); uid = task ?__task_cred (task)->euid :GLOBAL_ROOT_UID ; - seq_printf(m, "%20s %5d %3d %c %c %5d %10u %*s\n", + seq_printf(m, "%20s %5d %3d %c %c %5d %10u %*s %5llu\n", task ? task->comm : "<unknown>", pid_vnr(pid), priv->minor->index,@@ -109,7 +110,7 @@ static int drm_clients_info(struct seq_file *m, void *data)from_kuid_munged (seq_user_ns (m), uid), priv->magic,DRM_CLIENT_NAME_MAX_LEN , - priv->client_name ? priv->client_name : "<unset>"); + priv->client_name ? priv->client_name : "<unset>", priv->client_id);rcu_read_unlock ();mutex_unlock (&priv->client_name_lock); }
Hi,
This patch looks similar to:
https://lists.freedesktop.org/archives/dri-devel/2025-May/507653.html
Thanks,
Pierre-Eric
Le 28/05/2025 à 13:00, Christian König a écrit :
Quoted 64 lines
Adding some people who worked on the client name and client id fields.
Quoted 22 lines · Sunil Khatri
pid is not always the right choice for fd to track the caller and hence adding drm client-id to the print which is unique for a drm client and can be used by driver in debugging
One of the use is to further enhance debugging for amdgpu driver based on client-id.
Signed-off-by Sunil Khatri <[email protected]>--- drivers/gpu/drm/drm_debugfs.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)drivers/gpu/drm/drm_debugfs.c +0
-1@@ -77,14 +77,15 @@ static int drm_clients_info(struct seq_file *m, void *data)kuid_t uid; seq_printf(m, - "%20s %5s %3s master a %5s %10s %*s\n",drivers/gpu/drm/drm_debugfs.c static int drm_clients_info(struct seq_file *m, void *data) · line 88
Quoted 10 lines
drivers/gpu/drm/drm_debugfs.c +3
-1+"%20s %5s %3s master a %5s %10s %*s %5s\n" ,"command" ,"tgid" ,"dev" ,"uid" ,"magic" ,DRM_CLIENT_NAME_MAX_LEN , - "name"); +"name" , + "client-id");It might make sense to print the client id first and then the name.
Apart from that looks sane to me.
Regards,
Christian.Quoted 21 lines
drivers/gpu/drm/drm_debugfs.c +2
-2/* dev->filelist is sorted youngest first, but we want to present * oldest first (i.e. kernel, servers, clients), so walk backwardss. @@ -100,7 +101,7 @@ static int drm_clients_info(struct seq_file *m, void *data) pid =rcu_dereference (priv->pid); task =pid_task (pid,PIDTYPE_TGID ); uid = task ?__task_cred (task)->euid :GLOBAL_ROOT_UID ; - seq_printf(m, "%20s %5d %3d %c %c %5d %10u %*s\n", + seq_printf(m, "%20s %5d %3d %c %c %5d %10u %*s %5llu\n", task ? task->comm : "<unknown>", pid_vnr(pid), priv->minor->index,@@ -109,7 +110,7 @@ static int drm_clients_info(struct seq_file *m, void *data)from_kuid_munged (seq_user_ns (m), uid), priv->magic,DRM_CLIENT_NAME_MAX_LEN , - priv->client_name ? priv->client_name : "<unset>"); + priv->client_name ? priv->client_name : "<unset>", priv->client_id);rcu_read_unlock ();mutex_unlock (&priv->client_name_lock); }
Quoted 4 lines · Pierre-Eric Pelloux-Prayer
Hi,
This patch looks similar to:
https://lists.freedesktop.org/archives/dri-devel/2025-May/507653.html
Mhm, I thought that I have seen that before.
Why haven't we pushed that yet? Is there still some ongoing reviews on the scheduler side?
Regards,
Christian.
Quoted 67 lines
Thanks,
Pierre-EricLe 28/05/2025 à 13:00, Christian König a écrit :
Quoted 62 lines
Adding some people who worked on the client name and client id fields.
Quoted 21 lines · Sunil Khatri
pid is not always the right choice for fd to track the caller and hence adding drm client-id to the print which is unique for a drm client and can be used by driver in debugging
One of the use is to further enhance debugging for amdgpu driver based on client-id.
Signed-off-by Sunil Khatri <[email protected]>---
drivers/gpu/drm/drm_debugfs.c| 9 +++++----1 file changed, 5 insertions(+), 4 deletions(-)drivers/gpu/drm/drm_debugfs.c +0
-1@@ -77,14 +77,15 @@ static int drm_clients_info(struct seq_file *m, void *data) kuid_t uid; seq_printf(m, - "%20s %5s %3s master a %5s %10s %*s\n",drivers/gpu/drm/drm_debugfs.c static int drm_clients_info(struct seq_file *m, void *data) · line 87
Quoted 10 lines
drivers/gpu/drm/drm_debugfs.c +3
-1+ "%20s %5s %3s master a %5s %10s %*s %5s\n", "command", "tgid", "dev", "uid", "magic", DRM_CLIENT_NAME_MAX_LEN, - "name"); + "name", + "client-id");It might make sense to print the client id first and then the name.
Apart from that looks sane to me.
Regards,
Christian.Quoted 20 lines
drivers/gpu/drm/drm_debugfs.c +2
-2/* dev->filelist is sorted youngest first, but we want to present* oldest first (i.e. kernel, servers, clients), so walk backwardss. @@ -100,7 +101,7 @@ static int drm_clients_info(struct seq_file *m, void *data) pid = rcu_dereference(priv->pid); task = pid_task(pid, PIDTYPE_TGID); uid = task ? __task_cred(task)->euid : GLOBAL_ROOT_UID; - seq_printf(m, "%20s %5d %3d %c %c %5d %10u %*s\n", + seq_printf(m, "%20s %5d %3d %c %c %5d %10u %*s %5llu\n", task ? task->comm : "<unknown>", pid_vnr(pid), priv->minor->index,@@ -109,7 +110,7 @@ static int drm_clients_info(struct seq_file *m, void *data) from_kuid_munged(seq_user_ns(m), uid), priv->magic, DRM_CLIENT_NAME_MAX_LEN, - priv->client_name ? priv->client_name : "<unset>"); + priv->client_name ? priv->client_name : "<unset>", priv->client_id); rcu_read_unlock(); mutex_unlock(&priv->client_name_lock); }
Sure Pierre
Go ahead and get them merged. I am also planning to use that information in debugfs implementation of some parameters of our driver so I do need those. I will drop my debugfs patch.
Regards
Sunil Khatri
Quoted 77 lines · Christian König
Quoted 4 lines · Pierre-Eric Pelloux-Prayer
Hi,
This patch looks similar to:
https://lists.freedesktop.org/archives/dri-devel/2025-May/507653.htmlMhm, I thought that I have seen that before.
Why haven't we pushed that yet? Is there still some ongoing reviews on the scheduler side?
Regards,
Christian.Quoted 65 lines
Thanks,
Pierre-EricLe 28/05/2025 à 13:00, Christian König a écrit :
Quoted 61 lines
Adding some people who worked on the client name and client id fields.
Quoted 21 lines · Sunil Khatri
pid is not always the right choice for fd to track the caller and hence adding drm client-id to the print which is unique for a drm client and can be used by driver in debugging
One of the use is to further enhance debugging for amdgpu driver based on client-id.
Signed-off-by Sunil Khatri<[email protected]>--- drivers/gpu/drm/drm_debugfs.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)drivers/gpu/drm/drm_debugfs.c +0
-1@@ -77,14 +77,15 @@ static int drm_clients_info(struct seq_file *m, void *data) kuid_t uid; seq_printf(m, - "%20s %5s %3s master a %5s %10s %*s\n",drivers/gpu/drm/drm_debugfs.c static int drm_clients_info(struct seq_file *m, void *data) · line 87
Quoted 10 lines
drivers/gpu/drm/drm_debugfs.c +3
-1+ "%20s %5s %3s master a %5s %10s %*s %5s\n", "command", "tgid", "dev", "uid", "magic", DRM_CLIENT_NAME_MAX_LEN, - "name"); + "name", + "client-id");It might make sense to print the client id first and then the name.
Apart from that looks sane to me.
Regards,
Christian.Quoted 20 lines
drivers/gpu/drm/drm_debugfs.c +2
-2/* dev->filelist is sorted youngest first, but we want to present* oldest first (i.e. kernel, servers, clients), so walk backwardss. @@ -100,7 +101,7 @@ static int drm_clients_info(struct seq_file *m, void *data) pid = rcu_dereference(priv->pid); task = pid_task(pid, PIDTYPE_TGID); uid = task ? __task_cred(task)->euid : GLOBAL_ROOT_UID; - seq_printf(m, "%20s %5d %3d %c %c %5d %10u %*s\n", + seq_printf(m, "%20s %5d %3d %c %c %5d %10u %*s %5llu\n", task ? task->comm : "<unknown>", pid_vnr(pid), priv->minor->index,@@ -109,7 +110,7 @@ static int drm_clients_info(struct seq_file *m, void *data) from_kuid_munged(seq_user_ns(m), uid), priv->magic, DRM_CLIENT_NAME_MAX_LEN, - priv->client_name ? priv->client_name : "<unset>"); + priv->client_name ? priv->client_name : "<unset>", priv->client_id); rcu_read_unlock(); mutex_unlock(&priv->client_name_lock); }
[AMD Official Use Only - AMD Internal Distribution Only]
Sure Pierre
Go ahead and get them merged. I am also planning to use that information in debugfs implementation of some parameters of our driver so I do need those. I will drop my patch.
Regards
Sunil Khatri
-----Original Message-----
From: Pierre-Eric Pelloux-Prayer <[email protected]>
Sent: Wednesday, May 28, 2025 6:03 PM
To: Koenig, Christian <[email protected]>; Khatri, Sunil <[email protected]>; [email protected]; Tvrtko Ursulin <[email protected]>; [email protected]; Pelloux-Prayer, Pierre-Eric <[email protected]>
Subject: Re: [PATCH] drm/debugfs: add client-id to the debugfs entry
Hi,
This patch looks similar to:
https://lists.freedesktop.org/archives/dri-devel/2025-May/507653.html
Thanks,
Pierre-Eric
Quoted 65 lines · Christian König
Adding some people who worked on the client name and client id fields.
Quoted 22 lines · Sunil Khatri
pid is not always the right choice for fd to track the caller and hence adding drm client-id to the print which is unique for a drm client and can be used by driver in debugging
One of the use is to further enhance debugging for amdgpu driver based on client-id.
Signed-off-by Sunil Khatri <[email protected]>--- drivers/gpu/drm/drm_debugfs.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/drm_debugfs.cindex6b2178864c7e..2d43bda82887100644drivers/gpu/drm/drm_debugfs.c +0
-1@@ -77,14 +77,15 @@ static int drm_clients_info(struct seq_file *m, void *data)kuid_t uid; seq_printf(m, - "%20s %5s %3s master a %5s %10s %*s\n",drivers/gpu/drm/drm_debugfs.c static int drm_clients_info(struct seq_file *m, void *data) · line 88
Quoted 10 lines
drivers/gpu/drm/drm_debugfs.c +3
-1+"%20s %5s %3s master a %5s %10s %*s %5s\n" ,"command" ,"tgid" ,"dev" ,"uid" ,"magic" ,DRM_CLIENT_NAME_MAX_LEN , - "name"); +"name" , + "client-id");It might make sense to print the client id first and then the name.
Apart from that looks sane to me.
Regards,
Christian.Quoted 22 lines
drivers/gpu/drm/drm_debugfs.c +3
-2/* dev->filelist is sorted youngest first, but we want to present * oldest first (i.e. kernel, servers, clients), so walk backwardss. @@ -100,7 +101,7 @@ static int drm_clients_info(struct seq_file *m, void *data) pid =rcu_dereference (priv->pid); task =pid_task (pid,PIDTYPE_TGID ); uid = task ?__task_cred (task)->euid :GLOBAL_ROOT_UID ; - seq_printf(m, "%20s %5d %3d %c %c %5d %10u %*s\n", + seq_printf(m, "%20s %5d %3d %c %c %5d %10u %*s %5llu\n", task ? task->comm : "<unknown>", pid_vnr(pid), priv->minor->index,@@ -109,7 +110,7 @@ static int drm_clients_info(struct seq_file *m, void *data)from_kuid_munged (seq_user_ns (m), uid), priv->magic,DRM_CLIENT_NAME_MAX_LEN , - priv->client_name ? priv->client_name : "<unset>"); + priv->client_name ? priv->client_name :"<unset>" , +priv->client_id);rcu_read_unlock ();mutex_unlock (&priv->client_name_lock); }