Skip to contentSkip to conversation

ethernet: intel: fix building with large NR_CPUS

PATCH In review Arnd Bergmann 5 participants 5 messages Jun 20, 2025 – Jul 8, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 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.

---
v2: move rcu to just after the napi_struct [Alexander Lobakin]

---
 drivers/net/ethernet/intel/fm10k/fm10k.h | 3 ++-
 drivers/net/ethernet/intel/i40e/i40e.h   | 2 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe.h | 3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k.h +2 -1
index 6119a4108838..65a2816142d9 100644
@@ -189,13 +189,14 @@ struct fm10k_q_vector {
 	struct fm10k_ring_container rx, tx;
 
 	struct napi_struct napi;
+	struct rcu_head rcu;	/* to avoid race with update stats on free */
+
 	cpumask_t affinity_mask;
 	char name[IFNAMSIZ + 9];
 
 #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
index 54d5fdc303ca..c429252859d3 100644
@@ -946,6 +946,7 @@ struct i40e_q_vector {
 	u16 reg_idx;		/* register index of the interrupt */
 
 	struct napi_struct napi;
+	struct rcu_head rcu;	/* to avoid race with update stats on free */
 
 	struct i40e_ring_container rx;
 	struct i40e_ring_container tx;
@@ -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 +2 -1
index c6772cd2d802..3f9521d4e899 100644
@@ -507,9 +507,10 @@ struct ixgbe_q_vector {
 	struct ixgbe_ring_container rx, tx;
 
 	struct napi_struct napi;
+	struct rcu_head rcu;	/* to avoid race with update stats on free */
+
 	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
maintainer Acked-by on v2 1/1
#1 lore raw

From: Arnd Bergmann <[email protected]>
Date: Fri, 20 Jun 2025 19:31:24 +0200

Quoted 14 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);
      |         ^~~~~~~~~
Quoted 7 lines

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.

---
v2: move rcu to just after the napi_struct [Alexander Lobakin]

Reviewed-by on v2 1/1
#2 lore raw
In reply to Arnd Bergmann
Quoted 41 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Arnd Bergmann
Sent: Friday, June 20, 2025 7:31 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]>; Simon Horman <[email protected]>; Dr. David Alan Gilbert <[email protected]>; Loktionov, Aleksandr <[email protected]>; Dawid Osuchowski <[email protected]>; Jagielski, Jedrzej <[email protected]>; Polchlopek, Mateusz <[email protected]>; Kwapulinski, Piotr <[email protected]>; Mrozowicz, SlawomirX <[email protected]>; Martyna Szapar-Mudlaw <[email protected]>; intel-wired- [email protected]; [email protected]; linux- [email protected]
Subject: [Intel-wired-lan] [PATCH] [v2] 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’

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.

Quoted 77 lines

---
v2: move rcu to just after the napi_struct [Alexander Lobakin]

---
 drivers/net/ethernet/intel/fm10k/fm10k.h | 3 ++-
 drivers/net/ethernet/intel/i40e/i40e.h   | 2 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe.h | 3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k.h +2 -1
index 6119a4108838..65a2816142d9 100644
@@ -189,13 +189,14 @@ struct fm10k_q_vector {
 	struct fm10k_ring_container rx, tx;
 
 	struct napi_struct napi;
+	struct rcu_head rcu;	/* to avoid race with update stats on free
 */
+
 	cpumask_t affinity_mask;
 	char name[IFNAMSIZ + 9];
 
 #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 */

drivers/net/ethernet/intel/fm10k/fm10k.h +0 -0
 	struct fm10k_ring ring[] ____cacheline_internodealigned_in_smp;
drivers/net/ethernet/intel/i40e/i40e.h +1 -0
index 54d5fdc303ca..c429252859d3 100644
@@ -946,6 +946,7 @@ struct i40e_q_vector {
 	u16 reg_idx;		/* register index of the interrupt */
 
 	struct napi_struct napi;
+	struct rcu_head rcu;	/* to avoid race with update stats on free
 */
 
 	struct i40e_ring_container rx;
drivers/net/ethernet/intel/i40e/i40e.h +0 -1
 	struct i40e_ring_container tx;
@@ -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 -0
 	bool in_busy_poll;
drivers/net/ethernet/intel/ixgbe/ixgbe.h +2 -1
index c6772cd2d802..3f9521d4e899 100644
@@ -507,9 +507,10 @@ struct ixgbe_q_vector {
 	struct ixgbe_ring_container rx, tx;
 
 	struct napi_struct napi;
+	struct rcu_head rcu;	/* to avoid race with update stats on free
 */
+
 	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 */
--
2.39.5

Reviewed-by on v2 1/1
#3 lore raw
In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>
Date: Fri, 20 Jun 2025 19:31:24 +0200

Quoted 11 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’

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.

Quoted 2 lines

---
v2: move rcu to just after the napi_struct [Alexander Lobakin]

Thanks!
Olek

Tested-by on v2 1/1
#4 lore raw
In reply to Arnd Bergmann
Quoted 25 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Arnd Bergmann
Sent: Friday, June 20, 2025 10:31 AM
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]>; Simon Horman <[email protected]>; Dr. David Alan Gilbert <[email protected]>; Loktionov, Aleksandr <[email protected]>; Dawid Osuchowski > <[email protected]>; Jagielski, Jedrzej <[email protected]>; Polchlopek, Mateusz <[email protected]>; Kwapulinski, Piotr <[email protected]>; Mrozowicz, SlawomirX > <[email protected]>; Martyna Szapar-Mudlaw <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: [Intel-wired-lan] [PATCH] [v2] 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.

Quoted 8 lines

---
v2: move rcu to just after the napi_struct [Alexander Lobakin]

---
 drivers/net/ethernet/intel/fm10k/fm10k.h | 3 ++-
 drivers/net/ethernet/intel/i40e/i40e.h   | 2 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe.h | 3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)