netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next:main 26/50] net/ipv4/tcp.c:4673:2: error: call to '__compiletime_assert_1030' declared with 'error' attribute: BUILD_BUG_ON failed: offsetof(struct tcp_sock, __cacheline_group_end__tcp_sock_write_txrx) - offsetofend(struct tcp_sock, __cacheline_group_begin__tcp_sock_...
@ 2024-04-08 14:49 kernel test robot
  2024-04-08 23:06 ` Vladimir Oltean
  0 siblings, 1 reply; 8+ messages in thread
From: kernel test robot @ 2024-04-08 14:49 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: llvm, oe-kbuild-all, netdev

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git main
head:   358961f51fa5fa1aebf9c25fdcf4f9750f3c647e
commit: d2c3a7eb1afada8cfb5fde41489913ea5733a319 [26/50] tcp: more struct tcp_sock adjustments
config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20240408/202404082207.HCEdQhUO-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 73ddb2a7471986a7ed600dbea14efc60f0d0db47)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240408/202404082207.HCEdQhUO-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202404082207.HCEdQhUO-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from net/ipv4/tcp.c:252:
   In file included from include/linux/inet_diag.h:5:
   In file included from include/net/netlink.h:6:
   In file included from include/linux/netlink.h:7:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:10:
   In file included from include/linux/mm.h:2208:
   include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     522 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   In file included from net/ipv4/tcp.c:252:
   In file included from include/linux/inet_diag.h:5:
   In file included from include/net/netlink.h:6:
   In file included from include/linux/netlink.h:7:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:12:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     547 |         val = __raw_readb(PCI_IOBASE + addr);
         |                           ~~~~~~~~~~ ^
   include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     560 |         val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
      37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
         |                                                   ^
   In file included from net/ipv4/tcp.c:252:
   In file included from include/linux/inet_diag.h:5:
   In file included from include/net/netlink.h:6:
   In file included from include/linux/netlink.h:7:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:12:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     573 |         val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
      35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
         |                                                   ^
   In file included from net/ipv4/tcp.c:252:
   In file included from include/linux/inet_diag.h:5:
   In file included from include/net/netlink.h:6:
   In file included from include/linux/netlink.h:7:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:12:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     584 |         __raw_writeb(value, PCI_IOBASE + addr);
         |                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     594 |         __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     604 |         __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
>> net/ipv4/tcp.c:4673:2: error: call to '__compiletime_assert_1030' declared with 'error' attribute: BUILD_BUG_ON failed: offsetof(struct tcp_sock, __cacheline_group_end__tcp_sock_write_txrx) - offsetofend(struct tcp_sock, __cacheline_group_begin__tcp_sock_write_txrx) > 92
    4673 |         CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_write_txrx, 92);
         |         ^
   include/linux/cache.h:108:2: note: expanded from macro 'CACHELINE_ASSERT_GROUP_SIZE'
     108 |         BUILD_BUG_ON(offsetof(TYPE, __cacheline_group_end__##GROUP) - \
         |         ^
   include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON'
      50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
         |         ^
   include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:448:2: note: expanded from macro '_compiletime_assert'
     448 |         __compiletime_assert(condition, msg, prefix, suffix)
         |         ^
   include/linux/compiler_types.h:441:4: note: expanded from macro '__compiletime_assert'
     441 |                         prefix ## suffix();                             \
         |                         ^
   <scratch space>:29:1: note: expanded from here
      29 | __compiletime_assert_1030
         | ^
   7 warnings and 1 error generated.


vim +4673 net/ipv4/tcp.c

  4600	
  4601	static void __init tcp_struct_check(void)
  4602	{
  4603		/* TX read-mostly hotpath cache lines */
  4604		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_tx, max_window);
  4605		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_tx, rcv_ssthresh);
  4606		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_tx, reordering);
  4607		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_tx, notsent_lowat);
  4608		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_tx, gso_segs);
  4609		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_tx, lost_skb_hint);
  4610		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_tx, retransmit_skb_hint);
  4611		CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_read_tx, 40);
  4612	
  4613		/* TXRX read-mostly hotpath cache lines */
  4614		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_txrx, tsoffset);
  4615		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_txrx, snd_wnd);
  4616		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_txrx, mss_cache);
  4617		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_txrx, snd_cwnd);
  4618		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_txrx, prr_out);
  4619		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_txrx, lost_out);
  4620		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_txrx, sacked_out);
  4621		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_txrx, scaling_ratio);
  4622		CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_read_txrx, 32);
  4623	
  4624		/* RX read-mostly hotpath cache lines */
  4625		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_rx, copied_seq);
  4626		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_rx, rcv_tstamp);
  4627		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_rx, snd_wl1);
  4628		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_rx, tlp_high_seq);
  4629		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_rx, rttvar_us);
  4630		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_rx, retrans_out);
  4631		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_rx, advmss);
  4632		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_rx, urg_data);
  4633		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_rx, lost);
  4634		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_rx, rtt_min);
  4635		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_rx, out_of_order_queue);
  4636		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_rx, snd_ssthresh);
  4637		CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_read_rx, 69);
  4638	
  4639		/* TX read-write hotpath cache lines */
  4640		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, segs_out);
  4641		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, data_segs_out);
  4642		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, bytes_sent);
  4643		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, snd_sml);
  4644		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, chrono_start);
  4645		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, chrono_stat);
  4646		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, write_seq);
  4647		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, pushed_seq);
  4648		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, lsndtime);
  4649		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, mdev_us);
  4650		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, tcp_wstamp_ns);
  4651		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, rtt_seq);
  4652		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, tsorted_sent_queue);
  4653		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, highest_sack);
  4654		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, ecn_flags);
  4655		CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_write_tx, 89);
  4656	
  4657		/* TXRX read-write hotpath cache lines */
  4658		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, pred_flags);
  4659		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, tcp_clock_cache);
  4660		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, tcp_mstamp);
  4661		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, rcv_nxt);
  4662		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, snd_nxt);
  4663		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, snd_una);
  4664		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, window_clamp);
  4665		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, srtt_us);
  4666		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, packets_out);
  4667		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, snd_up);
  4668		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, delivered);
  4669		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, delivered_ce);
  4670		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, app_limited);
  4671		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, rcv_wnd);
  4672		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, rx_opt);
> 4673		CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_write_txrx, 92);
  4674	
  4675		/* RX read-write hotpath cache lines */
  4676		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, bytes_received);
  4677		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, segs_in);
  4678		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, data_segs_in);
  4679		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, rcv_wup);
  4680		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, max_packets_out);
  4681		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, cwnd_usage_seq);
  4682		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, rate_delivered);
  4683		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, rate_interval_us);
  4684		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, rcv_rtt_last_tsecr);
  4685		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, first_tx_mstamp);
  4686		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, delivered_mstamp);
  4687		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, bytes_acked);
  4688		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, rcv_rtt_est);
  4689		CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, rcvq_space);
  4690		CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_write_rx, 99);
  4691	}
  4692	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [net-next:main 26/50] net/ipv4/tcp.c:4673:2: error: call to '__compiletime_assert_1030' declared with 'error' attribute: BUILD_BUG_ON failed: offsetof(struct tcp_sock, __cacheline_group_end__tcp_sock_write_txrx) - offsetofend(struct tcp_sock, __cacheline_group_begin__tcp_sock_...
  2024-04-08 14:49 [net-next:main 26/50] net/ipv4/tcp.c:4673:2: error: call to '__compiletime_assert_1030' declared with 'error' attribute: BUILD_BUG_ON failed: offsetof(struct tcp_sock, __cacheline_group_end__tcp_sock_write_txrx) - offsetofend(struct tcp_sock, __cacheline_group_begin__tcp_sock_ kernel test robot
@ 2024-04-08 23:06 ` Vladimir Oltean
  2024-04-09  5:08   ` Eric Dumazet
  0 siblings, 1 reply; 8+ messages in thread
From: Vladimir Oltean @ 2024-04-08 23:06 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: kernel test robot, llvm, oe-kbuild-all, netdev

Hi Eric,

On Mon, Apr 08, 2024 at 10:49:35PM +0800, kernel test robot wrote:
> >> net/ipv4/tcp.c:4673:2: error: call to '__compiletime_assert_1030' declared with 'error' attribute: BUILD_BUG_ON failed: offsetof(struct tcp_sock, __cacheline_group_end__tcp_sock_write_txrx) - offsetofend(struct tcp_sock, __cacheline_group_begin__tcp_sock_write_txrx) > 92
> > 4673		CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_write_txrx, 92);

I can confirm the same compile time assertion with an armv7 gcc 7.3.1 compiler.
If I revert commit 86dad9aebd0d ("Revert "tcp: more struct tcp_sock adjustments")
it goes away.

Before the change (actually with it reverted), I can see that the
tcp_sock_write_txrx cacheline group begins at offset 1821 with a 3 byte
hole, and ends at offset 1897 (it has 76 bytes).

$ pahole -C tcp_sock $KBUILD_OUTPUT/net/ipv4/tcp.o
struct tcp_sock {
	struct inet_connection_sock inet_conn __attribute__((__aligned__(8))); /*     0  1568 */
	/* --- cacheline 24 boundary (1536 bytes) was 32 bytes ago --- */
	__u8                       __cacheline_group_begin__tcp_sock_read_tx[0]; /*  1568     0 */
	u32                        max_window;           /*  1568     4 */
	u32                        rcv_ssthresh;         /*  1572     4 */
	u32                        reordering;           /*  1576     4 */
	u32                        notsent_lowat;        /*  1580     4 */
	u16                        gso_segs;             /*  1584     2 */

	/* XXX 2 bytes hole, try to pack */

	struct sk_buff *           lost_skb_hint;        /*  1588     4 */
	struct sk_buff *           retransmit_skb_hint;  /*  1592     4 */
	__u8                       __cacheline_group_end__tcp_sock_read_tx[0]; /*  1596     0 */
	__u8                       __cacheline_group_begin__tcp_sock_read_txrx[0]; /*  1596     0 */
	u32                        tsoffset;             /*  1596     4 */
	/* --- cacheline 25 boundary (1600 bytes) --- */
	u32                        snd_wnd;              /*  1600     4 */
	u32                        mss_cache;            /*  1604     4 */
	u32                        snd_cwnd;             /*  1608     4 */
	u32                        prr_out;              /*  1612     4 */
	u32                        lost_out;             /*  1616     4 */
	u32                        sacked_out;           /*  1620     4 */
	u16                        tcp_header_len;       /*  1624     2 */
	u8                         scaling_ratio;        /*  1626     1 */
	u8                         chrono_type:2;        /*  1627: 0  1 */
	u8                         repair:1;             /*  1627: 2  1 */
	u8                         tcp_usec_ts:1;        /*  1627: 3  1 */
	u8                         is_sack_reneg:1;      /*  1627: 4  1 */
	u8                         is_cwnd_limited:1;    /*  1627: 5  1 */

	/* XXX 2 bits hole, try to pack */

	__u8                       __cacheline_group_end__tcp_sock_read_txrx[0]; /*  1628     0 */
	__u8                       __cacheline_group_begin__tcp_sock_read_rx[0]; /*  1628     0 */
	u32                        copied_seq;           /*  1628     4 */
	u32                        rcv_tstamp;           /*  1632     4 */
	u32                        snd_wl1;              /*  1636     4 */
	u32                        tlp_high_seq;         /*  1640     4 */
	u32                        rttvar_us;            /*  1644     4 */
	u32                        retrans_out;          /*  1648     4 */
	u16                        advmss;               /*  1652     2 */
	u16                        urg_data;             /*  1654     2 */
	u32                        lost;                 /*  1656     4 */
	struct minmax              rtt_min;              /*  1660    24 */
	/* --- cacheline 26 boundary (1664 bytes) was 20 bytes ago --- */
	struct rb_root             out_of_order_queue;   /*  1684     4 */
	u32                        snd_ssthresh;         /*  1688     4 */
	__u8                       __cacheline_group_end__tcp_sock_read_rx[0]; /*  1692     0 */

	/* XXX 36 bytes hole, try to pack */

	/* --- cacheline 27 boundary (1728 bytes) --- */
	__u8                       __cacheline_group_begin__tcp_sock_write_tx[0] __attribute__((__aligned__(64))); /*  1728     0 */
	u32                        segs_out;             /*  1728     4 */
	u32                        data_segs_out;        /*  1732     4 */
	u64                        bytes_sent;           /*  1736     8 */
	u32                        snd_sml;              /*  1744     4 */
	u32                        chrono_start;         /*  1748     4 */
	u32                        chrono_stat[3];       /*  1752    12 */
	u32                        write_seq;            /*  1764     4 */
	u32                        pushed_seq;           /*  1768     4 */
	u32                        lsndtime;             /*  1772     4 */
	u32                        mdev_us;              /*  1776     4 */
	u32                        rtt_seq;              /*  1780     4 */
	u64                        tcp_wstamp_ns;        /*  1784     8 */
	/* --- cacheline 28 boundary (1792 bytes) --- */
	u64                        tcp_clock_cache;      /*  1792     8 */
	u64                        tcp_mstamp;           /*  1800     8 */
	struct list_head           tsorted_sent_queue;   /*  1808     8 */
	struct sk_buff *           highest_sack;         /*  1816     4 */
	u8                         ecn_flags;            /*  1820     1 */
	__u8                       __cacheline_group_end__tcp_sock_write_tx[0]; /*  1821     0 */
	__u8                       __cacheline_group_begin__tcp_sock_write_txrx[0]; /*  1821     0 */

	/* XXX 3 bytes hole, try to pack */

	__be32                     pred_flags;           /*  1824     4 */
	u32                        rcv_nxt;              /*  1828     4 */
	u32                        snd_nxt;              /*  1832     4 */
	u32                        snd_una;              /*  1836     4 */
	u32                        window_clamp;         /*  1840     4 */
	u32                        srtt_us;              /*  1844     4 */
	u32                        packets_out;          /*  1848     4 */
	u32                        snd_up;               /*  1852     4 */
	/* --- cacheline 29 boundary (1856 bytes) --- */
	u32                        delivered;            /*  1856     4 */
	u32                        delivered_ce;         /*  1860     4 */
	u32                        app_limited;          /*  1864     4 */
	u32                        rcv_wnd;              /*  1868     4 */
	struct tcp_options_received rx_opt;              /*  1872    24 */
	u8                         nonagle:4;            /*  1896: 0  1 */
	u8                         rate_app_limited:1;   /*  1896: 4  1 */

	/* XXX 3 bits hole, try to pack */

	__u8                       __cacheline_group_end__tcp_sock_write_txrx[0]; /*  1897     0 */

	/* XXX 7 bytes hole, try to pack */

	__u8                       __cacheline_group_begin__tcp_sock_write_rx[0] __attribute__((__aligned__(8))); /*  1904     0 */
	u64                        bytes_received;       /*  1904     8 */
	u32                        segs_in;              /*  1912     4 */
	u32                        data_segs_in;         /*  1916     4 */
	/* --- cacheline 30 boundary (1920 bytes) --- */
	u32                        rcv_wup;              /*  1920     4 */
	u32                        max_packets_out;      /*  1924     4 */
	u32                        cwnd_usage_seq;       /*  1928     4 */
	u32                        rate_delivered;       /*  1932     4 */
	u32                        rate_interval_us;     /*  1936     4 */
	u32                        rcv_rtt_last_tsecr;   /*  1940     4 */
	u64                        first_tx_mstamp;      /*  1944     8 */
	u64                        delivered_mstamp;     /*  1952     8 */
	u64                        bytes_acked;          /*  1960     8 */
	struct {
		u32                rtt_us;               /*  1968     4 */
		u32                seq;                  /*  1972     4 */
		u64                time;                 /*  1976     8 */
	} rcv_rtt_est;                                   /*  1968    16 */
	/* --- cacheline 31 boundary (1984 bytes) --- */
	struct {
		u32                space;                /*  1984     4 */
		u32                seq;                  /*  1988     4 */
		u64                time;                 /*  1992     8 */
	} rcvq_space;                                    /*  1984    16 */
	__u8                       __cacheline_group_end__tcp_sock_write_rx[0]; /*  2000     0 */
	u32                        dsack_dups;           /*  2000     4 */
	u32                        compressed_ack_rcv_nxt; /*  2004     4 */
	struct list_head           tsq_node;             /*  2008     8 */
	struct tcp_rack            rack;                 /*  2016    24 */

	/* XXX last struct has 2 bytes of padding */

	u8                         compressed_ack;       /*  2040     1 */
	u8                         dup_ack_counter:2;    /*  2041: 0  1 */
	u8                         tlp_retrans:1;        /*  2041: 2  1 */
	u8                         unused:5;             /*  2041: 3  1 */
	u8                         thin_lto:1;           /*  2042: 0  1 */
	u8                         recvmsg_inq:1;        /*  2042: 1  1 */
	u8                         fastopen_connect:1;   /*  2042: 2  1 */
	u8                         fastopen_no_cookie:1; /*  2042: 3  1 */
	u8                         fastopen_client_fail:2; /*  2042: 4  1 */
	u8                         frto:1;               /*  2042: 6  1 */

	/* XXX 1 bit hole, try to pack */

	u8                         repair_queue;         /*  2043     1 */
	u8                         save_syn:2;           /*  2044: 0  1 */
	u8                         syn_data:1;           /*  2044: 2  1 */
	u8                         syn_fastopen:1;       /*  2044: 3  1 */
	u8                         syn_fastopen_exp:1;   /*  2044: 4  1 */
	u8                         syn_fastopen_ch:1;    /*  2044: 5  1 */
	u8                         syn_data_acked:1;     /*  2044: 6  1 */

	/* XXX 1 bit hole, try to pack */

	u8                         keepalive_probes;     /*  2045     1 */

	/* XXX 2 bytes hole, try to pack */

	/* --- cacheline 32 boundary (2048 bytes) --- */
	u32                        tcp_tx_delay;         /*  2048     4 */
	u32                        mdev_max_us;          /*  2052     4 */
	u32                        reord_seen;           /*  2056     4 */
	u32                        snd_cwnd_cnt;         /*  2060     4 */
	u32                        snd_cwnd_clamp;       /*  2064     4 */
	u32                        snd_cwnd_used;        /*  2068     4 */
	u32                        snd_cwnd_stamp;       /*  2072     4 */
	u32                        prior_cwnd;           /*  2076     4 */
	u32                        prr_delivered;        /*  2080     4 */
	u32                        last_oow_ack_time;    /*  2084     4 */
	struct hrtimer             pacing_timer __attribute__((__aligned__(8))); /*  2088    48 */

	/* XXX last struct has 4 bytes of padding */

	/* --- cacheline 33 boundary (2112 bytes) was 24 bytes ago --- */
	struct hrtimer             compressed_ack_timer __attribute__((__aligned__(8))); /*  2136    48 */

	/* XXX last struct has 4 bytes of padding */

	/* --- cacheline 34 boundary (2176 bytes) was 8 bytes ago --- */
	struct sk_buff *           ooo_last_skb;         /*  2184     4 */
	struct tcp_sack_block      duplicate_sack[1];    /*  2188     8 */
	struct tcp_sack_block      selective_acks[4];    /*  2196    32 */
	struct tcp_sack_block      recv_sack_cache[4];   /*  2228    32 */
	/* --- cacheline 35 boundary (2240 bytes) was 20 bytes ago --- */
	int                        lost_cnt_hint;        /*  2260     4 */
	u32                        prior_ssthresh;       /*  2264     4 */
	u32                        high_seq;             /*  2268     4 */
	u32                        retrans_stamp;        /*  2272     4 */
	u32                        undo_marker;          /*  2276     4 */
	int                        undo_retrans;         /*  2280     4 */

	/* XXX 4 bytes hole, try to pack */

	u64                        bytes_retrans;        /*  2288     8 */
	u32                        total_retrans;        /*  2296     4 */
	u32                        rto_stamp;            /*  2300     4 */
	/* --- cacheline 36 boundary (2304 bytes) --- */
	u16                        total_rto;            /*  2304     2 */
	u16                        total_rto_recoveries; /*  2306     2 */
	u32                        total_rto_time;       /*  2308     4 */
	u32                        urg_seq;              /*  2312     4 */
	unsigned int               keepalive_time;       /*  2316     4 */
	unsigned int               keepalive_intvl;      /*  2320     4 */
	int                        linger2;              /*  2324     4 */
	u8                         bpf_sock_ops_cb_flags; /*  2328     1 */
	u8                         bpf_chg_cc_inprogress:1; /*  2329: 0  1 */

	/* XXX 7 bits hole, try to pack */

	u16                        timeout_rehash;       /*  2330     2 */
	u32                        rcv_ooopack;          /*  2332     4 */
	struct {
		u32                probe_seq_start;      /*  2336     4 */
		u32                probe_seq_end;        /*  2340     4 */
	} mtu_probe;                                     /*  2336     8 */
	u32                        plb_rehash;           /*  2344     4 */
	u32                        mtu_info;             /*  2348     4 */
	struct tcp_fastopen_request * fastopen_req;      /*  2352     4 */
	struct request_sock *      fastopen_rsk;         /*  2356     4 */
	struct saved_syn *         saved_syn;            /*  2360     4 */

	/* size: 2368, cachelines: 37, members: 156 */
	/* sum members: 2304, holes: 6, sum holes: 54 */
	/* sum bitfield members: 34 bits, bit holes: 5, sum bit holes: 14 bits */
	/* padding: 4 */
	/* paddings: 3, sum paddings: 10 */
	/* forced alignments: 5, forced holes: 2, sum forced holes: 43 */
} __attribute__((__aligned__(64)));

After the change, it begins at 1805 and ends at 1901, thus triggering
the assertion (96 > 92):

struct tcp_sock {
	struct inet_connection_sock inet_conn __attribute__((__aligned__(8))); /*     0  1568 */
	/* --- cacheline 24 boundary (1536 bytes) was 32 bytes ago --- */
	__u8                       __cacheline_group_begin__tcp_sock_read_tx[0]; /*  1568     0 */
	u32                        max_window;           /*  1568     4 */
	u32                        rcv_ssthresh;         /*  1572     4 */
	u32                        reordering;           /*  1576     4 */
	u32                        notsent_lowat;        /*  1580     4 */
	u16                        gso_segs;             /*  1584     2 */

	/* XXX 2 bytes hole, try to pack */

	struct sk_buff *           lost_skb_hint;        /*  1588     4 */
	struct sk_buff *           retransmit_skb_hint;  /*  1592     4 */
	__u8                       __cacheline_group_end__tcp_sock_read_tx[0]; /*  1596     0 */
	__u8                       __cacheline_group_begin__tcp_sock_read_txrx[0]; /*  1596     0 */
	u32                        tsoffset;             /*  1596     4 */
	/* --- cacheline 25 boundary (1600 bytes) --- */
	u32                        snd_wnd;              /*  1600     4 */
	u32                        mss_cache;            /*  1604     4 */
	u32                        snd_cwnd;             /*  1608     4 */
	u32                        prr_out;              /*  1612     4 */
	u32                        lost_out;             /*  1616     4 */
	u32                        sacked_out;           /*  1620     4 */
	u16                        tcp_header_len;       /*  1624     2 */
	u8                         scaling_ratio;        /*  1626     1 */
	u8                         chrono_type:2;        /*  1627: 0  1 */
	u8                         repair:1;             /*  1627: 2  1 */
	u8                         tcp_usec_ts:1;        /*  1627: 3  1 */
	u8                         is_sack_reneg:1;      /*  1627: 4  1 */
	u8                         is_cwnd_limited:1;    /*  1627: 5  1 */

	/* XXX 2 bits hole, try to pack */

	__u8                       __cacheline_group_end__tcp_sock_read_txrx[0]; /*  1628     0 */
	__u8                       __cacheline_group_begin__tcp_sock_read_rx[0]; /*  1628     0 */
	u32                        copied_seq;           /*  1628     4 */
	u32                        rcv_tstamp;           /*  1632     4 */
	u32                        snd_wl1;              /*  1636     4 */
	u32                        tlp_high_seq;         /*  1640     4 */
	u32                        rttvar_us;            /*  1644     4 */
	u32                        retrans_out;          /*  1648     4 */
	u16                        advmss;               /*  1652     2 */
	u16                        urg_data;             /*  1654     2 */
	u32                        lost;                 /*  1656     4 */
	struct minmax              rtt_min;              /*  1660    24 */
	/* --- cacheline 26 boundary (1664 bytes) was 20 bytes ago --- */
	struct rb_root             out_of_order_queue;   /*  1684     4 */
	u32                        snd_ssthresh;         /*  1688     4 */
	u8                         recvmsg_inq:1;        /*  1692: 0  1 */

	/* XXX 7 bits hole, try to pack */

	__u8                       __cacheline_group_end__tcp_sock_read_rx[0]; /*  1693     0 */

	/* XXX 35 bytes hole, try to pack */

	/* --- cacheline 27 boundary (1728 bytes) --- */
	__u8                       __cacheline_group_begin__tcp_sock_write_tx[0] __attribute__((__aligned__(64))); /*  1728     0 */
	u32                        segs_out;             /*  1728     4 */
	u32                        data_segs_out;        /*  1732     4 */
	u64                        bytes_sent;           /*  1736     8 */
	u32                        snd_sml;              /*  1744     4 */
	u32                        chrono_start;         /*  1748     4 */
	u32                        chrono_stat[3];       /*  1752    12 */
	u32                        write_seq;            /*  1764     4 */
	u32                        pushed_seq;           /*  1768     4 */
	u32                        lsndtime;             /*  1772     4 */
	u32                        mdev_us;              /*  1776     4 */
	u32                        rtt_seq;              /*  1780     4 */
	u64                        tcp_wstamp_ns;        /*  1784     8 */
	/* --- cacheline 28 boundary (1792 bytes) --- */
	struct list_head           tsorted_sent_queue;   /*  1792     8 */
	struct sk_buff *           highest_sack;         /*  1800     4 */
	u8                         ecn_flags;            /*  1804     1 */
	__u8                       __cacheline_group_end__tcp_sock_write_tx[0]; /*  1805     0 */
	__u8                       __cacheline_group_begin__tcp_sock_write_txrx[0]; /*  1805     0 */

	/* XXX 3 bytes hole, try to pack */

	__be32                     pred_flags;           /*  1808     4 */

	/* XXX 4 bytes hole, try to pack */

	u64                        tcp_clock_cache;      /*  1816     8 */
	u64                        tcp_mstamp;           /*  1824     8 */
	u32                        rcv_nxt;              /*  1832     4 */
	u32                        snd_nxt;              /*  1836     4 */
	u32                        snd_una;              /*  1840     4 */
	u32                        window_clamp;         /*  1844     4 */
	u32                        srtt_us;              /*  1848     4 */
	u32                        packets_out;          /*  1852     4 */
	/* --- cacheline 29 boundary (1856 bytes) --- */
	u32                        snd_up;               /*  1856     4 */
	u32                        delivered;            /*  1860     4 */
	u32                        delivered_ce;         /*  1864     4 */
	u32                        app_limited;          /*  1868     4 */
	u32                        rcv_wnd;              /*  1872     4 */
	struct tcp_options_received rx_opt;              /*  1876    24 */
	u8                         nonagle:4;            /*  1900: 0  1 */
	u8                         rate_app_limited:1;   /*  1900: 4  1 */

	/* XXX 3 bits hole, try to pack */

	__u8                       __cacheline_group_end__tcp_sock_write_txrx[0]; /*  1901     0 */

	/* XXX 3 bytes hole, try to pack */

	__u8                       __cacheline_group_begin__tcp_sock_write_rx[0] __attribute__((__aligned__(8))); /*  1904     0 */
	u64                        bytes_received;       /*  1904     8 */
	u32                        segs_in;              /*  1912     4 */
	u32                        data_segs_in;         /*  1916     4 */
	/* --- cacheline 30 boundary (1920 bytes) --- */
	u32                        rcv_wup;              /*  1920     4 */
	u32                        max_packets_out;      /*  1924     4 */
	u32                        cwnd_usage_seq;       /*  1928     4 */
	u32                        rate_delivered;       /*  1932     4 */
	u32                        rate_interval_us;     /*  1936     4 */
	u32                        rcv_rtt_last_tsecr;   /*  1940     4 */
	u64                        first_tx_mstamp;      /*  1944     8 */
	u64                        delivered_mstamp;     /*  1952     8 */
	u64                        bytes_acked;          /*  1960     8 */
	struct {
		u32                rtt_us;               /*  1968     4 */
		u32                seq;                  /*  1972     4 */
		u64                time;                 /*  1976     8 */
	} rcv_rtt_est;                                   /*  1968    16 */
	/* --- cacheline 31 boundary (1984 bytes) --- */
	struct {
		u32                space;                /*  1984     4 */
		u32                seq;                  /*  1988     4 */
		u64                time;                 /*  1992     8 */
	} rcvq_space;                                    /*  1984    16 */
	__u8                       __cacheline_group_end__tcp_sock_write_rx[0]; /*  2000     0 */
	u32                        dsack_dups;           /*  2000     4 */
	u32                        compressed_ack_rcv_nxt; /*  2004     4 */
	struct list_head           tsq_node;             /*  2008     8 */
	struct tcp_rack            rack;                 /*  2016    24 */

	/* XXX last struct has 2 bytes of padding */

	u8                         compressed_ack;       /*  2040     1 */
	u8                         dup_ack_counter:2;    /*  2041: 0  1 */
	u8                         tlp_retrans:1;        /*  2041: 2  1 */
	u8                         unused:5;             /*  2041: 3  1 */
	u8                         thin_lto:1;           /*  2042: 0  1 */
	u8                         fastopen_connect:1;   /*  2042: 1  1 */
	u8                         fastopen_no_cookie:1; /*  2042: 2  1 */
	u8                         fastopen_client_fail:2; /*  2042: 3  1 */
	u8                         frto:1;               /*  2042: 5  1 */

	/* XXX 2 bits hole, try to pack */

	u8                         repair_queue;         /*  2043     1 */
	u8                         save_syn:2;           /*  2044: 0  1 */
	u8                         syn_data:1;           /*  2044: 2  1 */
	u8                         syn_fastopen:1;       /*  2044: 3  1 */
	u8                         syn_fastopen_exp:1;   /*  2044: 4  1 */
	u8                         syn_fastopen_ch:1;    /*  2044: 5  1 */
	u8                         syn_data_acked:1;     /*  2044: 6  1 */

	/* XXX 1 bit hole, try to pack */

	u8                         keepalive_probes;     /*  2045     1 */

	/* XXX 2 bytes hole, try to pack */

	/* --- cacheline 32 boundary (2048 bytes) --- */
	u32                        tcp_tx_delay;         /*  2048     4 */
	u32                        mdev_max_us;          /*  2052     4 */
	u32                        reord_seen;           /*  2056     4 */
	u32                        snd_cwnd_cnt;         /*  2060     4 */
	u32                        snd_cwnd_clamp;       /*  2064     4 */
	u32                        snd_cwnd_used;        /*  2068     4 */
	u32                        snd_cwnd_stamp;       /*  2072     4 */
	u32                        prior_cwnd;           /*  2076     4 */
	u32                        prr_delivered;        /*  2080     4 */
	u32                        last_oow_ack_time;    /*  2084     4 */
	struct hrtimer             pacing_timer __attribute__((__aligned__(8))); /*  2088    48 */

	/* XXX last struct has 4 bytes of padding */

	/* --- cacheline 33 boundary (2112 bytes) was 24 bytes ago --- */
	struct hrtimer             compressed_ack_timer __attribute__((__aligned__(8))); /*  2136    48 */

	/* XXX last struct has 4 bytes of padding */

	/* --- cacheline 34 boundary (2176 bytes) was 8 bytes ago --- */
	struct sk_buff *           ooo_last_skb;         /*  2184     4 */
	struct tcp_sack_block      duplicate_sack[1];    /*  2188     8 */
	struct tcp_sack_block      selective_acks[4];    /*  2196    32 */
	struct tcp_sack_block      recv_sack_cache[4];   /*  2228    32 */
	/* --- cacheline 35 boundary (2240 bytes) was 20 bytes ago --- */
	int                        lost_cnt_hint;        /*  2260     4 */
	u32                        prior_ssthresh;       /*  2264     4 */
	u32                        high_seq;             /*  2268     4 */
	u32                        retrans_stamp;        /*  2272     4 */
	u32                        undo_marker;          /*  2276     4 */
	int                        undo_retrans;         /*  2280     4 */

	/* XXX 4 bytes hole, try to pack */

	u64                        bytes_retrans;        /*  2288     8 */
	u32                        total_retrans;        /*  2296     4 */
	u32                        rto_stamp;            /*  2300     4 */
	/* --- cacheline 36 boundary (2304 bytes) --- */
	u16                        total_rto;            /*  2304     2 */
	u16                        total_rto_recoveries; /*  2306     2 */
	u32                        total_rto_time;       /*  2308     4 */
	u32                        urg_seq;              /*  2312     4 */
	unsigned int               keepalive_time;       /*  2316     4 */
	unsigned int               keepalive_intvl;      /*  2320     4 */
	int                        linger2;              /*  2324     4 */
	u8                         bpf_sock_ops_cb_flags; /*  2328     1 */
	u8                         bpf_chg_cc_inprogress:1; /*  2329: 0  1 */

	/* XXX 7 bits hole, try to pack */

	u16                        timeout_rehash;       /*  2330     2 */
	u32                        rcv_ooopack;          /*  2332     4 */
	struct {
		u32                probe_seq_start;      /*  2336     4 */
		u32                probe_seq_end;        /*  2340     4 */
	} mtu_probe;                                     /*  2336     8 */
	u32                        plb_rehash;           /*  2344     4 */
	u32                        mtu_info;             /*  2348     4 */
	struct tcp_fastopen_request * fastopen_req;      /*  2352     4 */
	struct request_sock *      fastopen_rsk;         /*  2356     4 */
	struct saved_syn *         saved_syn;            /*  2360     4 */

	/* size: 2368, cachelines: 37, members: 156 */
	/* sum members: 2304, holes: 7, sum holes: 53 */
	/* sum bitfield members: 34 bits, bit holes: 6, sum bit holes: 22 bits */
	/* padding: 4 */
	/* paddings: 3, sum paddings: 10 */
	/* forced alignments: 5, forced holes: 2, sum forced holes: 38 */
} __attribute__((__aligned__(64)));

It gained 20 bytes in the change. Most notably, it gained a 4 byte hole
between pred_flags and tcp_clock_cache.

I haven't followed the development of these optimizations, and I tried a
few trivial things, some of which didn't work, and some of which did.
Of those that worked, the most notable one was letting the 2 u64 fields,
tcp_clock_cache and tcp_mstamp, be the first members of the group, and
moving the __be32 pred_flags right below them.

Obviously my level of confidence in the fix is quite low, so it would be
great if you could cast an expert eye onto this.

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

* Re: [net-next:main 26/50] net/ipv4/tcp.c:4673:2: error: call to '__compiletime_assert_1030' declared with 'error' attribute: BUILD_BUG_ON failed: offsetof(struct tcp_sock, __cacheline_group_end__tcp_sock_write_txrx) - offsetofend(struct tcp_sock, __cacheline_group_begin__tcp_sock_...
  2024-04-08 23:06 ` Vladimir Oltean
@ 2024-04-09  5:08   ` Eric Dumazet
  2024-04-10 17:28     ` Florian Fainelli
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Dumazet @ 2024-04-09  5:08 UTC (permalink / raw)
  To: Vladimir Oltean; +Cc: kernel test robot, llvm, oe-kbuild-all, netdev

On Tue, Apr 9, 2024 at 1:06 AM Vladimir Oltean <olteanv@gmail.com> wrote:
>
> Hi Eric,
>
> On Mon, Apr 08, 2024 at 10:49:35PM +0800, kernel test robot wrote:
> > >> net/ipv4/tcp.c:4673:2: error: call to '__compiletime_assert_1030' declared with 'error' attribute: BUILD_BUG_ON failed: offsetof(struct tcp_sock, __cacheline_group_end__tcp_sock_write_txrx) - offsetofend(struct tcp_sock, __cacheline_group_begin__tcp_sock_write_txrx) > 92
> > > 4673                CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_write_txrx, 92);
>
> I can confirm the same compile time assertion with an armv7 gcc 7.3.1 compiler.
> If I revert commit 86dad9aebd0d ("Revert "tcp: more struct tcp_sock adjustments")
> it goes away.
>
> Before the change (actually with it reverted), I can see that the
> tcp_sock_write_txrx cacheline group begins at offset 1821 with a 3 byte
> hole, and ends at offset 1897 (it has 76 bytes).


...

> It gained 20 bytes in the change. Most notably, it gained a 4 byte hole
> between pred_flags and tcp_clock_cache.
>
> I haven't followed the development of these optimizations, and I tried a
> few trivial things, some of which didn't work, and some of which did.
> Of those that worked, the most notable one was letting the 2 u64 fields,
> tcp_clock_cache and tcp_mstamp, be the first members of the group, and
> moving the __be32 pred_flags right below them.
>
> Obviously my level of confidence in the fix is quite low, so it would be
> great if you could cast an expert eye onto this.

I am on it, do not worry, thanks !

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

* Re: [net-next:main 26/50] net/ipv4/tcp.c:4673:2: error: call to '__compiletime_assert_1030' declared with 'error' attribute: BUILD_BUG_ON failed: offsetof(struct tcp_sock, __cacheline_group_end__tcp_sock_write_txrx) - offsetofend(struct tcp_sock, __cacheline_group_begin__tcp_sock_...
  2024-04-09  5:08   ` Eric Dumazet
@ 2024-04-10 17:28     ` Florian Fainelli
  2024-04-10 17:33       ` Eric Dumazet
  0 siblings, 1 reply; 8+ messages in thread
From: Florian Fainelli @ 2024-04-10 17:28 UTC (permalink / raw)
  To: Eric Dumazet, Vladimir Oltean, Jakub Kicinski
  Cc: kernel test robot, llvm, oe-kbuild-all, netdev



On 4/8/2024 10:08 PM, Eric Dumazet wrote:
> On Tue, Apr 9, 2024 at 1:06 AM Vladimir Oltean <olteanv@gmail.com> wrote:
>>
>> Hi Eric,
>>
>> On Mon, Apr 08, 2024 at 10:49:35PM +0800, kernel test robot wrote:
>>>>> net/ipv4/tcp.c:4673:2: error: call to '__compiletime_assert_1030' declared with 'error' attribute: BUILD_BUG_ON failed: offsetof(struct tcp_sock, __cacheline_group_end__tcp_sock_write_txrx) - offsetofend(struct tcp_sock, __cacheline_group_begin__tcp_sock_write_txrx) > 92
>>>> 4673                CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_write_txrx, 92);
>>
>> I can confirm the same compile time assertion with an armv7 gcc 7.3.1 compiler.
>> If I revert commit 86dad9aebd0d ("Revert "tcp: more struct tcp_sock adjustments")
>> it goes away.
>>
>> Before the change (actually with it reverted), I can see that the
>> tcp_sock_write_txrx cacheline group begins at offset 1821 with a 3 byte
>> hole, and ends at offset 1897 (it has 76 bytes).
> 
> 
> ...
> 
>> It gained 20 bytes in the change. Most notably, it gained a 4 byte hole
>> between pred_flags and tcp_clock_cache.
>>
>> I haven't followed the development of these optimizations, and I tried a
>> few trivial things, some of which didn't work, and some of which did.
>> Of those that worked, the most notable one was letting the 2 u64 fields,
>> tcp_clock_cache and tcp_mstamp, be the first members of the group, and
>> moving the __be32 pred_flags right below them.
>>
>> Obviously my level of confidence in the fix is quite low, so it would be
>> great if you could cast an expert eye onto this.
> 
> I am on it, do not worry, thanks !

Also just got hit by this on an ARMv7 build configuration as well.

Jakub, I do not see a 32-bit build in the various checks being run for a 
patch, could you add one, if nothing else a i386 build and a 
multi_v7_defconfig build would get us a good build coverage.

Thanks!
-- 
Florian

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

* Re: [net-next:main 26/50] net/ipv4/tcp.c:4673:2: error: call to '__compiletime_assert_1030' declared with 'error' attribute: BUILD_BUG_ON failed: offsetof(struct tcp_sock, __cacheline_group_end__tcp_sock_write_txrx) - offsetofend(struct tcp_sock, __cacheline_group_begin__tcp_sock_...
  2024-04-10 17:28     ` Florian Fainelli
@ 2024-04-10 17:33       ` Eric Dumazet
  2024-04-11  1:36         ` Jakub Kicinski
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Dumazet @ 2024-04-10 17:33 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Vladimir Oltean, Jakub Kicinski, kernel test robot, llvm,
	oe-kbuild-all, netdev

On Wed, Apr 10, 2024 at 7:28 PM Florian Fainelli <f.fainelli@gmail.com> wrote:
>
>
>
> On 4/8/2024 10:08 PM, Eric Dumazet wrote:
> > On Tue, Apr 9, 2024 at 1:06 AM Vladimir Oltean <olteanv@gmail.com> wrote:
> >>
> >> Hi Eric,
> >>
> >> On Mon, Apr 08, 2024 at 10:49:35PM +0800, kernel test robot wrote:
> >>>>> net/ipv4/tcp.c:4673:2: error: call to '__compiletime_assert_1030' declared with 'error' attribute: BUILD_BUG_ON failed: offsetof(struct tcp_sock, __cacheline_group_end__tcp_sock_write_txrx) - offsetofend(struct tcp_sock, __cacheline_group_begin__tcp_sock_write_txrx) > 92
> >>>> 4673                CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_write_txrx, 92);
> >>
> >> I can confirm the same compile time assertion with an armv7 gcc 7.3.1 compiler.
> >> If I revert commit 86dad9aebd0d ("Revert "tcp: more struct tcp_sock adjustments")
> >> it goes away.
> >>
> >> Before the change (actually with it reverted), I can see that the
> >> tcp_sock_write_txrx cacheline group begins at offset 1821 with a 3 byte
> >> hole, and ends at offset 1897 (it has 76 bytes).
> >
> >
> > ...
> >
> >> It gained 20 bytes in the change. Most notably, it gained a 4 byte hole
> >> between pred_flags and tcp_clock_cache.
> >>
> >> I haven't followed the development of these optimizations, and I tried a
> >> few trivial things, some of which didn't work, and some of which did.
> >> Of those that worked, the most notable one was letting the 2 u64 fields,
> >> tcp_clock_cache and tcp_mstamp, be the first members of the group, and
> >> moving the __be32 pred_flags right below them.
> >>
> >> Obviously my level of confidence in the fix is quite low, so it would be
> >> great if you could cast an expert eye onto this.
> >
> > I am on it, do not worry, thanks !
>
> Also just got hit by this on an ARMv7 build configuration as well.
>
> Jakub, I do not see a 32-bit build in the various checks being run for a
> patch, could you add one, if nothing else a i386 build and a
> multi_v7_defconfig build would get us a good build coverage.

i386 build was just fine for me.

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

* Re: [net-next:main 26/50] net/ipv4/tcp.c:4673:2: error: call to '__compiletime_assert_1030' declared with 'error' attribute: BUILD_BUG_ON failed: offsetof(struct tcp_sock, __cacheline_group_end__tcp_sock_write_txrx) - offsetofend(struct tcp_sock, __cacheline_group_begin__tcp_sock_...
  2024-04-10 17:33       ` Eric Dumazet
@ 2024-04-11  1:36         ` Jakub Kicinski
  2024-04-11 19:21           ` Florian Fainelli
  0 siblings, 1 reply; 8+ messages in thread
From: Jakub Kicinski @ 2024-04-11  1:36 UTC (permalink / raw)
  To: Eric Dumazet, Florian Fainelli
  Cc: Vladimir Oltean, kernel test robot, llvm, oe-kbuild-all, netdev

On Wed, 10 Apr 2024 19:33:54 +0200 Eric Dumazet wrote:
> > Jakub, I do not see a 32-bit build in the various checks being run for a
> > patch, could you add one, if nothing else a i386 build and a
> > multi_v7_defconfig build would get us a good build coverage.  
> 
> i386 build was just fine for me.

Yes, we test i386 too, FWIW.

Florian, does arm32 break a lot? I may not be paying sufficient
attention. We can add more build tests but the CPU time we have 
is unfortunately finite :(

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

* Re: [net-next:main 26/50] net/ipv4/tcp.c:4673:2: error: call to '__compiletime_assert_1030' declared with 'error' attribute: BUILD_BUG_ON failed: offsetof(struct tcp_sock, __cacheline_group_end__tcp_sock_write_txrx) - offsetofend(struct tcp_sock, __cacheline_group_begin__tcp_sock_...
  2024-04-11  1:36         ` Jakub Kicinski
@ 2024-04-11 19:21           ` Florian Fainelli
  2024-04-12  1:37             ` Jakub Kicinski
  0 siblings, 1 reply; 8+ messages in thread
From: Florian Fainelli @ 2024-04-11 19:21 UTC (permalink / raw)
  To: Jakub Kicinski, Eric Dumazet
  Cc: Vladimir Oltean, kernel test robot, llvm, oe-kbuild-all, netdev

On 4/10/24 18:36, Jakub Kicinski wrote:
> On Wed, 10 Apr 2024 19:33:54 +0200 Eric Dumazet wrote:
>>> Jakub, I do not see a 32-bit build in the various checks being run for a
>>> patch, could you add one, if nothing else a i386 build and a
>>> multi_v7_defconfig build would get us a good build coverage.
>>
>> i386 build was just fine for me.
> 
> Yes, we test i386 too, FWIW.
> 
> Florian, does arm32 break a lot? I may not be paying sufficient
> attention. We can add more build tests but the CPU time we have
> is unfortunately finite :(

Yes, that is why I mentioned multi_v7_defconfig, you an see the build 
failure with that configuration. Of course Eric fixed it now, thanks!
-- 
Florian


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

* Re: [net-next:main 26/50] net/ipv4/tcp.c:4673:2: error: call to '__compiletime_assert_1030' declared with 'error' attribute: BUILD_BUG_ON failed: offsetof(struct tcp_sock, __cacheline_group_end__tcp_sock_write_txrx) - offsetofend(struct tcp_sock, __cacheline_group_begin__tcp_sock_...
  2024-04-11 19:21           ` Florian Fainelli
@ 2024-04-12  1:37             ` Jakub Kicinski
  0 siblings, 0 replies; 8+ messages in thread
From: Jakub Kicinski @ 2024-04-12  1:37 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Eric Dumazet, Vladimir Oltean, kernel test robot, llvm,
	oe-kbuild-all, netdev

On Thu, 11 Apr 2024 12:21:22 -0700 Florian Fainelli wrote:
> > Florian, does arm32 break a lot? I may not be paying sufficient
> > attention. We can add more build tests but the CPU time we have
> > is unfortunately finite :(  
> 
> Yes, that is why I mentioned multi_v7_defconfig, you an see the build 
> failure with that configuration. Of course Eric fixed it now, thanks!

Would you be willing to type up a bash script along the lines of:

https://github.com/linux-netdev/nipa/blob/main/contest/tests/build-doc.sh

perhaps some inspiration from:

https://github.com/linux-netdev/nipa/blob/main/tests/patch/build_allmodconfig_warn/build_allmodconfig.sh

? (the former runs on the test branches the latter commit by commit)

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

end of thread, other threads:[~2024-04-12  1:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-08 14:49 [net-next:main 26/50] net/ipv4/tcp.c:4673:2: error: call to '__compiletime_assert_1030' declared with 'error' attribute: BUILD_BUG_ON failed: offsetof(struct tcp_sock, __cacheline_group_end__tcp_sock_write_txrx) - offsetofend(struct tcp_sock, __cacheline_group_begin__tcp_sock_ kernel test robot
2024-04-08 23:06 ` Vladimir Oltean
2024-04-09  5:08   ` Eric Dumazet
2024-04-10 17:28     ` Florian Fainelli
2024-04-10 17:33       ` Eric Dumazet
2024-04-11  1:36         ` Jakub Kicinski
2024-04-11 19:21           ` Florian Fainelli
2024-04-12  1:37             ` Jakub Kicinski

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).