Skip to contentSkip to conversation

drm/amdgpu: Fix no-procfs build

PATCH Applied Rob Clark 3 participants 5 messages May 25, 2023 – May 26, 2023

Subsystems (2)
lore
Share & tools
lore

Rob Clark

author
#0 lore raw

PATCH 1/2 drm/amdgpu: Fix no-procfs build

From: Rob Clark <[email protected]>

Fixes undefined symbol when PROC_FS is not enabled.

Fixes 376c25f8ca47 ("drm/amdgpu: Switch to fdinfo helper")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -0
index 1b46e7ac7cb0..c9a41c997c6c 100644
@@ -2795,21 +2795,23 @@ static const struct drm_driver amdgpu_kms_driver = {
 	    DRIVER_SYNCOBJ_TIMELINE,
 	.open = amdgpu_driver_open_kms,
 	.postclose = amdgpu_driver_postclose_kms,
 	.lastclose = amdgpu_driver_lastclose_kms,
 	.ioctls = amdgpu_ioctls_kms,
 	.num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
 	.dumb_create = amdgpu_mode_dumb_create,
 	.dumb_map_offset = amdgpu_mode_dumb_mmap,
 	.fops = &amdgpu_driver_kms_fops,
 	.release = &amdgpu_driver_release_kms,
+#ifdef CONFIG_PROC_FS
 	.show_fdinfo = amdgpu_show_fdinfo,
+#endif
 
 	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
 	.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
 	.gem_prime_import = amdgpu_gem_prime_import,
 	.gem_prime_mmap = drm_gem_prime_mmap,
 
 	.name = DRIVER_NAME,
 	.desc = DRIVER_DESC,
 	.date = DRIVER_DATE,
 	.major = KMS_DRIVER_MAJOR,
Signature · 1 line
2.40.1
author
#1 lore raw

PATCH 2/2 drm/amdgpu: Remove duplicate fdinfo fields

From: Rob Clark <[email protected]>

Some of the fields that are handled by drm_show_fdinfo() crept back in when rebasing the patch. Remove them again.

Fixes 376c25f8ca47 ("drm/amdgpu: Switch to fdinfo helper")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c +0 -3
index 13d7413d4ca3..a93e5627901a 100644
@@ -80,23 +80,20 @@ void amdgpu_show_fdinfo(struct drm_printer *p, struct drm_file *file)
 
 	amdgpu_ctx_mgr_usage(&fpriv->ctx_mgr, usage);
 
 	/*
 	 * ******************************************************************
 	 * For text output format description please see drm-usage-stats.rst!
 	 * ******************************************************************
 	 */
 
 	drm_printf(p, "pasid:\t%u\n", fpriv->vm.pasid);
-	drm_printf(p, "drm-driver:\t%s\n", file->minor->dev->driver->name);
-	drm_printf(p, "drm-pdev:\t%04x:%02x:%02x.%d\n", domain, bus, dev, fn);
-	drm_printf(p, "drm-client-id:\t%Lu\n", vm->immediate.fence_context);
 	drm_printf(p, "drm-memory-vram:\t%llu KiB\n", stats.vram/1024UL);
 	drm_printf(p, "drm-memory-gtt: \t%llu KiB\n", stats.gtt/1024UL);
 	drm_printf(p, "drm-memory-cpu: \t%llu KiB\n", stats.cpu/1024UL);
 	drm_printf(p, "amd-memory-visible-vram:\t%llu KiB\n",
 		   stats.visible_vram/1024UL);
 	drm_printf(p, "amd-evicted-vram:\t%llu KiB\n",
 		   stats.evicted_vram/1024UL);
 	drm_printf(p, "amd-evicted-visible-vram:\t%llu KiB\n",
 		   stats.evicted_visible_vram/1024UL);
 	drm_printf(p, "amd-requested-vram:\t%llu KiB\n",
Signature · 1 line
2.40.1
Reviewed-by [email protected] on v1 2/2
#2 lore raw

Re: [PATCH 2/2] drm/amdgpu: Remove duplicate fdinfo fields

Quoted 8 lines · Rob Clark

From: Rob Clark <[email protected]>

Some of the fields that are handled by drm_show_fdinfo() crept back in when rebasing the patch. Remove them again.

Fixes 376c25f8ca47 ("drm/amdgpu: Switch to fdinfo helper")

Series is:

Quoted 35 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c +0 -4
index 13d7413d4ca3..a93e5627901a 100644
@@ -80,23 +80,20 @@ void amdgpu_show_fdinfo(struct drm_printer *p, struct drm_file *file)
 
        amdgpu_ctx_mgr_usage(&fpriv->ctx_mgr, usage);
 
        /*
         * ******************************************************************
         * For text output format description please see drm-usage-stats.rst!
         * ******************************************************************
         */
 
        drm_printf(p, "pasid:\t%u\n", fpriv->vm.pasid);
-       drm_printf(p, "drm-driver:\t%s\n", file->minor->dev->driver->name);
-       drm_printf(p, "drm-pdev:\t%04x:%02x:%02x.%d\n", domain, bus, dev, fn);
-       drm_printf(p, "drm-client-id:\t%Lu\n", vm->immediate.fence_context);
        drm_printf(p, "drm-memory-vram:\t%llu KiB\n", stats.vram/1024UL);
        drm_printf(p, "drm-memory-gtt: \t%llu KiB\n", stats.gtt/1024UL);
        drm_printf(p, "drm-memory-cpu: \t%llu KiB\n", stats.cpu/1024UL);
        drm_printf(p, "amd-memory-visible-vram:\t%llu KiB\n",
                   stats.visible_vram/1024UL);
        drm_printf(p, "amd-evicted-vram:\t%llu KiB\n",
                   stats.evicted_vram/1024UL);
        drm_printf(p, "amd-evicted-visible-vram:\t%llu KiB\n",
                   stats.evicted_visible_vram/1024UL);
        drm_printf(p, "amd-requested-vram:\t%llu KiB\n",
--

2.40.1

#3 lore raw

Re: [PATCH 2/2] drm/amdgpu: Remove duplicate fdinfo fields

In reply to Rob Clark

Hi Rob,

Quoted 29 lines · Rob Clark

From: Rob Clark <[email protected]>

Some of the fields that are handled by drm_show_fdinfo() crept back in when rebasing the patch. Remove them again.

Fixes 376c25f8ca47 ("drm/amdgpu: Switch to fdinfo helper")
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c | 3 ---
  1 file changed, 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c +0 -3
index 13d7413d4ca3..a93e5627901a 100644
@@ -80,23 +80,20 @@ void amdgpu_show_fdinfo(struct drm_printer *p, struct drm_file *file)
 
  	amdgpu_ctx_mgr_usage(&fpriv->ctx_mgr, usage);
 
  	/*
  	 * ******************************************************************
  	 * For text output format description please see drm-usage-stats.rst!
  	 * ******************************************************************
  	 */
 
  	drm_printf(p, "pasid:\t%u\n", fpriv->vm.pasid);
-	drm_printf(p, "drm-driver:\t%s\n", file->minor->dev->driver->name);
-	drm_printf(p, "drm-pdev:\t%04x:%02x:%02x.%d\n", domain, bus, dev, fn);
-	drm_printf(p, "drm-client-id:\t%Lu\n", vm->immediate.fence_context);

drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c void amdgpu_show_fdinfo(struct drm_printer *p, struct drm_file *file) · line 99

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c +0 -0
  	drm_printf(p, "drm-memory-vram:\t%llu KiB\n", stats.vram/1024UL);
  	drm_printf(p, "drm-memory-gtt: \t%llu KiB\n", stats.gtt/1024UL);
  	drm_printf(p, "drm-memory-cpu: \t%llu KiB\n", stats.cpu/1024UL);
  	drm_printf(p, "amd-memory-visible-vram:\t%llu KiB\n",
  		   stats.visible_vram/1024UL);
  	drm_printf(p, "amd-evicted-vram:\t%llu KiB\n",
  		   stats.evicted_vram/1024UL);
  	drm_printf(p, "amd-evicted-visible-vram:\t%llu KiB\n",
  		   stats.evicted_visible_vram/1024UL);
  	drm_printf(p, "amd-requested-vram:\t%llu KiB\n",

I got:
drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c: In function ‘amdgpu_show_fdinfo’:
drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c:64:32: error: variable ‘domain’ set but not used [-Werror=unused-but-set-variable]
64 | uint32_t bus, dev, fn, domain;
| ^~~~~~
drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c:64:28: error: variable ‘fn’ set but not used [-Werror=unused-but-set-variable]
64 | uint32_t bus, dev, fn, domain;
| ^~
drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c:64:23: error: variable ‘dev’ set but not used [-Werror=unused-but-set-variable]
64 | uint32_t bus, dev, fn, domain;
| ^~~
drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c:64:18: error: variable ‘bus’ set but not used [-Werror=unused-but-set-variable]
64 | uint32_t bus, dev, fn, domain;

after applying patch 2, can you fix it ? Seems you can keep the drm-pdev print line

I applied patch 1

Thanks,
Neil