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 7102EA00C3; Fri, 13 May 2022 08:27:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 64653427F1; Fri, 13 May 2022 08:27:28 +0200 (CEST) Received: from mail.lysator.liu.se (mail.lysator.liu.se [130.236.254.3]) by mails.dpdk.org (Postfix) with ESMTP id E430B410F2 for ; Fri, 13 May 2022 08:27:26 +0200 (CEST) Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id 41A959A2C for ; Fri, 13 May 2022 08:27:25 +0200 (CEST) Received: by mail.lysator.liu.se (Postfix, from userid 1004) id 401AC9BA8; Fri, 13 May 2022 08:27:25 +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=-3.6 required=5.0 tests=ALL_TRUSTED, AWL, NICE_REPLY_A, T_SCC_BODY_TEXT_LINE autolearn=disabled version=3.4.6 X-Spam-Score: -3.6 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) server-digest SHA256) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id 23FE499B3; Fri, 13 May 2022 08:27:19 +0200 (CEST) Message-ID: <6a61dcf6-17b4-e037-52b1-7ff67397997d@lysator.liu.se> Date: Fri, 13 May 2022 08:27:19 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH v6] eal: add seqlock Content-Language: en-US To: Stephen Hemminger Cc: =?UTF-8?Q?Mattias_R=c3=b6nnblom?= , Thomas Monjalon , David Marchand , dev@dpdk.org, onar.olsen@ericsson.com, Honnappa.Nagarahalli@arm.com, nd@arm.com, konstantin.ananyev@intel.com, mb@smartsharesystems.com, Chengwen Feng , Ola Liljedahl References: <20220508121242.290008-1-mattias.ronnblom@ericsson.com> <20220508091034.53b23b3e@hermes.local> <55ed0b2b-ebe6-fd48-48b8-d173a69d541f@lysator.liu.se> <20220508204825.375965c8@hermes.local> From: =?UTF-8?Q?Mattias_R=c3=b6nnblom?= In-Reply-To: <20220508204825.375965c8@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-05-09 05:48, Stephen Hemminger wrote: > On Sun, 8 May 2022 21:40:58 +0200 > Mattias Rönnblom wrote: > >>> I think would be good to have the sequence count (read side only) like >>> the kernel and sequence lock (sequence count + spinlock) as separate things. >>> >>> That way the application could use sequence count + ticket lock if it >>> needed to scale to more writers. >>> >> >> Sounds reasonable. Would that be something like: >> >> typedef struct { >> uint32_t sn; >> } rte_seqlock_t; >> >> rte_seqlock_read_begin() >> rte_seqlock_read_retry() >> rte_seqlock_write_begin() >> rte_seqlock_write_end() >> >> typedef struct { >> rte_seqlock_t seqlock; >> rte_spinlock_t wlock; >> } rte__t; >> >> rte__read_begin() >> rte__read_retry() >> rte__write_lock() >> rte__write_unlock() >> >> or are you suggesting removing the spinlock altogether, and leave >> writer-side synchronization to the application (at least in this DPDK >> release)? > > > No, like Linux kernel. Use seqcount for the reader counter only object > and seqlock for the seqcount + spinlock version. Should rte_seqcount_t be in a separate file? Normally, I would use the "header file per 'class'" pattern (unless things are very tightly coupled), but I suspect DPDK style is the "header file per group of related 'classes'".