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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEXW_YT5+ginWcAM-Bxk7tDcGxOgn-6cuTamBJOzr8ta6_jf+g@mail.gmail.com>
Date:   Wed, 18 Oct 2023 10:32:22 -0400
From:   Joel Fernandes <joel@...lfernandes.org>
To:     Uladzislau Rezki <urezki@...il.com>
Cc:     "Paul E . McKenney" <paulmck@...nel.org>,
        RCU <rcu@...r.kernel.org>,
        Neeraj upadhyay <Neeraj.Upadhyay@....com>,
        Boqun Feng <boqun.feng@...il.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Oleksiy Avramchenko <oleksiy.avramchenko@...y.com>,
        Frederic Weisbecker <frederic@...nel.org>
Subject: Re: [PATCH v3 1/1] rcu: Reduce synchronize_rcu() waiting time

On Tue, Oct 17, 2023 at 10:06 AM Uladzislau Rezki <urezki@...il.com> wrote:
[...]
> > > +
> > > +       /* Finally. */
> > > +       complete(&rs->completion);
> > > +}
> > > +
> > > +static void rcu_sr_normal_gp_cleanup_work(struct work_struct *work)
> > > +{
> > > +       struct llist_node *done, *rcu, *next;
> > > +
> > > +       done = llist_del_all(&sr.done);
> > > +       if (!done)
> > > +               return;
> > > +
> > > +       llist_for_each_safe(rcu, next, done)
> > > +               rcu_sr_normal_complete(rcu);
> > > +}
> > [...]
> > > +static void rcu_sr_normal_add_req(struct rcu_synchronize *rs)
> > > +{
> > > +       atomic_inc(&sr.active);
> > > +       if (llist_add((struct llist_node *) &rs->head, &sr.curr))
> > > +               /* Set the tail. Only first and one user can do that. */
> > > +               WRITE_ONCE(sr.curr_tail, (struct llist_node *) &rs->head);
> > > +       atomic_dec(&sr.active);
> >
> > Here there is no memory ordering provided by the atomic ops. Is that really Ok?
> >
> This needs to be reworked since there is no ordering guaranteed. I think
> there is a version of "atomic_inc_something" that guarantees it?

Yeah there is atomic_fetch_{inc,dec}{_acquire,_release}()

Or:
  atomic_inc(&sr.active);
  smp_mb__after_atomic();

  smp_mb__before_atomic();
  atomic_dec(&sr.active);

?

That's probably better because we don't need ordering before the inc
or after the dec, AFAICS.

I am actually a bit surprised there is no atomic_inc_acquire() yet. :-)

Thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ