diff mbox series

[net-next,v7,2/3] net: tcp: un-pin the tw_timer

Message ID 20240604140903.31939-3-fw@strlen.de (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: tcp: un-pin tw timer | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 903 this patch: 903
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 1 maintainers not CCed: dsahern@kernel.org
netdev/build_clang success Errors and warnings before: 905 this patch: 905
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 No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 907 this patch: 907
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 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-06-04--18-00 (tests: 1045)

Commit Message

Florian Westphal June 4, 2024, 2:08 p.m. UTC
After previous patch, even if timer fires immediately on another CPU,
context that schedules the timer now holds the ehash spinlock, so timer
cannot reap tw socket until ehash lock is released.

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 no changes.

 net/ipv4/inet_timewait_sock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eric Dumazet June 5, 2024, 6:59 a.m. UTC | #1
On Tue, Jun 4, 2024 at 4:11 PM Florian Westphal <fw@strlen.de> wrote:
>
> After previous patch, even if timer fires immediately on another CPU,
> context that schedules the timer now holds the ehash spinlock, so timer
> cannot reap tw socket until ehash lock is released.
>
> Signed-off-by: Florian Westphal <fw@strlen.de>

Reviewed-by: Eric Dumazet <edumazet@google.com>
Sebastian Andrzej Siewior June 5, 2024, 8:51 a.m. UTC | #2
On 2024-06-04 16:08:48 [+0200], Florian Westphal wrote:
> After previous patch, even if timer fires immediately on another CPU,
> context that schedules the timer now holds the ehash spinlock, so timer
> cannot reap tw socket until ehash lock is released.

The two callers of inet_twsk_hashdance_schedule() have the comment:
| /* tw_timer is pinned, so we need to make sure BH are disabled
|  * in following section, otherwise timer handler could run before
|  * we complete the initialization.
|  */

This isn't accurate anymore. I would suggest to simply remove the
comment. The only reason for local_bh_disable() is (are) the lock(s).

> Signed-off-by: Florian Westphal <fw@strlen.de>

Sebastian
diff mbox series

Patch

diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c
index 628d33a41ce5..3e89b927ee61 100644
--- a/net/ipv4/inet_timewait_sock.c
+++ b/net/ipv4/inet_timewait_sock.c
@@ -203,7 +203,7 @@  struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk,
 		tw->tw_prot	    = sk->sk_prot_creator;
 		atomic64_set(&tw->tw_cookie, atomic64_read(&sk->sk_cookie));
 		twsk_net_set(tw, sock_net(sk));
-		timer_setup(&tw->tw_timer, tw_timer_handler, TIMER_PINNED);
+		timer_setup(&tw->tw_timer, tw_timer_handler, 0);
 		/*
 		 * Because we use RCU lookups, we should not set tw_refcnt
 		 * to a non null value before everything is setup for this