From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756380AbeATABM (ORCPT ); Fri, 19 Jan 2018 19:01:12 -0500 Received: from violet.fr.zoreil.com ([92.243.8.30]:55299 "EHLO violet.fr.zoreil.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756246AbeATABE (ORCPT ); Fri, 19 Jan 2018 19:01:04 -0500 Date: Sat, 20 Jan 2018 01:00:12 +0100 From: Francois Romieu To: Peter Zijlstra Cc: Jia-Ju Bai , nic_swsd@realtek.com, alexander.h.duyck@redhat.com, David Miller , dhowells@redhat.com, paulmck@linux.vnet.ibm.com, will.deacon@arm.com, netdev@vger.kernel.org, Linux Kernel Mailing List Subject: Re: net: r8169: a question of memory barrier in the r8169 driver Message-ID: <20180120000012.GB14475@electric-eye.fr.zoreil.com> References: <9a373156-41e5-a78b-cd31-c4b9bdba2696@gmail.com> <20180118150658.GE2249@hirez.programming.kicks-ass.net> <20180119011118.GB15920@electric-eye.fr.zoreil.com> <20180119171442.GY2228@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180119171442.GY2228@hirez.programming.kicks-ass.net> X-Organisation: Land of Sunshine Inc. User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Peter Zijlstra : > On Fri, Jan 19, 2018 at 02:11:18AM +0100, Francois Romieu wrote: > > Peter Zijlstra : > > [...] > > > There is only 1 variable afaict. Memory barriers need at least 2 in > > > order to be able to do _anything_. > > > > I don't get your point: why don't {cur_tx, dirty_tx} qualify as said > > two variables ? > > There wasn't any cur_tx in the code you provided. /* A skbuff with nr_frags needs nr_frags+1 entries in the tx queue */ #define TX_FRAGS_READY_FOR(tp,nr_frags) \ (TX_SLOTS_AVAIL(tp) >= (nr_frags + 1)) #define TX_SLOTS_AVAIL(tp) \ (tp->dirty_tx + NUM_TX_DESC - tp->cur_tx) Both are also used in rtl_tx. I don't get your point. Even a single variable is scattered through the system. -- Ueimor