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 70452436F6; Fri, 15 Dec 2023 03:47:42 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3B6A040266; Fri, 15 Dec 2023 03:47:42 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 84B3A40263 for ; Fri, 15 Dec 2023 03:47:40 +0100 (CET) Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SrttF0rjtzZdMl; Fri, 15 Dec 2023 10:47:33 +0800 (CST) Received: from kwepemd100004.china.huawei.com (unknown [7.221.188.31]) by mail.maildlp.com (Postfix) with ESMTPS id DE108140118; Fri, 15 Dec 2023 10:47:37 +0800 (CST) Received: from [10.67.121.175] (10.67.121.175) by kwepemd100004.china.huawei.com (7.221.188.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1258.28; Fri, 15 Dec 2023 10:47:37 +0800 Message-ID: <041426af-9b1c-e827-749c-35930dd7f6e2@huawei.com> Date: Fri, 15 Dec 2023 10:47:36 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH 1/2] eal: fix constraints on stdatomic API To: Tyler Retzlaff CC: , =?UTF-8?Q?Morten_Br=c3=b8rup?= , Konstantin Ananyev , , , References: <20231211073904.811243-1-haijie1@huawei.com> <20231211073904.811243-2-haijie1@huawei.com> <20231211185327.GA16826@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> From: Jie Hai In-Reply-To: <20231211185327.GA16826@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.121.175] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemd100004.china.huawei.com (7.221.188.31) 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 2023/12/12 2:53, Tyler Retzlaff wrote: > On Mon, Dec 11, 2023 at 03:39:03PM +0800, Jie Hai wrote: >> The first parameter of rte_atomic_exchange_explicit() must be a >> pointer to _Atomic type. If run command "meson setup --werror >> -Denable_stdatomic=true build && ninja -C build", error will occur. >> Thia patch fixes it. >> >> Fixes: 1ec6a845b5cb ("eal: use stdatomic API in public headers") >> Cc: stable@dpdk.org >> >> Signed-off-by: Jie Hai >> --- >> app/test/test_atomic.c | 6 +++--- >> lib/eal/include/generic/rte_atomic.h | 12 ++++++------ >> 2 files changed, 9 insertions(+), 9 deletions(-) >> >> diff --git a/app/test/test_atomic.c b/app/test/test_atomic.c >> index db07159e81ab..c3cb3ae0ea57 100644 >> --- a/app/test/test_atomic.c >> +++ b/app/test/test_atomic.c >> @@ -347,9 +347,9 @@ typedef union { >> const uint8_t CRC8_POLY = 0x91; >> uint8_t crc8_table[256]; >> >> -volatile uint16_t token16; >> -volatile uint32_t token32; >> -volatile uint64_t token64; >> +volatile RTE_ATOMIC(uint16_t) token16; >> +volatile RTE_ATOMIC(uint32_t) token32; >> +volatile RTE_ATOMIC(uint64_t) token64; > > subject to my comment below, volatile qualification can be removed. > >> >> static void >> build_crc8_table(void) >> diff --git a/lib/eal/include/generic/rte_atomic.h b/lib/eal/include/generic/rte_atomic.h >> index 0e639dad76a4..38c3b41f9c68 100644 >> --- a/lib/eal/include/generic/rte_atomic.h >> +++ b/lib/eal/include/generic/rte_atomic.h >> @@ -207,11 +207,11 @@ rte_atomic16_cmpset(volatile uint16_t *dst, uint16_t exp, uint16_t src) >> * The original value at that location >> */ >> static inline uint16_t >> -rte_atomic16_exchange(volatile uint16_t *dst, uint16_t val); >> +rte_atomic16_exchange(volatile RTE_ATOMIC(uint16_t) *dst, uint16_t val); > > the existing rte_atomicNN (the old non-standard ones) are deprecated and will > be eventually removed so there isn't a lot of value in churning their > signatures to wrap the rte_stdatomic macros. > > the right thing to do here to just change the calling code to use the generic > rte_stdatomic macros directly so we can eventually remove > rte_atomicNN_xxx. > > ty > Hi, Tyler Retzlaff, Thank you for your review. As I understand it, this code is used to test the API rte_atomXXX_change, and the call here should not be modified. Since the current problem affects compilation, I think it can be solved first. What do you think? Thanks, Jie Hai > .