dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/2] debugfs support for pt base for each vm
@ 2025-06-13  7:15 Sunil Khatri
  2025-06-13  7:15 ` [PATCH v1 1/2] drm: add debugfs support per client-id Sunil Khatri
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Sunil Khatri @ 2025-06-13  7:15 UTC (permalink / raw)
  To: Christian König, dri-devel; +Cc: amd-gfx, Sunil Khatri

root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/clients
             command  tgid dev master a   uid      magic                                                             name client-id
      systemd-logind  1056   0   y    y     0          0                                                          <unset>     5
            Xwayland  1733 128   n    n   120          0                                                          <unset>     8
     mutter-x11-fram  2048 128   n    n   120          0                                                          <unset>     9
            ibus-x11  2071 128   n    n   120          0                                                          <unset>    10
root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client
client-1/  client-10/ client-2/  client-5/  client-8/  client-9/  clients
root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-1
client-1/  client-10/
root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-1
client-1/  client-10/
root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-1/pt_base
81febf3000
root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-5/pt_base
81febe9000
root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-8/pt_base
81febdc000
root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-9/pt_base
81febb2000
root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-10/pt_base
81febaf000


Sunil Khatri (2):
  drm: add debugfs support per client-id
  amdgpu: add debugfs file for pt-base per client-id

 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c  | 14 +++++++++++++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h  |  4 +++-
 drivers/gpu/drm/drm_file.c              | 13 +++++++++++++
 include/drm/drm_file.h                  |  7 +++++++
 5 files changed, 37 insertions(+), 3 deletions(-)

-- 
2.34.1


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

* [PATCH v1 1/2] drm: add debugfs support per client-id
  2025-06-13  7:15 [PATCH v1 0/2] debugfs support for pt base for each vm Sunil Khatri
@ 2025-06-13  7:15 ` Sunil Khatri
  2025-06-13  7:15 ` [PATCH v1 2/2] amdgpu: add debugfs file for pt-base " Sunil Khatri
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Sunil Khatri @ 2025-06-13  7:15 UTC (permalink / raw)
  To: Christian König, dri-devel; +Cc: amd-gfx, Sunil Khatri

add support to add a directory for each client-id
per drm node based on drm-file.

Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
---
 drivers/gpu/drm/drm_file.c | 11 +++++++++++
 include/drm/drm_file.h     |  7 +++++++
 2 files changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
index 06ba6dcbf5ae..7a055fe7d4d5 100644
--- a/drivers/gpu/drm/drm_file.c
+++ b/drivers/gpu/drm/drm_file.c
@@ -39,6 +39,7 @@
 #include <linux/poll.h>
 #include <linux/slab.h>
 #include <linux/vga_switcheroo.h>
+#include <linux/debugfs.h>
 
 #include <drm/drm_client_event.h>
 #include <drm/drm_drv.h>
@@ -133,6 +134,7 @@ struct drm_file *drm_file_alloc(struct drm_minor *minor)
 	struct drm_device *dev = minor->dev;
 	struct drm_file *file;
 	int ret;
+	char *dir_name;
 
 	file = kzalloc(sizeof(*file), GFP_KERNEL);
 	if (!file)
@@ -143,6 +145,12 @@ struct drm_file *drm_file_alloc(struct drm_minor *minor)
 	rcu_assign_pointer(file->pid, get_pid(task_tgid(current)));
 	file->minor = minor;
 
+	dir_name = kasprintf(GFP_KERNEL, "client-%llu", file->client_id);
+	if (!dir_name)
+		return ERR_PTR(-ENOMEM);
+
+	file->debugfs_client = debugfs_create_dir(dir_name, minor->debugfs_root);
+
 	/* for compatibility root is always authenticated */
 	file->authenticated = capable(CAP_SYS_ADMIN);
 
@@ -237,6 +245,9 @@ void drm_file_free(struct drm_file *file)
 
 	drm_events_release(file);
 
+	debugfs_remove_recursive(file->debugfs_client);
+	file->debugfs_client = NULL;
+
 	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
 		drm_fb_release(file);
 		drm_property_destroy_user_blobs(dev, file);
diff --git a/include/drm/drm_file.h b/include/drm/drm_file.h
index 5c3b2aa3e69d..eab7546aad79 100644
--- a/include/drm/drm_file.h
+++ b/include/drm/drm_file.h
@@ -400,6 +400,13 @@ struct drm_file {
 	 * @client_name_lock: Protects @client_name.
 	 */
 	struct mutex client_name_lock;
+
+	/**
+	 * @debugfs_client:
+	 *
+	 * debugfs directory for each client under a drm node.
+	 */
+	struct dentry *debugfs_client;
 };
 
 /**
-- 
2.34.1


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

* [PATCH v1 2/2] amdgpu: add debugfs file for pt-base per client-id
  2025-06-13  7:15 [PATCH v1 0/2] debugfs support for pt base for each vm Sunil Khatri
  2025-06-13  7:15 ` [PATCH v1 1/2] drm: add debugfs support per client-id Sunil Khatri
@ 2025-06-13  7:15 ` Sunil Khatri
  2025-06-13 23:10   ` kernel test robot
  2025-06-13  9:00 ` [PATCH v1 0/2] debugfs support for pt base for each vm Christian König
  2025-06-20 12:40 ` Tvrtko Ursulin
  3 siblings, 1 reply; 8+ messages in thread
From: Sunil Khatri @ 2025-06-13  7:15 UTC (permalink / raw)
  To: Christian König, dri-devel; +Cc: amd-gfx, Sunil Khatri

Each drm node is associated with a unique client-id.
Adding root page table base address of the VM under
the client-id node in debugfs.

Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c  | 14 +++++++++++++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h  |  4 +++-
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index d2ce7d86dbc8..aa912168fd68 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -1395,7 +1395,7 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
 	if (r)
 		goto error_pasid;
 
-	r = amdgpu_vm_init(adev, &fpriv->vm, fpriv->xcp_id);
+	r = amdgpu_vm_init(adev, &fpriv->vm, fpriv->xcp_id, file_priv);
 	if (r)
 		goto error_pasid;
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 3911c78f8282..33415ecc6819 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -2520,6 +2520,17 @@ void amdgpu_vm_set_task_info(struct amdgpu_vm *vm)
 	get_task_comm(vm->task_info->process_name, current->group_leader);
 }
 
+#if defined(CONFIG_DEBUG_FS)
+static int amdgpu_pt_base_show(void *data, u64 *val)
+{
+	struct amdgpu_vm *vm = (struct amdgpu_vm *)data;
+	*val = amdgpu_bo_gpu_offset(vm->root.bo);
+	return 0;
+}
+
+DEFINE_DEBUGFS_ATTRIBUTE(amdgpu_pt_base_fops, amdgpu_pt_base_show, NULL, "%llx\n");
+#endif
+
 /**
  * amdgpu_vm_init - initialize a vm instance
  *
@@ -2533,7 +2544,7 @@ void amdgpu_vm_set_task_info(struct amdgpu_vm *vm)
  * 0 for success, error for failure.
  */
 int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
-		   int32_t xcp_id)
+		   int32_t xcp_id, struct drm_file *file)
 {
 	struct amdgpu_bo *root_bo;
 	struct amdgpu_bo_vm *root;
@@ -2609,6 +2620,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 	if (r)
 		DRM_DEBUG("Failed to create task info for VM\n");
 
+	debugfs_create_file("pt_base", 0444, file->debugfs_client, vm, &amdgpu_pt_base_fops);
 	amdgpu_bo_unreserve(vm->root.bo);
 	amdgpu_bo_unref(&root_bo);
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
index f3ad687125ad..555afaf867c4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
@@ -487,7 +487,9 @@ int amdgpu_vm_set_pasid(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 			u32 pasid);
 
 long amdgpu_vm_wait_idle(struct amdgpu_vm *vm, long timeout);
-int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, int32_t xcp_id);
+int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, int32_t xcp_id,
+		   struct drm_file *file);
+
 int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm);
 void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm);
 int amdgpu_vm_lock_pd(struct amdgpu_vm *vm, struct drm_exec *exec,
-- 
2.34.1


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

* Re: [PATCH v1 0/2] debugfs support for pt base for each vm
  2025-06-13  7:15 [PATCH v1 0/2] debugfs support for pt base for each vm Sunil Khatri
  2025-06-13  7:15 ` [PATCH v1 1/2] drm: add debugfs support per client-id Sunil Khatri
  2025-06-13  7:15 ` [PATCH v1 2/2] amdgpu: add debugfs file for pt-base " Sunil Khatri
@ 2025-06-13  9:00 ` Christian König
  2025-06-13  9:29   ` Khatri, Sunil
  2025-06-20 12:40 ` Tvrtko Ursulin
  3 siblings, 1 reply; 8+ messages in thread
From: Christian König @ 2025-06-13  9:00 UTC (permalink / raw)
  To: Sunil Khatri, dri-devel; +Cc: amd-gfx



On 6/13/25 09:15, Sunil Khatri wrote:
> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/clients
>              command  tgid dev master a   uid      magic                                                             name client-id
>       systemd-logind  1056   0   y    y     0          0                                                          <unset>     5
>             Xwayland  1733 128   n    n   120          0                                                          <unset>     8
>      mutter-x11-fram  2048 128   n    n   120          0                                                          <unset>     9
>             ibus-x11  2071 128   n    n   120          0                                                          <unset>    10
> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client
> client-1/  client-10/ client-2/  client-5/  client-8/  client-9/  clients
> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-1
> client-1/  client-10/
> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-1
> client-1/  client-10/
> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-1/pt_base
> 81febf3000
> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-5/pt_base
> 81febe9000
> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-8/pt_base
> 81febdc000
> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-9/pt_base
> 81febb2000
> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-10/pt_base
> 81febaf000

First of all move the client-* directories one directory up.

You put the directory under the debugfs directory of the device, but the idea here is that we can lockup the client device independent.

If we want to know which device a client belongs to we can easily add a symlink from the client subdirectory to the device (probably a good idea).

Regards,
Christian.

> 
> 
> Sunil Khatri (2):
>   drm: add debugfs support per client-id
>   amdgpu: add debugfs file for pt-base per client-id
> 
>  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c  | 14 +++++++++++++-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h  |  4 +++-
>  drivers/gpu/drm/drm_file.c              | 13 +++++++++++++
>  include/drm/drm_file.h                  |  7 +++++++
>  5 files changed, 37 insertions(+), 3 deletions(-)
> 


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

* Re: [PATCH v1 0/2] debugfs support for pt base for each vm
  2025-06-13  9:00 ` [PATCH v1 0/2] debugfs support for pt base for each vm Christian König
@ 2025-06-13  9:29   ` Khatri, Sunil
  0 siblings, 0 replies; 8+ messages in thread
From: Khatri, Sunil @ 2025-06-13  9:29 UTC (permalink / raw)
  To: Christian König, Sunil Khatri, dri-devel; +Cc: amd-gfx


On 6/13/2025 2:30 PM, Christian König wrote:
>
> On 6/13/25 09:15, Sunil Khatri wrote:
>> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/clients
>>               command  tgid dev master a   uid      magic                                                             name client-id
>>        systemd-logind  1056   0   y    y     0          0                                                          <unset>     5
>>              Xwayland  1733 128   n    n   120          0                                                          <unset>     8
>>       mutter-x11-fram  2048 128   n    n   120          0                                                          <unset>     9
>>              ibus-x11  2071 128   n    n   120          0                                                          <unset>    10
>> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client
>> client-1/  client-10/ client-2/  client-5/  client-8/  client-9/  clients
>> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-1
>> client-1/  client-10/
>> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-1
>> client-1/  client-10/
>> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-1/pt_base
>> 81febf3000
>> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-5/pt_base
>> 81febe9000
>> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-8/pt_base
>> 81febdc000
>> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-9/pt_base
>> 81febb2000
>> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-10/pt_base
>> 81febaf000
> First of all move the client-* directories one directory up.
Isn't it better to have the clients under the corresponding device only 
in that case user dont have to find which device they belong to and we 
dont have to create a symlink too back to the device.
Infact /sys/kernel/debug/dri/0/clients is also drm device specific. If 
we keep it outside then in case of multi gpu from different vendors, it 
will be all mixed up and i am not sure if client-ids are per device. if 
yes, then there is possibility of duplicates over override.

Regards
Sunil
>
> You put the directory under the debugfs directory of the device, but the idea here is that we can lockup the client device independent.
>
> If we want to know which device a client belongs to we can easily add a symlink from the client subdirectory to the device (probably a good idea).
>
> Regards,
> Christian.
>
>>
>> Sunil Khatri (2):
>>    drm: add debugfs support per client-id
>>    amdgpu: add debugfs file for pt-base per client-id
>>
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  2 +-
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c  | 14 +++++++++++++-
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h  |  4 +++-
>>   drivers/gpu/drm/drm_file.c              | 13 +++++++++++++
>>   include/drm/drm_file.h                  |  7 +++++++
>>   5 files changed, 37 insertions(+), 3 deletions(-)
>>

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

* Re: [PATCH v1 2/2] amdgpu: add debugfs file for pt-base per client-id
  2025-06-13  7:15 ` [PATCH v1 2/2] amdgpu: add debugfs file for pt-base " Sunil Khatri
@ 2025-06-13 23:10   ` kernel test robot
  0 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2025-06-13 23:10 UTC (permalink / raw)
  To: Sunil Khatri, Christian König, dri-devel
  Cc: llvm, oe-kbuild-all, amd-gfx, Sunil Khatri

Hi Sunil,

kernel test robot noticed the following build errors:

[auto build test ERROR on drm-exynos/exynos-drm-next]
[also build test ERROR on linus/master drm/drm-next v6.16-rc1 next-20250613]
[cannot apply to drm-intel/for-linux-next drm-intel/for-linux-next-fixes drm-misc/drm-misc-next drm-tip/drm-tip]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Sunil-Khatri/drm-add-debugfs-support-per-client-id/20250613-151800
base:   https://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git exynos-drm-next
patch link:    https://lore.kernel.org/r/20250613071537.701563-3-sunil.khatri%40amd.com
patch subject: [PATCH v1 2/2] amdgpu: add debugfs file for pt-base per client-id
config: arm64-randconfig-003-20250614 (https://download.01.org/0day-ci/archive/20250614/202506140646.VrFqwwXA-lkp@intel.com/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project f819f46284f2a79790038e1f6649172789734ae8)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250614/202506140646.VrFqwwXA-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202506140646.VrFqwwXA-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:2622:66: error: use of undeclared identifier 'amdgpu_pt_base_fops'; did you mean 'amdgpu_dmabuf_ops'?
    2622 |         debugfs_create_file("pt_base", 0444, file->debugfs_client, vm, &amdgpu_pt_base_fops);
         |                                                                         ^~~~~~~~~~~~~~~~~~~
         |                                                                         amdgpu_dmabuf_ops
   drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.h:35:33: note: 'amdgpu_dmabuf_ops' declared here
      35 | extern const struct dma_buf_ops amdgpu_dmabuf_ops;
         |                                 ^
   1 error generated.


vim +2622 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

  2532	
  2533	/**
  2534	 * amdgpu_vm_init - initialize a vm instance
  2535	 *
  2536	 * @adev: amdgpu_device pointer
  2537	 * @vm: requested vm
  2538	 * @xcp_id: GPU partition selection id
  2539	 *
  2540	 * Init @vm fields.
  2541	 *
  2542	 * Returns:
  2543	 * 0 for success, error for failure.
  2544	 */
  2545	int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
  2546			   int32_t xcp_id, struct drm_file *file)
  2547	{
  2548		struct amdgpu_bo *root_bo;
  2549		struct amdgpu_bo_vm *root;
  2550		int r, i;
  2551	
  2552		vm->va = RB_ROOT_CACHED;
  2553		for (i = 0; i < AMDGPU_MAX_VMHUBS; i++)
  2554			vm->reserved_vmid[i] = NULL;
  2555		INIT_LIST_HEAD(&vm->evicted);
  2556		INIT_LIST_HEAD(&vm->evicted_user);
  2557		INIT_LIST_HEAD(&vm->relocated);
  2558		INIT_LIST_HEAD(&vm->moved);
  2559		INIT_LIST_HEAD(&vm->idle);
  2560		INIT_LIST_HEAD(&vm->invalidated);
  2561		spin_lock_init(&vm->status_lock);
  2562		INIT_LIST_HEAD(&vm->freed);
  2563		INIT_LIST_HEAD(&vm->done);
  2564		INIT_KFIFO(vm->faults);
  2565	
  2566		r = amdgpu_vm_init_entities(adev, vm);
  2567		if (r)
  2568			return r;
  2569	
  2570		ttm_lru_bulk_move_init(&vm->lru_bulk_move);
  2571	
  2572		vm->is_compute_context = false;
  2573	
  2574		vm->use_cpu_for_update = !!(adev->vm_manager.vm_update_mode &
  2575					    AMDGPU_VM_USE_CPU_FOR_GFX);
  2576	
  2577		DRM_DEBUG_DRIVER("VM update mode is %s\n",
  2578				 vm->use_cpu_for_update ? "CPU" : "SDMA");
  2579		WARN_ONCE((vm->use_cpu_for_update &&
  2580			   !amdgpu_gmc_vram_full_visible(&adev->gmc)),
  2581			  "CPU update of VM recommended only for large BAR system\n");
  2582	
  2583		if (vm->use_cpu_for_update)
  2584			vm->update_funcs = &amdgpu_vm_cpu_funcs;
  2585		else
  2586			vm->update_funcs = &amdgpu_vm_sdma_funcs;
  2587	
  2588		vm->last_update = dma_fence_get_stub();
  2589		vm->last_unlocked = dma_fence_get_stub();
  2590		vm->last_tlb_flush = dma_fence_get_stub();
  2591		vm->generation = amdgpu_vm_generation(adev, NULL);
  2592	
  2593		mutex_init(&vm->eviction_lock);
  2594		vm->evicting = false;
  2595		vm->tlb_fence_context = dma_fence_context_alloc(1);
  2596	
  2597		r = amdgpu_vm_pt_create(adev, vm, adev->vm_manager.root_level,
  2598					false, &root, xcp_id);
  2599		if (r)
  2600			goto error_free_delayed;
  2601	
  2602		root_bo = amdgpu_bo_ref(&root->bo);
  2603		r = amdgpu_bo_reserve(root_bo, true);
  2604		if (r) {
  2605			amdgpu_bo_unref(&root_bo);
  2606			goto error_free_delayed;
  2607		}
  2608	
  2609		amdgpu_vm_bo_base_init(&vm->root, vm, root_bo);
  2610		r = dma_resv_reserve_fences(root_bo->tbo.base.resv, 1);
  2611		if (r)
  2612			goto error_free_root;
  2613	
  2614		r = amdgpu_vm_pt_clear(adev, vm, root, false);
  2615		if (r)
  2616			goto error_free_root;
  2617	
  2618		r = amdgpu_vm_create_task_info(vm);
  2619		if (r)
  2620			DRM_DEBUG("Failed to create task info for VM\n");
  2621	
> 2622		debugfs_create_file("pt_base", 0444, file->debugfs_client, vm, &amdgpu_pt_base_fops);
  2623		amdgpu_bo_unreserve(vm->root.bo);
  2624		amdgpu_bo_unref(&root_bo);
  2625	
  2626		return 0;
  2627	
  2628	error_free_root:
  2629		amdgpu_vm_pt_free_root(adev, vm);
  2630		amdgpu_bo_unreserve(vm->root.bo);
  2631		amdgpu_bo_unref(&root_bo);
  2632	
  2633	error_free_delayed:
  2634		dma_fence_put(vm->last_tlb_flush);
  2635		dma_fence_put(vm->last_unlocked);
  2636		ttm_lru_bulk_move_fini(&adev->mman.bdev, &vm->lru_bulk_move);
  2637		amdgpu_vm_fini_entities(vm);
  2638	
  2639		return r;
  2640	}
  2641	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH v1 0/2] debugfs support for pt base for each vm
  2025-06-13  7:15 [PATCH v1 0/2] debugfs support for pt base for each vm Sunil Khatri
                   ` (2 preceding siblings ...)
  2025-06-13  9:00 ` [PATCH v1 0/2] debugfs support for pt base for each vm Christian König
@ 2025-06-20 12:40 ` Tvrtko Ursulin
  2025-06-23  5:15   ` Khatri, Sunil
  3 siblings, 1 reply; 8+ messages in thread
From: Tvrtko Ursulin @ 2025-06-20 12:40 UTC (permalink / raw)
  To: Sunil Khatri, Christian König, dri-devel; +Cc: amd-gfx


On 13/06/2025 08:15, Sunil Khatri wrote:
> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/clients
>               command  tgid dev master a   uid      magic                                                             name client-id
>        systemd-logind  1056   0   y    y     0          0                                                          <unset>     5
>              Xwayland  1733 128   n    n   120          0                                                          <unset>     8
>       mutter-x11-fram  2048 128   n    n   120          0                                                          <unset>     9
>              ibus-x11  2071 128   n    n   120          0                                                          <unset>    10
> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client
> client-1/  client-10/ client-2/  client-5/  client-8/  client-9/  clients

How about making clients a directory? Ie. in your example:

# ls -1 /sys/kernel/debug/dri/0/clients/
1
5
8
9
10

# cat /sys/kernel/debug/dri/0/clients/1/pt_base
81febf3000

Regards,

Tvrtko

> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-1
> client-1/  client-10/
> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-1
> client-1/  client-10/
> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-1/pt_base
> 81febf3000
> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-5/pt_base
> 81febe9000
> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-8/pt_base
> 81febdc000
> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-9/pt_base
> 81febb2000
> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-10/pt_base
> 81febaf000
> 
> 
> Sunil Khatri (2):
>    drm: add debugfs support per client-id
>    amdgpu: add debugfs file for pt-base per client-id
> 
>   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  2 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c  | 14 +++++++++++++-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h  |  4 +++-
>   drivers/gpu/drm/drm_file.c              | 13 +++++++++++++
>   include/drm/drm_file.h                  |  7 +++++++
>   5 files changed, 37 insertions(+), 3 deletions(-)
> 


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

* Re: [PATCH v1 0/2] debugfs support for pt base for each vm
  2025-06-20 12:40 ` Tvrtko Ursulin
@ 2025-06-23  5:15   ` Khatri, Sunil
  0 siblings, 0 replies; 8+ messages in thread
From: Khatri, Sunil @ 2025-06-23  5:15 UTC (permalink / raw)
  To: Tvrtko Ursulin, Sunil Khatri, Christian König, dri-devel; +Cc: amd-gfx


On 6/20/2025 6:10 PM, Tvrtko Ursulin wrote:
>
> On 13/06/2025 08:15, Sunil Khatri wrote:
>> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/clients
>>               command  tgid dev master a   uid magic name client-id
>>        systemd-logind  1056   0   y    y     0 0 <unset>     5
>>              Xwayland  1733 128   n    n   120 0 <unset>     8
>>       mutter-x11-fram  2048 128   n    n   120 0 <unset>     9
>>              ibus-x11  2071 128   n    n   120 0 <unset>    10
>> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client
>> client-1/  client-10/ client-2/  client-5/  client-8/ client-9/  clients
>
> How about making clients a directory? Ie. in your example:

This has been updated. Could you please review the V4 patchset and may 
be soon there will be a v5. There are some changes already so request to 
please have a look on v4/v5.

Regards
Sunil Khatri

>
> # ls -1 /sys/kernel/debug/dri/0/clients/
> 1
> 5
> 8
> 9
> 10
>
> # cat /sys/kernel/debug/dri/0/clients/1/pt_base
> 81febf3000
>
> Regards,
>
> Tvrtko
>
>> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-1
>> client-1/  client-10/
>> root@amd-X570-AORUS-ELITE:~# cat /sys/kernel/debug/dri/0/client-1
>> client-1/  client-10/
>> root@amd-X570-AORUS-ELITE:~# cat 
>> /sys/kernel/debug/dri/0/client-1/pt_base
>> 81febf3000
>> root@amd-X570-AORUS-ELITE:~# cat 
>> /sys/kernel/debug/dri/0/client-5/pt_base
>> 81febe9000
>> root@amd-X570-AORUS-ELITE:~# cat 
>> /sys/kernel/debug/dri/0/client-8/pt_base
>> 81febdc000
>> root@amd-X570-AORUS-ELITE:~# cat 
>> /sys/kernel/debug/dri/0/client-9/pt_base
>> 81febb2000
>> root@amd-X570-AORUS-ELITE:~# cat 
>> /sys/kernel/debug/dri/0/client-10/pt_base
>> 81febaf000
>>
>>
>> Sunil Khatri (2):
>>    drm: add debugfs support per client-id
>>    amdgpu: add debugfs file for pt-base per client-id
>>
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  2 +-
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c  | 14 +++++++++++++-
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h  |  4 +++-
>>   drivers/gpu/drm/drm_file.c              | 13 +++++++++++++
>>   include/drm/drm_file.h                  |  7 +++++++
>>   5 files changed, 37 insertions(+), 3 deletions(-)
>>
>

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

end of thread, other threads:[~2025-06-23  5:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-13  7:15 [PATCH v1 0/2] debugfs support for pt base for each vm Sunil Khatri
2025-06-13  7:15 ` [PATCH v1 1/2] drm: add debugfs support per client-id Sunil Khatri
2025-06-13  7:15 ` [PATCH v1 2/2] amdgpu: add debugfs file for pt-base " Sunil Khatri
2025-06-13 23:10   ` kernel test robot
2025-06-13  9:00 ` [PATCH v1 0/2] debugfs support for pt base for each vm Christian König
2025-06-13  9:29   ` Khatri, Sunil
2025-06-20 12:40 ` Tvrtko Ursulin
2025-06-23  5:15   ` Khatri, Sunil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).