linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
* [Linux-kernel-mentees] [PATCH v2] drivers: soc: ti: knav_qmss_queue: Pass lockdep expression to RCU lists
@ 2020-01-17 13:30 Amol Grover
  2020-01-17 18:24 ` santosh.shilimkar
  0 siblings, 1 reply; 6+ messages in thread
From: Amol Grover @ 2020-01-17 13:30 UTC (permalink / raw)
  To: Santosh Shilimkar
  Cc: Paul E . McKenney, linux-kernel, linux-arm-kernel,
	Joel Fernandes, linux-kernel-mentees

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.

Signed-off-by: Amol Grover <frextrite@gmail.com>
---
v2:
- Remove rcu_read_lock_held() from lockdep expression since it is
  implicitly checked for.

 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..37f3db6c041c 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,	\
+				knav_dev_lock_held())
 
 #define for_each_instance(idx, inst, kdev)		\
 	for (idx = 0, inst = kdev->instances;		\
-- 
2.24.1

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Linux-kernel-mentees] [PATCH v2] drivers: soc: ti: knav_qmss_queue: Pass lockdep expression to RCU lists
  2020-01-17 13:30 [Linux-kernel-mentees] [PATCH v2] drivers: soc: ti: knav_qmss_queue: Pass lockdep expression to RCU lists Amol Grover
@ 2020-01-17 18:24 ` santosh.shilimkar
  2020-01-17 19:25   ` Olof Johansson
  0 siblings, 1 reply; 6+ messages in thread
From: santosh.shilimkar @ 2020-01-17 18:24 UTC (permalink / raw)
  To: Amol Grover, arm-soc
  Cc: Paul E . McKenney, linux-kernel, linux-arm-kernel,
	Santosh Shilimkar, Joel Fernandes, linux-kernel-mentees

On 1/17/20 5:30 AM, Amol Grover wrote:
> 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.
> 
> Signed-off-by: Amol Grover <frextrite@gmail.com>
> ---
> v2:
> - Remove rcu_read_lock_held() from lockdep expression since it is
>    implicitly checked for.
> 
Looks fine to me.

Hi Olof, Arnd,
Can you please pick this one and apply to your driver-soc branch ?
I already sent out pull request and hence the request.

regards,
Santosh
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Linux-kernel-mentees] [PATCH v2] drivers: soc: ti: knav_qmss_queue: Pass lockdep expression to RCU lists
  2020-01-17 18:24 ` santosh.shilimkar
@ 2020-01-17 19:25   ` Olof Johansson
  2020-01-18  4:07     ` Amol Grover
  0 siblings, 1 reply; 6+ messages in thread
From: Olof Johansson @ 2020-01-17 19:25 UTC (permalink / raw)
  To: santosh.shilimkar
  Cc: Paul E . McKenney, linux-kernel, arm-soc, Santosh Shilimkar,
	Joel Fernandes, linux-kernel-mentees, linux-arm-kernel

On Fri, Jan 17, 2020 at 10:24:04AM -0800, santosh.shilimkar@oracle.com wrote:
> On 1/17/20 5:30 AM, Amol Grover wrote:
> > 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.
> > 
> > Signed-off-by: Amol Grover <frextrite@gmail.com>
> > ---
> > v2:
> > - Remove rcu_read_lock_held() from lockdep expression since it is
> >    implicitly checked for.
> > 
> Looks fine to me.
> 
> Hi Olof, Arnd,
> Can you please pick this one and apply to your driver-soc branch ?
> I already sent out pull request and hence the request.

Hi,

Can you please email the whole patch with sign-off to
soc@kernel.org? Otherwise it won't end up in patchwork, which is how we track
patches and pull requests these days.


Thanks,

-Olof
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Linux-kernel-mentees] [PATCH v2] drivers: soc: ti: knav_qmss_queue: Pass lockdep expression to RCU lists
  2020-01-17 19:25   ` Olof Johansson
@ 2020-01-18  4:07     ` Amol Grover
  0 siblings, 0 replies; 6+ messages in thread
From: Amol Grover @ 2020-01-18  4:07 UTC (permalink / raw)
  To: Olof Johansson
  Cc: Paul E . McKenney, santosh.shilimkar, linux-kernel, arm-soc,
	Santosh Shilimkar, Joel Fernandes, linux-kernel-mentees,
	linux-arm-kernel

On Fri, Jan 17, 2020 at 11:25:55AM -0800, Olof Johansson wrote:
> On Fri, Jan 17, 2020 at 10:24:04AM -0800, santosh.shilimkar@oracle.com wrote:
> > On 1/17/20 5:30 AM, Amol Grover wrote:
> > > 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.
> > > 
> > > Signed-off-by: Amol Grover <frextrite@gmail.com>
> > > ---
> > > v2:
> > > - Remove rcu_read_lock_held() from lockdep expression since it is
> > >    implicitly checked for.
> > > 
> > Looks fine to me.
> > 
> > Hi Olof, Arnd,
> > Can you please pick this one and apply to your driver-soc branch ?
> > I already sent out pull request and hence the request.
> 
> Hi,
> 
> Can you please email the whole patch with sign-off to
> soc@kernel.org? Otherwise it won't end up in patchwork, which is how we track
> patches and pull requests these days.
> 

Thank you Santosh and Olof. I'm resending the patch to soc@kernel.org
as well.

Thanks
Amol

> 
> Thanks,
> 
> -Olof
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Linux-kernel-mentees] [PATCH v2] drivers: soc: ti: knav_qmss_queue: Pass lockdep expression to RCU lists
  2020-01-18  4:24 Amol Grover
@ 2020-01-18 18:06 ` santosh.shilimkar
  0 siblings, 0 replies; 6+ messages in thread
From: santosh.shilimkar @ 2020-01-18 18:06 UTC (permalink / raw)
  To: Amol Grover, Santosh Shilimkar, Olof Johansson
  Cc: Paul E . McKenney, linux-kernel, soc, arm, Joel Fernandes,
	linux-kernel-mentees, linux-arm-kernel

On 1/17/20 8:24 PM, Amol Grover wrote:
> 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.
> 
> Signed-off-by: Amol Grover <frextrite@gmail.com>
> ---
> v2:
> - Remove rcu_read_lock_held() from lockdep expression since it is
>    implicitly checked for.
>
Thanks.
Acked-by: Santosh Shilimkar <ssantosh@kernel.org>

>   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..37f3db6c041c 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,	\
> +				knav_dev_lock_held())
>   
>   #define for_each_instance(idx, inst, kdev)		\
>   	for (idx = 0, inst = kdev->instances;		\
> 
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Linux-kernel-mentees] [PATCH v2] drivers: soc: ti: knav_qmss_queue: Pass lockdep expression to RCU lists
@ 2020-01-18  4:24 Amol Grover
  2020-01-18 18:06 ` santosh.shilimkar
  0 siblings, 1 reply; 6+ messages in thread
From: Amol Grover @ 2020-01-18  4:24 UTC (permalink / raw)
  To: Santosh Shilimkar, Olof Johansson
  Cc: Paul E . McKenney, santosh.shilimkar, linux-kernel, soc, arm,
	Joel Fernandes, linux-kernel-mentees, linux-arm-kernel

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.

Signed-off-by: Amol Grover <frextrite@gmail.com>
---
v2:
- Remove rcu_read_lock_held() from lockdep expression since it is
  implicitly checked for.

 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..37f3db6c041c 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,	\
+				knav_dev_lock_held())
 
 #define for_each_instance(idx, inst, kdev)		\
 	for (idx = 0, inst = kdev->instances;		\
-- 
2.24.1

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-01-18 18:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-17 13:30 [Linux-kernel-mentees] [PATCH v2] drivers: soc: ti: knav_qmss_queue: Pass lockdep expression to RCU lists Amol Grover
2020-01-17 18:24 ` santosh.shilimkar
2020-01-17 19:25   ` Olof Johansson
2020-01-18  4:07     ` Amol Grover
2020-01-18  4:24 Amol Grover
2020-01-18 18:06 ` santosh.shilimkar

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