[PATCH v2 1/2] drm/i915/gvt: Fix possible recursive locking issue
Dong, Chuanxiao
chuanxiao.dong at intel.com
Fri Jun 23 10:32:48 UTC 2017
> -----Original Message-----
> From: Dong, Chuanxiao
> Sent: Friday, June 23, 2017 3:03 PM
> To: 'Zhenyu Wang' <zhenyuw at linux.intel.com>
> Cc: intel-gvt-dev at lists.freedesktop.org
> Subject: RE: [PATCH v2 1/2] drm/i915/gvt: Fix possible recursive locking issue
>
>
>
> > -----Original Message-----
> > From: Zhenyu Wang [mailto:zhenyuw at linux.intel.com]
> > Sent: Friday, June 23, 2017 2:51 PM
> > To: Dong, Chuanxiao <chuanxiao.dong at intel.com>
> > Cc: intel-gvt-dev at lists.freedesktop.org
> > Subject: Re: [PATCH v2 1/2] drm/i915/gvt: Fix possible recursive
> > locking issue
> >
> > On 2017.06.21 10:29:57 +0800, Chuanxiao Dong wrote:
> > > @@ -482,6 +513,7 @@ static int intel_vgpu_iommu_notifier(struct
> > notifier_block *nb,
> > > struct intel_vgpu *vgpu = container_of(nb,
> > > struct intel_vgpu,
> > > vdev.iommu_notifier);
> > > + bool sched_unmap = false;
> > >
> > > if (action == VFIO_IOMMU_NOTIFY_DMA_UNMAP) {
> > > struct vfio_iommu_type1_dma_unmap *unmap = data; @@
> > -491,7 +523,10
> > > @@ static int intel_vgpu_iommu_notifier(struct notifier_block *nb,
> > > end_gfn = gfn + unmap->size / PAGE_SIZE;
> > >
> > > while (gfn < end_gfn)
> > > - gvt_cache_remove(vgpu, gfn++);
> > > + sched_unmap |= gvt_cache_mark(vgpu, gfn++);
> > > +
> > > + if (sched_unmap)
> > > + schedule_work(&vgpu->vdev.unpin_work);
> > > }
> > >
> >
> > And might just check list_empty(unpin_list) here if require to
> > schedule unpin work, pls resend this with those change.
>
> Sure. Will cook the v3 for review. Thanks a lot for the comments!
There will be a corner case when check list_empty(unpin_list) for scheduling the unpin_work. If there is no gfn marked removed in this notifier but the unpin_list is not empty which is doing the unpin, notifier will schedule the unpin_work again. Looks like using the check list_empty() can involve unnecessary scheduling of unpin_work. What do you think?
Thanks
Chuanxiao
More information about the intel-gvt-dev
mailing list