[PATCH v3 2/2] drm/i915/gvt: Add error handling for submit_context function

fred gao fred.gao at intel.com
Mon Aug 21 03:09:03 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.

Signed-off-by: fred gao <fred.gao at intel.com>
---
 drivers/gpu/drm/i915/gvt/execlist.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gvt/execlist.c b/drivers/gpu/drm/i915/gvt/execlist.c
index 24770a5..130d77c 100644
--- a/drivers/gpu/drm/i915/gvt/execlist.c
+++ b/drivers/gpu/drm/i915/gvt/execlist.c
@@ -766,8 +766,11 @@ static int submit_context(struct intel_vgpu *vgpu, int ring_id,
 
 	if (ret == 0)
 		queue_workload(workload);
-	else if (vgpu_is_vm_unhealthy(ret))
+	else if (vgpu_is_vm_unhealthy(ret)) {
+		intel_gvt_mm_unreference(workload->shadow_mm);
+		kmem_cache_free(vgpu->workloads, workload);
 		enter_failsafe_mode(vgpu, GVT_FAILSAFE_GUEST_ERR);
+	}
 	return ret;
 }
 
-- 
2.7.4



More information about the intel-gvt-dev mailing list