ethernet: intel: fix building with large NR_CPUS
Subsystems (3)
PATCH 1/1 ethernet: intel: fix building with large NR_CPUS
From: Arnd Bergmann <[email protected]>
With large values of CONFIG_NR_CPUS, three Intel ethernet drivers fail to compile like:
In function ‘i40e_free_q_vector’,
inlined from ‘i40e_vsi_alloc_q_vectors’ at drivers/net/ethernet/intel/i40e/i40e_main.c:12112:3:
571 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)include/linux/rcupdate.h:1084:17: note: in expansion of macro ‘BUILD_BUG_ON’
1084 | BUILD_BUG_ON(offsetof(typeof(*(ptr)), rhf) >= 4096); \drivers/net/ethernet/intel/i40e/i40e_main.c:5113:9: note: in expansion of macro ‘kfree_rcu’
5113 | kfree_rcu(q_vector, rcu);
| ^~~~~~~~~The problem is that the 'rcu' member in 'q_vector' is too far from the start of the structure. Move this member before the CPU mask instead, in all three drivers.
--- drivers/net/ethernet/intel/fm10k/fm10k.h | 2 +- drivers/net/ethernet/intel/i40e/i40e.h | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k.h +1 -1
@@ -187,6 +187,7 @@ struct fm10k_q_vector {u32 __iomem *itr;/* pointer to ITR register for this vector */ u16 v_idx;/* index of q_vector within interface array */ struct fm10k_ring_container rx, tx; +struct rcu_head rcu;/* to avoid race with update stats on free */ struct napi_struct napi;cpumask_t affinity_mask;
@@ -195,7 +196,6 @@ struct fm10k_q_vector {#ifdef CONFIG_DEBUG_FS struct dentry *dbg_q_vector;#endif /* CONFIG_DEBUG_FS */ -struct rcu_head rcu;/* to avoid race with update stats on free */ /* for dynamic allocation of rings associated with this q_vector */ struct fm10k_ring ring[]____cacheline_internodealigned_in_smp ;
drivers/net/ethernet/intel/i40e/i40e.h +1 -1
@@ -944,6 +944,7 @@ struct i40e_q_vector {u16 v_idx;/* index in the vsi->q_vector array. */ u16 reg_idx;/* register index of the interrupt */ +struct rcu_head rcu;/* to avoid race with update stats on free */ struct napi_struct napi;
@@ -956,7 +957,6 @@ struct i40e_q_vector {cpumask_t affinity_mask;struct irq_affinity_notify affinity_notify; -struct rcu_head rcu;/* to avoid race with update stats on free */ char name[I40E_INT_NAME_STR_LEN ];bool arm_wb_state;bool in_busy_poll;
drivers/net/ethernet/intel/ixgbe/ixgbe.h +1 -1
@@ -505,11 +505,11 @@ struct ixgbe_q_vector {* represents the vector for this ring */ u16 itr;/* Interrupt throttle rate written to EITR */ struct ixgbe_ring_container rx, tx; +struct rcu_head rcu;/* to avoid race with update stats on free */ struct napi_struct napi;cpumask_t affinity_mask;int numa_node; -struct rcu_head rcu;/* to avoid race with update stats on free */ char name[IFNAMSIZ +9 ];/* for dynamic allocation of rings associated with this q_vector */
Signature · 1 line
2.39.5
Quoted 32 lines
-----Original Message-----
From: Arnd Bergmann <[email protected]>
Sent: Friday, June 20, 2025 1:11 PM
To: Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Andrew Lunn <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>
Cc: Arnd Bergmann <[email protected]>; Loktionov, Aleksandr <[email protected]>; Simon Horman <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: [PATCH] ethernet: intel: fix building with largeNR_CPUSFrom: Arnd Bergmann <[email protected]>
With large values of
CONFIG_NR_CPUS, three Intel ethernet drivers fail to compile like:In function ‘i40e_free_q_vector’,
inlined from ‘i40e_vsi_alloc_q_vectors’ atdrivers/net/ethernet/intel/i40e/i40e_main.c:12112:3:
571 | _compiletime_assert(condition, msg,__compiletime_assert_,__COUNTER__)include/linux/rcupdate.h:1084:17: note: in expansion of macro ‘BUILD_BUG_ON’
1084 | BUILD_BUG_ON(offsetof(typeof(*(ptr)), rhf) >=
4096); \drivers/net/ethernet/intel/i40e/i40e_main.c:5113:9: note: in expansion of macro ‘kfree_rcu’
Quoted 8 lines
5113 | kfree_rcu(q_vector, rcu); | ^~~~~~~~~The problem is that the 'rcu' member in '
q_vector' is too far from the start of the structure. Move this member before the CPU mask instead, in all three drivers.Signed-off-by Arnd Bergmann <[email protected]>
Quoted 78 lines
--- drivers/net/ethernet/intel/fm10k/fm10k.h | 2 +- drivers/net/ethernet/intel/i40e/i40e.h | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)drivers/net/ethernet/intel/fm10k/fm10k.h +1
-0@@ -187,6 +187,7 @@ struct fm10k_q_vector {u32 __iomem *itr;/* pointer to ITR register for this vector */ u16 v_idx;/* index of q_vector within interface array */ struct fm10k_ring_container rx, tx; +struct rcu_head rcu;/* to avoid race with update stats on free */ drivers/net/ethernet/intel/fm10k/fm10k.h +0
-1struct napi_struct napi;cpumask_t affinity_mask;@@ -195,7 +196,6 @@ struct fm10k_q_vector { #ifdef CONFIG_DEBUG_FSstruct dentry *dbg_q_vector; #endif /* CONFIG_DEBUG_FS */ -struct rcu_head rcu;/* to avoid race with update stats on free *//* for dynamic allocation of rings associated with this
q_vector*/drivers/net/ethernet/intel/fm10k/fm10k.h +0
-0struct fm10k_ring ring[]____cacheline_internodealigned_in_smp ;drivers/net/ethernet/intel/i40e/i40e.h +1
-1@@ -944,6 +944,7 @@ struct i40e_q_vector {u16 v_idx;/* index in the vsi->q_vector array. */ u16 reg_idx;/* register index of the interrupt */ +struct rcu_head rcu;/* to avoid race with update stats on free */ struct napi_struct napi;@@ -956,7 +957,6 @@ struct i40e_q_vector {cpumask_t affinity_mask; struct irq_affinity_notify affinity_notify; -struct rcu_head rcu;/* to avoid race with update stats on free */ char name[I40E_INT_NAME_STR_LEN ];bool arm_wb_state;drivers/net/ethernet/intel/i40e/i40e.h +0
-0bool in_busy_poll;drivers/net/ethernet/intel/ixgbe/ixgbe.h +1
-1@@ -505,11 +505,11 @@ struct ixgbe_q_vector {* represents the vector for this ring */ u16 itr;/* Interrupt throttle rate written to EITR */ struct ixgbe_ring_container rx, tx; +struct rcu_head rcu;/* to avoid race with update stats on free */ struct napi_struct napi;cpumask_t affinity_mask;int numa_node; -struct rcu_head rcu;/* to avoid race with update stats on free */drivers/net/ethernet/intel/ixgbe/ixgbe.h +0
-0char name[IFNAMSIZ +9 ];/* for dynamic allocation of rings associated with this
q_vector*/
--
2.39.5
From: Arnd Bergmann <[email protected]>
Date: Fri, 20 Jun 2025 13:11:17 +0200
Quoted 30 lines
From: Arnd Bergmann <[email protected]>
With large values of
CONFIG_NR_CPUS, three Intel ethernet drivers fail to compile like:In function ‘i40e_free_q_vector’,
inlined from ‘i40e_vsi_alloc_q_vectors’ at drivers/net/ethernet/intel/i40e/i40e_main.c:12112:3:571 |
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)include/linux/rcupdate.h:1084:17: note: in expansion of macro ‘BUILD_BUG_ON’
1084 |BUILD_BUG_ON(offsetof(typeof(*(ptr)), rhf) >= 4096); \drivers/net/ethernet/intel/i40e/i40e_main.c:5113:9: note: in expansion of macro ‘kfree_rcu’5113 | kfree_rcu(q_vector, rcu); | ^~~~~~~~~The problem is that the 'rcu' member in '
q_vector' is too far from the start of the structure. Move this member before the CPU mask instead, in all three drivers.Signed-off-by Arnd Bergmann <[email protected]>--- drivers/net/ethernet/intel/fm10k/fm10k.h | 2 +- drivers/net/ethernet/intel/i40e/i40e.h | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)drivers/net/ethernet/intel/fm10k/fm10k.h +0
-0
drivers/net/ethernet/intel/fm10k/fm10k.h struct fm10k_q_vector { · line 192
Quoted 6 lines
drivers/net/ethernet/intel/fm10k/fm10k.h +1
-0@@ -187,6 +187,7 @@ struct fm10k_q_vector {u32 __iomem *itr;/* pointer to ITR register for this vector */ u16 v_idx;/* index of q_vector within interface array */ struct fm10k_ring_container rx, tx; +struct rcu_head rcu;/* to avoid race with update stats on free */ struct napi_struct napi;
I'd place it *after* ::napi as the latter is hot and better to still be near rx/tx etc.
Same for the rest of the drivers.
Thanks,
Olek