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] [day] [month] [year] [list]
Message-ID: <CAOuPNLiu23e4O_tP=1nzgAp4vyhsW7gH2351Y6oxbjK2NGEFRA@mail.gmail.com>
Date: Sun, 6 Oct 2024 13:51:57 +0530
From: Pintu Agarwal <pintu.ping@...il.com>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc: Pintu Kumar <quic_pintu@...cinc.com>, hannes@...xchg.org, surenb@...gle.com, 
	peterz@...radead.org, mingo@...hat.com, juri.lelli@...hat.com, 
	vincent.guittot@...aro.org, dietmar.eggemann@....com, rostedt@...dmis.org, 
	bsegall@...gle.com, mgorman@...e.de, vschneid@...hat.com, 
	linux-kernel@...r.kernel.org, joe@...ches.com, skhan@...uxfoundation.org
Subject: Re: [PATCH v4] sched/psi: fix memory barrier without comment warnings

On Sun, 6 Oct 2024 at 12:33, Christophe JAILLET
<christophe.jaillet@...adoo.fr> wrote:
>
> Le 06/10/2024 à 08:00, Pintu Kumar a écrit :
> > These warnings were reported by checkpatch.
> > Fix them with minor changes.
> > No functional changes.
> >
> > WARNING: memory barrier without comment
> > +       t = smp_load_acquire(trigger_ptr);
> >
> > WARNING: memory barrier without comment
> > +       smp_store_release(&seq->private, new);
> >
> > Signed-off-by: Pintu Kumar <quic_pintu@...cinc.com>
> >
> > ---
> > Changes in V4:
> > Added () in comment as well suggested by Christophe JAILLET.
> > V3: https://lore.kernel.org/all/00aeb243-3d47-42be-b52c-08b39c5fef07@wanadoo.fr/
> > Changes in V3:
> > Removed signature of Joe as requested. No other change.
> > V2: https://lore.kernel.org/all/CAOuPNLi1mUKW_vv0E6Ynzvdw_rHvCye+nAf2bWv6Qj9A8ofX1g@mail.gmail.com/
> > Changes in V2:
> > Retain printk_deferred warnings as suggested by Joe Perches.
> > V1: https://lore.kernel.org/all/a848671f803ba2b4ab14b0f7b09f0f53a8dd1c4b.camel@perches.com/
> > ---
> >   kernel/sched/psi.c | 2 ++
> >   1 file changed, 2 insertions(+)
> >
> > diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c
> > index 020d58967d4e..175423716e4c 100644
> > --- a/kernel/sched/psi.c
> > +++ b/kernel/sched/psi.c
> > @@ -1474,6 +1474,7 @@ __poll_t psi_trigger_poll(void **trigger_ptr,
> >       if (static_branch_likely(&psi_disabled))
> >               return DEFAULT_POLLMASK | EPOLLERR | EPOLLPRI;
> >
> > +     /* Pairs with the smp_store_release() in psi_write */
> >       t = smp_load_acquire(trigger_ptr);
> >       if (!t)
> >               return DEFAULT_POLLMASK | EPOLLERR | EPOLLPRI;
> > @@ -1557,6 +1558,7 @@ static ssize_t psi_write(struct file *file, const char __user *user_buf,
> >               return PTR_ERR(new);
> >       }
> >
> > +     /* Pairs with the smp_store_acquire() in psi_trigger_poll */
>
> Sorry if I was unclear in my previous comment, but my main point is that
> I think that it should be smp_load_acquire() and not smp_store_acquire().
>
> (Also, if you add some (), you could also add them for psi_trigger_poll
> and psi_write)
>
Oh sorry, my bad, I overlooked it again. You are right.
Thank you so much for pointing this out.
I corrected it now. Will push the new patchset again.
{{{
-       /* Pairs with the smp_store_release() in psi_write */
+       /* Pairs with the smp_store_release() in psi_write() */
        t = smp_load_acquire(trigger_ptr);
....
-       /* Pairs with the smp_store_acquire() in psi_trigger_poll */
+       /* Pairs with the smp_load_acquire() in psi_trigger_poll() */
        smp_store_release(&seq->private, new);
}}}

Thanks,
Pintu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ