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 1D588A0C45; Thu, 28 Oct 2021 09:02:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 01AD14067B; Thu, 28 Oct 2021 09:02:40 +0200 (CEST) Received: from mail-io1-f41.google.com (mail-io1-f41.google.com [209.85.166.41]) by mails.dpdk.org (Postfix) with ESMTP id A3AED4003F for ; Thu, 28 Oct 2021 09:02:38 +0200 (CEST) Received: by mail-io1-f41.google.com with SMTP id r194so6796924iod.7 for ; Thu, 28 Oct 2021 00:02:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6lowqhQVkmQJQm5/COFQ9JRVtksjyriqt6ngUU7Zd2c=; b=RIN4HYofEOoXd4tn4sKTH5HfjmpS7Kcr1NSkkRDioJUI7BRNudUGSU8h+KXRqy+OT0 GZH+XspW93v8EcvrFaxGnY8YxJjsOW75YAmTka43rcGp8FAWvkKp1Kl20d0kkpL4tWfQ ufm5Drg88hBgU6HDXCrC8TG0evDxjs+UBylRdYDn2hVclY91iEt0fCj++d3pzp2BU1BF UkrTP2mM8AGJvUwG+xfwAuOR4EfEFzR643aZXFWS2rCQCSZBa+seYeZ7qLhSs+uKD1/0 YKUNyMripxhCylp9/vAh4DWtZ3/BW1ZFe5b/4shlWw2jgdx6IshnlmjMlh/PUVivQ+Wl H+pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6lowqhQVkmQJQm5/COFQ9JRVtksjyriqt6ngUU7Zd2c=; b=lAcNIWufnEeIXWhvVhOU4xqFRy+Wgdi9u60iZm2+qVv9uonbBF8FEnKLobGeDssawU HyzAV69josBPSkeDok2j/UdBn6v8aQX3fFgvlbNUWT9O/k/9CpzhqzK09vTqA7PPyjsY LnEqcb7UlU0cA9n/HGn2MYasNW3fjaQeDPhimmRpQBROUcJLT/FkiqORxmGfOjh8Y1QP f/0xo9n4Pdr5Ouv5w97voNXfeKFtG1KXb2XTeKdANxB9xExp1nI74XjPUqZD1zA/JGH3 t69RhoWHfOisFab+5QaitoNN4/mlU2jytPqF3R8ADUP7VamcZTbD7LMLiCP77uH2MCLv U8gA== X-Gm-Message-State: AOAM533h4aiiVs/6yr+u7Ng/Sqktv3TdJdQ0CsbGymxBuwEDo47RRgOK 48ZQhOB1up64ihetfTA5E25rz/kAQLBT1H0zCQ0= X-Google-Smtp-Source: ABdhPJxMUPZqrxF1e5pmCqVTQI42bX2UYcy/PIUQjoPCPYUwQF3Var4zJhedZeleIDyb5H249RQyYRN7NTCEEpj5Bks= X-Received: by 2002:a05:6638:3796:: with SMTP id w22mr1945063jal.126.1635404557953; Thu, 28 Oct 2021 00:02:37 -0700 (PDT) MIME-Version: 1.0 References: <20210902053253.3017858-1-feifei.wang2@arm.com> <20211028065640.139655-1-feifei.wang2@arm.com> <20211028065640.139655-4-feifei.wang2@arm.com> In-Reply-To: <20211028065640.139655-4-feifei.wang2@arm.com> From: Jerin Jacob Date: Thu, 28 Oct 2021 12:32:12 +0530 Message-ID: To: Feifei Wang Cc: Honnappa Nagarahalli , dpdk-dev , nd , "Ananyev, Konstantin" , Stephen Hemminger , David Marchand , Thomas Monjalon , =?UTF-8?Q?Mattias_R=C3=B6nnblom?= , Ruifeng Wang Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v7 3/5] eal: use wait event scheme for mcslock 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 Sender: "dev" On Thu, Oct 28, 2021 at 12:27 PM Feifei Wang wrote: > > Instead of polling for mcslock to be updated, use wait event scheme > for this case. > > Furthermore, use 'uintptr_t *' is for different size of pointer in 32/64 > bits architecture. > > And define a new pointer 'next' for the compilation error: > ------------------------------------------------------------------- > 'dereferencing type-punned pointer will break strict-aliasing rules' > ------------------------------------------------------------------- > > Signed-off-by: Feifei Wang > Reviewed-by: Ruifeng Wang > --- > lib/eal/include/generic/rte_mcslock.h | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/lib/eal/include/generic/rte_mcslock.h b/lib/eal/include/generic/rte_mcslock.h > index 34f33c64a5..d5b9b293cd 100644 > --- a/lib/eal/include/generic/rte_mcslock.h > +++ b/lib/eal/include/generic/rte_mcslock.h > @@ -116,8 +116,9 @@ rte_mcslock_unlock(rte_mcslock_t **msl, rte_mcslock_t *me) > /* More nodes added to the queue by other CPUs. > * Wait until the next pointer is set. > */ > - while (__atomic_load_n(&me->next, __ATOMIC_RELAXED) == NULL) > - rte_pause(); > + uintptr_t *next = NULL; It is going to update in the next line. Why explicit NULL assignment? > + next = (uintptr_t *)&me->next; > + rte_wait_event(next, UINTPTR_MAX, ==, 0, __ATOMIC_RELAXED); > } > > /* Pass lock to next waiter. */ > -- > 2.25.1 >