drm/amdgpu: fix job priority handling

Submitted by Zhou, David(ChunMing) on July 19, 2018, 2:08 a.m.

Details

Message ID BY1PR12MB05024007737495912767622CB4520@BY1PR12MB0502.namprd12.prod.outlook.com
State New
Headers show
Series "drm/amdgpu: fix job priority handling" ( rev: 2 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Zhou, David(ChunMing) July 19, 2018, 2:08 a.m.
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>


-----Original Message-----
From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf Of Christian K?nig

Sent: Thursday, July 19, 2018 2:15 AM
To: amd-gfx@lists.freedesktop.org
Subject: [PATCH] drm/amdgpu: fix job priority handling

The job might already be released at this point.

Signed-off-by: Christian K├Ânig <christian.koenig@amd.com>

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c  | 4 +++-  drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

 	*f = dma_fence_get(&job->base.s_fence->finished);
 	amdgpu_job_free_resources(job);
+	priority = job->base.s_priority;
 	drm_sched_entity_push_job(&job->base, entity);
 
 	ring = to_amdgpu_ring(entity->sched);
-	amdgpu_ring_priority_get(ring, job->base.s_priority);
+	amdgpu_ring_priority_get(ring, priority);
 
 	return 0;
 }
--
2.14.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 911c4a12a163..7c5cc33d0cda 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -1209,6 +1209,7 @@  static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,  {
 	struct amdgpu_ring *ring = p->ring;
 	struct drm_sched_entity *entity = &p->ctx->rings[ring->idx].entity;
+	enum drm_sched_priority priority;
 	struct amdgpu_job *job;
 	unsigned i;
 	uint64_t seq;
@@ -1258,10 +1259,11 @@  static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,
 	amdgpu_job_free_resources(job);
 
 	trace_amdgpu_cs_ioctl(job);
+	priority = job->base.s_priority;
 	drm_sched_entity_push_job(&job->base, entity);
 
 	ring = to_amdgpu_ring(entity->sched);
-	amdgpu_ring_priority_get(ring, job->base.s_priority);
+	amdgpu_ring_priority_get(ring, priority);
 
 	ttm_eu_fence_buffer_objects(&p->ticket, &p->validated, p->fence);
 	amdgpu_mn_unlock(p->mn);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
index 8b679c85d213..5a2c26a85984 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
@@ -126,6 +126,7 @@  void amdgpu_job_free(struct amdgpu_job *job)  int amdgpu_job_submit(struct amdgpu_job *job, struct drm_sched_entity *entity,
 		      void *owner, struct dma_fence **f)  {
+	enum drm_sched_priority priority;
 	struct amdgpu_ring *ring;
 	int r;
 
@@ -139,10 +140,11 @@  int amdgpu_job_submit(struct amdgpu_job *job, struct drm_sched_entity *entity,
 	job->owner = owner;