From: Amol Grover <frextrite@gmail•com>
To: Santosh Shilimkar <ssantosh@kernel•org>
Cc: "Paul E . McKenney" <paulmck@kernel•org>,
Amol Grover <frextrite@gmail•com>,
linux-kernel@vger•kernel.org,
linux-arm-kernel@lists•infradead.org,
Joel Fernandes <joel@joelfernandes•org>,
linux-kernel-mentees@lists•linuxfoundation.org,
Madhuparna Bhowmik <madhuparnabhowmik04@gmail•com>
Subject: [PATCH] drivers: soc: ti: knav_qmss_queue: Pass lockdep expression to RCU lists
Date: Fri, 10 Jan 2020 18:02:13 +0530 [thread overview]
Message-ID: <20200110123212.26756-1-frextrite@gmail.com> (raw)
inst->handles is traversed using list_for_each_entry_rcu
outside an RCU read-side critical section but under the protection
of knav_dev_lock.
Hence, add corresponding lockdep expression to silence false-positive
lockdep warnings, and harden RCU lists.
Add macro for the corresponding lockdep expression to make the code
clean and concise.
Signed-off-by: Amol Grover <frextrite@gmail•com>
---
drivers/soc/ti/knav_qmss_queue.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/soc/ti/knav_qmss_queue.c b/drivers/soc/ti/knav_qmss_queue.c
index 1ccc9064e1eb..888dc091c63b 100644
--- a/drivers/soc/ti/knav_qmss_queue.c
+++ b/drivers/soc/ti/knav_qmss_queue.c
@@ -25,6 +25,8 @@
static struct knav_device *kdev;
static DEFINE_MUTEX(knav_dev_lock);
+#define knav_dev_lock_held() \
+ lockdep_is_held(&knav_dev_lock)
/* Queue manager register indices in DTS */
#define KNAV_QUEUE_PEEK_REG_INDEX 0
@@ -52,8 +54,9 @@ static DEFINE_MUTEX(knav_dev_lock);
#define knav_queue_idx_to_inst(kdev, idx) \
(kdev->instances + (idx << kdev->inst_shift))
-#define for_each_handle_rcu(qh, inst) \
- list_for_each_entry_rcu(qh, &inst->handles, list)
+#define for_each_handle_rcu(qh, inst) \
+ list_for_each_entry_rcu(qh, &inst->handles, list, \
+ rcu_read_lock_held() || knav_dev_lock_held())
#define for_each_instance(idx, inst, kdev) \
for (idx = 0, inst = kdev->instances; \
--
2.24.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists•infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
reply other threads:[~2020-01-10 12:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20200110123212.26756-1-frextrite@gmail.com \
--to=frextrite@gmail$(echo .)com \
--cc=joel@joelfernandes$(echo .)org \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-kernel-mentees@lists$(echo .)linuxfoundation.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=madhuparnabhowmik04@gmail$(echo .)com \
--cc=paulmck@kernel$(echo .)org \
--cc=ssantosh@kernel$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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