Skip to contentSkip to conversation

drm/i915: Fix GVT balloon fail path handling

PATCH In review Zhenyu Wang 3 participants 4 messages Jun 10, 2019 – Jun 11, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Fix GVT balloon fail path handling

For any reason if GVT balloon failed, deballoon would be called. This adds a simple mask to check validity of balloon spaces. When failure happens, that mask is used to track for deballoon, so it won't cause any invalid space reference in fail path, which fixed kernel oops when balloon error happened.

---
 drivers/gpu/drm/i915/i915_vgpu.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/i915_vgpu.c +15 -12
index 94d3992b599d..5aec34db1aaa 100644
@@ -94,6 +94,7 @@ struct _balloon_info_ {
 	 * graphic memory, 2/3 for unmappable graphic memory.
 	 */
 	struct drm_mm_node space[4];
+	u8 valid;
 };
 
 static struct _balloon_info_ bl_info;
@@ -126,8 +127,12 @@ void intel_vgt_deballoon(struct drm_i915_private *dev_priv)
 
 	DRM_DEBUG("VGT deballoon.\n");
 
-	for (i = 0; i < 4; i++)
-		vgt_deballoon_space(&dev_priv->ggtt, &bl_info.space[i]);
+	for (i = 0; i < 4; i++) {
+		if (bl_info.valid & BIT(i)) {
+			vgt_deballoon_space(&dev_priv->ggtt, &bl_info.space[i]);
+			bl_info.valid &= ~(u8)BIT(i);
+		}
+	}
 }
 
 static int vgt_balloon_space(struct i915_ggtt *ggtt,
@@ -232,16 +237,17 @@ int intel_vgt_balloon(struct drm_i915_private *dev_priv)
 	if (unmappable_base > ggtt->mappable_end) {
 		ret = vgt_balloon_space(ggtt, &bl_info.space[2],
 					ggtt->mappable_end, unmappable_base);
-
 		if (ret)
 			goto err;
+		bl_info.valid |= BIT(2);
 	}
 
 	if (unmappable_end < ggtt_end) {
 		ret = vgt_balloon_space(ggtt, &bl_info.space[3],
 					unmappable_end, ggtt_end);
 		if (ret)
-			goto err_upon_mappable;
+			goto err;
+		bl_info.valid |= BIT(3);
 	}
 
 	/* Mappable graphic memory ballooning */
@@ -250,7 +256,8 @@ int intel_vgt_balloon(struct drm_i915_private *dev_priv)
 					0, mappable_base);
 
 		if (ret)
-			goto err_upon_unmappable;
+			goto err;
+		bl_info.valid |= BIT(0);
 	}
 
 	if (mappable_end < ggtt->mappable_end) {
@@ -258,19 +265,15 @@ int intel_vgt_balloon(struct drm_i915_private *dev_priv)
 					mappable_end, ggtt->mappable_end);
 
 		if (ret)
-			goto err_below_mappable;
+			goto err;
+		bl_info.valid |= BIT(1);
 	}
 
 	DRM_INFO("VGT balloon successfully\n");
 	return 0;
 
-err_below_mappable:
-	vgt_deballoon_space(ggtt, &bl_info.space[0]);
-err_upon_unmappable:
-	vgt_deballoon_space(ggtt, &bl_info.space[3]);
-err_upon_mappable:
-	vgt_deballoon_space(ggtt, &bl_info.space[2]);
 err:
+	intel_vgt_deballoon(dev_priv);
 	DRM_ERROR("VGT balloon fail\n");
 	return ret;
 }
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

Quoting Zhenyu Wang (2019-06-10 10:28:19)

Quoted 5 lines

For any reason if GVT balloon failed, deballoon would be called. This adds a simple mask to check validity of balloon spaces. When failure happens, that mask is used to track for deballoon, so it won't cause any invalid space reference in fail path, which fixed kernel oops when balloon error happened.

Against the upstream, it uses an onion unwind. Only those nodes successfully reserved are removed.

Quoted 18 lines
---
 drivers/gpu/drm/i915/i915_vgpu.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/i915_vgpu.c +1 -0
index 94d3992b599d..5aec34db1aaa 100644
@@ -94,6 +94,7 @@ struct _balloon_info_ {
         * graphic memory, 2/3 for unmappable graphic memory.
         */
        struct drm_mm_node space[4];
+       u8 valid;
 };
 
 static struct _balloon_info_ bl_info;

drivers/gpu/drm/i915/i915_vgpu.c void intel_vgt_deballoon(struct drm_i915_private *dev_priv) · line 133

Quoted 9 lines
drivers/gpu/drm/i915/i915_vgpu.c +4 -2
@@ -126,8 +127,12 @@ void intel_vgt_deballoon(struct drm_i915_private *dev_priv)
 
        DRM_DEBUG("VGT deballoon.\n");
 
-       for (i = 0; i < 4; i++)
-               vgt_deballoon_space(&dev_priv->ggtt, &bl_info.space[i]);
+       for (i = 0; i < 4; i++) {
+               if (bl_info.valid & BIT(i)) {
+                       vgt_deballoon_space(&dev_priv->ggtt, &bl_info.space[i]);
+                       bl_info.valid &= ~(u8)BIT(i);

Is the problem that you are calling it twice? As far I can see we only call it from i915_ggtt_cleanup_hw... Oh, note that i915_gem_init_ggtt() fails to unwind correctly, and intel_vgt_deballoon is called from the wrong point.

Fwiw, you could just use

	if (!drm_mm_node_alloced(node))
		return;

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

#2 lore raw

✓ Fi.CI.BAT: success for drm/i915: Fix GVT balloon fail path handling

In reply to Zhenyu Wang
== Series Details ==

== Series Details ==

Series: drm/i915: Fix GVT balloon fail path handling
URL : https://patchwork.freedesktop.org/series/61830/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6225 -> Patchwork_13218
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13218/

Known issues
------------

Here are the changes found in Patchwork_13218 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_ctx_create@basic-files:
- fi-icl-dsi: [PASS][1] -> [INCOMPLETE][2] ([fdo#107713] / [fdo#109100])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6225/fi-icl-dsi/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13218/fi-icl-dsi/igt@[email protected]

* igt@gem_exec_create@basic:
- fi-icl-y: [PASS][3] -> [INCOMPLETE][4] ([fdo#107713])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6225/fi-icl-y/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13218/fi-icl-y/igt@[email protected]

#### Possible fixes ####

* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-7500u: [FAIL][5] ([fdo#109485]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6225/fi-kbl-7500u/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13218/fi-kbl-7500u/igt@[email protected]

* igt@kms_frontbuffer_tracking@basic:
- fi-hsw-peppy: [DMESG-WARN][7] ([fdo#102614]) -> [PASS][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6225/fi-hsw-peppy/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13218/fi-hsw-peppy/igt@[email protected]

[fdo#102614]: https://bugs.freedesktop.org/show_bug.cgi?id=102614
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#109100]: https://bugs.freedesktop.org/show_bug.cgi?id=109100
[fdo#109485]: https://bugs.freedesktop.org/show_bug.cgi?id=109485

Participating hosts (54 -> 45)
------------------------------

Missing (9): fi-kbl-soraka fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-apl-guc fi-byt-clapper fi-bdw-samus fi-cml-u

Build changes
-------------

* Linux: CI_DRM_6225 -> Patchwork_13218

CI_DRM_6225: 39bb7459567aada2e706e4da4a650dc4f7c41abf @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5049: db51cbba5a8f4856d6f56a61aa51fda6e239fa44 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_13218: 1479965541ec242e97d86a1f2e25755b2982dcbe @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

1479965541ec drm/i915: Fix GVT balloon fail path handling

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13218/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

✗ Fi.CI.IGT: failure for drm/i915: Fix GVT balloon fail path handling

In reply to Zhenyu Wang
== Series Details ==

== Series Details ==

Series: drm/i915: Fix GVT balloon fail path handling
URL : https://patchwork.freedesktop.org/series/61830/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_6225_full -> Patchwork_13218_full
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_13218_full absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_13218_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_13218_full:

### IGT changes ###

#### Possible regressions ####

* igt@i915_selftest@live_hangcheck:
- shard-kbl: [PASS][1] -> [DMESG-FAIL][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6225/shard-kbl2/igt@i915_selftest@live_hangcheck.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13218/shard-kbl7/igt@i915_selftest@live_hangcheck.html

Known issues
------------

Here are the changes found in Patchwork_13218_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@i915_suspend@fence-restore-tiled2untiled:
- shard-apl: [PASS][3] -> [DMESG-WARN][4] ([fdo#108566]) +2 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6225/shard-apl8/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13218/shard-apl7/igt@[email protected]

* igt@kms_flip@flip-vs-suspend:
- shard-hsw: [PASS][5] -> [INCOMPLETE][6] ([fdo#103540])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6225/shard-hsw5/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13218/shard-hsw8/igt@[email protected]

* igt@kms_flip@flip-vs-suspend-interruptible:
- shard-snb: [PASS][7] -> [INCOMPLETE][8] ([fdo#105411])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6225/shard-snb2/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13218/shard-snb1/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-cur-indfb-draw-blt:
- shard-hsw: [PASS][9] -> [SKIP][10] ([fdo#109271]) +11 similar issues
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6225/shard-hsw4/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13218/shard-hsw1/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render:
- shard-iclb: [PASS][11] -> [FAIL][12] ([fdo#103167]) +4 similar issues
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6225/shard-iclb7/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render.html
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13218/shard-iclb8/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render.html

* igt@kms_plane_lowres@pipe-a-tiling-x:
- shard-iclb: [PASS][13] -> [FAIL][14] ([fdo#103166])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6225/shard-iclb5/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13218/shard-iclb1/igt@[email protected]

* igt@kms_setmode@basic:
- shard-apl: [PASS][15] -> [FAIL][16] ([fdo#99912])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6225/shard-apl4/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13218/shard-apl8/igt@[email protected]

* igt@kms_vblank@pipe-c-ts-continuation-suspend:
- shard-skl: [PASS][17] -> [INCOMPLETE][18] ([fdo#104108]) +1 similar issue
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6225/shard-skl9/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13218/shard-skl5/igt@[email protected]

* igt@perf@oa-exponents:
- shard-glk: [PASS][19] -> [FAIL][20] ([fdo#105483])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6225/shard-glk7/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13218/shard-glk5/igt@[email protected]

#### Possible fixes ####

* igt@gem_eio@in-flight-suspend:
- shard-skl: [INCOMPLETE][21] ([fdo#104108]) -> [PASS][22] +2 similar issues
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6225/shard-skl4/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13218/shard-skl8/igt@[email protected]

* {igt@gem_exec_balancer@smoke}:
- shard-iclb: [SKIP][23] ([fdo#110854]) -> [PASS][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6225/shard-iclb6/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13218/shard-iclb4/igt@[email protected]

* igt@kms_cursor_crc@pipe-b-cursor-suspend:
- shard-kbl: [DMESG-WARN][25] ([fdo#108566]) -> [PASS][26]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6225/shard-kbl6/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13218/shard-kbl7/igt@[email protected]

* igt@kms_flip@2x-flip-vs-expired-vblank-interruptible:
- shard-glk: [FAIL][27] ([fdo#105363]) -> [PASS][28]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6225/shard-glk1/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13218/shard-glk2/igt@[email protected]

* igt@kms_flip@2x-plain-flip-ts-check-interruptible:
- shard-hsw: [SKIP][29] ([fdo#109271]) -> [PASS][30] +19 similar issues
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6225/shard-hsw1/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13218/shard-hsw8/igt@[email protected]

* igt@kms_flip@flip-vs-expired-vblank-interruptible:
- shard-skl: [FAIL][31] ([fdo#105363]) -> [PASS][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6225/shard-skl9/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13218/shard-skl4/igt@[email protected]

* igt@kms_flip@flip-vs-suspend-interruptible:
- shard-apl: [DMESG-WARN][33] ([fdo#108566]) -> [PASS][34] +5 similar issues
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6225/shard-apl4/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13218/shard-apl1/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-1p-pri-indfb-multidraw:
- shard-iclb: [FAIL][35] ([fdo#103167]) -> [PASS][36] +2 similar issues
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6225/shard-iclb6/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13218/shard-iclb8/igt@[email protected]

* igt@kms_setmode@basic:
- shard-kbl: [FAIL][37] ([fdo#99912]) -> [PASS][38]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6225/shard-kbl2/igt@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13218/shard-kbl2/igt@[email protected]

#### Warnings ####

* igt@gem_mmap_gtt@forked-big-copy-xy:
- shard-iclb: [TIMEOUT][39] ([fdo#109673]) -> [INCOMPLETE][40] ([fdo#107713] / [fdo#109100])
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6225/shard-iclb1/igt@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13218/shard-iclb4/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540
[fdo#104108]: https://bugs.freedesktop.org/show_bug.cgi?id=104108
[fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
[fdo#105411]: https://bugs.freedesktop.org/show_bug.cgi?id=105411
[fdo#105483]: https://bugs.freedesktop.org/show_bug.cgi?id=105483
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
[fdo#109100]: https://bugs.freedesktop.org/show_bug.cgi?id=109100
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109673]: https://bugs.freedesktop.org/show_bug.cgi?id=109673
[fdo#110854]: https://bugs.freedesktop.org/show_bug.cgi?id=110854
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912

Participating hosts (10 -> 10)
------------------------------

No changes in participating hosts

Build changes
-------------

* Linux: CI_DRM_6225 -> Patchwork_13218

CI_DRM_6225: 39bb7459567aada2e706e4da4a650dc4f7c41abf @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5049: db51cbba5a8f4856d6f56a61aa51fda6e239fa44 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_13218: 1479965541ec242e97d86a1f2e25755b2982dcbe @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13218/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx