Commit 46b441ef authored by fred gao's avatar fred gao Committed by Zhenyu Wang

drm/i915/gvt: Refine error handling for intel_vgpu_pin_mm

When it is failed in shadow_mm, the pin_count should rollback
to the original states before return.

v2:
- split the mixed several error paths for better review. (Zhenyu)

v3:
  increase the pincount after shadow success. (Zhenyu)
Signed-off-by: default avatarfred gao <fred.gao@intel.com>
Signed-off-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
parent 0cce2823
...@@ -1647,14 +1647,13 @@ int intel_vgpu_pin_mm(struct intel_vgpu_mm *mm) ...@@ -1647,14 +1647,13 @@ int intel_vgpu_pin_mm(struct intel_vgpu_mm *mm)
if (WARN_ON(mm->type != INTEL_GVT_MM_PPGTT)) if (WARN_ON(mm->type != INTEL_GVT_MM_PPGTT))
return 0; return 0;
atomic_inc(&mm->pincount);
if (!mm->shadowed) { if (!mm->shadowed) {
ret = shadow_mm(mm); ret = shadow_mm(mm);
if (ret) if (ret)
return ret; return ret;
} }
atomic_inc(&mm->pincount);
list_del_init(&mm->lru_list); list_del_init(&mm->lru_list);
list_add_tail(&mm->lru_list, &mm->vgpu->gvt->gtt.mm_lru_list_head); list_add_tail(&mm->lru_list, &mm->vgpu->gvt->gtt.mm_lru_list_head);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment