* [PATCH]ipv6: multicast: In mld_send_cr function moving read lock to second for loop [not found] <CAHSpA58KdjMLnnGdbyDbASJLFuf2BHLsADBuO1jeT_1uFp9GUA@mail.gmail.com> @ 2018-08-17 12:31 ` Guruswamy Basavaiah 2018-08-18 20:58 ` David Miller 0 siblings, 1 reply; 3+ messages in thread From: Guruswamy Basavaiah @ 2018-08-17 12:31 UTC (permalink / raw) To: netdev, davem, Alexey Kuznetsov, Hideaki YOSHIFUJI In function mld_send_cr, the first loop is already protected by idev->mc_lock, it dont need idev->lock read lock, hence moving it only to second for loop. Signed-off-by: Guruswamy Basavaiah <guru2018@gmail.com> --- net/ipv6/mcast.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index d64ee7e..d8e7e15 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c @@ -1860,7 +1860,6 @@ static void mld_send_cr(struct inet6_dev *idev) struct sk_buff *skb = NULL; int type, dtype; - read_lock_bh(&idev->lock); spin_lock(&idev->mc_lock); /* deleted MCA's */ @@ -1897,6 +1896,7 @@ static void mld_send_cr(struct inet6_dev *idev) } spin_unlock(&idev->mc_lock); + read_lock_bh(&idev->lock); /* change recs */ for (pmc = idev->mc_list; pmc; pmc = pmc->next) { spin_lock_bh(&pmc->mca_lock); -- 2.9.5 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH]ipv6: multicast: In mld_send_cr function moving read lock to second for loop 2018-08-17 12:31 ` [PATCH]ipv6: multicast: In mld_send_cr function moving read lock to second for loop Guruswamy Basavaiah @ 2018-08-18 20:58 ` David Miller 2018-09-18 13:21 ` Guruswamy Basavaiah 0 siblings, 1 reply; 3+ messages in thread From: David Miller @ 2018-08-18 20:58 UTC (permalink / raw) To: guru2018; +Cc: netdev, kuznet, yoshfuji From: Guruswamy Basavaiah <guru2018@gmail.com> Date: Fri, 17 Aug 2018 18:01:41 +0530 > @@ -1860,7 +1860,6 @@ static void mld_send_cr(struct inet6_dev *idev) > struct sk_buff *skb = NULL; > int type, dtype; > > - read_lock_bh(&idev->lock); > spin_lock(&idev->mc_lock); > > /* deleted MCA's */ This will lead to deadlocks, idev->mc_lock must be taken with _bh(). I have zero confidence in this change, did you do any stress testing with lockdep enabled? It would have caught this quickly. ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH]ipv6: multicast: In mld_send_cr function moving read lock to second for loop 2018-08-18 20:58 ` David Miller @ 2018-09-18 13:21 ` Guruswamy Basavaiah 0 siblings, 0 replies; 3+ messages in thread From: Guruswamy Basavaiah @ 2018-09-18 13:21 UTC (permalink / raw) To: davem; +Cc: netdev, Alexey Kuznetsov, Hideaki YOSHIFUJI > This will lead to deadlocks, idev->mc_lock must be taken with _bh(). Modified the existing spin_lock to spin_lock_bh > I have zero confidence in this change, did you do any stress testing > with lockdep enabled? It would have caught this quickly. With LOCKDEP enabled ran LTP multicast stress with the below new patch. Test case is successful and LOCKDEP did not catch any dead lock issues. --- >From 789840a6c6f783311ea7dfd832787c27d5b8359f Mon Sep 17 00:00:00 2001 From: Guruswamy Basavaiah <guru2018@gmail.com> Date: Tue, 18 Sep 2018 18:40:21 +0530 Subject: [PATCH] ipv6: multicast: In mld_send_cr function moving read lock to second for loop In function mld_send_cr, the first loop is already protected by idev->mc_lock, it dont need idev->lock read lock, hence moving it only to second for loop. And converting the existing spin_lock to spin_lock_bh Signed-off-by: Guruswamy Basavaiah <guru2018@gmail.com> --- net/ipv6/mcast.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 4ae54aaca373..751e580eb0ed 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c @@ -1912,8 +1912,7 @@ static void mld_send_cr(struct inet6_dev *idev) struct sk_buff *skb = NULL; int type, dtype; - read_lock_bh(&idev->lock); - spin_lock(&idev->mc_lock); + spin_lock_bh(&idev->mc_lock); /* deleted MCA's */ pmc_prev = NULL; @@ -1947,8 +1946,9 @@ static void mld_send_cr(struct inet6_dev *idev) } else pmc_prev = pmc; } - spin_unlock(&idev->mc_lock); + spin_unlock_bh(&idev->mc_lock); + read_lock_bh(&idev->lock); /* change recs */ for (pmc = idev->mc_list; pmc; pmc = pmc->next) { spin_lock_bh(&pmc->mca_lock); -- 2.14.4 On Sun, 19 Aug 2018 at 02:28, David Miller <davem@davemloft.net> wrote: > > From: Guruswamy Basavaiah <guru2018@gmail.com> > Date: Fri, 17 Aug 2018 18:01:41 +0530 > > > @@ -1860,7 +1860,6 @@ static void mld_send_cr(struct inet6_dev *idev) > > struct sk_buff *skb = NULL; > > int type, dtype; > > > > - read_lock_bh(&idev->lock); > > spin_lock(&idev->mc_lock); > > > > /* deleted MCA's */ > > This will lead to deadlocks, idev->mc_lock must be taken with _bh(). > > I have zero confidence in this change, did you do any stress testing > with lockdep enabled? It would have caught this quickly. -- Guruswamy Basavaiah ^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-09-18 18:54 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <CAHSpA58KdjMLnnGdbyDbASJLFuf2BHLsADBuO1jeT_1uFp9GUA@mail.gmail.com> 2018-08-17 12:31 ` [PATCH]ipv6: multicast: In mld_send_cr function moving read lock to second for loop Guruswamy Basavaiah 2018-08-18 20:58 ` David Miller 2018-09-18 13:21 ` Guruswamy Basavaiah
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).