Skip to contentSkip to conversation

sched/psi: fix memory barrier without comment warnings

PATCH Superseded Pintu Kumar 3 participants 3 messages Oct 5, 2024 – Oct 6, 2024

Subsystems (2)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 sched/psi: fix memory barrier without comment warnings

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);

---
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/[email protected]/

---
 kernel/sched/psi.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/sched/psi.c +2 -0
index 020d58967d4e..4e4ff12fdeae 100644
@@ -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);
 
Signature · 1 line
2.17.1
#1 lore raw

Le 05/10/2024 à 19:45, Pintu Kumar a écrit :

Quoted 36 lines

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);

---
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/[email protected]/

---
  kernel/sched/psi.c | 2 ++
  1 file changed, 2 insertions(+)
kernel/sched/psi.c +1 -0
index 020d58967d4e..4e4ff12fdeae 100644
@@ -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;

kernel/sched/psi.c static ssize_t psi_write(struct file *file, const char __user *user_buf, · line 1561

Quoted 4 lines
kernel/sched/psi.c +1 -0
@@ -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

Quoted 3 lines
kernel/sched/psi.c +0 -0
  	smp_store_release(&seq->private, new);
  	mutex_unlock(&seq->lock);
 
#2 lore raw
Quoted 41 lines · Christophe JAILLET
Quoted 39 lines · 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);

---
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/[email protected]/

---
  kernel/sched/psi.c | 2 ++
  1 file changed, 2 insertions(+)
kernel/sched/psi.c +1 -0
index 020d58967d4e..4e4ff12fdeae 100644
@@ -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);
      }
 
Quoted 5 lines

kernel/sched/psi.c static ssize_t psi_write(struct file *file, const char __user *user_buf, · line 1561

Quoted 1 line
kernel/sched/psi.c +1 -0
+     /* 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