[PATCH v5] sched/psi: fix memory barrier without comment warnings

Pintu Kumar posted 1 patch 1 year, 4 months ago
kernel/sched/psi.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH v5] sched/psi: fix memory barrier without comment warnings
Posted by Pintu Kumar 1 year, 4 months ago
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@quicinc.com>

---
Changes in V5:
Corrected api name and missing () in comments as suggested by Christophe JAILLET.
V4: https://lore.kernel.org/all/a8393bc0-6f56-4e40-b971-4a837cf28323@wanadoo.fr/
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..907fa3830c8e 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_load_acquire() in psi_trigger_poll() */
 	smp_store_release(&seq->private, new);
 	mutex_unlock(&seq->lock);
 
-- 
2.17.1
Re: [PATCH v5] sched/psi: fix memory barrier without comment warnings
Posted by Suren Baghdasaryan 1 year, 3 months ago
On Sun, Oct 6, 2024 at 1:29 AM Pintu Kumar <quic_pintu@quicinc.com> wrote:
>
> 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@quicinc.com>

Acked-by: Suren Baghdasaryan <surenb@google.com>

>
> ---
> Changes in V5:
> Corrected api name and missing () in comments as suggested by Christophe JAILLET.
> V4: https://lore.kernel.org/all/a8393bc0-6f56-4e40-b971-4a837cf28323@wanadoo.fr/
> 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..907fa3830c8e 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_load_acquire() in psi_trigger_poll() */
>         smp_store_release(&seq->private, new);
>         mutex_unlock(&seq->lock);
>
> --
> 2.17.1
>
Re: [PATCH v5] sched/psi: fix memory barrier without comment warnings
Posted by Pintu Agarwal 1 year, 3 months ago
Hi,

On Tue, 15 Oct 2024 at 02:36, Suren Baghdasaryan <surenb@google.com> wrote:
>
> On Sun, Oct 6, 2024 at 1:29 AM Pintu Kumar <quic_pintu@quicinc.com> wrote:
> >
> > 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@quicinc.com>
>
> Acked-by: Suren Baghdasaryan <surenb@google.com>
>

Any further comment on this ?
Re: [PATCH v5] sched/psi: fix memory barrier without comment warnings
Posted by Pintu Agarwal 1 year, 2 months ago
Hi,

On Wed, 23 Oct 2024 at 19:57, Pintu Agarwal <pintu.ping@gmail.com> wrote:
>
> Hi,
>
> On Tue, 15 Oct 2024 at 02:36, Suren Baghdasaryan <surenb@google.com> wrote:
> >
> > On Sun, Oct 6, 2024 at 1:29 AM Pintu Kumar <quic_pintu@quicinc.com> wrote:
> > >
> > > 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@quicinc.com>
> >
> > Acked-by: Suren Baghdasaryan <surenb@google.com>
> >
>
> Any further comment on this ?

Just a follow up. Are we picking this or I need to push again ?

Thanks,
Pintu
Re: [PATCH v5] sched/psi: fix memory barrier without comment warnings
Posted by Suren Baghdasaryan 1 year, 2 months ago
On Wed, Nov 27, 2024 at 5:25 PM Pintu Agarwal <pintu.ping@gmail.com> wrote:
>
> Hi,
>
> On Wed, 23 Oct 2024 at 19:57, Pintu Agarwal <pintu.ping@gmail.com> wrote:
> >
> > Hi,
> >
> > On Tue, 15 Oct 2024 at 02:36, Suren Baghdasaryan <surenb@google.com> wrote:
> > >
> > > On Sun, Oct 6, 2024 at 1:29 AM Pintu Kumar <quic_pintu@quicinc.com> wrote:
> > > >
> > > > 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@quicinc.com>
> > >
> > > Acked-by: Suren Baghdasaryan <surenb@google.com>
> > >
> >
> > Any further comment on this ?
>
> Just a follow up. Are we picking this or I need to push again ?

I'm guessing it just fell through the cracks. Peter, could you please
pick it into your tree?
Thanks,
Suren.

>
> Thanks,
> Pintu
Re: [PATCH v5] sched/psi: fix memory barrier without comment warnings
Posted by Pintu Agarwal 1 year, 2 months ago
On Sat, 30 Nov 2024 at 04:34, Suren Baghdasaryan <surenb@google.com> wrote:
>
> On Wed, Nov 27, 2024 at 5:25 PM Pintu Agarwal <pintu.ping@gmail.com> wrote:
> >
> > Hi,
> >
> > On Wed, 23 Oct 2024 at 19:57, Pintu Agarwal <pintu.ping@gmail.com> wrote:
> > >
> > > Hi,
> > >
> > > On Tue, 15 Oct 2024 at 02:36, Suren Baghdasaryan <surenb@google.com> wrote:
> > > >
> > > > On Sun, Oct 6, 2024 at 1:29 AM Pintu Kumar <quic_pintu@quicinc.com> wrote:
> > > > >
> > > > > 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@quicinc.com>
> > > >
> > > > Acked-by: Suren Baghdasaryan <surenb@google.com>
> > > >
> > >
> > > Any further comment on this ?
> >
> > Just a follow up. Are we picking this or I need to push again ?
>
> I'm guessing it just fell through the cracks. Peter, could you please
> pick it into your tree?

Thanks Suren for the update.


Regards,
Pintu
Re: [PATCH v5] sched/psi: fix memory barrier without comment warnings
Posted by Pintu Agarwal 1 year, 3 months ago
Hi,

On Sun, 6 Oct 2024 at 13:59, Pintu Kumar <quic_pintu@quicinc.com> wrote:
>
> 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@quicinc.com>
>
> ---
> Changes in V5:
> Corrected api name and missing () in comments as suggested by Christophe JAILLET.
> V4: https://lore.kernel.org/all/a8393bc0-6f56-4e40-b971-4a837cf28323@wanadoo.fr/
> 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..907fa3830c8e 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_load_acquire() in psi_trigger_poll() */
>         smp_store_release(&seq->private, new);
>         mutex_unlock(&seq->lock);
>
> --
> 2.17.1
>
Addressed all review comments on this latest v5.
Any further comments on this patchset ?

Thanks,
Pintu