[PATCH 2/2] drm/i915/gvt: Fix inconsistent locks holding sequence
Zhenyu Wang
zhenyuw at linux.intel.com
Tue Jun 20 14:52:16 UTC 2017
On 2017.06.20 14:23:22 +0000, Dong, Chuanxiao wrote:
> > > In this case, rb_first() won't be protected by cache_lock for getting the
> > node. We may still want this to be protected.
> > >
> >
> > oh, yeah, you're right, might just use for(;;) though.
>
> Backing to your suggestion, how about change to below:
>
> mutex_lock(&cache_lock);
> while ((node = rb_first(...))) {
> dma = rb_entry(node, struct gvt_dma, node);
> gvt_dma_unmap_iova(vgpu, dma->iova);
> gfn = dma->gfn;
> __gvt_cache_remove_entry(vgpu, dma);
> mutex_unlock(&cache_lock);
> vfio_unpin_pages(dev, &gfn, 1);
> mutex_lock(&cache_lock);
> }
> mutex_unlock(&cache_lock);
>
Not nice, that's why I suggest to use for style.
--
Open Source Technology Center, Intel ltd.
$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/intel-gvt-dev/attachments/20170620/2f2a6361/attachment.sig>
More information about the intel-gvt-dev
mailing list