diff options
author | Magnus Karlsson <magnus.karlsson@intel.com> | 2019-04-16 14:58:08 +0200 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2019-04-16 20:13:10 -0700 |
commit | f63666de2ba9c1c3ac0ec57fc5d3032514ec80f1 (patch) | |
tree | 8e8af6ef9982d99779a317e02eb16898ed1d5572 /arch/sh/drivers | |
parent | d1b7725dfea3e6c1aff2ee94baf3658aba450fbe (diff) | |
download | linux-f63666de2ba9c1c3ac0ec57fc5d3032514ec80f1.tar.bz2 |
xsk: fix XDP socket ring buffer memory ordering
The ring buffer code of XDP sockets is missing a memory barrier on the
consumer side between the load of the data and the write that signals
that it is ok for the producer to put new data into the buffer. On
architectures that does not guarantee that stores are not reordered
with older loads, the producer might put data into the ring before the
consumer had the chance to read it. As IA does guarantee this
ordering, it would only need a compiler barrier here, but there are no
primitives in Linux for this specific case (hinder writes to be ordered
before older reads) so I had to add a smp_mb() here which will
translate into a run-time synch operation on IA.
Added a longish comment in the code explaining what each barrier in
the ring implementation accomplishes and what would happen if we
removed one of them.
Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'arch/sh/drivers')
0 files changed, 0 insertions, 0 deletions