Re: [PATCH 4.19 012/120] tcp: annotate tp->write_seq lockless reads

From: Pavel Machek
Date: Tue Mar 16 2021 - 05:53:55 EST


Hi!

> > From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> >
> > From: Eric Dumazet <edumazet@xxxxxxxxxx>
>
> Dup.

Aha, sorry, crossed mails. Still I wonder if hiding assignment into
macro is good:

> > --- a/net/ipv4/tcp_minisocks.c
> > +++ b/net/ipv4/tcp_minisocks.c
> > @@ -510,7 +510,7 @@ struct sock *tcp_create_openreq_child(co
> > newtp->app_limited = ~0U;
> >
> > tcp_init_xmit_timers(newsk);
> > - newtp->write_seq = newtp->pushed_seq = treq->snt_isn + 1;
> > + WRITE_ONCE(newtp->write_seq, newtp->pushed_seq = treq->snt_isn + 1);
>
> Would it be better to do assignment to pushed_seq outside of
> WRITE_ONCE macro? This is ... "interesting".

Best regards,
Pavel



--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

Attachment: signature.asc
Description: Digital signature