cp->cp_send_gen is treated as a normal variable, although it may beThere is explicit memory barrier before the value is read outside
used by different threads.
This is fixed by using {READ,WRITE}_ONCE when it is incremented and
READ_ONCE when it is read outside the {acquire,release}_in_xmit
protection.
Normative reference from the Linux-Kernel Memory Model:Having said that, {READ,WRITE}_ONCE usages seems to make
Loads from and stores to shared (but non-atomic) variables should
be protected with the READ_ONCE(), WRITE_ONCE(), and
ACCESS_ONCE().
Clause 5.1.2.4/25 in the C standard is also relevant.
Signed-off-by: HÃkon Bugge <haakon.bugge@xxxxxxxxxx>
Reviewed-by: Knut Omang <knut.omang@xxxxxxxxxx>
---