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 90BA0A050B; Fri, 8 Apr 2022 15:50:16 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6F90C4067E; Fri, 8 Apr 2022 15:50:16 +0200 (CEST) Received: from mail.lysator.liu.se (mail.lysator.liu.se [130.236.254.3]) by mails.dpdk.org (Postfix) with ESMTP id 6C0664003F for ; Fri, 8 Apr 2022 15:50:15 +0200 (CEST) Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id F0F887DC for ; Fri, 8 Apr 2022 15:50:14 +0200 (CEST) Received: by mail.lysator.liu.se (Postfix, from userid 1004) id EF917A9F; Fri, 8 Apr 2022 15:50:14 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on hermod.lysator.liu.se X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=ALL_TRUSTED, AWL, NICE_REPLY_A, T_SCC_BODY_TEXT_LINE autolearn=disabled version=3.4.6 X-Spam-Score: -2.7 Received: from [192.168.1.59] (unknown [62.63.215.114]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id 461A76D4; Fri, 8 Apr 2022 15:50:14 +0200 (CEST) Message-ID: Date: Fri, 8 Apr 2022 15:50:13 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH v2] eal: add seqlock Content-Language: en-US To: Stephen Hemminger Cc: dev@dpdk.org, Thomas Monjalon , David Marchand , onar.olsen@ericsson.com, Honnappa.Nagarahalli@arm.com, nd@arm.com, konstantin.ananyev@intel.com, mb@smartsharesystems.com, Ola Liljedahl , =?UTF-8?Q?Mattias_R=c3=b6nnblom?= References: <98CBD80474FA8B44BF855DF32C47DC35D86F84@smartserver.smartshare.dk> <20220330142602.108061-1-mattias.ronnblom@ericsson.com> <20220405131614.4e691adc@hermes.local> From: =?UTF-8?Q?Mattias_R=c3=b6nnblom?= In-Reply-To: <20220405131614.4e691adc@hermes.local> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP 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 2022-04-05 22:16, Stephen Hemminger wrote: > On Wed, 30 Mar 2022 16:26:02 +0200 > Mattias Rönnblom wrote: > >> +/** >> + * A static seqlock initializer. >> + */ >> +#define RTE_SEQLOCK_INITIALIZER { 0, RTE_SPINLOCK_INITIALIZER } > > Used named field initializers here please. > OK. >> +/** >> + * Initialize the seqlock. >> + * >> + * This function initializes the seqlock, and leaves the writer-side >> + * spinlock unlocked. >> + * >> + * @param seqlock >> + * A pointer to the seqlock. >> + */ >> +__rte_experimental >> +void >> +rte_seqlock_init(rte_seqlock_t *seqlock); > > You need to add the standard experimental prefix > to the comment so that doxygen marks the API as experimental > in documentation. > OK. >> +static inline bool >> +rte_seqlock_read_retry(const rte_seqlock_t *seqlock, uint32_t begin_sn) >> +{ >> + uint32_t end_sn; >> + >> + /* make sure the data loads happens before the sn load */ >> + rte_atomic_thread_fence(__ATOMIC_ACQUIRE); >> + >> + end_sn = __atomic_load_n(&seqlock->sn, __ATOMIC_RELAXED); >> + >> + return unlikely(begin_sn & 1 || begin_sn != end_sn); > > Please add parenthesis around the and to test if odd. > It would be good to document why if begin_sn is odd it returns false. > > Will do. Thanks.