[PATCH v4 2/2] drm/i915/gvt: Add error handling for submit_context
fred gao
fred.gao at intel.com
Wed Aug 30 08:14:50 UTC 2017
When a scan error occurs in submit_context, this patch is to
decrease the mm ref count and free the workload struct before
the workload is abandoned.
v2:
- submit_context related code should be combined together. (Zhenyu)
Signed-off-by: fred gao <fred.gao at intel.com>
---
drivers/gpu/drm/i915/gvt/execlist.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/gvt/execlist.c b/drivers/gpu/drm/i915/gvt/execlist.c
index 5ec07ec..1fa4e73 100644
--- a/drivers/gpu/drm/i915/gvt/execlist.c
+++ b/drivers/gpu/drm/i915/gvt/execlist.c
@@ -759,13 +759,20 @@ static int submit_context(struct intel_vgpu *vgpu, int ring_id,
if (list_empty(workload_q_head(vgpu, ring_id))) {
intel_runtime_pm_get(dev_priv);
mutex_lock(&dev_priv->drm.struct_mutex);
- intel_gvt_scan_and_shadow_workload(workload);
+ ret = intel_gvt_scan_and_shadow_workload(workload);
mutex_unlock(&dev_priv->drm.struct_mutex);
intel_runtime_pm_put(dev_priv);
}
- queue_workload(workload);
- return 0;
+ if (ret == 0)
+ queue_workload(workload);
+ else {
+ intel_gvt_mm_unreference(workload->shadow_mm);
+ kmem_cache_free(vgpu->workloads, workload);
+ if (vgpu_is_vm_unhealthy(ret))
+ enter_failsafe_mode(vgpu, GVT_FAILSAFE_GUEST_ERR);
+ }
+ return ret;
}
int intel_vgpu_submit_execlist(struct intel_vgpu *vgpu, int ring_id)
--
2.7.4
More information about the intel-gvt-dev
mailing list