[PATCH v11 06/16] eal: use prefetch intrinsics
David Marchand
david.marchand at redhat.com
Thu Aug 24 14:25:35 CEST 2023
On Thu, Aug 24, 2023 at 2:06 PM David Marchand
<david.marchand at redhat.com> wrote:
> I had a look at the vhost library and I think the compiler thinks size may be 0.
> Changing the loop on size with a do { } while (size > 0); resolves the warning.
> I can post a change for this, as we hit a similar issue in the past
> and the code does not make sense comparing size on the first iteration
> of this loop.
This sounds like a commit 4226aa9caca9 ("vhost: fix build with GCC
12") we had on LoongArch.
And the 32bits build warning goes away with this:
diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
index d7624d18c8..41328b7530 100644
--- a/lib/vhost/virtio_net.c
+++ b/lib/vhost/virtio_net.c
@@ -1906,7 +1906,7 @@ vhost_enqueue_async_packed(struct virtio_net *dev,
uint16_t buf_id = 0;
uint32_t len = 0;
uint16_t desc_count = 0;
- uint64_t size = pkt->pkt_len + sizeof(struct virtio_net_hdr_mrg_rxbuf);
+ uint64_t size = (uint64_t)pkt->pkt_len + sizeof(struct
virtio_net_hdr_mrg_rxbuf);
uint32_t buffer_len[vq->size];
uint16_t buffer_buf_id[vq->size];
uint16_t buffer_desc_count[vq->size];
>
> However, I am a bit puzzled why the prefetch change makes the compiler
> consider this loop differently.
> We have the same constructs everywhere in this library and x86_64
> builds are fine...
--
David Marchand
More information about the dev
mailing list