[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: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 09/10] virtio: read avail_idx from VQ only when necessary |
Date: |
Tue, 19 Jan 2016 19:48:42 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 |
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
- [Qemu-devel] [PATCH 02/10] virtio: move allocation to virtqueue_pop/vring_pop, (continued)