From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C1575430F0; Thu, 24 Aug 2023 14:06:36 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4CABE40EE1; Thu, 24 Aug 2023 14:06:36 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 62BCA40150 for ; Thu, 24 Aug 2023 14:06:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692878794; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oymTUI051dkJuEa0mU1zkUtxtsOPThYG3BlJP8aCgMQ=; b=HVZjqNgV6KgKsPGUmNqGX0ft0L9EDGwm+hPi/CO0wGuhTaxdK5tAiVeV2JSyuj0tulX+6K wQp5FRidTi9Qdsg0fKuqhqurFvl7IHA4cACgytUXqz7y4LbQWpOayZLlu8cWuJ8EFZl/T5 aNgPPajD04CRPVS08F4EJ7MTSZO+Hx8= Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-504-9DGnxmDUOh28AR9UNYfBcA-1; Thu, 24 Aug 2023 08:06:33 -0400 X-MC-Unique: 9DGnxmDUOh28AR9UNYfBcA-1 Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-5009bdf5bdfso583595e87.0 for ; Thu, 24 Aug 2023 05:06:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692878791; x=1693483591; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oymTUI051dkJuEa0mU1zkUtxtsOPThYG3BlJP8aCgMQ=; b=NBOjUx6D+Sq8Ygkif8oKYlgWwqMApyESome1Ob44ncLvMj0XxhdarNEptjBRAwxGy3 sqbQdFG1+c5I4k4dN7hrEQojkDgVgJP+8XyUfrW4lo7jvNvV3fVuZd6gZKKL8uaoNpfn yKNM/fWdie41wMXJnFbQl6K6RV8qlznnoVJtnZ3KSBYIzj8E/bwdCHmjfceCjv7tg5Tq rAjiS4VXM15Xa0JwQl6avFvZKgYvcttLl48PAxSbF/O4rcqJdtCFfjZ8xXlx4lWBWiW0 jDpbjuwhyjlFXj7LIcdiWGfoYWHRLKoBP26HXkVCwMPz/v24gOoToqI0Ct8ME5g4kC9N 2sNg== X-Gm-Message-State: AOJu0Yzc2OByKYbPRu3elWLNbAAsf4+6WsYzEVZ8qWGQGEkE+Y9RWXk7 pPBBqQRvQD9/MBpl83ZWIRcn3uVqAfgDMwjXFM4Hi8ppmOyOq8KCGiKEcuE9dUaG5DLM6+JSCCO w6jNC0ZSNZP7rIomcbyo= X-Received: by 2002:a05:6512:3f17:b0:500:9034:ce52 with SMTP id y23-20020a0565123f1700b005009034ce52mr2296010lfa.17.1692878791803; Thu, 24 Aug 2023 05:06:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG/Wt2YrJwUArOObqBW5DhJH9i5RzrbU3xsA7nNR1ZTcTRWmp1Za361V8WTtHDn0qIvwIBRXZZxZKWNXZPuBFQ= X-Received: by 2002:a05:6512:3f17:b0:500:9034:ce52 with SMTP id y23-20020a0565123f1700b005009034ce52mr2295998lfa.17.1692878791384; Thu, 24 Aug 2023 05:06:31 -0700 (PDT) MIME-Version: 1.0 References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1691781658-32520-1-git-send-email-roretzla@linux.microsoft.com> <1691781658-32520-7-git-send-email-roretzla@linux.microsoft.com> In-Reply-To: <1691781658-32520-7-git-send-email-roretzla@linux.microsoft.com> From: David Marchand Date: Thu, 24 Aug 2023 14:06:19 +0200 Message-ID: Subject: Re: [PATCH v11 06/16] eal: use prefetch intrinsics To: Tyler Retzlaff , Maxime Coquelin Cc: dev@dpdk.org, Bruce Richardson , Konstantin Ananyev , Ciara Power , thomas@monjalon.net, mb@smartsharesystems.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Fri, Aug 11, 2023 at 9:21=E2=80=AFPM Tyler Retzlaff wrote: > > Inline assembly is not supported for MSVC x64 instead use _mm_prefetch > and _mm_cldemote intrinsics. > > Signed-off-by: Tyler Retzlaff > Acked-by: Bruce Richardson > Acked-by: Morten Br=C3=B8rup > Acked-by: Konstantin Ananyev > --- > lib/eal/x86/include/rte_prefetch.h | 25 +++++++++++++++++++++---- > 1 file changed, 21 insertions(+), 4 deletions(-) > > diff --git a/lib/eal/x86/include/rte_prefetch.h b/lib/eal/x86/include/rte= _prefetch.h > index 7fd01c4..7a6988e 100644 > --- a/lib/eal/x86/include/rte_prefetch.h > +++ b/lib/eal/x86/include/rte_prefetch.h > @@ -9,30 +9,38 @@ > extern "C" { > #endif > > +#include > + > #include > #include > #include "generic/rte_prefetch.h" > > +#pragma GCC diagnostic push > +#pragma GCC diagnostic ignored "-Wcast-qual" > + > static inline void rte_prefetch0(const volatile void *p) > { > - asm volatile ("prefetcht0 %[p]" : : [p] "m" (*(const volatile cha= r *)p)); > + _mm_prefetch((const void *)p, _MM_HINT_T0); > } > Quite surprisingly, this part (exactly) breaks 32bits build in the vhost library: ccache cc -Ilib/librte_vhost.a.p -Ilib -I../../../git/pub/dpdk.org/main/lib -Ilib/vhost -I../../../git/pub/dpdk.org/main/lib/vhost -I. -I../../../git/pub/dpdk.org/main -Iconfig -I../../../git/pub/dpdk.org/main/config -Ilib/eal/include -I../../../git/pub/dpdk.org/main/lib/eal/include -Ilib/eal/linux/include -I../../../git/pub/dpdk.org/main/lib/eal/linux/include -Ilib/eal/x86/include -I../../../git/pub/dpdk.org/main/lib/eal/x86/include -Ilib/eal/common -I../../../git/pub/dpdk.org/main/lib/eal/common -Ilib/eal -I../../../git/pub/dpdk.org/main/lib/eal -Ilib/kvargs -I../../../git/pub/dpdk.org/main/lib/kvargs -Ilib/log -I../../../git/pub/dpdk.org/main/lib/log -Ilib/metrics -I../../../git/pub/dpdk.org/main/lib/metrics -Ilib/telemetry -I../../../git/pub/dpdk.org/main/lib/telemetry -Ilib/ethdev -I../../../git/pub/dpdk.org/main/lib/ethdev -Ilib/net -I../../../git/pub/dpdk.org/main/lib/net -Ilib/mbuf -I../../../git/pub/dpdk.org/main/lib/mbuf -Ilib/mempool -I../../../git/pub/dpdk.org/main/lib/mempool -Ilib/ring -I../../../git/pub/dpdk.org/main/lib/ring -Ilib/meter -I../../../git/pub/dpdk.org/main/lib/meter -Ilib/cryptodev -I../../../git/pub/dpdk.org/main/lib/cryptodev -Ilib/rcu -I../../../git/pub/dpdk.org/main/lib/rcu -Ilib/hash -I../../../git/pub/dpdk.org/main/lib/hash -Ilib/pci -I../../../git/pub/dpdk.org/main/lib/pci -Ilib/dmadev -I../../../git/pub/dpdk.org/main/lib/dmadev -fdiagnostics-color=3Dalways -D_FILE_OFFSET_BITS=3D64 -Wall -Winvalid-pch -Wextra -Werror -std=3Dc11 -O2 -g -include rte_config.h -Wcast-qual -Wdeprecated -Wformat -Wformat-nonliteral -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wsign-compare -Wstrict-prototypes -Wundef -Wwrite-strings -Wno-address-of-packed-member -Wno-packed-not-aligned -Wno-missing-field-initializers -Wno-zero-length-bounds -Wno-pointer-to-int-cast -D_GNU_SOURCE -m32 -fPIC -march=3Dnative -mrtm -DALLOW_EXPERIMENTAL_API -DALLOW_INTERNAL_API -Wno-format-truncation -DVHOST_GCC_UNROLL_PRAGMA -fno-strict-aliasing -DVHOST_HAS_VDUSE -DRTE_LOG_DEFAULT_LOGTYPE=3Dlib.vhost -MD -MQ lib/librte_vhost.a.p/vhost_virtio_net.c.o -MF lib/librte_vhost.a.p/vhost_virtio_net.c.o.d -o lib/librte_vhost.a.p/vhost_virtio_net.c.o -c ../../../git/pub/dpdk.org/main/lib/vhost/virtio_net.c In function =E2=80=98mbuf_to_desc=E2=80=99, inlined from =E2=80=98vhost_enqueue_async_packed=E2=80=99 at ../../../git/pub/dpdk.org/main/lib/vhost/virtio_net.c:1948:6, inlined from =E2=80=98virtio_dev_rx_async_packed=E2=80=99 at ../../../git/pub/dpdk.org/main/lib/vhost/virtio_net.c:1965:6, inlined from =E2=80=98virtio_dev_rx_async_submit_packed=E2=80=99 at ../../../git/pub/dpdk.org/main/lib/vhost/virtio_net.c:2127:7: ../../../git/pub/dpdk.org/main/lib/vhost/virtio_net.c:1230:18: error: =E2=80=98buf_vec[0].buf_addr=E2=80=99 may be used uninitialized [-Werror=3Dmaybe-uninitialized] 1230 | buf_addr =3D buf_vec[vec_idx].buf_addr; | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../../git/pub/dpdk.org/main/lib/vhost/virtio_net.c: In function =E2=80=98virtio_dev_rx_async_submit_packed=E2=80=99: ../../../git/pub/dpdk.org/main/lib/vhost/virtio_net.c:1963:27: note: =E2=80=98buf_vec=E2=80=99 declared here 1963 | struct buf_vector buf_vec[BUF_VECTOR_MAX]; | ^~~~~~~ In function =E2=80=98mbuf_to_desc=E2=80=99, inlined from =E2=80=98vhost_enqueue_async_packed=E2=80=99 at ../../../git/pub/dpdk.org/main/lib/vhost/virtio_net.c:1948:6, inlined from =E2=80=98virtio_dev_rx_async_packed=E2=80=99 at ../../../git/pub/dpdk.org/main/lib/vhost/virtio_net.c:1965:6, inlined from =E2=80=98virtio_dev_rx_async_submit_packed=E2=80=99 at ../../../git/pub/dpdk.org/main/lib/vhost/virtio_net.c:2127:7: ../../../git/pub/dpdk.org/main/lib/vhost/virtio_net.c:1231:18: error: =E2=80=98buf_vec[0].buf_iova=E2=80=99 may be used uninitialized [-Werror=3Dmaybe-uninitialized] 1231 | buf_iova =3D buf_vec[vec_idx].buf_iova; | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../../git/pub/dpdk.org/main/lib/vhost/virtio_net.c: In function =E2=80=98virtio_dev_rx_async_submit_packed=E2=80=99: ../../../git/pub/dpdk.org/main/lib/vhost/virtio_net.c:1963:27: note: =E2=80=98buf_vec=E2=80=99 declared here 1963 | struct buf_vector buf_vec[BUF_VECTOR_MAX]; | ^~~~~~~ In function =E2=80=98mbuf_to_desc=E2=80=99, inlined from =E2=80=98vhost_enqueue_async_packed=E2=80=99 at ../../../git/pub/dpdk.org/main/lib/vhost/virtio_net.c:1948:6, inlined from =E2=80=98virtio_dev_rx_async_packed=E2=80=99 at ../../../git/pub/dpdk.org/main/lib/vhost/virtio_net.c:1965:6, inlined from =E2=80=98virtio_dev_rx_async_submit_packed=E2=80=99 at ../../../git/pub/dpdk.org/main/lib/vhost/virtio_net.c:2127:7: ../../../git/pub/dpdk.org/main/lib/vhost/virtio_net.c:1232:35: error: =E2=80=98buf_vec[0].buf_len=E2=80=99 may be used uninitialized [-Werror=3Dmaybe-uninitialized] 1232 | buf_len =3D buf_vec[vec_idx].buf_len; | ~~~~~~~~~~~~~~~~^~~~~~~~ ../../../git/pub/dpdk.org/main/lib/vhost/virtio_net.c: In function =E2=80=98virtio_dev_rx_async_submit_packed=E2=80=99: ../../../git/pub/dpdk.org/main/lib/vhost/virtio_net.c:1963:27: note: =E2=80=98buf_vec=E2=80=99 declared here 1963 | struct buf_vector buf_vec[BUF_VECTOR_MAX]; | ^~~~~~~ cc1: all warnings being treated as errors ninja: build stopped: subcommand failed. 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 warn= ing. 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. 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... --=20 David Marchand