From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH] ring: fix c11 memory ordering issue Date: Mon, 06 Aug 2018 11:19:20 +0200 Message-ID: <1937068.bZVvs4nVfc@xps> References: <20180806011805.7857-1-gavin.hu@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org, Honnappa.Nagarahalli@arm.com, steve.capper@arm.com, Ola.Liljedahl@arm.com, jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com, jia.he@hxt-semitech.com, stable@dpdk.org To: Gavin Hu Return-path: In-Reply-To: <20180806011805.7857-1-gavin.hu@arm.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi, Please start your patch by explaining the issue you are solving. What is the consequence of the bug on the behaviour? What is the scope of the bug? only PPC? 06/08/2018 03:18, Gavin Hu: > 1) In update_tail, read ht->tail using __atomic_load. > 2) In __rte_ring_move_prod_head, move the __atomic_load_n up and out of > the do {} while loop as upon failure the old_head will be updated, > another load is not necessary. > 3) Synchronize the load-acquires of prod.tail and cons.tail with store- > releases of update_tail which releases all ring updates up to the > value of ht->tail. > 4) When calling __atomic_compare_exchange_n, relaxed ordering for both > success and failure, as multiple threads can work independently on > the same end of the ring (either enqueue or dequeue) without > synchronization, not as operating on tail, which has to be finished > in sequence. > > Fixes: 39368ebfc6 ("ring: introduce C11 memory model barrier option") > Cc: stable@dpdk.org > > Reviewed-by: Honnappa Nagarahalli > Reviewed-by: Steve Capper > Reviewed-by: Ola Liljedahl > Signed-off-by: Gavin Hu Your Signed-off-by should be first in the list. These tags are added in the chronological order.