[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] issues of region cache and iommu reset
From: |
Michael S. Tsirkin |
Subject: |
Re: [Qemu-devel] issues of region cache and iommu reset |
Date: |
Thu, 30 Mar 2017 00:28:36 +0300 |
On Wed, Mar 29, 2017 at 10:09:10AM +0200, Paolo Bonzini wrote:
>
>
> On 29/03/2017 10:00, Jason Wang wrote:
> >
> >
> > 1) vtd was reset first
> >
> > 2) during the reset of virtio-net-pci #1, deletion of msix subregion
> > will cause a commit of all memory listeners
> >
> > 3) virito-net-pci #2's region cache will be update, but since vtd has
> > already been reset, it can't get a valid mappings here
> >
> > Any ideas on how to fix this? Need region cache be aware of IOMMU/IOTLB
> > state in this case? Or can we simply reset IOMMU as the last one?
>
> Something like this?
>
> diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
> index 03592c5..73e69ac 100644
> --- a/hw/virtio/virtio.c
> +++ b/hw/virtio/virtio.c
> @@ -176,6 +176,10 @@ err_used:
> address_space_cache_destroy(&new->desc);
> err_desc:
> g_free(new);
> + atomic_rcu_set(&vq->vring.caches, NULL);
> + if (old) {
> + call_rcu(old, virtio_free_region_cache, rcu);
> + }
> }
>
> /* virt queue functions */
I would be worried about call_rcu here - this means
something can hang on to and use the old cache,
and reset really must act as a sync/flush point.
> Paolo
- Re: [Qemu-devel] issues of region cache and iommu reset, (continued)
- Re: [Qemu-devel] issues of region cache and iommu reset, Jason Wang, 2017/03/29
- Re: [Qemu-devel] issues of region cache and iommu reset, Paolo Bonzini, 2017/03/29
- Re: [Qemu-devel] issues of region cache and iommu reset, Jason Wang, 2017/03/29
- Re: [Qemu-devel] issues of region cache and iommu reset, Paolo Bonzini, 2017/03/29
- Re: [Qemu-devel] issues of region cache and iommu reset, Jason Wang, 2017/03/29
- Re: [Qemu-devel] issues of region cache and iommu reset, Michael S. Tsirkin, 2017/03/29
- Re: [Qemu-devel] issues of region cache and iommu reset, Cornelia Huck, 2017/03/29
- Re: [Qemu-devel] issues of region cache and iommu reset,
Michael S. Tsirkin <=
- Re: [Qemu-devel] issues of region cache and iommu reset, Peter Xu, 2017/03/29