qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 09/10] virtio: read avail_idx from VQ only when


From: Vincenzo Maffione
Subject: Re: [Qemu-devel] [PATCH 09/10] virtio: read avail_idx from VQ only when necessary
Date: Thu, 21 Jan 2016 22:40:23 +0100

2016-01-19 19:48 GMT+01:00 Paolo Bonzini <address@hidden>:
>
>
> On 19/01/2016 17:54, Michael S. Tsirkin wrote:
>> On Fri, Jan 15, 2016 at 01:41:57PM +0100, Paolo Bonzini wrote:
>>> From: Vincenzo Maffione <address@hidden>
>>>
>>> The virtqueue_pop() implementation needs to check if the avail ring
>>> contains some pending buffers. To perform this check, it is not
>>> always necessary to fetch the avail_idx in the VQ memory, which is
>>> expensive. This patch introduces a shadow variable tracking avail_idx
>>> and modifies virtio_queue_empty() to access avail_idx in physical
>>> memory only when necessary.
>>>
>>> Signed-off-by: Vincenzo Maffione <address@hidden>
>>> Message-Id: <address@hidden>
>>> Signed-off-by: Paolo Bonzini <address@hidden>
>>
>> Is the cost due to the page walk?
>
> Yes, as with all the other patches.  But unlike patches 7 and 10 where
> we just reduce the number of walks, for patch 8 and 9 it's difficult to
> beat a local cache. :)
>
>>> @@ -1579,6 +1595,7 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int 
>>> version_id)
>>>                  return -1;
>>>              }
>>>              vdev->vq[i].used_idx = vring_used_idx(&vdev->vq[i]);
>>> +            vdev->vq[i].shadow_avail_idx = vring_avail_idx(&vdev->vq[i]);
>>>          }
>>>      }
>>
>>
>> shadow_avail_idx also should be updated on vhost stop,
>
> That's virtio_queue_set_last_avail_idx, right?
>
> Paolo

Right. Sorry, I missed that.

Vincenzo



-- 
Vincenzo Maffione



reply via email to

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