From: Eric Dumazet <eric.dumazet@gmail.com>
To: Taehee Yoo <ap420073@gmail.com>,
netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org
Cc: jwi@linux.ibm.com, kgraul@linux.ibm.com, hca@linux.ibm.com,
gor@linux.ibm.com, borntraeger@de.ibm.com,
mareklindner@neomailbox.ch, sw@simonwunderlich.de, a@unstable.cc,
sven@narfation.org, yoshfuji@linux-ipv6.org, dsahern@kernel.org,
linux-s390@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org
Subject: Re: [PATCH net-next v3 7/7] mld: add mc_lock for protecting per-interface mld data
Date: Tue, 30 Mar 2021 13:59:32 +0200 [thread overview]
Message-ID: <fd460c2b-b974-db00-5097-4af08f12c670@gmail.com> (raw)
In-Reply-To: <20210325161657.10517-8-ap420073@gmail.com>
On 3/25/21 5:16 PM, Taehee Yoo wrote:
> The purpose of this lock is to avoid a bottleneck in the query/report
> event handler logic.
>
> By previous patches, almost all mld data is protected by RTNL.
> So, the query and report event handler, which is data path logic
> acquires RTNL too. Therefore if a lot of query and report events
> are received, it uses RTNL for a long time.
> So it makes the control-plane bottleneck because of using RTNL.
> In order to avoid this bottleneck, mc_lock is added.
>
> mc_lock protect only per-interface mld data and per-interface mld
> data is used in the query/report event handler logic.
> So, no longer rtnl_lock is needed in the query/report event handler logic.
> Therefore bottleneck will be disappeared by mc_lock.
>
What testsuite have you run exactly to validate this monster patch ?
Have you used CONFIG_LOCKDEP=y / CONFIG_DEBUG_ATOMIC_SLEEP=y ?
> Suggested-by: Cong Wang <xiyou.wangcong@gmail.com>
> Signed-off-by: Taehee Yoo <ap420073@gmail.com>
[...]
> /*
> - * device multicast group del
> + * device multicast group del
> */
> int __ipv6_dev_mc_dec(struct inet6_dev *idev, const struct in6_addr *addr)
> {
> @@ -943,8 +967,9 @@ int __ipv6_dev_mc_dec(struct inet6_dev *idev, const struct in6_addr *addr)
>
> ASSERT_RTNL();
>
> + mutex_lock(&idev->mc_lock);
> for (map = &idev->mc_list;
> - (ma = rtnl_dereference(*map));
> + (ma = mc_dereference(*map, idev));
> map = &ma->next) {
> if (ipv6_addr_equal(&ma->mca_addr, addr)) {
> if (--ma->mca_users == 0) {
This can be called with rcu_bh held, thus :
BUG: sleeping function called from invalid context at kernel/locking/mutex.c:928
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 4624, name: kworker/1:2
4 locks held by kworker/1:2/4624:
#0: ffff88802135d138 ((wq_completion)ipv6_addrconf){+.+.}-{0:0}, at: arch_atomic64_set arch/x86/include/asm/atomic64_64.h:34 [inline]
#0: ffff88802135d138 ((wq_completion)ipv6_addrconf){+.+.}-{0:0}, at: atomic64_set include/asm-generic/atomic-instrumented.h:856 [inline]
#0: ffff88802135d138 ((wq_completion)ipv6_addrconf){+.+.}-{0:0}, at: atomic_long_set include/asm-generic/atomic-long.h:41 [inline]
#0: ffff88802135d138 ((wq_completion)ipv6_addrconf){+.+.}-{0:0}, at: set_work_data kernel/workqueue.c:616 [inline]
#0: ffff88802135d138 ((wq_completion)ipv6_addrconf){+.+.}-{0:0}, at: set_work_pool_and_clear_pending kernel/workqueue.c:643 [inline]
#0: ffff88802135d138 ((wq_completion)ipv6_addrconf){+.+.}-{0:0}, at: process_one_work+0x871/0x1600 kernel/workqueue.c:2246
#1: ffffc90009adfda8 ((addr_chk_work).work){+.+.}-{0:0}, at: process_one_work+0x8a5/0x1600 kernel/workqueue.c:2250
#2: ffffffff8d66d328 (rtnl_mutex){+.+.}-{3:3}, at: addrconf_verify_work+0xa/0x20 net/ipv6/addrconf.c:4572
#3: ffffffff8bf74300 (rcu_read_lock_bh){....}-{1:2}, at: addrconf_verify_rtnl+0x2b/0x1150 net/ipv6/addrconf.c:4459
Preemption disabled at:
[<ffffffff87b39f41>] local_bh_disable include/linux/bottom_half.h:19 [inline]
[<ffffffff87b39f41>] rcu_read_lock_bh include/linux/rcupdate.h:727 [inline]
[<ffffffff87b39f41>] addrconf_verify_rtnl+0x41/0x1150 net/ipv6/addrconf.c:4461
CPU: 1 PID: 4624 Comm: kworker/1:2 Not tainted 5.12.0-rc4-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: ipv6_addrconf addrconf_verify_work
Call Trace:
__dump_stack lib/dump_stack.c:79 [inline]
dump_stack+0x141/0x1d7 lib/dump_stack.c:120
___might_sleep.cold+0x1f1/0x237 kernel/sched/core.c:8328
__mutex_lock_common kernel/locking/mutex.c:928 [inline]
__mutex_lock+0xa9/0x1120 kernel/locking/mutex.c:1096
__ipv6_dev_mc_dec+0x5f/0x340 net/ipv6/mcast.c:970
addrconf_leave_solict net/ipv6/addrconf.c:2182 [inline]
addrconf_leave_solict net/ipv6/addrconf.c:2174 [inline]
__ipv6_ifa_notify+0x5b6/0xa90 net/ipv6/addrconf.c:6077
ipv6_ifa_notify net/ipv6/addrconf.c:6100 [inline]
ipv6_del_addr+0x463/0xae0 net/ipv6/addrconf.c:1294
addrconf_verify_rtnl+0xd59/0x1150 net/ipv6/addrconf.c:4488
addrconf_verify_work+0xf/0x20 net/ipv6/addrconf.c:4573
process_one_work+0x98d/0x1600 kernel/workqueue.c:2275
worker_thread+0x64c/0x1120 kernel/workqueue.c:2421
kthread+0x3b1/0x4a0 kernel/kthread.c:292
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294
next prev parent reply other threads:[~2021-03-30 12:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-25 16:16 [PATCH net-next v3 0/7] mld: change context from atomic to sleepable Taehee Yoo
2021-03-25 16:16 ` [PATCH net-next v3 1/7] mld: convert from timer to delayed work Taehee Yoo
2021-03-25 16:16 ` [PATCH net-next v3 2/7] mld: get rid of inet6_dev->mc_lock Taehee Yoo
2021-03-25 16:16 ` [PATCH net-next v3 3/7] mld: convert ipv6_mc_socklist->sflist to RCU Taehee Yoo
2021-03-25 16:16 ` [PATCH net-next v3 4/7] mld: convert ip6_sf_list " Taehee Yoo
2021-03-25 16:16 ` [PATCH net-next v3 5/7] mld: convert ifmcaddr6 " Taehee Yoo
2021-03-29 19:56 ` Eric Dumazet
2021-03-30 3:41 ` Taehee Yoo
2021-03-25 16:16 ` [PATCH net-next v3 6/7] mld: add new workqueues for process mld events Taehee Yoo
2021-03-25 16:16 ` [PATCH net-next v3 7/7] mld: add mc_lock for protecting per-interface mld data Taehee Yoo
2021-03-30 11:59 ` Eric Dumazet [this message]
2021-03-30 12:24 ` Eric Dumazet
2021-03-30 15:01 ` Taehee Yoo
2021-03-25 16:24 ` [PATCH net-next v3 0/7] mld: change context from atomic to sleepable Taehee Yoo
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=fd460c2b-b974-db00-5097-4af08f12c670@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=a@unstable.cc \
--cc=ap420073@gmail.com \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=borntraeger@de.ibm.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=jwi@linux.ibm.com \
--cc=kgraul@linux.ibm.com \
--cc=kuba@kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mareklindner@neomailbox.ch \
--cc=netdev@vger.kernel.org \
--cc=sven@narfation.org \
--cc=sw@simonwunderlich.de \
--cc=yoshfuji@linux-ipv6.org \
/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).