Skip to contentSkip to conversation

drm/i915/gen9: fix error path in intel_init_workaround_bb

PATCH In review Imre Deak 4 participants 10 messages Jun 23, 2015

Subsystems (2)
lore
Share & tools
lore

Imre Deak

author
#0 lore raw

PATCH 1/1 drm/i915/gen9: fix error path in intel_init_workaround_bb

On the GEN!=8 error path we call kmap_atomic() which returns in atomic context and then lrc_destroy_wa_ctx_obj() which can be called only in process context. Fix this by preserving the correct cleanup order on this error path.

Also convert the WARN to DRM_ERROR the stack trace isn't really useful.

---
 drivers/gpu/drm/i915/intel_lrc.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +7 -3
index 1b50dd7..8bff1a2 100644
@@ -1289,10 +1289,14 @@ static int intel_init_workaround_bb(struct intel_engine_cs *ring)
 		if (ret)
 			goto out;
 	} else {
-		WARN(INTEL_INFO(ring->dev)->gen >= 8,
-		     "WA batch buffer is not initialized for Gen%d\n",
-		     INTEL_INFO(ring->dev)->gen);
+		if (INTEL_INFO(ring->dev)->gen >= 8)
+			DRM_ERROR("WA batch buffer is not initialized for Gen%d\n",
+				  INTEL_INFO(ring->dev)->gen);
+
+		kunmap_atomic(batch);
 		lrc_destroy_wa_ctx_obj(ring);
+
+		return 0;
 	}
 
 out:
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 17 lines · Imre Deak

On the GEN!=8 error path we call kmap_atomic() which returns in atomic context and then lrc_destroy_wa_ctx_obj() which can be called only in process context. Fix this by preserving the correct cleanup order on this error path.

Also convert the WARN to DRM_ERROR the stack trace isn't really useful.

---
 drivers/gpu/drm/i915/intel_lrc.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +0 -0
index 1b50dd7..8bff1a2 100644

drivers/gpu/drm/i915/intel_lrc.c static int intel_init_workaround_bb(struct intel_engine_cs *ring) · line 1295

Quoted 10 lines
drivers/gpu/drm/i915/intel_lrc.c +4 -3
@@ -1289,10 +1289,14 @@ static int intel_init_workaround_bb(struct intel_engine_cs *ring)
 		if (ret)
 			goto out;
 	} else {
-		WARN(INTEL_INFO(ring->dev)->gen >= 8,
-		     "WA batch buffer is not initialized for Gen%d\n",
-		     INTEL_INFO(ring->dev)->gen);
+		if (INTEL_INFO(ring->dev)->gen >= 8)
+			DRM_ERROR("WA batch buffer is not initialized for Gen%d\n",
+				  INTEL_INFO(ring->dev)->gen);
+

Do this test upfront, then we don't have multiple error paths.
http://paste.debian.net/255769
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#2 lore raw
Quoted 23 lines · Chris Wilson
Quoted 22 lines · Imre Deak

On the GEN!=8 error path we call kmap_atomic() which returns in atomic context and then lrc_destroy_wa_ctx_obj() which can be called only in process context. Fix this by preserving the correct cleanup order on this error path.

Also convert the WARN to DRM_ERROR the stack trace isn't really useful.

---
 drivers/gpu/drm/i915/intel_lrc.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +0 -2
index 1b50dd7..8bff1a2 100644
@@ -1289,10 +1289,14 @@ static int intel_init_workaround_bb(struct intel_engine_cs *ring)
 		if (ret)
 			goto out;
 	} else {
-		WARN(INTEL_INFO(ring->dev)->gen >= 8,
-		     "WA batch buffer is not initialized for Gen%d\n",
Quoted 8 lines

drivers/gpu/drm/i915/intel_lrc.c static int intel_init_workaround_bb(struct intel_engine_cs *ring) · line 1295

Quoted 5 lines
drivers/gpu/drm/i915/intel_lrc.c +4 -1
-		     INTEL_INFO(ring->dev)->gen);
+		if (INTEL_INFO(ring->dev)->gen >= 8)
+			DRM_ERROR("WA batch buffer is not initialized for Gen%d\n",
+				  INTEL_INFO(ring->dev)->gen);
+

Do this test upfront, then we don't have multiple error paths.
http://paste.debian.net/255769

I didn't bother moving it, I suppose GEN9 support will be added soon anyway and we get a bit more test coverage on GEN9 meanwhile. But if you insist I can move it.

Quoted 2 lines

-Chris

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
Quoted 33 lines · Imre Deak
Quoted 23 lines · Chris Wilson
Quoted 22 lines · Imre Deak

On the GEN!=8 error path we call kmap_atomic() which returns in atomic context and then lrc_destroy_wa_ctx_obj() which can be called only in process context. Fix this by preserving the correct cleanup order on this error path.

Also convert the WARN to DRM_ERROR the stack trace isn't really useful.

---
  drivers/gpu/drm/i915/intel_lrc.c | 10 +++++++---
  1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +0 -2
index 1b50dd7..8bff1a2 100644
@@ -1289,10 +1289,14 @@ static int intel_init_workaround_bb(struct intel_engine_cs *ring)
  		if (ret)
  			goto out;
  	} else {
-		WARN(INTEL_INFO(ring->dev)->gen >= 8,
-		     "WA batch buffer is not initialized for Gen%d\n",
Quoted 8 lines

drivers/gpu/drm/i915/intel_lrc.c static int intel_init_workaround_bb(struct intel_engine_cs *ring) · line 1295

Quoted 5 lines
drivers/gpu/drm/i915/intel_lrc.c +4 -1
-		     INTEL_INFO(ring->dev)->gen);
+		if (INTEL_INFO(ring->dev)->gen >= 8)
+			DRM_ERROR("WA batch buffer is not initialized for Gen%d\n",
+				  INTEL_INFO(ring->dev)->gen);
+

Do this test upfront, then we don't have multiple error paths.
http://paste.debian.net/255769

Quoted 3 lines

I didn't bother moving it, I suppose GEN9 support will be added soon anyway and we get a bit more test coverage on GEN9 meanwhile. But if you insist I can move it.

Hi Imre,

I sent the following patch with the changes suggested by Chris.
https://patchwork.kernel.org/patch/6661891/
Since you sent it first, my patch can be ignored if your patch is updated.

regards
Arun

Quoted 10 lines
Quoted 3 lines

-Chris

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

author
#4 lore raw
Quoted 38 lines · Arun
Quoted 33 lines · Imre Deak
Quoted 23 lines · Chris Wilson
Quoted 22 lines · Imre Deak

On the GEN!=8 error path we call kmap_atomic() which returns in atomic context and then lrc_destroy_wa_ctx_obj() which can be called only in process context. Fix this by preserving the correct cleanup order on this error path.

Also convert the WARN to DRM_ERROR the stack trace isn't really useful.

---
  drivers/gpu/drm/i915/intel_lrc.c | 10 +++++++---
  1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +0 -2
index 1b50dd7..8bff1a2 100644
@@ -1289,10 +1289,14 @@ static int intel_init_workaround_bb(struct intel_engine_cs *ring)
  		if (ret)
  			goto out;
  	} else {
-		WARN(INTEL_INFO(ring->dev)->gen >= 8,
-		     "WA batch buffer is not initialized for Gen%d\n",
Quoted 8 lines

drivers/gpu/drm/i915/intel_lrc.c static int intel_init_workaround_bb(struct intel_engine_cs *ring) · line 1295

Quoted 5 lines
drivers/gpu/drm/i915/intel_lrc.c +4 -1
-		     INTEL_INFO(ring->dev)->gen);
+		if (INTEL_INFO(ring->dev)->gen >= 8)
+			DRM_ERROR("WA batch buffer is not initialized for Gen%d\n",
+				  INTEL_INFO(ring->dev)->gen);
+

Do this test upfront, then we don't have multiple error paths.
http://paste.debian.net/255769

Quoted 3 lines

I didn't bother moving it, I suppose GEN9 support will be added soon anyway and we get a bit more test coverage on GEN9 meanwhile. But if you insist I can move it.

Quoted 5 lines

Hi Imre,

I sent the following patch with the changes suggested by Chris.
https://patchwork.kernel.org/patch/6661891/
Since you sent it first, my patch can be ignored if your patch is updated.

I'm fine applying your patch, but I would ask to convert the WARN to DRM_ERROR. The stack trace doesn't add much to the error message and the WARN is needlessly verbose now on BXT,SKL..

--Imre

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw
Quoted 41 lines · Imre Deak
Quoted 40 lines · Arun
Quoted 33 lines · Imre Deak
Quoted 23 lines · Chris Wilson
Quoted 22 lines · Imre Deak

On the GEN!=8 error path we call kmap_atomic() which returns in atomic context and then lrc_destroy_wa_ctx_obj() which can be called only in process context. Fix this by preserving the correct cleanup order on this error path.

Also convert the WARN to DRM_ERROR the stack trace isn't really useful.

---
  drivers/gpu/drm/i915/intel_lrc.c | 10 +++++++---
  1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +0 -2
index 1b50dd7..8bff1a2 100644
@@ -1289,10 +1289,14 @@ static int intel_init_workaround_bb(struct intel_engine_cs *ring)
  		if (ret)
  			goto out;
  	} else {
-		WARN(INTEL_INFO(ring->dev)->gen >= 8,
-		     "WA batch buffer is not initialized for Gen%d\n",
Quoted 8 lines

drivers/gpu/drm/i915/intel_lrc.c static int intel_init_workaround_bb(struct intel_engine_cs *ring) · line 1295

Quoted 5 lines
drivers/gpu/drm/i915/intel_lrc.c +4 -1
-		     INTEL_INFO(ring->dev)->gen);
+		if (INTEL_INFO(ring->dev)->gen >= 8)
+			DRM_ERROR("WA batch buffer is not initialized for Gen%d\n",
+				  INTEL_INFO(ring->dev)->gen);
+

Do this test upfront, then we don't have multiple error paths.
http://paste.debian.net/255769

Quoted 3 lines

I didn't bother moving it, I suppose GEN9 support will be added soon anyway and we get a bit more test coverage on GEN9 meanwhile. But if you insist I can move it.

Hi Imre,

Quoted 7 lines
Quoted 3 lines

I sent the following patch with the changes suggested by Chris.
https://patchwork.kernel.org/patch/6661891/
Since you sent it first, my patch can be ignored if your patch is updated.

I'm fine applying your patch, but I would ask to convert the WARN to DRM_ERROR. The stack trace doesn't add much to the error message and the WARN is needlessly verbose now on BXT,SKL..

I presumed Arun choose WARN because we are missing w/a and wanted someone to step forward and prove the fixes?
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#6 lore raw
Quoted 46 lines · Chris Wilson
Quoted 45 lines · Imre Deak
Quoted 43 lines · Arun
Quoted 33 lines · Imre Deak
Quoted 23 lines · Chris Wilson
Quoted 22 lines · Imre Deak

On the GEN!=8 error path we call kmap_atomic() which returns in atomic context and then lrc_destroy_wa_ctx_obj() which can be called only in process context. Fix this by preserving the correct cleanup order on this error path.

Also convert the WARN to DRM_ERROR the stack trace isn't really useful.

---
  drivers/gpu/drm/i915/intel_lrc.c | 10 +++++++---
  1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +0 -2
index 1b50dd7..8bff1a2 100644
@@ -1289,10 +1289,14 @@ static int intel_init_workaround_bb(struct intel_engine_cs *ring)
  		if (ret)
  			goto out;
  	} else {
-		WARN(INTEL_INFO(ring->dev)->gen >= 8,
-		     "WA batch buffer is not initialized for Gen%d\n",
Quoted 8 lines

drivers/gpu/drm/i915/intel_lrc.c static int intel_init_workaround_bb(struct intel_engine_cs *ring) · line 1295

Quoted 5 lines
drivers/gpu/drm/i915/intel_lrc.c +4 -1
-		     INTEL_INFO(ring->dev)->gen);
+		if (INTEL_INFO(ring->dev)->gen >= 8)
+			DRM_ERROR("WA batch buffer is not initialized for Gen%d\n",
+				  INTEL_INFO(ring->dev)->gen);
+

Do this test upfront, then we don't have multiple error paths.
http://paste.debian.net/255769

Quoted 3 lines

I didn't bother moving it, I suppose GEN9 support will be added soon anyway and we get a bit more test coverage on GEN9 meanwhile. But if you insist I can move it.

Hi Imre,

I sent the following patch with the changes suggested by Chris.
https://patchwork.kernel.org/patch/6661891/
Since you sent it first, my patch can be ignored if your patch is updated.

Quoted 6 lines
Quoted 3 lines

I'm fine applying your patch, but I would ask to convert the WARN to DRM_ERROR. The stack trace doesn't add much to the error message and the WARN is needlessly verbose now on BXT,SKL..

I presumed Arun choose WARN because we are missing w/a and wanted someone to step forward and prove the fixes?

Imo it's unnecessarily verbose, during development when loading the driver I know that things are mostly ok if I can't see any such backtraces. But no strong opinion, I can also change this locally.

--Imre

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw
Quoted 51 lines · Imre Deak
Quoted 50 lines · Chris Wilson
Quoted 48 lines · Imre Deak
Quoted 38 lines · Arun
Quoted 33 lines · Imre Deak
Quoted 23 lines · Chris Wilson
Quoted 22 lines · Imre Deak

On the GEN!=8 error path we call kmap_atomic() which returns in atomic context and then lrc_destroy_wa_ctx_obj() which can be called only in process context. Fix this by preserving the correct cleanup order on this error path.

Also convert the WARN to DRM_ERROR the stack trace isn't really useful.

---
  drivers/gpu/drm/i915/intel_lrc.c | 10 +++++++---
  1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +0 -2
index 1b50dd7..8bff1a2 100644
@@ -1289,10 +1289,14 @@ static int intel_init_workaround_bb(struct intel_engine_cs *ring)
  		if (ret)
  			goto out;
  	} else {
-		WARN(INTEL_INFO(ring->dev)->gen >= 8,
-		     "WA batch buffer is not initialized for Gen%d\n",
Quoted 8 lines

drivers/gpu/drm/i915/intel_lrc.c static int intel_init_workaround_bb(struct intel_engine_cs *ring) · line 1295

Quoted 5 lines
drivers/gpu/drm/i915/intel_lrc.c +4 -1
-		     INTEL_INFO(ring->dev)->gen);
+		if (INTEL_INFO(ring->dev)->gen >= 8)
+			DRM_ERROR("WA batch buffer is not initialized for Gen%d\n",
+				  INTEL_INFO(ring->dev)->gen);
+

Do this test upfront, then we don't have multiple error paths.
http://paste.debian.net/255769

Quoted 3 lines

I didn't bother moving it, I suppose GEN9 support will be added soon anyway and we get a bit more test coverage on GEN9 meanwhile. But if you insist I can move it.

Quoted 5 lines

Hi Imre,

I sent the following patch with the changes suggested by Chris.
https://patchwork.kernel.org/patch/6661891/
Since you sent it first, my patch can be ignored if your patch is updated.

I'm fine applying your patch, but I would ask to convert the WARN to DRM_ERROR. The stack trace doesn't add much to the error message and the WARN is needlessly verbose now on BXT,SKL..

Quoted 6 lines
Quoted 2 lines

I presumed Arun choose WARN because we are missing w/a and wanted someone to step forward and prove the fixes?

Imo it's unnecessarily verbose, during development when loading the driver I know that things are mostly ok if I can't see any such backtraces. But no strong opinion, I can also change this locally.

An alternative would be to provide the stub wa_bb emission functions so that future wa need only start with a plain copy'n'paste. -Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw
Quoted 52 lines · Chris Wilson
Quoted 51 lines · Imre Deak
Quoted 50 lines · Chris Wilson
Quoted 48 lines · Imre Deak
Quoted 38 lines · Arun
Quoted 33 lines · Imre Deak
Quoted 23 lines · Chris Wilson
Quoted 22 lines · Imre Deak

On the GEN!=8 error path we call kmap_atomic() which returns in atomic context and then lrc_destroy_wa_ctx_obj() which can be called only in process context. Fix this by preserving the correct cleanup order on this error path.

Also convert the WARN to DRM_ERROR the stack trace isn't really useful.

---
   drivers/gpu/drm/i915/intel_lrc.c | 10 +++++++---
   1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +0 -2
index 1b50dd7..8bff1a2 100644
@@ -1289,10 +1289,14 @@ static int intel_init_workaround_bb(struct intel_engine_cs *ring)
   		if (ret)
   			goto out;
   	} else {
-		WARN(INTEL_INFO(ring->dev)->gen >= 8,
-		     "WA batch buffer is not initialized for Gen%d\n",
Quoted 8 lines

drivers/gpu/drm/i915/intel_lrc.c static int intel_init_workaround_bb(struct intel_engine_cs *ring) · line 1295

Quoted 5 lines
drivers/gpu/drm/i915/intel_lrc.c +4 -1
-		     INTEL_INFO(ring->dev)->gen);
+		if (INTEL_INFO(ring->dev)->gen >= 8)
+			DRM_ERROR("WA batch buffer is not initialized for Gen%d\n",
+				  INTEL_INFO(ring->dev)->gen);
+

Do this test upfront, then we don't have multiple error paths.
http://paste.debian.net/255769

Quoted 3 lines

I didn't bother moving it, I suppose GEN9 support will be added soon anyway and we get a bit more test coverage on GEN9 meanwhile. But if you insist I can move it.

Quoted 5 lines

Hi Imre,

I sent the following patch with the changes suggested by Chris.
https://patchwork.kernel.org/patch/6661891/
Since you sent it first, my patch can be ignored if your patch is updated.

I'm fine applying your patch, but I would ask to convert the WARN to DRM_ERROR. The stack trace doesn't add much to the error message and the WARN is needlessly verbose now on BXT,SKL..

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

I presumed Arun choose WARN because we are missing w/a and wanted someone to step forward and prove the fixes?

Imo it's unnecessarily verbose, during development when loading the driver I know that things are mostly ok if I can't see any such backtraces. But no strong opinion, I can also change this locally.

Error message can easily get lost and also it is not an error to not apply these WA which is why we also continue. I thought WARN will probably get more attention and help in adding missing WA quickly.

regards
Arun

Quoted 5 lines

An alternative would be to provide the stub wa_bb emission functions so that future wa need only start with a plain copy'n'paste. -Chris

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw
Quoted 56 lines · Arun
Quoted 55 lines · Chris Wilson
Quoted 54 lines · Imre Deak
Quoted 52 lines · Chris Wilson
Quoted 41 lines · Imre Deak
Quoted 40 lines · Arun
Quoted 33 lines · Imre Deak
Quoted 23 lines · Chris Wilson
Quoted 22 lines · Imre Deak

On the GEN!=8 error path we call kmap_atomic() which returns in atomic context and then lrc_destroy_wa_ctx_obj() which can be called only in process context. Fix this by preserving the correct cleanup order on this error path.

Also convert the WARN to DRM_ERROR the stack trace isn't really useful.

---
  drivers/gpu/drm/i915/intel_lrc.c | 10 +++++++---
  1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +0 -2
index 1b50dd7..8bff1a2 100644
@@ -1289,10 +1289,14 @@ static int intel_init_workaround_bb(struct intel_engine_cs *ring)
  		if (ret)
  			goto out;
  	} else {
-		WARN(INTEL_INFO(ring->dev)->gen >= 8,
-		     "WA batch buffer is not initialized for Gen%d\n",
Quoted 8 lines

drivers/gpu/drm/i915/intel_lrc.c static int intel_init_workaround_bb(struct intel_engine_cs *ring) · line 1295

Quoted 5 lines
drivers/gpu/drm/i915/intel_lrc.c +4 -1
-		     INTEL_INFO(ring->dev)->gen);
+		if (INTEL_INFO(ring->dev)->gen >= 8)
+			DRM_ERROR("WA batch buffer is not initialized for Gen%d\n",
+				  INTEL_INFO(ring->dev)->gen);
+

Do this test upfront, then we don't have multiple error paths.
http://paste.debian.net/255769

Quoted 3 lines

I didn't bother moving it, I suppose GEN9 support will be added soon anyway and we get a bit more test coverage on GEN9 meanwhile. But if you insist I can move it.

Hi Imre,

Quoted 7 lines
Quoted 3 lines

I sent the following patch with the changes suggested by Chris.
https://patchwork.kernel.org/patch/6661891/
Since you sent it first, my patch can be ignored if your patch is updated.

I'm fine applying your patch, but I would ask to convert the WARN to DRM_ERROR. The stack trace doesn't add much to the error message and the WARN is needlessly verbose now on BXT,SKL..

I presumed Arun choose WARN because we are missing w/a and wanted someone to step forward and prove the fixes?

Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

Imo it's unnecessarily verbose, during development when loading the driver I know that things are mostly ok if I can't see any such backtraces. But no strong opinion, I can also change this locally.

Error message can easily get lost and also it is not an error to not apply these WA which is why we also continue. I thought WARN will probably get more attention and help in adding missing WA quickly.

Friendly inquiry from your maintainer: Can we perhaps not bikeshed the benefits of DRM_ERROR vs. WARN_ON and just get this reviewed&merged?

From an igt/piglit pov both cause a test failure and so are equivalent. And I'm hopeful that the new QA team actually catches dmesg fallout reliable rsn.

Thanks, Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx