[PATCH 0/1][SRU][M][N] drm: Update file owner during use

AceLan Kao acelan.kao at canonical.com
Wed Dec 27 01:28:43 UTC 2023


From: "Chia-Lin Kao (AceLan)" <acelan.kao at canonical.com>

BugLink: https://bugs.launchpad.net/bugs/2047461

[Impact]
Our testing tools need to check the app runs on which GPU, and now it only
shows the processes as Xorg or XWayland

    $ cat /sys/kernel/debug/dri/0/clients
                 command pid dev master a uid magic
                    Xorg 2344 0 y y 0 0
                    Xorg 2344 0 n y 0 2
                    Xorg 2344 0 n y 0 3
                    Xorg 2344 0 n y 0 4

[Fix]
The commit from v6.7-rc1 fixes the issue

    $ cat /sys/kernel/debug/dri/0/clients
                 command tgid dev master a uid magic
                    Xorg 830 0 y y 0 0
           xfce4-session 880 0 n y 0 1
                   xfwm4 943 0 n y 0 2
               neverball 1095 0 n y 0 3

[Test case]
1. check processes by 'cat /sys/kernel/debug/dri/0/clients'
2. runs glxgears(specify the GPU if needed)
3. check the precesses again and there should be a 'glxgears' process

[Where problems could occur]
This commit added some protections on read/write and only changes the
process' pid, the worst case is that the process got the wrong pid as its
owner.

Tvrtko Ursulin (1):
  drm: Update file owner during use

 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c |  6 ++--
 drivers/gpu/drm/drm_auth.c              |  3 +-
 drivers/gpu/drm/drm_debugfs.c           | 10 ++++---
 drivers/gpu/drm/drm_file.c              | 40 +++++++++++++++++++++++--
 drivers/gpu/drm/drm_ioctl.c             |  3 ++
 drivers/gpu/drm/nouveau/nouveau_drm.c   |  5 +++-
 drivers/gpu/drm/vmwgfx/vmwgfx_gem.c     |  6 ++--
 include/drm/drm_file.h                  | 13 ++++++--
 8 files changed, 71 insertions(+), 15 deletions(-)

-- 
2.34.1




More information about the kernel-team mailing list