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 C1FE64618E; Tue, 4 Feb 2025 16:25:22 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9830A4025F; Tue, 4 Feb 2025 16:25:22 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id E2761400D6 for ; Tue, 4 Feb 2025 16:25:20 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1213) id EAB1D206AB97; Tue, 4 Feb 2025 07:25:19 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com EAB1D206AB97 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1738682719; bh=I7pxONnezt/Vjoy+4NzYl85h6ZfqBOUfKFLlqq29VXs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fNbxEzLBVsm9c0RThR5AWubyHm8hfr7RkbK4RTTQOXNt/RwAudxIK/HRNE5xMhKf7 kw8g8yZvE/1eTNLU1jKdF8y8PJlLkc4yFRPDn/odjIddfP6Z+q2mRDMcSl0kRhGaqK UGFYSQ/A0fSj+dVsDbPgYUaXuD/jgEEDw4523rD8= Date: Tue, 4 Feb 2025 07:25:19 -0800 From: Andre Muezerie To: Bruce Richardson Cc: dev@dpdk.org, david.marchand@redhat.com Subject: Re: [PATCH v3 2/2] stack: enable build with MSVC Message-ID: <20250204152519.GA32610@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1733848355-19048-1-git-send-email-andremue@linux.microsoft.com> <1738634318-12876-1-git-send-email-andremue@linux.microsoft.com> <1738634318-12876-3-git-send-email-andremue@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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, Feb 04, 2025 at 10:30:03AM +0000, Bruce Richardson wrote: > On Mon, Feb 03, 2025 at 05:58:38PM -0800, Andre Muezerie wrote: > > An implementation compatible with MSVC is provided for > > atomic128_cmp_exchange in rte_stack_lf_c11.h. > > > > Now that the issues preventing the code needed to build lib/stack > > have been addressed, it can be enabled so that it also gets built > > when using the MSVC compiler. > > > > Signed-off-by: Andre Muezerie > > --- > > lib/stack/meson.build | 6 ------ > > lib/stack/rte_stack_lf_c11.h | 27 +++++++++++++++++++++++++++ > > 2 files changed, 27 insertions(+), 6 deletions(-) > > > > diff --git a/lib/stack/meson.build b/lib/stack/meson.build > > index 7631a14784..18177a742f 100644 > > --- a/lib/stack/meson.build > > +++ b/lib/stack/meson.build > > @@ -1,12 +1,6 @@ > > # SPDX-License-Identifier: BSD-3-Clause > > # Copyright(c) 2019 Intel Corporation > > > > -if is_ms_compiler > > - build = false > > - reason = 'not supported building with Visual Studio Toolset' > > - subdir_done() > > -endif > > - > > sources = files('rte_stack.c', 'rte_stack_std.c', 'rte_stack_lf.c') > > headers = files('rte_stack.h') > > # subheaders, not for direct inclusion by apps > > diff --git a/lib/stack/rte_stack_lf_c11.h b/lib/stack/rte_stack_lf_c11.h > > index 60d46e963b..898d43edb2 100644 > > --- a/lib/stack/rte_stack_lf_c11.h > > +++ b/lib/stack/rte_stack_lf_c11.h > > @@ -8,6 +8,33 @@ > > #include > > #include > > > > +#ifdef RTE_TOOLCHAIN_MSVC > > +/** > > + * The maximum lock-free data size that can be manipulated atomically using C11 > > + * standard is limited to 8 bytes. > > + * > > + * This implementation for rte_atomic128_cmp_exchange operates on 16-byte > > + * data types and is made available here so that it can be used without the > > + * need to unnecessarily expose other non-C11 atomics present in > > + * rte_atomic_64.h when using MSVC. > > + */ > > +static inline int > > +rte_atomic128_cmp_exchange(rte_int128_t *dst, > > + rte_int128_t *exp, > > + const rte_int128_t *src, > > + unsigned int weak, > > + int success, > > + int failure) > > +{ > > + return (int)_InterlockedCompareExchange128( > > + (int64_t volatile *) dst, > > + src->val[1], /* exchange high */ > > + src->val[0], /* exchange low */ > > + (int64_t *) exp /* comparand result */ > > + ); > > +} > > +#endif /* RTE_TOOLCHAIN_MSVC */ > > + > > Is there a particular reason for having this only in the stack library, > more than more generically available? > > /Bruce The PR history shows that the intention with MSVC (which is a new toolchain/platform) was to block visibility of the rte_atomic APIs from day 1. More details can be seen here: https://github.com/JoverZhang/dpdk/pull/21/commits/27da6a1234148fef43687d324ab2221df0631b5c If there's a strong need we could revert that decision, but for now it seems it would be better to follow the established direction. -- Andre Muezerie