Commit 668ca1b4 authored by Monk Liu's avatar Monk Liu Committed by Alex Deucher

drm/amdgpu:don't change ctx->reset_couner upon query

reset_counter marks the reset counter number once the context
is created, shouldn't be changed due to query.

To keep U/K interface on the ctx_query and keep ctx's reset_counter
logic compatible with GPU RESET feature, now use another var named
"reset_counter_query" to replace the original checked & updated in
amdgpu_ctx_query.
Signed-off-by: default avatarMonk Liu <Monk.Liu@amd.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent a4176cb4
...@@ -735,6 +735,7 @@ struct amdgpu_ctx { ...@@ -735,6 +735,7 @@ struct amdgpu_ctx {
struct amdgpu_device *adev; struct amdgpu_device *adev;
struct amdgpu_queue_mgr queue_mgr; struct amdgpu_queue_mgr queue_mgr;
unsigned reset_counter; unsigned reset_counter;
unsigned reset_counter_query;
uint32_t vram_lost_counter; uint32_t vram_lost_counter;
spinlock_t ring_lock; spinlock_t ring_lock;
struct dma_fence **fences; struct dma_fence **fences;
......
...@@ -75,6 +75,7 @@ static int amdgpu_ctx_init(struct amdgpu_device *adev, ...@@ -75,6 +75,7 @@ static int amdgpu_ctx_init(struct amdgpu_device *adev,
} }
ctx->reset_counter = atomic_read(&adev->gpu_reset_counter); ctx->reset_counter = atomic_read(&adev->gpu_reset_counter);
ctx->reset_counter_query = ctx->reset_counter;
ctx->vram_lost_counter = atomic_read(&adev->vram_lost_counter); ctx->vram_lost_counter = atomic_read(&adev->vram_lost_counter);
ctx->init_priority = priority; ctx->init_priority = priority;
ctx->override_priority = AMD_SCHED_PRIORITY_UNSET; ctx->override_priority = AMD_SCHED_PRIORITY_UNSET;
...@@ -216,11 +217,11 @@ static int amdgpu_ctx_query(struct amdgpu_device *adev, ...@@ -216,11 +217,11 @@ static int amdgpu_ctx_query(struct amdgpu_device *adev,
/* determine if a GPU reset has occured since the last call */ /* determine if a GPU reset has occured since the last call */
reset_counter = atomic_read(&adev->gpu_reset_counter); reset_counter = atomic_read(&adev->gpu_reset_counter);
/* TODO: this should ideally return NO, GUILTY, or INNOCENT. */ /* TODO: this should ideally return NO, GUILTY, or INNOCENT. */
if (ctx->reset_counter == reset_counter) if (ctx->reset_counter_query == reset_counter)
out->state.reset_status = AMDGPU_CTX_NO_RESET; out->state.reset_status = AMDGPU_CTX_NO_RESET;
else else
out->state.reset_status = AMDGPU_CTX_UNKNOWN_RESET; out->state.reset_status = AMDGPU_CTX_UNKNOWN_RESET;
ctx->reset_counter = reset_counter; ctx->reset_counter_query = reset_counter;
mutex_unlock(&mgr->lock); mutex_unlock(&mgr->lock);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment