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: <CANn89iJkEzcU1-8yJF6AvYUqiE1U8-4oUcLOe73EtV=sHHnjZw@mail.gmail.com>
Date: Wed, 17 Apr 2024 15:41:36 +0200
From: Eric Dumazet <edumazet@...gle.com>
To: Simon Horman <horms@...nel.org>
Cc: "David S. Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, 
	Paolo Abeni <pabeni@...hat.com>, Jamal Hadi Salim <jhs@...atatu.com>, 
	Cong Wang <xiyou.wangcong@...il.com>, Jiri Pirko <jiri@...nulli.us>, netdev@...r.kernel.org, 
	eric.dumazet@...il.com
Subject: Re: [PATCH net-next 04/14] net_sched: sch_choke: implement lockless choke_dump()

On Wed, Apr 17, 2024 at 3:14 PM Simon Horman <horms@...nel.org> wrote:
>
> On Mon, Apr 15, 2024 at 01:20:44PM +0000, Eric Dumazet wrote:
> > Instead of relying on RTNL, choke_dump() can use READ_ONCE()
> > annotations, paired with WRITE_ONCE() ones in choke_change().
> >
> > Also use READ_ONCE(q->limit) in choke_enqueue() as the value
> > could change from choke_change().
>
> Hi Eric,
>
> I'm wondering if you could expand on why q->limit needs this treatment
> but not other fields, f.e. q->parms.qth_min (aka p->qth_min).

Other fields got their WRITE_ONCE() in red_set_parms()

+       WRITE_ONCE(p->qth_min, qth_min << Wlog);
+       WRITE_ONCE(p->qth_max, qth_max << Wlog);
+       WRITE_ONCE(p->Wlog, Wlog);
+       WRITE_ONCE(p->Plog, Plog);


>
> > Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> > ---
> >  include/net/red.h     | 10 +++++-----
> >  net/sched/sch_choke.c | 23 ++++++++++++-----------
> >  2 files changed, 17 insertions(+), 16 deletions(-)
> >
> > diff --git a/include/net/red.h b/include/net/red.h
>
> ...
>
> > @@ -244,7 +244,7 @@ static inline void red_set_parms(struct red_parms *p,
> >               max_P = red_maxp(Plog);
> >               max_P *= delta; /* max_P = (qth_max - qth_min)/2^Plog */
> >       }
> > -     p->max_P = max_P;
> > +     WRITE_ONCE(p->max_P, max_P);
> >       max_p_delta = max_P / delta;
> >       max_p_delta = max(max_p_delta, 1U);
> >       p->max_P_reciprocal  = reciprocal_value(max_p_delta);
>
> A little further down in this function p->Scell_log is set.
> I think it also needs the WRITE_ONCE() treatment as it
> is read in choke_dump().
>

I will squash in v2 the missing WRITE_ONCE(), thanks !

diff --git a/include/net/red.h b/include/net/red.h
index 7daf7cf6130aeccf3d81a77600f4445759f174b7..802287d52c9e37e76ba9154539f511629e4b9780
100644
--- a/include/net/red.h
+++ b/include/net/red.h
@@ -257,7 +257,7 @@ static inline void red_set_parms(struct red_parms *p,
        p->target_min = qth_min + 2*delta;
        p->target_max = qth_min + 3*delta;

-       p->Scell_log    = Scell_log;
+       WRITE_ONCE(p->Scell_log, Scell_log);
        p->Scell_max    = (255 << Scell_log);

        if (stab)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ