drm/amdgpu/userq: gnome shell uses max priority
Subsystems (2)
PATCH 1/1 drm/amdgpu/userq: gnome shell uses max priority
In function amdgpu_userq_priority_permit allow till maximum priority i.e 3 which is seen for gnome shell.
This is needed to fix the issue of unable to create queue for gnome shell.
logs:
[drm] *ERROR* comm: gnome-shell pid: 2802 client-id:10 client: Unset ... SK: Priority 3
--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +1 -1
@@ -701,7 +701,7 @@ void amdgpu_userq_put(struct amdgpu_usermode_queue *queue)static int amdgpu_userq_priority_permit (struct drm_file *filp,int priority) { -if (priority <AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGH ) +if (priority <=AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGH )return 0 ;if (capable (CAP_SYS_NICE ))
Signature · 1 line
2.34.1
Christian König
maintainerQuoted 8 lines · Sunil Khatri
In function
amdgpu_userq_priority_permitallow till maximum priority i.e 3 which is seen for gnome shell.This is needed to fix the issue of unable to create queue for gnome shell.
logs:
[drm] *ERROR* comm: gnome-shell pid: 2802 client-id:10 client: Unset ... SK: Priority 3
Clear NAK, as far as I can see the existing code is correct.
AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGH is only allowed when you have CAP_SYS_NICE, e.g. you are root.
That is also documented in the UAPI. Question is why is gnome shell trying to use that?
Regards,
Christian.
Quoted 19 lines
Signed-off-by Sunil Khatri <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +1
-1@@ -701,7 +701,7 @@ void amdgpu_userq_put(struct amdgpu_usermode_queue *queue)static int amdgpu_userq_priority_permit (struct drm_file *filp,int priority) { -if (priority <AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGH ) +if (priority <=AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGH )return 0 ;if (capable (CAP_SYS_NICE ))
Quoted 7 lines · Christian König
Quoted 6 lines · Sunil Khatri
In function
amdgpu_userq_priority_permitallow till maximum priority i.e 3 which is seen for gnome shell.This is needed to fix the issue of unable to create queue for gnome shell.
Quoted 7 lines
Quoted 2 lines
logs:
[drm] *ERROR* comm: gnome-shell pid: 2802 client-id:10 client: Unset ... SK: Priority 3Clear NAK, as far as I can see the existing code is correct.
AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGHis only allowed when you haveCAP_SYS_NICE, e.g. you are root.That is also documented in the UAPI. Question is why is gnome shell trying to use that?
I see, let me add Yogesh for his inputs, @yogesh, why gnome shell is asking for priority AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGH. Based on the code seems mesa is getting a flag set flags & PIPE_CONTEXT_HIGH_PRIORITY -> this sets AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGH for graphics queue. Regards Sunil Khatri
Quoted 22 lines
Regards,
Christian.Quoted 18 lines
Signed-off-by Sunil Khatri<[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +1
-1@@ -701,7 +701,7 @@ void amdgpu_userq_put(struct amdgpu_usermode_queue *queue)static int amdgpu_userq_priority_permit (struct drm_file *filp,int priority) { -if (priority <AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGH ) +if (priority <=AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGH )return 0 ;if (capable (CAP_SYS_NICE ))
Quoted 8 lines · Sunil
Quoted 7 lines · Christian König
Quoted 6 lines · Sunil Khatri
In function
amdgpu_userq_priority_permitallow till maximum priority i.e 3 which is seen for gnome shell.This is needed to fix the issue of unable to create queue for gnome shell.
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
logs:
[drm] *ERROR* comm: gnome-shell pid: 2802 client-id:10 client: Unset ... SK: Priority 3Clear NAK, as far as I can see the existing code is correct.
AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGHis only allowed when you haveCAP_SYS_NICE, e.g. you are root.That is also documented in the UAPI. Question is why is gnome shell trying to use that?
I see, let me add Yogesh for his inputs, @yogesh, why gnome shell is asking for priority AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGH. Based on the code seems mesa is getting a flag set flags &
PIPE_CONTEXT_HIGH_PRIORITY-> this setsAMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGHfor graphics queue.
For some background, mutter uses EGL_CONTEXT_PRIORITY_HIGH_IMG when EGL_IMG_context_priority is supported, to try and prevent its GPU work from getting starved by clients.
This works (or at least doesn't fail similarly) with kernel queues, presumably via DRM master status. I'd argue that should suffice with user queues as well.
Signature · 2 lines
Earthling Michel Dänzer \ GNOME / Xwayland / Mesa developer https://redhat.com \ Libre software enthusiast
Quoted 13 lines · Michel Dänzer
Quoted 12 lines · Sunil
Quoted 11 lines · Christian König
Quoted 8 lines · Sunil Khatri
In function
amdgpu_userq_priority_permitallow till maximum priority i.e 3 which is seen for gnome shell.This is needed to fix the issue of unable to create queue for gnome shell.
logs:
[drm] *ERROR* comm: gnome-shell pid: 2802 client-id:10 client: Unset ... SK: Priority 3Clear NAK, as far as I can see the existing code is correct.
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines
AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGHis only allowed when you haveCAP_SYS_NICE, e.g. you are root.That is also documented in the UAPI. Question is why is gnome shell trying to use that?
I see, let me add Yogesh for his inputs, @yogesh, why gnome shell is asking for priority AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGH. Based on the code seems mesa is getting a flag set flags &
PIPE_CONTEXT_HIGH_PRIORITY-> this setsAMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGHfor graphics queue.For some background, mutter uses
EGL_CONTEXT_PRIORITY_HIGH_IMGwhenEGL_IMG_context_priorityis supported, to try and prevent its GPU work from getting starved by clients.This works (or at least doesn't fail similarly) with kernel queues, presumably via DRM master status. I'd argue that should suffice with user queues as well.
Below is the check that we have for userqueues during queue creation, and for gnome it did not hit any of the condition and eventually return with -EACCES that is wrong. It has to be maste or CAP_SYS_NICE capable. if(priority<AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGH)
return0;
if(capable(CAP_SYS_NICE))
return0;
if(drm_is_current_master(filp))
return0;
return-EACCES;
regards
Sunil khatri
Quoted 2 lines
Quoted 31 lines · Sunil
On 14-04-2026 07:12 pm, Michel Dänzer wrote:
On 4/13/26 11:24, Khatri, Sunil wrote:
On 13-04-2026 02:32 pm, Christian König wrote:
On 4/13/26 10:49, Sunil Khatri wrote:
In function
amdgpu_userq_priority_permitallow till maximum priority i.e 3 which is seen for gnome shell.This is needed to fix the issue of unable to create queue for gnome shell.
logs:
[drm] *ERROR* comm: gnome-shell pid: 2802 client-id:10 client: Unset ... SK: Priority 3Clear NAK, as far as I can see the existing code is correct.
AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGHis only allowed when you haveCAP_SYS_NICE, e.g. you are root.That is also documented in the UAPI. Question is why is gnome shell trying to use that?
I see, let me add Yogesh for his inputs, @yogesh, why gnome shell is asking for priority
AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGH. Based on the code seems mesa is getting a flag set flags &PIPE_CONTEXT_HIGH_PRIORITY-> this setsAMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGHfor graphics queue.For some background, mutter uses
EGL_CONTEXT_PRIORITY_HIGH_IMGwhenEGL_IMG_context_priorityis supported, to try and prevent its GPU work from getting starved by clients.This works (or at least doesn't fail similarly) with kernel queues, presumably via DRM master status. I'd argue that should suffice with user queues as well.
Quoted 8 lines
Below is the check that we have for userqueues during queue creation, and for gnome it did not hit any of the condition and eventually return with
-EACCESthat is wrong. It has to be maste orCAP_SYS_NICEcapable. if (priority <AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGH)return 0; if (capable(CAP_SYS_NICE)) return 0; if (drm_is_current_master(filp)) return 0; return -EACCES;
This is the same logic as kernel queues:
/* NORMAL and below are accessible by everyone */
if (priority <= AMDGPU_CTX_PRIORITY_NORMAL)
return 0;
if (capable(CAP_SYS_NICE))
return 0;
if (drm_is_current_master(filp))
return 0;
return -EACCES;Maybe there is a timing difference?
Alex
Quoted 22 lines · Sunil
Quoted 13 lines · Michel Dänzer
Quoted 12 lines · Sunil
Quoted 11 lines · Christian König
Quoted 8 lines · Sunil Khatri
In function
amdgpu_userq_priority_permitallow till maximum priority i.e 3 which is seen for gnome shell.This is needed to fix the issue of unable to create queue for gnome shell.
logs:
[drm] *ERROR* comm: gnome-shell pid: 2802 client-id:10 client: Unset ... SK: Priority 3Clear NAK, as far as I can see the existing code is correct.
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines
AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGHis only allowed when you haveCAP_SYS_NICE, e.g. you are root.That is also documented in the UAPI. Question is why is gnome shell trying to use that?
I see, let me add Yogesh for his inputs, @yogesh, why gnome shell is asking for priority AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGH. Based on the code seems mesa is getting a flag set flags &
PIPE_CONTEXT_HIGH_PRIORITY-> this setsAMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGHfor graphics queue.For some background, mutter uses
EGL_CONTEXT_PRIORITY_HIGH_IMGwhenEGL_IMG_context_priorityis supported, to try and prevent its GPU work from getting starved by clients.This works (or at least doesn't fail similarly) with kernel queues, presumably via DRM master status. I'd argue that should suffice with user queues as well.
Quoted 8 lines
Below is the check that we have for userqueues during queue creation, and for gnome it did not hit any of the condition and eventually return with
-EACCESthat is wrong. It has to be maste orCAP_SYS_NICEcapable.if(priority<AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGH)
return0;
if(capable(CAP_SYS_NICE))
return0;
if(drm_is_current_master(filp))
return0;
return-EACCES;
Indeed, looks like at least in some cases mutter creates the EGL context before it has DRM master status. I'll look into fixing this in mutter.
With kernel queues, radeonsi silently falls back to a normal-priority context in this case, but then still claims it's high priority. I filed https://gitlab.freedesktop.org/mesa/mesa/-/work_items/15282 about this.
Meanwhile, user queues should probably also fail without logging an error in this case.
Signature · 2 lines
Earthling Michel Dänzer \ GNOME / Xwayland / Mesa developer https://redhat.com \ Libre software enthusiast
Quoted 32 lines · Michel Dänzer
Quoted 22 lines · Sunil
Quoted 13 lines · Michel Dänzer
Quoted 12 lines · Sunil
Quoted 11 lines · Christian König
Quoted 8 lines · Sunil Khatri
In function
amdgpu_userq_priority_permitallow till maximum priority i.e 3 which is seen for gnome shell.This is needed to fix the issue of unable to create queue for gnome shell.
logs:
[drm] *ERROR* comm: gnome-shell pid: 2802 client-id:10 client: Unset ... SK: Priority 3Clear NAK, as far as I can see the existing code is correct.
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines
AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGHis only allowed when you haveCAP_SYS_NICE, e.g. you are root.That is also documented in the UAPI. Question is why is gnome shell trying to use that?
I see, let me add Yogesh for his inputs, @yogesh, why gnome shell is asking for priority AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGH. Based on the code seems mesa is getting a flag set flags &
PIPE_CONTEXT_HIGH_PRIORITY-> this setsAMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGHfor graphics queue.For some background, mutter uses
EGL_CONTEXT_PRIORITY_HIGH_IMGwhenEGL_IMG_context_priorityis supported, to try and prevent its GPU work from getting starved by clients.This works (or at least doesn't fail similarly) with kernel queues, presumably via DRM master status. I'd argue that should suffice with user queues as well.
Quoted 8 lines
Below is the check that we have for userqueues during queue creation, and for gnome it did not hit any of the condition and eventually return with
-EACCESthat is wrong. It has to be maste orCAP_SYS_NICEcapable.if(priority<AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGH)
return0;
if(capable(CAP_SYS_NICE))
return0;
if(drm_is_current_master(filp))
return0;
return-EACCES;
Quoted 1 line
Indeed, looks like at least in some cases mutter creates the EGL context before it has DRM master status. I'll look into fixing this in mutter.
I realized what I'm seeing is a regression from https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40519 , since a render node file description can't have DRM master status.
I created https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40974 to fix that.
Signature · 2 lines
Earthling Michel Dänzer \ GNOME / Xwayland / Mesa developer https://redhat.com \ Libre software enthusiast
Seems to work. Not seeing the queue creation failures anymore after i used the change.
Regards
Sunil khatri
Quoted 37 lines · Michel Dänzer
Quoted 31 lines · Michel Dänzer
Quoted 22 lines · Sunil
Quoted 13 lines · Michel Dänzer
Quoted 12 lines · Sunil
Quoted 11 lines · Christian König
Quoted 8 lines · Sunil Khatri
In function
amdgpu_userq_priority_permitallow till maximum priority i.e 3 which is seen for gnome shell.This is needed to fix the issue of unable to create queue for gnome shell.
logs:
[drm] *ERROR* comm: gnome-shell pid: 2802 client-id:10 client: Unset ... SK: Priority 3Clear NAK, as far as I can see the existing code is correct.
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines
AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGHis only allowed when you haveCAP_SYS_NICE, e.g. you are root.That is also documented in the UAPI. Question is why is gnome shell trying to use that?
I see, let me add Yogesh for his inputs, @yogesh, why gnome shell is asking for priority AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGH. Based on the code seems mesa is getting a flag set flags &
PIPE_CONTEXT_HIGH_PRIORITY-> this setsAMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGHfor graphics queue.For some background, mutter uses
EGL_CONTEXT_PRIORITY_HIGH_IMGwhenEGL_IMG_context_priorityis supported, to try and prevent its GPU work from getting starved by clients.This works (or at least doesn't fail similarly) with kernel queues, presumably via DRM master status. I'd argue that should suffice with user queues as well.
Quoted 8 lines
Below is the check that we have for userqueues during queue creation, and for gnome it did not hit any of the condition and eventually return with
-EACCESthat is wrong. It has to be maste orCAP_SYS_NICEcapable.if(priority<AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGH)
return0;
if(capable(CAP_SYS_NICE))
return0;
if(drm_is_current_master(filp))
return0;
return-EACCES;Quoted 1 line
Indeed, looks like at least in some cases mutter creates the EGL context before it has DRM master status. I'll look into fixing this in mutter.
I realized what I'm seeing is a regression from https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40519 , since a render node file description can't have DRM master status.
I created https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40974 to fix that.
Quoted 12 lines · Sunil
Quoted 11 lines · Michel Dänzer
Quoted 10 lines · Michel Dänzer
Quoted 9 lines · Sunil
Below is the check that we have for userqueues during queue creation, and for gnome it did not hit any of the condition and eventually return with
-EACCESthat is wrong. It has to be maste orCAP_SYS_NICEcapable.if(priority<AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGH)
return0;
if(capable(CAP_SYS_NICE))
return0;
if(drm_is_current_master(filp))
return0;
return-EACCES;
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Indeed, looks like at least in some cases mutter creates the EGL context before it has DRM master status. I'll look into fixing this in mutter.
I realized what I'm seeing is a regression from https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40519 , since a render node file description can't have DRM master status.
I created https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40974 to fix that.
Seems to work. Not seeing the queue creation failures anymore after i used the change.
That's good.
There can still be scenarios where it'll fail though, which should be handled as gracefully with user queues as with kernel ones.
P.S. Please don't top-post.
Signature · 2 lines
Earthling Michel Dänzer \ GNOME / Xwayland / Mesa developer https://redhat.com \ Libre software enthusiast