From: Zhenyu Wang <zhenyuw@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: intel-gvt-dev@lists.freedesktop.org
Subject: [PATCH] drm/i915: Fix GVT balloon fail path handling
Date: Mon, 10 Jun 2019 17:28:19 +0800 [thread overview]
Message-ID: <20190610092819.11371-1-zhenyuw@linux.intel.com> (raw)
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.
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
---
drivers/gpu/drm/i915/i915_vgpu.c | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_vgpu.c b/drivers/gpu/drm/i915/i915_vgpu.c
index 94d3992b599d..5aec34db1aaa 100644
--- a/drivers/gpu/drm/i915/i915_vgpu.c
+++ b/drivers/gpu/drm/i915/i915_vgpu.c
@@ -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;
}
--
2.20.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next reply other threads:[~2019-06-10 9:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-10 9:28 Zhenyu Wang [this message]
2019-06-10 11:32 ` [PATCH] drm/i915: Fix GVT balloon fail path handling Chris Wilson
2019-06-10 13:14 ` ✓ Fi.CI.BAT: success for " Patchwork
2019-06-11 7:40 ` ✗ Fi.CI.IGT: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190610092819.11371-1-zhenyuw@linux.intel.com \
--to=zhenyuw@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-gvt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox