linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
* [Linux-kernel-mentees] [PATCH] net: xen-netback: hash.c: Use built-in RCU list checking
@ 2020-01-15 14:18 madhuparnabhowmik04
  2020-01-15 15:05 ` Wei Liu
  0 siblings, 1 reply; 6+ messages in thread
From: madhuparnabhowmik04 @ 2020-01-15 14:18 UTC (permalink / raw)
  To: wei.liu, paul
  Cc: paulmck, netdev, linux-kernel, joel, xen-devel, linux-kernel-mentees

From: Madhuparna Bhowmik <madhuparnabhowmik04@gmail.com>

list_for_each_entry_rcu has built-in RCU and lock checking.
Pass cond argument to list_for_each_entry_rcu.

Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik04@gmail.com>
---
 drivers/net/xen-netback/hash.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/xen-netback/hash.c b/drivers/net/xen-netback/hash.c
index 10d580c3dea3..3f9783f70a75 100644
--- a/drivers/net/xen-netback/hash.c
+++ b/drivers/net/xen-netback/hash.c
@@ -51,7 +51,8 @@ static void xenvif_add_hash(struct xenvif *vif, const u8 *tag,
 
 	found = false;
 	oldest = NULL;
-	list_for_each_entry_rcu(entry, &vif->hash.cache.list, link) {
+	list_for_each_entry_rcu(entry, &vif->hash.cache.list, link,
+				lockdep_is_held(&vif->hash.cache.lock)) {
 		/* Make sure we don't add duplicate entries */
 		if (entry->len == len &&
 		    memcmp(entry->tag, tag, len) == 0)
-- 
2.17.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] net: xen-netback: hash.c: Use built-in RCU list checking
  2020-01-15 14:18 [Linux-kernel-mentees] [PATCH] net: xen-netback: hash.c: Use built-in RCU list checking madhuparnabhowmik04
@ 2020-01-15 15:05 ` Wei Liu
  2020-01-15 15:47   ` Madhuparna Bhowmik
  0 siblings, 1 reply; 6+ messages in thread
From: Wei Liu @ 2020-01-15 15:05 UTC (permalink / raw)
  To: madhuparnabhowmik04
  Cc: wei.liu, paulmck, paul, netdev, linux-kernel, joel, xen-devel,
	linux-kernel-mentees

On Wed, Jan 15, 2020 at 07:48:40PM +0530, madhuparnabhowmik04@gmail.com wrote:
> From: Madhuparna Bhowmik <madhuparnabhowmik04@gmail.com>
> 
> list_for_each_entry_rcu has built-in RCU and lock checking.
> Pass cond argument to list_for_each_entry_rcu.
> 
> Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik04@gmail.com>

You seem to have dropped the second hunk which modified
xenvif_flush_hash, is that a mistake?

Wei.

> ---
>  drivers/net/xen-netback/hash.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/xen-netback/hash.c b/drivers/net/xen-netback/hash.c
> index 10d580c3dea3..3f9783f70a75 100644
> --- a/drivers/net/xen-netback/hash.c
> +++ b/drivers/net/xen-netback/hash.c
> @@ -51,7 +51,8 @@ static void xenvif_add_hash(struct xenvif *vif, const u8 *tag,
>  
>  	found = false;
>  	oldest = NULL;
> -	list_for_each_entry_rcu(entry, &vif->hash.cache.list, link) {
> +	list_for_each_entry_rcu(entry, &vif->hash.cache.list, link,
> +				lockdep_is_held(&vif->hash.cache.lock)) {
>  		/* Make sure we don't add duplicate entries */
>  		if (entry->len == len &&
>  		    memcmp(entry->tag, tag, len) == 0)
> -- 
> 2.17.1
> 
_______________________________________________
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] net: xen-netback: hash.c: Use built-in RCU list checking
  2020-01-15 15:05 ` Wei Liu
@ 2020-01-15 15:47   ` Madhuparna Bhowmik
  0 siblings, 0 replies; 6+ messages in thread
From: Madhuparna Bhowmik @ 2020-01-15 15:47 UTC (permalink / raw)
  To: Wei Liu
  Cc: Paul E. McKenney, paul, netdev, linux-kernel, Joel Fernandes,
	xen-devel, linux-kernel-mentees


[-- Attachment #1.1: Type: text/plain, Size: 1520 bytes --]

On Wed, Jan 15, 2020 at 8:35 PM Wei Liu <wei.liu@kernel.org> wrote:

> On Wed, Jan 15, 2020 at 07:48:40PM +0530, madhuparnabhowmik04@gmail.com
> wrote:
> > From: Madhuparna Bhowmik <madhuparnabhowmik04@gmail.com>
> >
> > list_for_each_entry_rcu has built-in RCU and lock checking.
> > Pass cond argument to list_for_each_entry_rcu.
> >
> > Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik04@gmail.com>
>
> You seem to have dropped the second hunk which modified
> xenvif_flush_hash, is that a mistake?
>

I am sorry again, Yes I forgot to add the second hunk.
I will send the final patch with both the hunks in a while.

Thank you,
Madhuparna

Wei.
>
> > ---
> >  drivers/net/xen-netback/hash.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/xen-netback/hash.c
> b/drivers/net/xen-netback/hash.c
> > index 10d580c3dea3..3f9783f70a75 100644
> > --- a/drivers/net/xen-netback/hash.c
> > +++ b/drivers/net/xen-netback/hash.c
> > @@ -51,7 +51,8 @@ static void xenvif_add_hash(struct xenvif *vif, const
> u8 *tag,
> >
> >       found = false;
> >       oldest = NULL;
> > -     list_for_each_entry_rcu(entry, &vif->hash.cache.list, link) {
> > +     list_for_each_entry_rcu(entry, &vif->hash.cache.list, link,
> > +                             lockdep_is_held(&vif->hash.cache.lock)) {
> >               /* Make sure we don't add duplicate entries */
> >               if (entry->len == len &&
> >                   memcmp(entry->tag, tag, len) == 0)
> > --
> > 2.17.1
> >
>

[-- Attachment #1.2: Type: text/html, Size: 2530 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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] net: xen-netback: hash.c: Use built-in RCU list checking
  2020-01-15 15:55 madhuparnabhowmik04
  2020-01-15 17:41 ` Wei Liu
@ 2020-01-17  9:57 ` David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2020-01-17  9:57 UTC (permalink / raw)
  To: madhuparnabhowmik04
  Cc: wei.liu, paulmck, paul, netdev, linux-kernel, joel, xen-devel,
	linux-kernel-mentees

From: madhuparnabhowmik04@gmail.com
Date: Wed, 15 Jan 2020 21:25:53 +0530

> From: Madhuparna Bhowmik <madhuparnabhowmik04@gmail.com>
> 
> list_for_each_entry_rcu has built-in RCU and lock checking.
> Pass cond argument to list_for_each_entry_rcu.
> 
> Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik04@gmail.com>

Applied to net-next.
_______________________________________________
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] net: xen-netback: hash.c: Use built-in RCU list checking
  2020-01-15 15:55 madhuparnabhowmik04
@ 2020-01-15 17:41 ` Wei Liu
  2020-01-17  9:57 ` David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: Wei Liu @ 2020-01-15 17:41 UTC (permalink / raw)
  To: madhuparnabhowmik04
  Cc: wei.liu, paulmck, paul, netdev, linux-kernel, joel, xen-devel,
	linux-kernel-mentees

On Wed, Jan 15, 2020 at 09:25:53PM +0530, madhuparnabhowmik04@gmail.com wrote:
> From: Madhuparna Bhowmik <madhuparnabhowmik04@gmail.com>
> 
> list_for_each_entry_rcu has built-in RCU and lock checking.
> Pass cond argument to list_for_each_entry_rcu.
> 
> Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik04@gmail.com>

Acked-by: Wei Liu <wei.liu@kernel.org>
_______________________________________________
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] net: xen-netback: hash.c: Use built-in RCU list checking
@ 2020-01-15 15:55 madhuparnabhowmik04
  2020-01-15 17:41 ` Wei Liu
  2020-01-17  9:57 ` David Miller
  0 siblings, 2 replies; 6+ messages in thread
From: madhuparnabhowmik04 @ 2020-01-15 15:55 UTC (permalink / raw)
  To: wei.liu, paul
  Cc: paulmck, netdev, linux-kernel, joel, xen-devel, linux-kernel-mentees

From: Madhuparna Bhowmik <madhuparnabhowmik04@gmail.com>

list_for_each_entry_rcu has built-in RCU and lock checking.
Pass cond argument to list_for_each_entry_rcu.

Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik04@gmail.com>
---
 drivers/net/xen-netback/hash.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/xen-netback/hash.c b/drivers/net/xen-netback/hash.c
index 10d580c3dea3..6b7532f7c936 100644
--- a/drivers/net/xen-netback/hash.c
+++ b/drivers/net/xen-netback/hash.c
@@ -51,7 +51,8 @@ static void xenvif_add_hash(struct xenvif *vif, const u8 *tag,
 
 	found = false;
 	oldest = NULL;
-	list_for_each_entry_rcu(entry, &vif->hash.cache.list, link) {
+	list_for_each_entry_rcu(entry, &vif->hash.cache.list, link,
+				lockdep_is_held(&vif->hash.cache.lock)) {
 		/* Make sure we don't add duplicate entries */
 		if (entry->len == len &&
 		    memcmp(entry->tag, tag, len) == 0)
@@ -102,7 +103,8 @@ static void xenvif_flush_hash(struct xenvif *vif)
 
 	spin_lock_irqsave(&vif->hash.cache.lock, flags);
 
-	list_for_each_entry_rcu(entry, &vif->hash.cache.list, link) {
+	list_for_each_entry_rcu(entry, &vif->hash.cache.list, link,
+				lockdep_is_held(&vif->hash.cache.lock)) {
 		list_del_rcu(&entry->link);
 		vif->hash.cache.count--;
 		kfree_rcu(entry, rcu);
-- 
2.17.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-17  9:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-15 14:18 [Linux-kernel-mentees] [PATCH] net: xen-netback: hash.c: Use built-in RCU list checking madhuparnabhowmik04
2020-01-15 15:05 ` Wei Liu
2020-01-15 15:47   ` Madhuparna Bhowmik
2020-01-15 15:55 madhuparnabhowmik04
2020-01-15 17:41 ` Wei Liu
2020-01-17  9:57 ` David Miller

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