Re: [PATCH net-next v4 1/2] tcp: annotate lockless access to sk->sk_err
quanyeyang <[email protected]>
| Newsgroups | gmane.linux.kernel,gmane.linux.network |
|---|---|
| Message-ID | <zEvCcu9s6PbTRajtbCvCik2zCOJsXozLWWvYsLfl6AV4IJLyXmS63i5nuaCmqk_5DsRajMO3IjRtFpOSpmRY55ByjpBJ8NmtwDk-kSpr9bM=@proton.me> |
On Friday, September 18th, 2026 at AM 2:51, David Laight <[email protected]> wrote: > Don't they need annotating with data_race() ? I think READ_ONCE() is the intended marker here. These loads are part of the I/O control flow (stop send/recv/splice), not diagnostic or heuristic reads. data_race() would silence KCSAN but would not restrict compiler optimizations, so the load could still be torn, fused or reissued. READ_ONCE() is a single-copy atomic load and pairs with the existing WRITE_ONCE()/xchg() updates of sk_err, same as tcp_poll() after e13ec3da05d1. sock_error() uses data_race() only on the fast-path "is it zero?" check, which is then validated by xchg(). That pattern does not apply to these peeks. Quanye