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 19936A0C43; Tue, 19 Oct 2021 13:10:27 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D11C5410F4; Tue, 19 Oct 2021 13:10:26 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 0A6FA4003E for ; Tue, 19 Oct 2021 13:10:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634641825; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=pvMGfyutZOa9w17Ty9FTR+An4MSMwR77wio5JikZBtk=; b=VqXnnR38K4LStwLGzV0xRvB6Et9vS1aMH0O59ruW//vAabhyb3OXzT5NfsMbswf8GQzBRZ GpeANq7rlgrF1saee4MxnZ+F6b53gj1VHyJCOaSGWdN7bQdZpTZj+XntKoRhyxnYtMO8u9 HqBa5/R7VhlO/KX+Iz1Gn/2JHIl4Qp8= Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-120-kWabCtflNqKKQJljjjhjCA-1; Tue, 19 Oct 2021 07:10:24 -0400 X-MC-Unique: kWabCtflNqKKQJljjjhjCA-1 Received: by mail-lj1-f199.google.com with SMTP id j8-20020a2e3c08000000b00210e2890d61so751463lja.9 for ; Tue, 19 Oct 2021 04:10:24 -0700 (PDT) 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=pvMGfyutZOa9w17Ty9FTR+An4MSMwR77wio5JikZBtk=; b=uGvV/kBM+Gy/gibUTTAzYjSo7+0/7rYM5BrR2zXxT4XgCiaoeHxnxVlSVLFU4dmvZG b3iqGnOSpWW7nF8PIyDa0oR+luv/YwNRcKEK/btxZuqTjUa7EmMVotONtoToVMPR8oM1 i4FLqxvwsypUJTwCCfOZ+LTrVcz7oIhBUqv0I/0nHpJmpTeBOQEtXylFbU8Kcf40j1N3 /E3OSVZf7P6VEqcKz7QrTxftoVQhkESQmsL3ku4lhtsWdLYq9/rNXM73Lr59UWzxKSNQ rRl22lLOh3y7j3FZfxBSfEX8Cvf+iDOA8LYPOqXD5aiOvToU9gZnY+VWrWLQm8Gc85Ey OibA== X-Gm-Message-State: AOAM5301RxEoNWDuOPm10CgNoyekUAc2qU3bpTHHJcDeMR1KwpLCNENG j1JHonOFAsgeHfX21s/j7na9pxcnM5grSweI/hWn2y4LIi1b4xAVV1DwlSV2iDR9QShhYcrd7vU KMDIhXpl0EdmSkV2GwfQ= X-Received: by 2002:a05:6512:3f28:: with SMTP id y40mr5471378lfa.499.1634641822853; Tue, 19 Oct 2021 04:10:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzS3xl1RuO5m/T7s43ttNJ2BVp2G7R87p53Kh6H8iLEyEu/CAJ8I2Dz2MNuRlee+5SfAOO6d3OeSKp2B76I5hk= X-Received: by 2002:a05:6512:3f28:: with SMTP id y40mr5471359lfa.499.1634641822641; Tue, 19 Oct 2021 04:10:22 -0700 (PDT) MIME-Version: 1.0 References: <20210825080127.495645-1-feifei.wang2@arm.com> <20210825080127.495645-3-feifei.wang2@arm.com> In-Reply-To: <20210825080127.495645-3-feifei.wang2@arm.com> From: David Marchand Date: Tue, 19 Oct 2021 13:10:11 +0200 Message-ID: To: Feifei Wang Cc: Honnappa Nagarahalli , dev , nd , Ruifeng Wang Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v1 2/2] mcslock: use wait until equal API for tight loop 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 Wed, Aug 25, 2021 at 10:02 AM Feifei Wang wrote: > > Instead of polling for previous lock holder unlocking, use > wait_until_equal API. > > Signed-off-by: Feifei Wang > Reviewed-by: Ruifeng Wang > --- > lib/eal/include/generic/rte_mcslock.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/lib/eal/include/generic/rte_mcslock.h b/lib/eal/include/generic/rte_mcslock.h > index 9f323bd2a2..c99343f22c 100644 > --- a/lib/eal/include/generic/rte_mcslock.h > +++ b/lib/eal/include/generic/rte_mcslock.h > @@ -84,8 +84,8 @@ rte_mcslock_lock(rte_mcslock_t **msl, rte_mcslock_t *me) > * to spin on me->locked until the previous lock holder resets > * the me->locked using mcslock_unlock(). > */ > - while (__atomic_load_n(&me->locked, __ATOMIC_ACQUIRE)) > - rte_pause(); > + rte_wait_until_equal_32((volatile uint32_t *)&me->locked, > + 0, __ATOMIC_ACQUIRE); Why do you need to cast as volatile? -- David Marchand