lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1411862731.15768.63.camel@edumazet-glaptop2.roam.corp.google.com>
Date:	Sat, 27 Sep 2014 17:05:31 -0700
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Hannes Frederic Sowa <hannes@...essinduktion.org>
Cc:	Or Gerlitz <gerlitz.or@...il.com>,
	Alexei Starovoitov <ast@...mgrid.com>,
	"David S. Miller" <davem@...emloft.net>,
	Jesper Dangaard Brouer <brouer@...hat.com>,
	Eric Dumazet <edumazet@...gle.com>,
	John Fastabend <john.r.fastabend@...el.com>,
	Linux Netdev List <netdev@...r.kernel.org>,
	Amir Vadai <amirv@...lanox.com>,
	Or Gerlitz <or.gerlitz@...il.com>
Subject: Re: [PATCH net-next] mlx4: optimize xmit path

On Sun, 2014-09-28 at 01:44 +0200, Hannes Frederic Sowa wrote:
> Hi Eric,
> 
> On Sun, Sep 28, 2014, at 00:56, Eric Dumazet wrote:
> > -       ring->cons += txbbs_skipped;
> > +
> > +       /* we want to dirty this cache line once */
> > +       ACCESS_ONCE(ring->last_nr_txbb) = last_nr_txbb;
> > +       ACCESS_ONCE(ring->cons) = ring_cons + txbbs_skipped;
> > +
> 
> Impressive work!
> 
> I wonder if another macro might be useful for those kind of
> dereferences, because ACCESS_ONCE is associated with correctness in my
> mind and those usages only try to optimize access patterns.
> Does OPTIMIZER_HIDE_VAR generate the same code?


If we have 

ring->cons += txbbs_skipped;

Then compiler might issue a RMW instruction.

And this is bad in this case.

I really want to _write_ into this location, and its fast because I
already have in ring_cons the content I fetched maybe hundred of
nanoseconds before, or even thousand of nanoseconds before.

ACCESS_ONCE(XXXX) = y

Is not only for correctness.

It exactly documents the fact that we want to perform a single write.

I believe it is time that people understand how useful is this helper
(Less than 700 occurrences in the whole kernel today, not including
Documentation/*)



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ