public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] tcp: tweak tcp_sock_write_txrx size assertion
@ 2024-04-09 14:09 Eric Dumazet
  2024-04-10 14:49 ` Vladimir Oltean
  2024-04-11  2:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2024-04-09 14:09 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: netdev, eric.dumazet, Eric Dumazet, kernel test robot,
	Vladimir Oltean

I forgot 32bit arches might have 64bit alignment for u64
fields.

tcp_sock_write_txrx group does not contain pointers,
but two u64 fields. It is possible that on 32bit kernel,
a 32bit hole is before tp->tcp_clock_cache.

I will try to remember a group can be bigger on 32bit
kernels in the future.

With help from Vladimir Oltean.

Fixes: d2c3a7eb1afa ("tcp: more struct tcp_sock adjustments")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202404082207.HCEdQhUO-lkp@intel.com/
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 net/ipv4/tcp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index b07aa71b24ec147d2f1f148e288231b3a492fb5a..e1bf468e0d22aad01532dce6e226ca095d578b91 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -4673,7 +4673,11 @@ static void __init tcp_struct_check(void)
 	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, app_limited);
 	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, rcv_wnd);
 	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, rx_opt);
-	CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_write_txrx, 92);
+
+	/* 32bit arches with 8byte alignment on u64 fields might need padding
+	 * before tcp_clock_cache.
+	 */
+	CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_write_txrx, 92 + 4);
 
 	/* RX read-write hotpath cache lines */
 	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, bytes_received);
-- 
2.44.0.478.gd926399ef9-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] tcp: tweak tcp_sock_write_txrx size assertion
  2024-04-09 14:09 [PATCH net-next] tcp: tweak tcp_sock_write_txrx size assertion Eric Dumazet
@ 2024-04-10 14:49 ` Vladimir Oltean
  2024-04-11  2:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Vladimir Oltean @ 2024-04-10 14:49 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, netdev,
	eric.dumazet, kernel test robot

On Tue, Apr 09, 2024 at 02:09:14PM +0000, Eric Dumazet wrote:
> I forgot 32bit arches might have 64bit alignment for u64
> fields.
> 
> tcp_sock_write_txrx group does not contain pointers,
> but two u64 fields. It is possible that on 32bit kernel,
> a 32bit hole is before tp->tcp_clock_cache.
> 
> I will try to remember a group can be bigger on 32bit
> kernels in the future.
> 
> With help from Vladimir Oltean.
> 
> Fixes: d2c3a7eb1afa ("tcp: more struct tcp_sock adjustments")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202404082207.HCEdQhUO-lkp@intel.com/
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Vladimir Oltean <vladimir.oltean@nxp.com>
> ---

Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] tcp: tweak tcp_sock_write_txrx size assertion
  2024-04-09 14:09 [PATCH net-next] tcp: tweak tcp_sock_write_txrx size assertion Eric Dumazet
  2024-04-10 14:49 ` Vladimir Oltean
@ 2024-04-11  2:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-04-11  2:00 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: davem, kuba, pabeni, netdev, eric.dumazet, lkp, vladimir.oltean

Hello:

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

On Tue,  9 Apr 2024 14:09:14 +0000 you wrote:
> I forgot 32bit arches might have 64bit alignment for u64
> fields.
> 
> tcp_sock_write_txrx group does not contain pointers,
> but two u64 fields. It is possible that on 32bit kernel,
> a 32bit hole is before tp->tcp_clock_cache.
> 
> [...]

Here is the summary with links:
  - [net-next] tcp: tweak tcp_sock_write_txrx size assertion
    https://git.kernel.org/netdev/net-next/c/9b9fd45869e7

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-11  2:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-09 14:09 [PATCH net-next] tcp: tweak tcp_sock_write_txrx size assertion Eric Dumazet
2024-04-10 14:49 ` Vladimir Oltean
2024-04-11  2:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox