diff mbox series

[net] net: linkwatch: use system_unbound_wq

Message ID 20240805085821.1616528-1-edumazet@google.com (mailing list archive)
State Accepted
Commit 3e7917c0cdad835a5121520fc5686d954b7a61ab
Delegated to: Netdev Maintainers
Headers show
Series [net] net: linkwatch: use system_unbound_wq | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 29 this patch: 29
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 1 maintainers not CCed: johannes.berg@intel.com
netdev/build_clang success Errors and warnings before: 29 this patch: 29
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 29 this patch: 29
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 11 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-08-06--00-00 (tests: 707)

Commit Message

Eric Dumazet Aug. 5, 2024, 8:58 a.m. UTC
linkwatch_event() grabs possibly very contended RTNL mutex.

system_wq is not suitable for such work.

Inspired by many noisy syzbot reports.

3 locks held by kworker/0:7/5266:
 #0: ffff888015480948 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3206 [inline]
 #0: ffff888015480948 ((wq_completion)events){+.+.}-{0:0}, at: process_scheduled_works+0x90a/0x1830 kernel/workqueue.c:3312
 #1: ffffc90003f6fd00 ((linkwatch_work).work){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3207 [inline]
 , at: process_scheduled_works+0x945/0x1830 kernel/workqueue.c:3312
 #2: ffffffff8fa6f208 (rtnl_mutex){+.+.}-{3:3}, at: linkwatch_event+0xe/0x60 net/core/link_watch.c:276

Reported-by: syzbot <syzkaller@googlegroups.com>
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/core/link_watch.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Kuniyuki Iwashima Aug. 5, 2024, 5:54 p.m. UTC | #1
From: Eric Dumazet <edumazet@google.com>
Date: Mon,  5 Aug 2024 08:58:21 +0000
> linkwatch_event() grabs possibly very contended RTNL mutex.
> 
> system_wq is not suitable for such work.
> 
> Inspired by many noisy syzbot reports.
> 
> 3 locks held by kworker/0:7/5266:
>  #0: ffff888015480948 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3206 [inline]
>  #0: ffff888015480948 ((wq_completion)events){+.+.}-{0:0}, at: process_scheduled_works+0x90a/0x1830 kernel/workqueue.c:3312
>  #1: ffffc90003f6fd00 ((linkwatch_work).work){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3207 [inline]
>  , at: process_scheduled_works+0x945/0x1830 kernel/workqueue.c:3312
>  #2: ffffffff8fa6f208 (rtnl_mutex){+.+.}-{3:3}, at: linkwatch_event+0xe/0x60 net/core/link_watch.c:276
> 
> Reported-by: syzbot <syzkaller@googlegroups.com>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>


> ---
>  net/core/link_watch.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/core/link_watch.c b/net/core/link_watch.c
> index 8ec35194bfcb8574f53a9fd28f0cb2ebfe9a3f2e..ab150641142aa1545c71fc5d3b11db33c70cf437 100644
> --- a/net/core/link_watch.c
> +++ b/net/core/link_watch.c
> @@ -148,9 +148,9 @@ static void linkwatch_schedule_work(int urgent)
>  	 * override the existing timer.
>  	 */
>  	if (test_bit(LW_URGENT, &linkwatch_flags))
> -		mod_delayed_work(system_wq, &linkwatch_work, 0);
> +		mod_delayed_work(system_unbound_wq, &linkwatch_work, 0);
>  	else
> -		schedule_delayed_work(&linkwatch_work, delay);
> +		queue_delayed_work(system_unbound_wq, &linkwatch_work, delay);
>  }
>  
>  
> -- 
> 2.46.0.rc2.264.g509ed76dc8-goog
patchwork-bot+netdevbpf@kernel.org Aug. 6, 2024, 8:27 p.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon,  5 Aug 2024 08:58:21 +0000 you wrote:
> linkwatch_event() grabs possibly very contended RTNL mutex.
> 
> system_wq is not suitable for such work.
> 
> Inspired by many noisy syzbot reports.
> 
> 3 locks held by kworker/0:7/5266:
>  #0: ffff888015480948 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3206 [inline]
>  #0: ffff888015480948 ((wq_completion)events){+.+.}-{0:0}, at: process_scheduled_works+0x90a/0x1830 kernel/workqueue.c:3312
>  #1: ffffc90003f6fd00 ((linkwatch_work).work){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3207 [inline]
>  , at: process_scheduled_works+0x945/0x1830 kernel/workqueue.c:3312
>  #2: ffffffff8fa6f208 (rtnl_mutex){+.+.}-{3:3}, at: linkwatch_event+0xe/0x60 net/core/link_watch.c:276
> 
> [...]

Here is the summary with links:
  - [net] net: linkwatch: use system_unbound_wq
    https://git.kernel.org/netdev/net/c/3e7917c0cdad

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/core/link_watch.c b/net/core/link_watch.c
index 8ec35194bfcb8574f53a9fd28f0cb2ebfe9a3f2e..ab150641142aa1545c71fc5d3b11db33c70cf437 100644
--- a/net/core/link_watch.c
+++ b/net/core/link_watch.c
@@ -148,9 +148,9 @@  static void linkwatch_schedule_work(int urgent)
 	 * override the existing timer.
 	 */
 	if (test_bit(LW_URGENT, &linkwatch_flags))
-		mod_delayed_work(system_wq, &linkwatch_work, 0);
+		mod_delayed_work(system_unbound_wq, &linkwatch_work, 0);
 	else
-		schedule_delayed_work(&linkwatch_work, delay);
+		queue_delayed_work(system_unbound_wq, &linkwatch_work, delay);
 }