* [PATCH v3] sched/psi: fix memory barrier without comment warnings
@ 2024-10-05 17:45 Pintu Kumar
2024-10-05 18:52 ` Christophe JAILLET
0 siblings, 1 reply; 3+ messages in thread
From: Pintu Kumar @ 2024-10-05 17:45 UTC (permalink / raw)
To: hannes, surenb, peterz, mingo, juri.lelli, vincent.guittot,
dietmar.eggemann, rostedt, bsegall, mgorman, vschneid,
linux-kernel
Cc: joe, skhan, pintu.ping, Pintu Kumar
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 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..4e4ff12fdeae 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 */
smp_store_release(&seq->private, new);
mutex_unlock(&seq->lock);
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] sched/psi: fix memory barrier without comment warnings
2024-10-05 17:45 [PATCH v3] sched/psi: fix memory barrier without comment warnings Pintu Kumar
@ 2024-10-05 18:52 ` Christophe JAILLET
2024-10-06 6:03 ` Pintu Agarwal
0 siblings, 1 reply; 3+ messages in thread
From: Christophe JAILLET @ 2024-10-05 18:52 UTC (permalink / raw)
To: Pintu Kumar, hannes, surenb, peterz, mingo, juri.lelli,
vincent.guittot, dietmar.eggemann, rostedt, bsegall, mgorman,
vschneid, linux-kernel
Cc: joe, skhan, pintu.ping
Le 05/10/2024 à 19:45, 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@quicinc.com>
>
> ---
> 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..4e4ff12fdeae 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 */
smp_load_acquire()?
I would also add some () after the functions name, here and above.
CJ
> smp_store_release(&seq->private, new);
> mutex_unlock(&seq->lock);
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] sched/psi: fix memory barrier without comment warnings
2024-10-05 18:52 ` Christophe JAILLET
@ 2024-10-06 6:03 ` Pintu Agarwal
0 siblings, 0 replies; 3+ messages in thread
From: Pintu Agarwal @ 2024-10-06 6:03 UTC (permalink / raw)
To: Christophe JAILLET
Cc: Pintu Kumar, hannes, surenb, peterz, mingo, juri.lelli,
vincent.guittot, dietmar.eggemann, rostedt, bsegall, mgorman,
vschneid, linux-kernel, joe, skhan
On Sun, 6 Oct 2024 at 00:22, Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
>
> Le 05/10/2024 à 19:45, 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@quicinc.com>
> >
> > ---
> > 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..4e4ff12fdeae 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 */
>
> smp_load_acquire()?
> I would also add some () after the functions name, here and above.
>
Okay added () in comment for function name and sent v4.
Thank you so much for your review.
Thanks,
Pintu
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-06 6:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-05 17:45 [PATCH v3] sched/psi: fix memory barrier without comment warnings Pintu Kumar
2024-10-05 18:52 ` Christophe JAILLET
2024-10-06 6:03 ` Pintu Agarwal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®