From: "Michael S. Tsirkin" <mst@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>, Peter Xu <peterx@redhat.com>,
qemu devel <qemu-devel@nongnu.org>,
Cornelia Huck <cornelia.huck@de.ibm.com>
Subject: Re: [Qemu-devel] issues of region cache and iommu reset
Date: Thu, 30 Mar 2017 00:28:36 +0300 [thread overview]
Message-ID: <20170330002755-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <aa8f8830-9426-7cf5-ec99-363035315aa3@redhat.com>
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
next prev parent reply other threads:[~2017-03-29 21:28 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-29 8:00 [Qemu-devel] issues of region cache and iommu reset Jason Wang
2017-03-29 8:09 ` Paolo Bonzini
2017-03-29 8:37 ` Jason Wang
2017-03-29 8:41 ` Paolo Bonzini
2017-03-29 9:09 ` Jason Wang
2017-03-29 9:11 ` Paolo Bonzini
2017-03-29 9:24 ` Jason Wang
2017-03-29 21:31 ` Michael S. Tsirkin
2017-03-29 8:45 ` Cornelia Huck
2017-03-29 9:18 ` Jason Wang
2017-03-29 11:39 ` Cornelia Huck
2017-03-30 2:14 ` Jason Wang
2017-03-29 21:28 ` Michael S. Tsirkin [this message]
2017-03-30 9:02 ` Paolo Bonzini
2017-03-29 8:16 ` Peter Xu
2017-03-29 21:38 ` Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170330002755-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=cornelia.huck@de.ibm.com \
--cc=jasowang@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.