From: madhuparnabhowmik10@gmail.com
To: rjw@rjwysocki.net, pavel@ucw.cz, len.brown@intel.com,
gregkh@linuxfoundation.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
joel@joelfernandes.org, frextrite@gmail.com,
linux-kernel-mentees@lists.linuxfoundation.org,
paulmck@kernel.org,
Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
Subject: [PATCH 2/2] drivers: base: power: wakeup.c: Use built-in RCU list checking
Date: Fri, 28 Feb 2020 23:17:45 +0530 [thread overview]
Message-ID: <20200228174745.9308-1-madhuparnabhowmik10@gmail.com> (raw)
From: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
Pass cond argument to list_for_each_entry_rcu() to fix the
following false positive lockdep warning and other uses of
list_for_each_entry_rcu() in wakeup.c.
[ 331.934648] =============================
[ 331.934650] WARNING: suspicious RCU usage
[ 331.934653] 5.6.0-rc1+ #5 Not tainted
[ 331.934655] -----------------------------
[ 331.934657] drivers/base/power/wakeup.c:408 RCU-list traversed in non-reader section!!
[ 333.025156] =============================
[ 333.025161] WARNING: suspicious RCU usage
[ 333.025168] 5.6.0-rc1+ #5 Not tainted
[ 333.025173] -----------------------------
[ 333.025180] drivers/base/power/wakeup.c:424 RCU-list traversed in non-reader section!!
Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
---
drivers/base/power/wakeup.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
index 27f3e60608e5..d9fefc65ac34 100644
--- a/drivers/base/power/wakeup.c
+++ b/drivers/base/power/wakeup.c
@@ -405,7 +405,8 @@ void device_wakeup_arm_wake_irqs(void)
int srcuidx;
srcuidx = srcu_read_lock(&wakeup_srcu);
- list_for_each_entry_rcu(ws, &wakeup_sources, entry)
+ list_for_each_entry_rcu(ws, &wakeup_sources, entry,
+ srcu_read_lock_held(&wakeup_srcu))
dev_pm_arm_wake_irq(ws->wakeirq);
srcu_read_unlock(&wakeup_srcu, srcuidx);
}
@@ -421,7 +422,8 @@ void device_wakeup_disarm_wake_irqs(void)
int srcuidx;
srcuidx = srcu_read_lock(&wakeup_srcu);
- list_for_each_entry_rcu(ws, &wakeup_sources, entry)
+ list_for_each_entry_rcu(ws, &wakeup_sources, entry,
+ srcu_read_lock_held(&wakeup_srcu))
dev_pm_disarm_wake_irq(ws->wakeirq);
srcu_read_unlock(&wakeup_srcu, srcuidx);
}
@@ -874,7 +876,8 @@ void pm_print_active_wakeup_sources(void)
struct wakeup_source *last_activity_ws = NULL;
srcuidx = srcu_read_lock(&wakeup_srcu);
- list_for_each_entry_rcu(ws, &wakeup_sources, entry) {
+ list_for_each_entry_rcu(ws, &wakeup_sources, entry,
+ srcu_read_lock_held(&wakeup_srcu)) {
if (ws->active) {
pm_pr_dbg("active wakeup source: %s\n", ws->name);
active = 1;
@@ -1025,7 +1028,8 @@ void pm_wakep_autosleep_enabled(bool set)
int srcuidx;
srcuidx = srcu_read_lock(&wakeup_srcu);
- list_for_each_entry_rcu(ws, &wakeup_sources, entry) {
+ list_for_each_entry_rcu(ws, &wakeup_sources, entry,
+ srcu_read_lock_held(&wakeup_srcu)) {
spin_lock_irq(&ws->lock);
if (ws->autosleep_enabled != set) {
ws->autosleep_enabled = set;
@@ -1104,7 +1108,8 @@ static void *wakeup_sources_stats_seq_start(struct seq_file *m,
}
*srcuidx = srcu_read_lock(&wakeup_srcu);
- list_for_each_entry_rcu(ws, &wakeup_sources, entry) {
+ list_for_each_entry_rcu(ws, &wakeup_sources, entry,
+ srcu_read_lock_held(&wakeup_srcu)) {
if (n-- <= 0)
return ws;
}
--
2.17.1
next reply other threads:[~2020-02-28 17:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-28 17:47 madhuparnabhowmik10 [this message]
2020-03-03 19:42 [PATCH 2/2] drivers: base: power: wakeup.c: Use built-in RCU list checking madhuparnabhowmik10
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200228174745.9308-1-madhuparnabhowmik10@gmail.com \
--to=madhuparnabhowmik10@gmail.com \
--cc=frextrite@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=joel@joelfernandes.org \
--cc=len.brown@intel.com \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=pavel@ucw.cz \
--cc=rjw@rjwysocki.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).