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 8973D43B76; Tue, 5 Mar 2024 19:44:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 11606402AC; Tue, 5 Mar 2024 19:44:49 +0100 (CET) Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by mails.dpdk.org (Postfix) with ESMTP id EC29140270 for ; Tue, 5 Mar 2024 19:44:47 +0100 (CET) Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1dc49afb495so1150425ad.2 for ; Tue, 05 Mar 2024 10:44:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1709664287; x=1710269087; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=M7umkNN1fLSAHm9nrxrWi1Y7rcFTRvHT2MWnFUDxCEc=; b=opzVIBqGue/Ss164jR0v523jlirx5jtp9oBG2jmDlCZvi/rNmE232EpY1yq6vvUAId 6xckjhzkDXGV3NRIYKZ0xH7EhdN24jYPHFtf3p9JqnJXGB+YM7QLtqIeoOj70KfCZixn H336+D/laUsJRxsU1ATFqqb9McSyw7mcSjjg/PUOnCC4yEO1JFpDXj3w0Eelic0bNdww rqSbSuxo+ikt84uECuNm0bCfHjFYPWSGkyoDv9a9Tr/qnQC4ZjCq2ETuV0EaATaWicaM pYzj7GcFTbksbHU/5Wh0spP9nHK8wzetQ3HzgTOO4FKsTYJnxRRlkzwYUgtGIqq6PeUl gVkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709664287; x=1710269087; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M7umkNN1fLSAHm9nrxrWi1Y7rcFTRvHT2MWnFUDxCEc=; b=U7YhK/OPORDO7sB2qu7446yqX3w9IVtlm8jNLD41PyQq+fPaCPmu4UT0yGAYqQnDNI SkisSRbVuMDHpwffBDzfbEToh8jWUcvleVvEXIIp2fSsAEk4DSbriWaJ99VmpueddpDX gtbTST1mhmUCEYJ3RqDSdq1xq1VXbNUkuR2a7Yl4tYwqWWgeodL2GeeAsLsqWL1BdX+Y jiCT83WQwXbpyJueRMM+MYkGsGc2/V0pLBiZmN1ShHXuIAT/fWshlqN4I5sZD5ZSqKUK WocV1RslslIeXmi6CdjtktSto10BUZa1Metx49eb0/Idn0Z+8A9brdpj6hbwe6UxTrsp tYjg== X-Forwarded-Encrypted: i=1; AJvYcCX/Buq1iDqn/oee3wrOXqnAeRY8sXdRelLnrvV9ATPWXvn5qFdMzb3vLNbzVJ0/jnuGsYkIM+frVIzudVc= X-Gm-Message-State: AOJu0YwMcphlsgL4w4SuLKcIWItZiS+KsXWV4G82s5xh4ALLbInTTSxC y8dKkrzp1yFom4+2ZDFB93u6vGfRx0GeasK3Okb+XHlzh+I/H6C/qSroROtLi6Y= X-Google-Smtp-Source: AGHT+IGDURHvEacZmwku13dc7hdXj7GfEhm/QWrSPDtogX4eCZTxtYsLme4vUdbRIFlru7Fm7ZatNQ== X-Received: by 2002:a17:90a:9f8b:b0:29a:7bec:32a0 with SMTP id o11-20020a17090a9f8b00b0029a7bec32a0mr9785472pjp.49.1709664286937; Tue, 05 Mar 2024 10:44:46 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id s22-20020a17090aa11600b0029b6e3f089bsm680733pjp.49.2024.03.05.10.44.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 10:44:46 -0800 (PST) Date: Tue, 5 Mar 2024 10:44:44 -0800 From: Stephen Hemminger To: Tyler Retzlaff Cc: David Marchand , dev@dpdk.org, Yipeng Wang , Sameh Gobriel , Bruce Richardson , Vladimir Medvedkin Subject: Re: [PATCH] hash: make gfni stubs inline Message-ID: <20240305104444.24b97e4d@hermes.local> In-Reply-To: <20240305175300.GC18937@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <20240304184508.89956-1-stephen@networkplumber.org> <20240305175300.GC18937@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> MIME-Version: 1.0 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 Tue, 5 Mar 2024 09:53:00 -0800 Tyler Retzlaff wrote: > On Tue, Mar 05, 2024 at 11:14:45AM +0100, David Marchand wrote: > > On Mon, Mar 4, 2024 at 7:45=E2=80=AFPM Stephen Hemminger > > wrote: =20 > > > > > > This reverts commit 07d836e5929d18ad6640ebae90dd2f81a2cafb71. > > > > > > Tyler found build issues with MSVC and the thash gfni stubs. > > > The problem would be link errors from missing symbols. =20 > >=20 > > Trying to understand this link error. > > Does it come from the fact that rte_thash_gfni/rte_thash_gfni_bulk > > declarations are hidden under RTE_THASH_GFNI_DEFINED in > > rte_thash_gfni.h? > >=20 > > If so, why not always expose those two symbols unconditionnally and > > link with the stub only when ! RTE_THASH_GFNI_DEFINED. =20 >=20 > So I don't have a lot of background of this lib. >=20 > I think we understand that we can't conditionally expose symbols. That's > what windows was picking up because it seems none of our CI's ever end > up with RTE_THASH_GFNI_DEFINED but my local test system did and failed. > (my experiments showed that Linux would complain too if it was defined) >=20 > If we always expose the symbols then as you point out we have to > conditionally link with the stub otherwise the inline (non-stub) will be > duplicate and build / link will fail. >=20 > I guess the part I don't understand with your suggestion is how we would > conditionally link with just the stub? We have to link with rte_hash to > get the rest of hash and the stub. I've probably missed something here. >=20 > Since we never had a release exposing the new symbols introduced by > Stephen in question my suggestion was that we just revert for 24.03 so > we don't end up with an ABI break later if we choose to solve the > problem without exports. >=20 > I don't know what else to do, but I think we need to decide for 24.03. >=20 > ty Another option would be introduce dead code stubs all the time. Then have inline wrapper that redirect to the dead stub if needed. Something like: =46rom 7bb972d342e939200f8f993a9074b20794941f6a Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 5 Mar 2024 10:42:48 -0800 Subject: [PATCH] hash: rename GFNI stubs Make the GFNI stub functions always built. This solves the conditional linking problem. If GFNI is available, they will never get used. Signed-off-by: Stephen Hemminger --- lib/hash/rte_thash_gfni.c | 11 +++++------ lib/hash/rte_thash_gfni.h | 23 ++++++++++++++++++----- lib/hash/version.map | 9 +++++++-- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/lib/hash/rte_thash_gfni.c b/lib/hash/rte_thash_gfni.c index f1525f9838de..de67abb8b211 100644 --- a/lib/hash/rte_thash_gfni.c +++ b/lib/hash/rte_thash_gfni.c @@ -4,18 +4,18 @@ =20 #include =20 +#include #include #include =20 -#ifndef RTE_THASH_GFNI_DEFINED - RTE_LOG_REGISTER_SUFFIX(hash_gfni_logtype, gfni, INFO); #define RTE_LOGTYPE_HASH hash_gfni_logtype #define HASH_LOG(level, ...) \ RTE_LOG_LINE(level, HASH, "" __VA_ARGS__) =20 +__rte_internal uint32_t -rte_thash_gfni(const uint64_t *mtrx __rte_unused, +___rte_thash_gfni(const uint64_t *mtrx __rte_unused, const uint8_t *key __rte_unused, int len __rte_unused) { static bool warned; @@ -29,8 +29,9 @@ rte_thash_gfni(const uint64_t *mtrx __rte_unused, return 0; } =20 +__rte_internal void -rte_thash_gfni_bulk(const uint64_t *mtrx __rte_unused, +___rte_thash_gfni_bulk(const uint64_t *mtrx __rte_unused, int len __rte_unused, uint8_t *tuple[] __rte_unused, uint32_t val[], uint32_t num) { @@ -47,5 +48,3 @@ rte_thash_gfni_bulk(const uint64_t *mtrx __rte_unused, for (i =3D 0; i < num; i++) val[i] =3D 0; } - -#endif diff --git a/lib/hash/rte_thash_gfni.h b/lib/hash/rte_thash_gfni.h index eed55fc86c86..1cb61cf39675 100644 --- a/lib/hash/rte_thash_gfni.h +++ b/lib/hash/rte_thash_gfni.h @@ -9,7 +9,16 @@ extern "C" { #endif =20 -#include +#include +/* + * @internal + * Stubs defined for use when GFNI is not available + */ +uint32_t +___rte_thash_gfni(const uint64_t *mtrx, const uint8_t *key, int len); +void +___rte_thash_gfni_bulk(const uint64_t *mtrx, int len, uint8_t *tuple[], + uint32_t val[], uint32_t num); =20 #ifdef RTE_ARCH_X86 =20 @@ -18,10 +27,8 @@ extern "C" { #endif =20 #ifndef RTE_THASH_GFNI_DEFINED - /** * Calculate Toeplitz hash. - * Dummy implementation. * * @param m * Pointer to the matrices generated from the corresponding @@ -34,7 +41,10 @@ extern "C" { * Calculated Toeplitz hash value. */ uint32_t -rte_thash_gfni(const uint64_t *mtrx, const uint8_t *key, int len); +rte_thash_gfni(const uint64_t *mtrx, const uint8_t *key, int len) +{ + return ___rte_thash_gfni(mtrx, key, len); +} =20 /** * Bulk implementation for Toeplitz hash. @@ -55,7 +65,10 @@ rte_thash_gfni(const uint64_t *mtrx, const uint8_t *key,= int len); */ void rte_thash_gfni_bulk(const uint64_t *mtrx, int len, uint8_t *tuple[], - uint32_t val[], uint32_t num); + uint32_t val[], uint32_t num) +{ + return ___rte_thash_gfni_bulk(mtrx, len, tuple, val); +} =20 #endif /* RTE_THASH_GFNI_DEFINED */ =20 diff --git a/lib/hash/version.map b/lib/hash/version.map index 6b2afebf6b46..942e2998578f 100644 --- a/lib/hash/version.map +++ b/lib/hash/version.map @@ -41,10 +41,15 @@ DPDK_24 { rte_thash_get_gfni_matrices; rte_thash_get_helper; rte_thash_get_key; - rte_thash_gfni; - rte_thash_gfni_bulk; rte_thash_gfni_supported; rte_thash_init_ctx; =20 local: *; }; + +INTERNAL { + global: + + ___rte_thash_gfni; + ___rte_thash_gfni_bulk; +}; --=20 2.43.0