All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Michael S. Tsirkin" <mst@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 11:02:02 +0200	[thread overview]
Message-ID: <b7e37593-93ed-23c2-7b68-240b46aef9c0@redhat.com> (raw)
In-Reply-To: <20170330002755-mutt-send-email-mst@kernel.org>



On 29/03/2017 23:28, Michael S. Tsirkin wrote:
>> 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.

The flush is done later in virtio_reset.  Here it's just reacting
asynchronously to the IOMMU reset.

I'm thinking of adding a global generation count for IOMMU mappings, and
forcing an update when the IOMMU mappings have changed.

Paolo

  reply	other threads:[~2017-03-30  9:02 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
2017-03-30  9:02     ` Paolo Bonzini [this message]
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=b7e37593-93ed-23c2-7b68-240b46aef9c0@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=jasowang@redhat.com \
    --cc=mst@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.