Skip to contentSkip to conversation

drm/amdgpu: don't oops on failure to load

PATCH In review Dave Airlie 4 participants 4 messages Nov 2, 2015 – Nov 3, 2015

Subsystems (2)
lore
Share & tools
lore

Dave Airlie

author maintainer
#0 lore raw

PATCH 1/1 drm/amdgpu: don't oops on failure to load

From: Dave Airlie <[email protected]>

In two places amdgpu tries to tear down something it hasn't initalised when failing. This is what happens when you enable experimental support on topaz which then fails in ring init.

This patch allows it to fail cleanly.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c       | 3 +++
 drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +3 -0
index e0b80cc..fec65f0 100644
@@ -69,6 +69,9 @@ void amdgpu_ctx_fini(struct amdgpu_ctx *ctx)
 	struct amdgpu_device *adev = ctx->adev;
 	unsigned i, j;
 
+	if (!adev)
+		return;
+
 	for (i = 0; i < AMDGPU_MAX_RINGS; ++i)
 		for (j = 0; j < AMDGPU_CTX_MAX_CS_PENDING; ++j)
 			fence_put(ctx->rings[i].fences[j]);
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +2 -1
index 7fa1d7a..d3b9eb7 100644
@@ -462,5 +462,6 @@ int amd_sched_init(struct amd_gpu_scheduler *sched,
  */
 void amd_sched_fini(struct amd_gpu_scheduler *sched)
 {
-	kthread_stop(sched->thread);
+	if (sched->thread)
+		kthread_stop(sched->thread);
 }
Signature · 6 lines
2.5.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

Thanks for catching. Reviewed-by: Chunming Zhou <[email protected]>

Regards,
David Zhou

Quoted 52 lines

-----Original Message-----
From: dri-devel [mailto:[email protected]] On Behalf Of Dave Airlie
Sent: Tuesday, November 03, 2015 7:35 AM
To: [email protected]
Subject: [PATCH] drm/amdgpu: don't oops on failure to load

From: Dave Airlie <[email protected]>

In two places amdgpu tries to tear down something it hasn't initalised when failing. This is what happens when you enable experimental support on topaz which then fails in ring init.

This patch allows it to fail cleanly.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c       | 3 +++
 drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +3 -0
index e0b80cc..fec65f0 100644
@@ -69,6 +69,9 @@ void amdgpu_ctx_fini(struct amdgpu_ctx *ctx)
 	struct amdgpu_device *adev = ctx->adev;
 	unsigned i, j;
 
+	if (!adev)
+		return;
+
 	for (i = 0; i < AMDGPU_MAX_RINGS; ++i)
 		for (j = 0; j < AMDGPU_CTX_MAX_CS_PENDING; ++j)
 			fence_put(ctx->rings[i].fences[j]);
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +2 -2
index 7fa1d7a..d3b9eb7 100644
@@ -462,5 +462,6 @@ int amd_sched_init(struct amd_gpu_scheduler
 *sched,
  */
 void amd_sched_fini(struct amd_gpu_scheduler *sched)  {
-	kthread_stop(sched->thread);
+	if (sched->thread)
+		kthread_stop(sched->thread);
 }
--

2.5.0

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw

We handle the scheduler and amdgpu as two different components (the scheduler could be used by other drivers as well). So would be nice to have two patches for this.

But that's only nice to have, either way patch is Reviewed-by: Christian König <[email protected]> as well.

Regards,
Christian.

Quoted 57 lines · David(ChunMing)

Thanks for catching. Reviewed-by: Chunming Zhou <[email protected]>

Regards,
David Zhou

Quoted 52 lines

-----Original Message-----
From: dri-devel [mailto:[email protected]] On Behalf Of Dave Airlie
Sent: Tuesday, November 03, 2015 7:35 AM
To: [email protected]
Subject: [PATCH] drm/amdgpu: don't oops on failure to load

From: Dave Airlie <[email protected]>

In two places amdgpu tries to tear down something it hasn't initalised when failing. This is what happens when you enable experimental support on topaz which then fails in ring init.

This patch allows it to fail cleanly.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c       | 3 +++
  drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 3 ++-
  2 files changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +3 -0
index e0b80cc..fec65f0 100644
@@ -69,6 +69,9 @@ void amdgpu_ctx_fini(struct amdgpu_ctx *ctx)
  	struct amdgpu_device *adev = ctx->adev;
  	unsigned i, j;
 
+	if (!adev)
+		return;
+
  	for (i = 0; i < AMDGPU_MAX_RINGS; ++i)
  		for (j = 0; j < AMDGPU_CTX_MAX_CS_PENDING; ++j)
  			fence_put(ctx->rings[i].fences[j]);
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +2 -2
index 7fa1d7a..d3b9eb7 100644
@@ -462,5 +462,6 @@ int amd_sched_init(struct amd_gpu_scheduler
 *sched,
   */
  void amd_sched_fini(struct amd_gpu_scheduler *sched)  {
-	kthread_stop(sched->thread);
+	if (sched->thread)
+		kthread_stop(sched->thread);
  }
--

2.5.0

Quoted 8 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
Quoted 6 lines · Christian König

We handle the scheduler and amdgpu as two different components (the scheduler could be used by other drivers as well). So would be nice to have two patches for this.

But that's only nice to have, either way patch is Reviewed-by: Christian König <[email protected]> as well.

Split into two patches and applied. Thanks!

Alex

Quoted 78 lines

Regards,
Christian.

Quoted 61 lines · David(ChunMing)

Thanks for catching. Reviewed-by: Chunming Zhou <[email protected]>

Regards,
David Zhou

Quoted 55 lines

-----Original Message-----
From: dri-devel [mailto:[email protected]] On Behalf
Of Dave Airlie
Sent: Tuesday, November 03, 2015 7:35 AM
To: [email protected]
Subject: [PATCH] drm/amdgpu: don't oops on failure to load

From: Dave Airlie <[email protected]>

In two places amdgpu tries to tear down something it hasn't initalised when
failing. This is what happens when you enable experimental support on topaz
which then fails in ring init.

This patch allows it to fail cleanly.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c       | 3 +++
  drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 3 ++-
  2 files changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +3 -0
index e0b80cc..fec65f0 100644
@@ -69,6 +69,9 @@ void amdgpu_ctx_fini(struct amdgpu_ctx *ctx)
        struct amdgpu_device *adev = ctx->adev;
        unsigned i, j;
 
+       if (!adev)
+               return;
+
        for (i = 0; i < AMDGPU_MAX_RINGS; ++i)
                for (j = 0; j < AMDGPU_CTX_MAX_CS_PENDING; ++j)
                        fence_put(ctx->rings[i].fences[j]);
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +2 -2
index 7fa1d7a..d3b9eb7 100644
@@ -462,5 +462,6 @@ int amd_sched_init(struct amd_gpu_scheduler
 *sched,
   */
  void amd_sched_fini(struct amd_gpu_scheduler *sched)  {
-       kthread_stop(sched->thread);
+       if (sched->thread)
+               kthread_stop(sched->thread);
  }
--

2.5.0

Quoted 9 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel