From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Lino Sanfilippo" Subject: Aw: Re: [PATCH] mlx4: give precise rx/tx bytes/packets counters Date: Fri, 25 Nov 2016 17:30:57 +0100 Message-ID: References: <1480088780.8455.543.camel@edumazet-glaptop3.roam.corp.google.com> <063D6719AE5E284EB5DD2968C1650D6DB0228849@AcuExch.aculab.com>, <1480090590.8455.549.camel@edumazet-glaptop3.roam.corp.google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Cc: "David Laight" , "David Miller" , netdev , "Tariq Toukan" To: "Eric Dumazet" Return-path: Received: from mout.gmx.net ([212.227.17.21]:60061 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755530AbcKYQbg (ORCPT ); Fri, 25 Nov 2016 11:31:36 -0500 In-Reply-To: <1480090590.8455.549.camel@edumazet-glaptop3.roam.corp.google.com> Sender: netdev-owner@vger.kernel.org List-ID: Hi, > > The READ_ONCE() are documenting the fact that no lock is taken to fetch > the stats, while another cpus might being changing them. > > I had no answer yet from https://patchwork.ozlabs.org/patch/698449/ > > So I thought it was not needed to explain this in the changelog, given > that it apparently is one of the few things that can block someone to > understand one of my changes :/ > > Apparently nobody really understands READ_ONCE() purpose, it is really a > pity we have to explain this over and over. > Even at the risk of showing once more a lack of understanding for READ_ONCE(): Does not a READ_ONCE() have to e paired with some kind of WRITE_ONCE()? Furthermore: there a quite some network drivers that ensure visibility of the descriptor queue indices between xmit and xmit completion function by means of smp barriers. Could all these drivers theoretically be adjusted to use READ_ONCE(), WRITE_ONCE() for the indices instead? Regards, Lino