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 05D49A0501; Sat, 2 Apr 2022 02:50:17 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 94E7940E03; Sat, 2 Apr 2022 02:50:17 +0200 (CEST) Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) by mails.dpdk.org (Postfix) with ESMTP id B6E7E4067E for ; Sat, 2 Apr 2022 02:50:16 +0200 (CEST) Received: by mail-pg1-f170.google.com with SMTP id w21so3576105pgm.7 for ; Fri, 01 Apr 2022 17:50:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jceTZ7EffaHdsUAUEDgoYDGZFeSXGMU92MKLEEuOpEY=; b=KsGpWIdUHBYwysSCwXH8J+F/iBdAdFo/CXLwqSwQlXoYyXxZHF+jbE7Ja72Tjc8Z2X 8PgEnV2yCASzJWjqL+fd/ttiQ8xnVFEy0cKxTPGifm6Vk8ICsD9BAwQg2mvFuTRsefBI eujqrSVb8oy7NB1fDT1E4nH1OkcHmRBKPkqMv7Hbb1YGfDYOZJOY1hpjZK5s+sSpZj/c GOBSEeRDXuwzePS3iAdt1fYNZgEJH+xWhXraV0tJwk2Aitm6grj5YhMa4AChE63jAiD+ ipJSj4/d2gKMr/8naC7++Z0amjiyhCAdBuCzOOvjvNIkUonXVflpe1CO1LBuFyWp+BNg rM/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jceTZ7EffaHdsUAUEDgoYDGZFeSXGMU92MKLEEuOpEY=; b=HKIiFt0RfxFbta0gfhGfDPVeB7fUE76sw87cfdUwqhqeEKUEikGdcKMGod/Ik71NKI w6G+WzT+BxTJ+hrw1AlUi6YLrYoRaCRDRRdaNUIGwmWhPcDPzr2OLvbTCXNVNOLF4ymG axc+dR2FjhHewnah88M6oBR1Ye6w6IlOT9YHEfFa0Ry+OldktsfQqCw8z2n1Be8rGuOY HjP1hmh6PboNX86q9qu41vm8gfw52f9I9i3M0fGSZjhmHEcYi35g47e04kzwYcMsnHbA afkfUox3L58pMhGZhC+44tusMddG2gkb4mbA2IsWfGNUtGqiTonPgUAYp9lz6PrqCWDD Z8nQ== X-Gm-Message-State: AOAM532EIBU2fskrEnMT8Wl3Vl/Q//fOukrXXJ2qlA1NFjKOSp9aEVqs Sd9guTCNyhTSwuNWeYtWTqkf8A== X-Google-Smtp-Source: ABdhPJxYpHQrOEuVGWyfhrRwbi/5VVeOvvlo3JGFk3Hs8TxQcQ8bYxLvqx35GYw7HVe+OH67mWMvCg== X-Received: by 2002:a63:7258:0:b0:398:7298:c4b6 with SMTP id c24-20020a637258000000b003987298c4b6mr13408071pgn.436.1648860615680; Fri, 01 Apr 2022 17:50:15 -0700 (PDT) Received: from shemminger-XPS-13-9360 (hirgnt26.hicv.net. [205.172.16.196]) by smtp.gmail.com with ESMTPSA id gn21-20020a17090ac79500b001ca3c37af65sm3042969pjb.21.2022.04.01.17.50.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Apr 2022 17:50:15 -0700 (PDT) Date: Fri, 1 Apr 2022 14:50:08 -1000 From: Stephen Hemminger To: Mattias =?UTF-8?B?UsO2bm5ibG9t?= Cc: , Thomas Monjalon , David Marchand , , , , , , "Ola Liljedahl" Subject: Re: [PATCH v2] eal: add seqlock Message-ID: <20220401145008.25e1c9f5@shemminger-XPS-13-9360> In-Reply-To: <20220330142602.108061-1-mattias.ronnblom@ericsson.com> References: <98CBD80474FA8B44BF855DF32C47DC35D86F84@smartserver.smartshare.dk> <20220330142602.108061-1-mattias.ronnblom@ericsson.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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 Wed, 30 Mar 2022 16:26:02 +0200 Mattias R=C3=B6nnblom wrote: > + __atomic_store_n(&seqlock->sn, sn, __ATOMIC_RELAXED); > + > + /* __ATOMIC_RELEASE to prevent stores after (in program > order) > + * from happening before the sn store. > + */ > + rte_atomic_thread_fence(__ATOMIC_RELEASE); Couldn't atomic store with __ATOMIC_RELEASE do same thing? > +static inline void > +rte_seqlock_write_end(rte_seqlock_t *seqlock) > +{ > + uint32_t sn; > + > + sn =3D seqlock->sn + 1; > + > + /* synchronizes-with the load acquire in rte_seqlock_begin() > */ > + __atomic_store_n(&seqlock->sn, sn, __ATOMIC_RELEASE); > + > + rte_spinlock_unlock(&seqlock->lock); Atomic store is not necessary here, the atomic operation in spinlock_unlock wil assure theat the seqeuence number update is ordered correctly.