netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [v2] ethernet: intel: fix building with large NR_CPUS
@ 2025-06-20 17:31 Arnd Bergmann
  2025-06-20 17:52 ` David Miller
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Arnd Bergmann @ 2025-06-20 17:31 UTC (permalink / raw)
  To: Tony Nguyen, Przemek Kitszel, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Arnd Bergmann, Simon Horman, Dr. David Alan Gilbert,
	Aleksandr Loktionov, Dawid Osuchowski, Jedrzej Jagielski,
	Mateusz Polchlopek, Piotr Kwapulinski, Slawomir Mrozowicz,
	Martyna Szapar-Mudlaw, intel-wired-lan, netdev, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

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 <arnd@arndb.de>
---
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(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k.h b/drivers/net/ethernet/intel/fm10k/fm10k.h
index 6119a4108838..65a2816142d9 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k.h
+++ b/drivers/net/ethernet/intel/fm10k/fm10k.h
@@ -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;
diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h
index 54d5fdc303ca..c429252859d3 100644
--- a/drivers/net/ethernet/intel/i40e/i40e.h
+++ b/drivers/net/ethernet/intel/i40e/i40e.h
@@ -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;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index c6772cd2d802..3f9521d4e899 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -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


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

* Re: [PATCH] [v2] ethernet: intel: fix building with large NR_CPUS
  2025-06-20 17:31 [PATCH] [v2] ethernet: intel: fix building with large NR_CPUS Arnd Bergmann
@ 2025-06-20 17:52 ` David Miller
  2025-06-20 19:12 ` [Intel-wired-lan] " Loktionov, Aleksandr
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2025-06-20 17:52 UTC (permalink / raw)
  To: arnd
  Cc: anthony.l.nguyen, przemyslaw.kitszel, andrew+netdev, edumazet,
	kuba, pabeni, arnd, horms, linux, aleksandr.loktionov,
	dawid.osuchowski, jedrzej.jagielski, mateusz.polchlopek,
	piotr.kwapulinski, slawomirx.mrozowicz, martyna.szapar-mudlaw,
	intel-wired-lan, netdev, linux-kernel

From: Arnd Bergmann <arnd@kernel.org>
Date: Fri, 20 Jun 2025 19:31:24 +0200

> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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 <arnd@arndb.de>
> ---
> v2: move rcu to just after the napi_struct [Alexander Lobakin]

Acked-by: David S. Miller <davem@davemloft.net>

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

* RE: [Intel-wired-lan] [PATCH] [v2] ethernet: intel: fix building with large NR_CPUS
  2025-06-20 17:31 [PATCH] [v2] ethernet: intel: fix building with large NR_CPUS Arnd Bergmann
  2025-06-20 17:52 ` David Miller
@ 2025-06-20 19:12 ` Loktionov, Aleksandr
  2025-06-24 14:10 ` Alexander Lobakin
  2025-07-08  6:20 ` Mekala, SunithaX D
  3 siblings, 0 replies; 5+ messages in thread
From: Loktionov, Aleksandr @ 2025-06-20 19:12 UTC (permalink / raw)
  To: Arnd Bergmann, Nguyen, Anthony L, Kitszel, Przemyslaw,
	Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni
  Cc: Arnd Bergmann, Simon Horman, Dr. David Alan Gilbert,
	Dawid Osuchowski, Jagielski, Jedrzej, Polchlopek, Mateusz,
	Kwapulinski, Piotr, Mrozowicz, SlawomirX, Martyna Szapar-Mudlaw,
	intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org



> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf
> Of Arnd Bergmann
> Sent: Friday, June 20, 2025 7:31 PM
> To: Nguyen, Anthony L <anthony.l.nguyen@intel.com>; Kitszel,
> Przemyslaw <przemyslaw.kitszel@intel.com>; Andrew Lunn
> <andrew+netdev@lunn.ch>; David S. Miller <davem@davemloft.net>; Eric
> Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo
> Abeni <pabeni@redhat.com>
> Cc: Arnd Bergmann <arnd@arndb.de>; Simon Horman <horms@kernel.org>;
> Dr. David Alan Gilbert <linux@treblig.org>; Loktionov, Aleksandr
> <aleksandr.loktionov@intel.com>; Dawid Osuchowski
> <dawid.osuchowski@linux.intel.com>; Jagielski, Jedrzej
> <jedrzej.jagielski@intel.com>; Polchlopek, Mateusz
> <mateusz.polchlopek@intel.com>; Kwapulinski, Piotr
> <piotr.kwapulinski@intel.com>; Mrozowicz, SlawomirX
> <slawomirx.mrozowicz@intel.com>; Martyna Szapar-Mudlaw
> <martyna.szapar-mudlaw@linux.intel.com>; intel-wired-
> lan@lists.osuosl.org; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: [Intel-wired-lan] [PATCH] [v2] ethernet: intel: fix building
> with large NR_CPUS
> 
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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 <arnd@arndb.de>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> ---
> 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(-)
> 
> diff --git a/drivers/net/ethernet/intel/fm10k/fm10k.h
> b/drivers/net/ethernet/intel/fm10k/fm10k.h
> index 6119a4108838..65a2816142d9 100644
> --- a/drivers/net/ethernet/intel/fm10k/fm10k.h
> +++ b/drivers/net/ethernet/intel/fm10k/fm10k.h
> @@ -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;
> diff --git a/drivers/net/ethernet/intel/i40e/i40e.h
> b/drivers/net/ethernet/intel/i40e/i40e.h
> index 54d5fdc303ca..c429252859d3 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e.h
> +++ b/drivers/net/ethernet/intel/i40e/i40e.h
> @@ -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;
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
> b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
> index c6772cd2d802..3f9521d4e899 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
> @@ -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


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

* Re: [Intel-wired-lan] [PATCH] [v2] ethernet: intel: fix building with large NR_CPUS
  2025-06-20 17:31 [PATCH] [v2] ethernet: intel: fix building with large NR_CPUS Arnd Bergmann
  2025-06-20 17:52 ` David Miller
  2025-06-20 19:12 ` [Intel-wired-lan] " Loktionov, Aleksandr
@ 2025-06-24 14:10 ` Alexander Lobakin
  2025-07-08  6:20 ` Mekala, SunithaX D
  3 siblings, 0 replies; 5+ messages in thread
From: Alexander Lobakin @ 2025-06-24 14:10 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Tony Nguyen, Przemek Kitszel, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Arnd Bergmann,
	Simon Horman, Dr. David Alan Gilbert, Aleksandr Loktionov,
	Dawid Osuchowski, Jedrzej Jagielski, Mateusz Polchlopek,
	Piotr Kwapulinski, Slawomir Mrozowicz, Martyna Szapar-Mudlaw,
	intel-wired-lan, netdev, linux-kernel

From: Arnd Bergmann <arnd@kernel.org>
Date: Fri, 20 Jun 2025 19:31:24 +0200

> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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 <arnd@arndb.de>

Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>

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

Thanks!
Olek

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

* RE: [Intel-wired-lan] [PATCH] [v2] ethernet: intel: fix building with large NR_CPUS
  2025-06-20 17:31 [PATCH] [v2] ethernet: intel: fix building with large NR_CPUS Arnd Bergmann
                   ` (2 preceding siblings ...)
  2025-06-24 14:10 ` Alexander Lobakin
@ 2025-07-08  6:20 ` Mekala, SunithaX D
  3 siblings, 0 replies; 5+ messages in thread
From: Mekala, SunithaX D @ 2025-07-08  6:20 UTC (permalink / raw)
  To: Arnd Bergmann, Nguyen, Anthony L, Kitszel, Przemyslaw,
	Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni
  Cc: Arnd Bergmann, Simon Horman, Dr. David Alan Gilbert,
	Loktionov, Aleksandr, Dawid Osuchowski, Jagielski, Jedrzej,
	Polchlopek, Mateusz, Kwapulinski, Piotr, Mrozowicz, SlawomirX,
	Martyna Szapar-Mudlaw, intel-wired-lan@lists.osuosl.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of Arnd Bergmann
> Sent: Friday, June 20, 2025 10:31 AM
> To: Nguyen, Anthony L <anthony.l.nguyen@intel.com>; Kitszel, Przemyslaw <przemyslaw.kitszel@intel.com>; Andrew Lunn <andrew+netdev@lunn.ch>; David S. Miller <davem@davemloft.net>; Eric Dumazet >  <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>
> Cc: Arnd Bergmann <arnd@arndb.de>; Simon Horman <horms@kernel.org>; Dr. David Alan Gilbert <linux@treblig.org>; Loktionov, Aleksandr <aleksandr.loktionov@intel.com>; Dawid Osuchowski >  <dawid.osuchowski@linux.intel.com>; Jagielski, Jedrzej <jedrzej.jagielski@intel.com>; Polchlopek, Mateusz <mateusz.polchlopek@intel.com>; Kwapulinski, Piotr <piotr.kwapulinski@intel.com>; Mrozowicz, SlawomirX >  <slawomirx.mrozowicz@intel.com>; Martyna Szapar-Mudlaw <martyna.szapar-mudlaw@linux.intel.com>; intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org; linux-kernel@vger.kernel.org
>  Subject: [Intel-wired-lan] [PATCH] [v2] ethernet: intel: fix building with large NR_CPUS
> 
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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 <arnd@arndb.de>
> ---
>  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(-)

Tested-by: Sunitha Mekala <sunithax.d.mekala@intel.com> (A Contingent worker at Intel)

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

end of thread, other threads:[~2025-07-08  6:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-20 17:31 [PATCH] [v2] ethernet: intel: fix building with large NR_CPUS Arnd Bergmann
2025-06-20 17:52 ` David Miller
2025-06-20 19:12 ` [Intel-wired-lan] " Loktionov, Aleksandr
2025-06-24 14:10 ` Alexander Lobakin
2025-07-08  6:20 ` Mekala, SunithaX D

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