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 1DAF6A0501; Sat, 2 Apr 2022 02:52:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A863640E03; Sat, 2 Apr 2022 02:52:26 +0200 (CEST) Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) by mails.dpdk.org (Postfix) with ESMTP id 45DCF4067E for ; Sat, 2 Apr 2022 02:52:25 +0200 (CEST) Received: by mail-pf1-f182.google.com with SMTP id x31so4056641pfh.9 for ; Fri, 01 Apr 2022 17:52:25 -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=eql2/vG6WT394QNUuRQwSIaM+GxIhZ5gB2zvgT3oadk=; b=E6HHnx51dFtiLpUOC9mHqSwwYwRE18BLnS8OMFIn0RJVlLlgwb0mdqaBJJiTqM1ADa Gf9c9n9jjTzYmjDL1KruGEm+H0phSgm7AA448SBtiYrpqUcj0wsVQMI0qAkcYqeI/xHZ eGEbwYbnWhqqCh4dEhNBLSCMVqoaYJsSIjo3dRhGKE2eeKuzcimUb1PF6toA5LM/e++X 2a+RIkpBZR9ZwuXbJbMS3+u9scY8/LDIg3hU5PFhDiEvgdviVYIlkdiN1WurmoCKgN4M WW0mDw0H7ATTKe66gvHdYhCVTs2Lso8eh90VneSfYet1bBwWG30ZI8KBa8FYSXkjXDUc Ubng== 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=eql2/vG6WT394QNUuRQwSIaM+GxIhZ5gB2zvgT3oadk=; b=iSkScbbn88tnTOiPeO3GUVVq1XpRZE/ZLplPbdXP8i3OG4e/BPP1a1s9mSJHAGLhZS 11kNgyHsZbmuQOcgE/k1wZ+8v3WN62OQxV6OZULqcmFh0+P10j64/1Mn6xkb5RzgOmZw VFL0rIF+58ljaVthquSHpq0cWCfXposfdES0Ul0xAsiRDmclFZhfbmhLetBOwG5Hesv/ zGlW/xIi9Fx1/ouf7XiPMDbS6GhtC/cgq+2FQrEHdxenQ79ABjvoL7iusphIYeN0Vfw4 dI5yyoJ/1ToXYCM0ue+Z1EySuQkgSoQ3oz2ZH59HDvfPPhE8a9bhunTGpLrDbGxwBbUC pLvQ== X-Gm-Message-State: AOAM532MBGibixmk0D6KetcweXwYSigIVMTrXaZJw3RKk2CRymQy7hzW h+xHJtjRGSwGbZoHu/xlgmOlng== X-Google-Smtp-Source: ABdhPJzcfknhChFkVVSp9C4FySgdYJLh3eneKVVkLGlKzcVWp6p6k/u+MtU4T5OvMxBV+ewjrArE8w== X-Received: by 2002:a05:6a00:300d:b0:4fa:8327:88c7 with SMTP id ay13-20020a056a00300d00b004fa832788c7mr47460058pfb.16.1648860744273; Fri, 01 Apr 2022 17:52:24 -0700 (PDT) Received: from shemminger-XPS-13-9360 (hirgnt26.hicv.net. [205.172.16.196]) by smtp.gmail.com with ESMTPSA id h8-20020a17090a2ec800b001ca0ce2e2c8sm3480481pjs.47.2022.04.01.17.52.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Apr 2022 17:52:23 -0700 (PDT) Date: Fri, 1 Apr 2022 14:52:17 -1000 From: Stephen Hemminger To: Ola Liljedahl Cc: Mattias =?UTF-8?B?UsO2bm5ibG9t?= , "dev@dpdk.org" , Thomas Monjalon , David Marchand , Onar Olsen , "Honnappa.Nagarahalli@arm.com" , "nd@arm.com" , "konstantin.ananyev@intel.com" , "mb@smartsharesystems.com" Subject: Re: [PATCH v2] eal: add seqlock Message-ID: <20220401145217.66506c78@shemminger-XPS-13-9360> In-Reply-To: <1094901f-ee27-8c49-d71f-825ec5bfe2ad@arm.com> References: <98CBD80474FA8B44BF855DF32C47DC35D86F84@smartserver.smartshare.dk> <20220330142602.108061-1-mattias.ronnblom@ericsson.com> <3888e595-de18-3cf0-707b-309b153c2b02@ericsson.com> <37d60d0f-9911-7692-cdb6-62cd5da540ac@arm.com> <1094901f-ee27-8c49-d71f-825ec5bfe2ad@arm.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 Thu, 31 Mar 2022 16:53:00 +0200 Ola Liljedahl wrote: > From: Ola Liljedahl > To: Mattias R=C3=B6nnblom , "dev@dpdk.org" > Cc: Thomas Monjalon , David > Marchand , Onar Olsen > , "Honnappa.Nagarahalli@arm.com" > , "nd@arm.com" , > "konstantin.ananyev@intel.com" , > "mb@smartsharesystems.com" , > "stephen@networkplumber.org" Subject: > Re: [PATCH v2] eal: add seqlock Date: Thu, 31 Mar 2022 16:53:00 +0200 > User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 > Thunderbird/91.7.0 >=20 > (Thunderbird suddenly refuses to edit in plain text mode, hope the > mail gets sent as text anyway) >=20 > On 3/31/22 15:38, Mattias R=C3=B6nnblom wrote: >=20 > > On 2022-03-31 11:04, Ola Liljedahl wrote: =20 > >> On 3/31/22 09:46, Mattias R=C3=B6nnblom wrote: =20 > >>> On 2022-03-30 16:26, Mattias R=C3=B6nnblom wrote: > >>> =20 > > >>> Should the rte_seqlock_read_retry() be called > >>> rte_seqlock_read_end(), or some third alternative? I wanted to > >>> make clear it's not just a "release the lock" function. You could > >>> use the|||__attribute__((warn_unused_result)) annotation to make > >>> clear the return value cannot be ignored, although I'm not sure > >>> DPDK ever use that attribute. =20 > >> We have to decide how to use the seqlock API from the application > >> perspective. > >> Your current proposal: > >> do { > >> =C2=A0=C2=A0=C2=A0 sn =3D rte_seqlock_read_begin(&seqlock) > >> =C2=A0=C2=A0=C2=A0 //read protected data > >> } while (rte_seqlock_read_retry(&seqlock, sn)); > >> > >> or perhaps > >> sn =3D rte_seqlock_read_lock(&seqlock); > >> do { > >> =C2=A0=C2=A0=C2=A0 //read protected data > >> } while (!rte_seqlock_read_tryunlock(&seqlock, &sn)); > >> > >> Tryunlock should signal to the user that the unlock operation > >> might not succeed and something needs to be repeated. > >> =20 > > I like that your proposal is consistent with rwlock API, although I > > tend to think about a seqlock more like an arbitrary-size atomic > > load/store, where begin() is the beginning of the read transaction. > > =20 >=20 > I can see the evolution of an application where is starts to use > plain spin locks, moves to reader/writer locks for better performance > and eventually moves to seqlocks. The usage is the same, only the=20 > characteristics (including performance) differ. The semantics of seqlock in DPDK must be the same as what Linux kernel does or you are asking for trouble. It is not a reader-writer lock in traditional sense.