diff mbox series

drm/i915/gvt: more locking for ppgtt mm LRU list

Message ID 1580742421-25194-1-git-send-email-igor.druzhinin@citrix.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/gvt: more locking for ppgtt mm LRU list | expand

Commit Message

Igor Druzhinin Feb. 3, 2020, 3:07 p.m. UTC
When the lock was introduced in 72aabfb862e40 ("drm/i915/gvt: Add mutual
lock for ppgtt mm LRU list") one place got lost.

Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
---
 drivers/gpu/drm/i915/gvt/gtt.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Zhenyu Wang Feb. 10, 2020, 1:43 a.m. UTC | #1
On 2020.02.03 15:07:01 +0000, Igor Druzhinin wrote:
> When the lock was introduced in 72aabfb862e40 ("drm/i915/gvt: Add mutual
> lock for ppgtt mm LRU list") one place got lost.
> 
> Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
> ---
>  drivers/gpu/drm/i915/gvt/gtt.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/gvt/gtt.c b/drivers/gpu/drm/i915/gvt/gtt.c
> index 34cb404..4a48280 100644
> --- a/drivers/gpu/drm/i915/gvt/gtt.c
> +++ b/drivers/gpu/drm/i915/gvt/gtt.c
> @@ -1956,7 +1956,11 @@ void _intel_vgpu_mm_release(struct kref *mm_ref)
>  
>  	if (mm->type == INTEL_GVT_MM_PPGTT) {
>  		list_del(&mm->ppgtt_mm.list);
> +
> +		mutex_lock(&mm->vgpu->gvt->gtt.ppgtt_mm_lock);
>  		list_del(&mm->ppgtt_mm.lru_list);
> +		mutex_unlock(&mm->vgpu->gvt->gtt.ppgtt_mm_lock);
> +
>  		invalidate_ppgtt_mm(mm);
>  	} else {
>  		vfree(mm->ggtt_mm.virtual_ggtt);
> -- 

Thanks for the fix!

Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gvt/gtt.c b/drivers/gpu/drm/i915/gvt/gtt.c
index 34cb404..4a48280 100644
--- a/drivers/gpu/drm/i915/gvt/gtt.c
+++ b/drivers/gpu/drm/i915/gvt/gtt.c
@@ -1956,7 +1956,11 @@  void _intel_vgpu_mm_release(struct kref *mm_ref)
 
 	if (mm->type == INTEL_GVT_MM_PPGTT) {
 		list_del(&mm->ppgtt_mm.list);
+
+		mutex_lock(&mm->vgpu->gvt->gtt.ppgtt_mm_lock);
 		list_del(&mm->ppgtt_mm.lru_list);
+		mutex_unlock(&mm->vgpu->gvt->gtt.ppgtt_mm_lock);
+
 		invalidate_ppgtt_mm(mm);
 	} else {
 		vfree(mm->ggtt_mm.virtual_ggtt);