From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8C52FA04C0; Fri, 25 Sep 2020 16:27:30 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9BAA31E964; Fri, 25 Sep 2020 16:27:28 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by dpdk.org (Postfix) with ESMTP id 876B21D167 for ; Fri, 25 Sep 2020 16:27:27 +0200 (CEST) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601044046; 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=597sxhIZeL14I2CGcY52aV0T6ZvKHOQqgZ1B4V1CEns=; b=i4gBypJeQ+mA59L83jIzLV8qUSZCDN3TD28J01FnAfuY0y1zWCQJq6H5ZOlnDzMyQQeBI0 MXG7iJug1W+j2OnnAuvPLJoXqxE8YW11X0jTVgJCy4DTtj5XwZC4rfQ7AwTb3QWUnsZ1bu Ax1L7bMaByIlS1BjhWP1cnpwv1S6v9M= Received: from mail-vs1-f69.google.com (mail-vs1-f69.google.com [209.85.217.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-109-e2nxkr9mOTOgyEH8lqggtw-1; Fri, 25 Sep 2020 10:27:24 -0400 X-MC-Unique: e2nxkr9mOTOgyEH8lqggtw-1 Received: by mail-vs1-f69.google.com with SMTP id e202so784300vsc.4 for ; Fri, 25 Sep 2020 07:27:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=597sxhIZeL14I2CGcY52aV0T6ZvKHOQqgZ1B4V1CEns=; b=drIXpm4LWZNDtFx3eA+QAtBNAm4OvvxX47s3Pt5zZZCRdkuWxM44gCKNSCzlFZjNWA CDp8KvNK5jgUB1CMXAfkPcduonCCEAkmEu2ZjtcEY/ruSWZTi+oZDpusZ6lmfMwrwD4y SsedeCSVYWPXrcj/5lrMdcMewZB6BAqqY9pXAt7De4zclY72iAX6Xf1x/rgjpVuBcotb ep0izp1W9b5AzsLWzVgqAQ+A+Or8ScW9gGr66e5OR/1CNpUyOaDAuZa5ThvCGEMCZWqA 4CjRYZcnrLB2fWEcN8SP4yQaSxCt9jFyQ49kbm0itxYeEB4K9yQpvg3X8ciTjr4KXsQZ kvBA== X-Gm-Message-State: AOAM533vYBAZ0dHhkU7nsu8mB4fak5It7jBgxt64LB1Au+Yc0exg4wC7 j77PtR4hx/rmpT2lhHsJb+VRjEbuTY3qYi7agAsXm3dPZ9vqjr84sTbzKp2qBfJzPw5B+XaMG+w 53ROUH3qA+Ycd2gJEa2Y= X-Received: by 2002:ab0:7313:: with SMTP id v19mr2532279uao.87.1601044043750; Fri, 25 Sep 2020 07:27:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvFbtTc4yT7ZnINwIOFMOhVntiCtLUnrGVt5NZxY5hovIBrhV0k+MzGv9w3BbQ8eoru3MbzJ68JvWuif1oRt4= X-Received: by 2002:ab0:7313:: with SMTP id v19mr2532267uao.87.1601044043534; Fri, 25 Sep 2020 07:27:23 -0700 (PDT) MIME-Version: 1.0 References: <20200911152938.8019-1-steven.lariau@arm.com> <20200911152938.8019-6-steven.lariau@arm.com> In-Reply-To: From: David Marchand Date: Fri, 25 Sep 2020 16:27:12 +0200 Message-ID: To: Steven Lariau Cc: Olivier Matz , "dev@dpdk.org" , "nd@arm.com" , "dharmik.thakkar@arm.com" , "Eads, Gage" 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 5/5] lib/stack: remove pop cas release ordering X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Hello Steven, On Mon, Sep 21, 2020 at 7:17 PM Eads, Gage wrote: > > -----Original Message----- > > From: Steven Lariau > > Sent: Friday, September 11, 2020 10:30 AM > > To: Eads, Gage ; Olivier Matz > > Cc: dev@dpdk.org; nd@arm.com; dharmik.thakkar@arm.com; Steven Lariau > > > > Subject: [PATCH 5/5] lib/stack: remove pop cas release ordering > > > > Replace the store-release by relaxed for the CAS success at the end of > > pop. Release isn't needed, because there is not write to data that need > > to be synchronized. > > The only preceding write is when the length is decreased, but the length > > CAS loop already ensures the right synchronization. > > The situation to avoid is when a thread sees the old length but the new > > list, that doesn't have enough items for pop to success. > > But the CAS success on length before the pop loop ensures any core reads > > and updates the latest length, preventing this situation. > > > > The store-release is also used to make sure that the items are read > > before the head is updated, in order to prevent a core in pop to read an > > incorrect value because another core rewrites it with push. > > But this isn't needed, because items are read only when removed from the > > used list. Right after this, they are pushed to the free list, and the > > store-release in push makes sure the items are read before they are > > visible in the free list. > > Please add a comment to this effect above the compare-exchange call. Depending > on this caller behavior for correctness is a little risky, but since this header > is private to the library I think it's ok as long as it's well-documented. > Can you prepare a v2 for this comment? Thanks. -- David Marchand