[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH RFC] virtio: proposal to optimize accesses to VQ
From: |
Vincenzo Maffione |
Subject: |
Re: [Qemu-devel] [PATCH RFC] virtio: proposal to optimize accesses to VQs |
Date: |
Tue, 15 Dec 2015 10:22:26 +0100 |
> @@ -415,15 +399,15 @@ void virtqueue_get_avail_bytes(VirtQueue *vq, unsigned
> int *in_bytes,
> exit(1);
> }
>
> - if (vring_desc_flags(vdev, desc_pa, i) & VRING_DESC_F_WRITE) {
> - in_total += vring_desc_len(vdev, desc_pa, i);
> + if (desc.flags & VRING_DESC_F_WRITE) {
> + in_total += desc.flags;
> } else {
> - out_total += vring_desc_len(vdev, desc_pa, i);
> + out_total += desc.flags;
> }
> if (in_total >= max_in_bytes && out_total >= max_out_bytes) {
> goto done;
> }
> - } while ((i = virtqueue_next_desc(vdev, desc_pa, i, max)) != max);
> + } while ((i = virtqueue_read_next_desc(vdev, &desc, desc_pa, max))
> != max);
>
> if (!indirect)
> total_bufs = num_bufs;
Here (http://article.gmane.org/gmane.comp.emulators.qemu.block/6620) you meant
+ in_total += desc.len;
and
+ out_total += desc.len;
2015-12-14 17:06 GMT+01:00 Paolo Bonzini <address@hidden>:
>
>
> On 14/12/2015 15:51, Vincenzo Maffione wrote:
>>
>> This patch slightly rewrites the code to reduce the number of accesses, since
>> many of them seems unnecessary to me. After this reduction, the bottleneck
>> jumps from 1 Mpps to 2 Mpps.
>>
>> Patch is not complete (e.g. it still does not properly manage endianess, it
>> is
>> not clean, etc.). I just wanted to ask if you think the idea makes sense, and
>> a proper patch in this direction would be accepted.
>
> Yes, definitely. I have even done a very similar change here:
>
> http://article.gmane.org/gmane.comp.emulators.qemu.block/6620
>
> Can you review that patch, and possibly work on top of it?
>
> Thanks,
>
> Paolo
--
Vincenzo Maffione