qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 10/11] virtio: use VRingMemoryRegionCaches for d


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH 10/11] virtio: use VRingMemoryRegionCaches for descriptor ring
Date: Mon, 12 Dec 2016 16:06:15 +0000
User-agent: Mutt/1.7.1 (2016-10-04)

On Mon, Dec 12, 2016 at 12:18:56PM +0100, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
>  hw/virtio/virtio.c | 22 ++++++++--------------
>  1 file changed, 8 insertions(+), 14 deletions(-)
> 
> diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
> index 4f355b4..702da0b 100644
> --- a/hw/virtio/virtio.c
> +++ b/hw/virtio/virtio.c
> @@ -484,18 +484,16 @@ void virtqueue_get_avail_bytes(VirtQueue *vq, unsigned 
> int *in_bytes,
>      unsigned int max, idx;
>      unsigned int total_bufs, in_total, out_total;
>      MemoryRegionCache *desc_cache = NULL;
> -    MemoryRegionCache vring_desc_cache;
>      MemoryRegionCache indirect_desc_cache;
> +    VRingMemoryRegionCaches *caches;
>      int64_t len = 0;
>      int rc;
>  
>      rcu_read_lock();
>      idx = vq->last_avail_idx;
>      max = vq->vring.num;
> -    len = address_space_cache_init(&vring_desc_cache, &address_space_memory,
> -                                   vq->vring.desc, max * sizeof(VRingDesc),
> -                                   false);
> -    if (len < max * sizeof(VRingDesc)) {
> +    caches = atomic_rcu_read(&vq->vring.caches);

Now the rcu_read_lock() above makes sense :).

Reviewed-by: Stefan Hajnoczi <address@hidden>

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]