drm/amdgpu: add UAPI for user queue query status
Subsystems (3)
PATCH 1/5 drm/amdgpu: add UAPI for user queue query status
From: Alex Deucher <[email protected]>
Add an API to query queue status such as whether the queue is hung or whether vram is lost.
--- include/uapi/drm/amdgpu_drm.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
include/uapi/drm/amdgpu_drm.h +14 -0
@@ -340,6 +340,7 @@ union drm_amdgpu_ctx {/* user queue IOCTL operations */ #define AMDGPU_USERQ_OP_CREATE 1#define AMDGPU_USERQ_OP_FREE 2 +#define AMDGPU_USERQ_OP_QUERY_STATUS 3/* queue priority levels */ /* low < normal low < normal high < high */
@@ -352,6 +353,12 @@ union drm_amdgpu_ctx {/* for queues that need access to protected content */ #define AMDGPU_USERQ_CREATE_FLAGS_QUEUE_SECURE (1 << 2) + +/* the queue is hung */ +#define AMDGPU_USERQ_QUERY_STATUS_FLAGS_HUNG (1 << 0) +/* indicate vram lost since queue was created */ +#define AMDGPU_USERQ_QUERY_STATUS_FLAGS_VRAMLOST (1 << 1) +/* * This structure is a container to pass input configuration * info for all supported userqueue related operations.
@@ -433,9 +440,16 @@ struct drm_amdgpu_userq_out {__u32 _pad; }; +/* The structure to carry output of userqueue ops */ +struct drm_amdgpu_userq_out_query_state { +__u32 flags; +__u32 _pad; +}; +union drm_amdgpu_userq {struct drm_amdgpu_userq_in in;struct drm_amdgpu_userq_out out; +struct drm_amdgpu_userq_out_query_state out_qs; };/* GFX V11 IP specific MQD parameters */
Signature · 1 line
2.34.1
PATCH 2/5 drm/amdgpu/userq: implement support for query status
From: Alex Deucher <[email protected]>
Query the status of the user queue, currently whether the queue is hung and whether or not VRAM is lost.
v2: Misc cleanups
--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 35 +++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_userq.h | 1 + 2 files changed, 36 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +35 -0
@@ -692,6 +692,7 @@ amdgpu_userq_create(struct drm_file *filp, union drm_amdgpu_userq *args) queue->queue_type = args->in.ip_type; queue->vm = &fpriv->vm; queue->priority = priority; + queue->generation =amdgpu_vm_generation (adev, &fpriv->vm); queue->xcp_id = (fpriv->xcp_id !=AMDGPU_XCP_NO_PARTITION ) ? fpriv->xcp_id :0 ; queue->userq_mgr = uq_mgr;
@@ -812,6 +813,34 @@ amdgpu_userq_create(struct drm_file *filp, union drm_amdgpu_userq *args)return r; } +static int +amdgpu_userq_query_status (struct drm_file *filp,union drm_amdgpu_userq *args) +{ +struct amdgpu_fpriv *fpriv = filp->driver_priv; +struct amdgpu_userq_mgr *uq_mgr = &fpriv->userq_mgr; +struct amdgpu_device *adev = uq_mgr->adev; +struct amdgpu_usermode_queue *queue; +int queue_id = args->in.queue_id; + +mutex_lock (&uq_mgr->userq_mutex); + + queue =amdgpu_userq_get (uq_mgr, queue_id); +if (!queue) { +mutex_unlock (&uq_mgr->userq_mutex); +return -EINVAL ; + } + + args->out_qs.flags =0 ; +if (queue->state ==AMDGPU_USERQ_STATE_HUNG ) + args->out_qs.flags |=AMDGPU_USERQ_QUERY_STATUS_FLAGS_HUNG ; +if (queue->generation !=amdgpu_vm_generation (adev, &fpriv->vm)) + args->out_qs.flags |=AMDGPU_USERQ_QUERY_STATUS_FLAGS_VRAMLOST ; +amdgpu_userq_put (queue); +mutex_unlock (&uq_mgr->userq_mutex); + +return 0 ; +} +static int amdgpu_userq_input_args_validate (struct drm_device *dev,union drm_amdgpu_userq *args,struct drm_file *filp)
@@ -933,6 +962,12 @@ int amdgpu_userq_ioctl(struct drm_device *dev, void *data,break ; } +case AMDGPU_USERQ_OP_QUERY_STATUS : + r =amdgpu_userq_query_status (filp, args); +if (r) +drm_dbg_driver (dev,"Failed to query usermode queue status\n" ); +break ; +default :drm_dbg_driver (dev,"Invalid user queue op specified: %d\n" , args->in.op);return -EINVAL ;
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.h +1 -0
@@ -79,6 +79,7 @@ struct amdgpu_usermode_queue {struct dma_fence *last_fence;u32 xcp_id;int priority; +uint64_t generation;struct dentry *debugfs_queue;/**
Signature · 1 line
2.34.1
PATCH 3/5 drm/amdgpu: extend UAPI for reporting userq invalid VA
In reply to Prike LiangAdd UAPI new definition for reporting userq invalid virtual address status to user space.
--- include/uapi/drm/amdgpu_drm.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/uapi/drm/amdgpu_drm.h +2 -1
@@ -358,7 +358,8 @@ union drm_amdgpu_ctx {#define AMDGPU_USERQ_QUERY_STATUS_FLAGS_HUNG (1 << 0)/* indicate vram lost since queue was created */ #define AMDGPU_USERQ_QUERY_STATUS_FLAGS_VRAMLOST (1 << 1) - +/* the invalid userq VA unmapped */ +#define AMDGPU_USERQ_QUERY_STATUS_FLAGS_INVALID_VA (1 << 2)/* * This structure is a container to pass input configuration * info for all supported userqueue related operations.
Signature · 1 line
2.34.1
PATCH 4/5 drm/amdgpu: extend UAPI for reporting userq invalid VA
In reply to Prike LiangAdd UAPI new definition for reporting userq invalid virtual address status to user space.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +2 -0
@@ -835,6 +835,8 @@ amdgpu_userq_query_status(struct drm_file *filp, union drm_amdgpu_userq *args) args->out_qs.flags |=AMDGPU_USERQ_QUERY_STATUS_FLAGS_HUNG ;if (queue->generation !=amdgpu_vm_generation (adev, &fpriv->vm)) args->out_qs.flags |=AMDGPU_USERQ_QUERY_STATUS_FLAGS_VRAMLOST ; +if (queue->state ==AMDGPU_USERQ_STATE_INVALID_VA ) + args->out_qs.flags |=AMDGPU_USERQ_QUERY_STATUS_FLAGS_INVALID_VA ;amdgpu_userq_put (queue);mutex_unlock (&uq_mgr->userq_mutex);
Signature · 1 line
2.34.1
PATCH 5/5 drm/amdgpu: mark queue and process as guilty on resetting userq fault
In reply to Prike LiangWhen a queue encounters a reset error and fallback to device reset, mark both the queue and its owning process as guilty so that userspace is notified that the offending queue is no longer usable and should recreate the context before resubmitting work.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 4 +++- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 24 ++++++++++++++++++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.h | 5 ++++- 3 files changed, 28 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +3 -1
@@ -589,7 +589,9 @@ static int amdgpu_ctx_query2(struct amdgpu_device *adev,if (ctx->generation !=amdgpu_vm_generation (adev, &fpriv->vm)) out->state.flags |=AMDGPU_CTX_QUERY2_FLAGS_VRAMLOST ; -if (amdgpu_ctx_guilty (ctx)) +if (amdgpu_ctx_guilty (ctx) || + ((out->state.flags &AMDGPU_CTX_QUERY2_FLAGS_RESET ) && + fpriv->userq_mgr.guilty)) out->state.flags |=AMDGPU_CTX_QUERY2_FLAGS_GUILTY ;if (amdgpu_in_reset (adev))
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +21 -3
@@ -173,8 +173,12 @@ static void amdgpu_userq_hang_detect_work(struct work_struct *work)* Don't schedule the work here! Scheduling or queue work from one reset * handler to another is illegal if you don't take extra precautions! */ -if (gpu_reset) +if (gpu_reset) { +/* Block re-map until userspace recreates the queue. */ + queue->guilty = true; + queue->userq_mgr->guilty = true;amdgpu_userq_mgr_reset_work (&queue->userq_mgr->reset_work); + } }/*
@@ -389,8 +393,17 @@ static int amdgpu_userq_map_helper(struct amdgpu_usermode_queue *queue)int r;if (queue->state ==AMDGPU_USERQ_STATE_UNMAPPED ) { -trace_amdgpu_userq_state_start (queue); +if (queue->guilty) { +/* +* A queue that was reset for hanging must not be +* re-mapped: replaying its command stream faults +* again. Leave it unmapped for userspace to recreate. +*/ +return 0 ; + } + +trace_amdgpu_userq_state_start (queue); r = userq_funcs->map (queue);if (r) {trace_amdgpu_userq_state_changed (queue,AMDGPU_USERQ_STATE_HUNG );
@@ -833,7 +846,8 @@ amdgpu_userq_query_status(struct drm_file *filp, union drm_amdgpu_userq *args) args->out_qs.flags =0 ;if (queue->state ==AMDGPU_USERQ_STATE_HUNG ) args->out_qs.flags |=AMDGPU_USERQ_QUERY_STATUS_FLAGS_HUNG ; -if (queue->generation !=amdgpu_vm_generation (adev, &fpriv->vm)) +if (queue->generation !=amdgpu_vm_generation (adev, &fpriv->vm) || + fpriv->userq_mgr.guilty) args->out_qs.flags |=AMDGPU_USERQ_QUERY_STATUS_FLAGS_VRAMLOST ;if (queue->state ==AMDGPU_USERQ_STATE_INVALID_VA ) args->out_qs.flags |=AMDGPU_USERQ_QUERY_STATUS_FLAGS_INVALID_VA ;
@@ -1594,6 +1608,10 @@ int amdgpu_userq_post_reset(struct amdgpu_device *adev, bool vram_lost)int ret =0 , r;xa_for_each (&adev->userq_doorbell_xa, queue_id, queue) { +/* Guilty queues are not restored; userspace recreates them. */ +if (queue->guilty) +continue ; +if (queue->state ==AMDGPU_USERQ_STATE_HUNG && !vram_lost) {trace_amdgpu_userq_state_start (queue);
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.h +4 -1
@@ -51,6 +51,8 @@ struct amdgpu_userq_obj {struct amdgpu_usermode_queue {int queue_type;enum amdgpu_userq_state state; +/* Reset due to a hang; must not be re-mapped, userspace recreates. */ +bool guilty;uint64_t doorbell_handle;uint64_t doorbell_index;u32 doorbell_offset;
@@ -132,7 +134,8 @@ struct amdgpu_userq_mgr {struct drm_file *file;struct mutex proc_ctx_lock;struct amdgpu_userq_obj proc_ctx_obj; - +/* Set when any queue owned by this process is reset guilty */ +bool guilty;bool proc_ctx_allocated;uint32_t proc_ctx_array_index;/**
Signature · 1 line
2.34.1
Christian König
maintainerRe: [PATCH 5/5] drm/amdgpu: mark queue and process as guilty on resetting userq fault
Quoted 32 lines · Prike Liang
When a queue encounters a reset error and fallback to device reset, mark both the queue and its owning process as guilty so that userspace is notified that the offending queue is no longer usable and should recreate the context before resubmitting work.
Signed-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 4 +++- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 24 ++++++++++++++++++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.h | 5 ++++- 3 files changed, 28 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +3
-1@@ -589,7 +589,9 @@ static int amdgpu_ctx_query2(struct amdgpu_device *adev,if (ctx->generation !=amdgpu_vm_generation (adev, &fpriv->vm)) out->state.flags |=AMDGPU_CTX_QUERY2_FLAGS_VRAMLOST ; -if (amdgpu_ctx_guilty (ctx)) +if (amdgpu_ctx_guilty (ctx) || + ((out->state.flags &AMDGPU_CTX_QUERY2_FLAGS_RESET ) && + fpriv->userq_mgr.guilty)) out->state.flags |=AMDGPU_CTX_QUERY2_FLAGS_GUILTY ;if (amdgpu_in_reset (adev))drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c static void amdgpu_userq_hang_detect_work(struct work_struct *work) · line 179
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +4
-1@@ -173,8 +173,12 @@ static void amdgpu_userq_hang_detect_work(struct work_struct *work)* Don't schedule the work here! Scheduling or queue work from one reset * handler to another is illegal if you don't take extra precautions! */ -if (gpu_reset) +if (gpu_reset) { +/* Block re-map until userspace recreates the queue. */ + queue->guilty = true; + queue->userq_mgr->guilty = true;
Clear NAK to having a global guilty flag in the userq_mgr. Each queue should be handled completely separated.
The only case where that makes sense would be gang submitted queues, but we haven't implemented those.
Regards,
Christian.
Quoted 68 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +17
-2amdgpu_userq_mgr_reset_work (&queue->userq_mgr->reset_work); + } }/* @@ -389,8 +393,17 @@ static int amdgpu_userq_map_helper(struct amdgpu_usermode_queue *queue)int r;if (queue->state ==AMDGPU_USERQ_STATE_UNMAPPED ) { -trace_amdgpu_userq_state_start (queue); +if (queue->guilty) { +/* +* A queue that was reset for hanging must not be +* re-mapped: replaying its command stream faults +* again. Leave it unmapped for userspace to recreate. +*/ +return 0 ; + } + +trace_amdgpu_userq_state_start (queue); r = userq_funcs->map (queue);if (r) {trace_amdgpu_userq_state_changed (queue,AMDGPU_USERQ_STATE_HUNG );@@ -833,7 +846,8 @@ amdgpu_userq_query_status(struct drm_file *filp, union drm_amdgpu_userq *args) args->out_qs.flags =0 ;if (queue->state ==AMDGPU_USERQ_STATE_HUNG ) args->out_qs.flags |=AMDGPU_USERQ_QUERY_STATUS_FLAGS_HUNG ; -if (queue->generation !=amdgpu_vm_generation (adev, &fpriv->vm)) +if (queue->generation !=amdgpu_vm_generation (adev, &fpriv->vm) || + fpriv->userq_mgr.guilty) args->out_qs.flags |=AMDGPU_USERQ_QUERY_STATUS_FLAGS_VRAMLOST ;if (queue->state ==AMDGPU_USERQ_STATE_INVALID_VA ) args->out_qs.flags |=AMDGPU_USERQ_QUERY_STATUS_FLAGS_INVALID_VA ;@@ -1594,6 +1608,10 @@ int amdgpu_userq_post_reset(struct amdgpu_device *adev, bool vram_lost)int ret =0 , r;xa_for_each (&adev->userq_doorbell_xa, queue_id, queue) { +/* Guilty queues are not restored; userspace recreates them. */ +if (queue->guilty) +continue ; +if (queue->state ==AMDGPU_USERQ_STATE_HUNG && !vram_lost) {trace_amdgpu_userq_state_start (queue);drivers/gpu/drm/amd/amdgpu/amdgpu_userq.h +4
-1@@ -51,6 +51,8 @@ struct amdgpu_userq_obj {struct amdgpu_usermode_queue {int queue_type;enum amdgpu_userq_state state; +/* Reset due to a hang; must not be re-mapped, userspace recreates. */ +bool guilty;uint64_t doorbell_handle;uint64_t doorbell_index;u32 doorbell_offset;@@ -132,7 +134,8 @@ struct amdgpu_userq_mgr {struct drm_file *file;struct mutex proc_ctx_lock;struct amdgpu_userq_obj proc_ctx_obj; - +/* Set when any queue owned by this process is reset guilty */ +bool guilty;bool proc_ctx_allocated;uint32_t proc_ctx_array_index;/**
RE: [PATCH 5/5] drm/amdgpu: mark queue and process as guilty on resetting userq fault
AMD General
Regards,
Prike
Quoted 56 lines
-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Friday, September 11, 2026 5:45 PM
To: Liang, Prike <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Pelloux-Prayer, Pierre- Eric <[email protected]>
Subject: Re: [PATCH 5/5] drm/amdgpu: mark queue and process as guilty on resetting userq faultdrivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c static int amdgpu_ctx_query2(struct amdgpu_device
Quoted 19 lines · Prike Liang
When a queue encounters a reset error and fallback to device reset, mark both the queue and its owning process as guilty so that userspace is notified that the offending queue is no longer usable and should recreate the context before resubmitting work.
Signed-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 4 +++- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 24 ++++++++++++++++++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.h | 5 ++++- 3 files changed, 28 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +0
-0@@ -589,7 +589,9 @@ static int amdgpu_ctx_query2(struct amdgpu_device*adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c static void amdgpu_userq_hang_detect_work(struct
Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +3
-1if (ctx->generation !=amdgpu_vm_generation (adev, &fpriv->vm)) out->state.flags |=AMDGPU_CTX_QUERY2_FLAGS_VRAMLOST ; -if (amdgpu_ctx_guilty (ctx)) +if (amdgpu_ctx_guilty (ctx) || + ((out->state.flags &AMDGPU_CTX_QUERY2_FLAGS_RESET ) && + fpriv->userq_mgr.guilty)) out->state.flags |=AMDGPU_CTX_QUERY2_FLAGS_GUILTY ;if (amdgpu_in_reset (adev))drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +0
-0@@ -173,8 +173,12 @@ static void amdgpu_userq_hang_detect_work(struct
work_struct*work)drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c static void amdgpu_userq_hang_detect_work(struct work_struct *work) · line 179
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +4
-1* Don't schedule the work here! Scheduling or queue work from one reset * handler to another is illegal if you don't take extra precautions! */ -if (gpu_reset) +if (gpu_reset) { +/* Block re-map until userspace recreates the queue. */ + queue->guilty = true; + queue->userq_mgr->guilty = true;
Quoted 2 lines
Clear NAK to having a global guilty flag in the
userq_mgr. Each queue should be handled completely separated.
Yes, if a hung user queue can be successfully recovered via per-queue reset, the kernel should handle each affected user queue independently and resume normal execution.
But, if the guilty user queue cannot be recovered through per-queue reset, the driver will fall back to a device-level reset (i.e., Mode-1 reset). In this case, all user queue contexts will be lost, and this patch is to mark the guilty queue's process accordingly and report the fault to user space so it can recreate and resubmit the affected user queues for the context lost cases.
Thanks,
Prike
Quoted 83 lines
The only case where that makes sense would be gang submitted queues, but we haven't implemented those.
Regards,
Christian.drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c static int amdgpu_userq_map_helper(struct
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +1
-0amdgpu_userq_mgr_reset_work (&queue->userq_mgr->reset_work); + } }/* @@ -389,8 +393,17 @@ static int amdgpu_userq_map_helper(struct
amdgpu_usermode_queue*queue)Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +3
-1int r;if (queue->state ==AMDGPU_USERQ_STATE_UNMAPPED ) { -trace_amdgpu_userq_state_start (queue); +if (queue->guilty) { +/* +* A queue that was reset for hanging must not be drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c static int amdgpu_userq_map_helper(struct amdgpu_usermode_queue *queue)
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +7
-0+* re-mapped: replaying its command stream faults +* again. Leave it unmapped for userspace to recreate. +*/ +return 0 ; + } + +trace_amdgpu_userq_state_start (queue); r = userq_funcs->map (queue);if (r) { trace_amdgpu_userq_state_changed(queue,
AMDGPU_USERQ_STATE_HUNG);drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c amdgpu_userq_query_status(struct drm_file *filp, union
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +0
-0@@ -833,7 +846,8 @@ amdgpu_userq_query_status(struct drm_file *filp, union
drm_amdgpu_userq*args)drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c amdgpu_userq_query_status(struct drm_file *filp, union drm_amdgpu_userq *args)
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +0
-0args->out_qs.flags =0 ;if (queue->state ==AMDGPU_USERQ_STATE_HUNG ) args->out_qs.flags |=
AMDGPU_USERQ_QUERY_STATUS_FLAGS_HUNG;drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c amdgpu_userq_query_status(struct drm_file *filp, union drm_amdgpu_userq *args)
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +2
-1-if (queue->generation !=amdgpu_vm_generation (adev, &fpriv->vm)) +if (queue->generation !=amdgpu_vm_generation (adev, &fpriv->vm) || + fpriv->userq_mgr.guilty) args->out_qs.flags |=
AMDGPU_USERQ_QUERY_STATUS_FLAGS_VRAMLOST;drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c amdgpu_userq_query_status(struct drm_file *filp, union · line 853
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +0
-0if (queue->state ==AMDGPU_USERQ_STATE_INVALID_VA ) args->out_qs.flags |=
AMDGPU_USERQ_QUERY_STATUS_FLAGS_INVALID_VA;drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c int amdgpu_userq_post_reset(struct amdgpu_device
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +0
-0@@ -1594,6 +1608,10 @@ int amdgpu_userq_post_reset(struct amdgpu_device*adev, bool
vram_lost)drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c int amdgpu_userq_post_reset(struct amdgpu_device *adev, bool vram_lost)
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +4
-0int ret =0 , r;xa_for_each (&adev->userq_doorbell_xa, queue_id, queue) { +/* Guilty queues are not restored; userspace recreates them. */ +if (queue->guilty) +continue ; + if (queue->state == AMDGPU_USERQ_STATE_HUNG&& !vram_lost) {
Quoted 26 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +0
-0trace_amdgpu_userq_state_start (queue);drivers/gpu/drm/amd/amdgpu/amdgpu_userq.h +4
-1@@ -51,6 +51,8 @@ struct amdgpu_userq_obj { struct amdgpu_usermode_queue {int queue_type;enum amdgpu_userq_state state; +/* Reset due to a hang; must not be re-mapped, userspace recreates. */ +bool guilty;uint64_t doorbell_handle;uint64_t doorbell_index;u32 doorbell_offset;@@ -132,7 +134,8 @@ struct amdgpu_userq_mgr {struct drm_file *file;struct mutex proc_ctx_lock;struct amdgpu_userq_obj proc_ctx_obj; - +/* Set when any queue owned by this process is reset guilty */ +bool guilty;bool proc_ctx_allocated;uint32_t proc_ctx_array_index;/**