diff mbox series

[net] nfp: use irq_update_affinity_hint()

Message ID 20241107115002.413358-1-mheib@redhat.com (mailing list archive)
State Accepted
Commit d9e2e290f7142d4c67c05ebbe37388d54a66c6c5
Delegated to: Netdev Maintainers
Headers show
Series [net] nfp: use irq_update_affinity_hint() | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present fail Series targets non-next tree, but doesn't contain any Fixes tags
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 3 this patch: 3
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 5 maintainers not CCed: andrew+netdev@lunn.ch yinjun.zhang@corigine.com pabeni@redhat.com edumazet@google.com kuba@kernel.org
netdev/build_clang success Errors and warnings before: 3 this patch: 3
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 4 this patch: 4
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 16 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 3 this patch: 3
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-11-07--15-00 (tests: 787)

Commit Message

Mohammad Heib Nov. 7, 2024, 11:50 a.m. UTC
irq_set_affinity_hint() is deprecated, Use irq_update_affinity_hint()
instead. This removes the side-effect of actually applying the affinity.

The driver does not really need to worry about spreading its IRQs across
CPUs. The core code already takes care of that. when the driver applies the
affinities by itself, it breaks the users' expectations:

1. The user configures irqbalance with IRQBALANCE_BANNED_CPULIST in
   order to prevent IRQs from being moved to certain CPUs that run a
   real-time workload.

2. nfp device reopening will resets the affinity
   in nfp_net_netdev_open().

3. nfp has no idea about irqbalance's config, so it may move an IRQ to
   a banned CPU. The real-time workload suffers unacceptable latency.

Signed-off-by: Mohammad Heib <mheib@redhat.com>
---
 drivers/net/ethernet/netronome/nfp/nfp_net_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Simon Horman Nov. 10, 2024, 1:31 p.m. UTC | #1
On Thu, Nov 07, 2024 at 01:50:02PM +0200, Mohammad Heib wrote:
> irq_set_affinity_hint() is deprecated, Use irq_update_affinity_hint()
> instead. This removes the side-effect of actually applying the affinity.
> 
> The driver does not really need to worry about spreading its IRQs across
> CPUs. The core code already takes care of that. when the driver applies the
> affinities by itself, it breaks the users' expectations:
> 
> 1. The user configures irqbalance with IRQBALANCE_BANNED_CPULIST in
>    order to prevent IRQs from being moved to certain CPUs that run a
>    real-time workload.
> 
> 2. nfp device reopening will resets the affinity
>    in nfp_net_netdev_open().
> 
> 3. nfp has no idea about irqbalance's config, so it may move an IRQ to
>    a banned CPU. The real-time workload suffers unacceptable latency.
> 
> Signed-off-by: Mohammad Heib <mheib@redhat.com>

Reviewed-by: Simon Horman <horms@kernel.org>
Louis Peens Nov. 11, 2024, 5:33 a.m. UTC | #2
On Thu, Nov 07, 2024 at 01:50:02PM +0200, Mohammad Heib wrote:
> irq_set_affinity_hint() is deprecated, Use irq_update_affinity_hint()
> instead. This removes the side-effect of actually applying the affinity.
> 
> The driver does not really need to worry about spreading its IRQs across
> CPUs. The core code already takes care of that. when the driver applies the
> affinities by itself, it breaks the users' expectations:
> 
> 1. The user configures irqbalance with IRQBALANCE_BANNED_CPULIST in
>    order to prevent IRQs from being moved to certain CPUs that run a
>    real-time workload.
> 
> 2. nfp device reopening will resets the affinity
>    in nfp_net_netdev_open().
> 
> 3. nfp has no idea about irqbalance's config, so it may move an IRQ to
>    a banned CPU. The real-time workload suffers unacceptable latency.
> 
> Signed-off-by: Mohammad Heib <mheib@redhat.com>
> ---
>  drivers/net/ethernet/netronome/nfp/nfp_net_common.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
> index 6e0929af0f72..98e098c09c03 100644
> --- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
> +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
> @@ -829,7 +829,7 @@ nfp_net_prepare_vector(struct nfp_net *nn, struct nfp_net_r_vector *r_vec,
>  		return err;
>  	}
>  
> -	irq_set_affinity_hint(r_vec->irq_vector, &r_vec->affinity_mask);
> +	irq_update_affinity_hint(r_vec->irq_vector, &r_vec->affinity_mask);
>  
>  	nn_dbg(nn, "RV%02d: irq=%03d/%03d\n", idx, r_vec->irq_vector,
>  	       r_vec->irq_entry);
> @@ -840,7 +840,7 @@ nfp_net_prepare_vector(struct nfp_net *nn, struct nfp_net_r_vector *r_vec,
>  static void
>  nfp_net_cleanup_vector(struct nfp_net *nn, struct nfp_net_r_vector *r_vec)
>  {
> -	irq_set_affinity_hint(r_vec->irq_vector, NULL);
> +	irq_update_affinity_hint(r_vec->irq_vector, NULL);
>  	nfp_net_napi_del(&nn->dp, r_vec);
>  	free_irq(r_vec->irq_vector, r_vec);
>  }
Looks good to me, thank you!

Reviewed-by: Louis Peens <louis.peens@corigine.com>
> -- 
> 2.34.3
>
patchwork-bot+netdevbpf@kernel.org Nov. 12, 2024, 12:10 a.m. UTC | #3
Hello:

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

On Thu,  7 Nov 2024 13:50:02 +0200 you wrote:
> irq_set_affinity_hint() is deprecated, Use irq_update_affinity_hint()
> instead. This removes the side-effect of actually applying the affinity.
> 
> The driver does not really need to worry about spreading its IRQs across
> CPUs. The core code already takes care of that. when the driver applies the
> affinities by itself, it breaks the users' expectations:
> 
> [...]

Here is the summary with links:
  - [net] nfp: use irq_update_affinity_hint()
    https://git.kernel.org/netdev/net-next/c/d9e2e290f714

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
index 6e0929af0f72..98e098c09c03 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
@@ -829,7 +829,7 @@  nfp_net_prepare_vector(struct nfp_net *nn, struct nfp_net_r_vector *r_vec,
 		return err;
 	}
 
-	irq_set_affinity_hint(r_vec->irq_vector, &r_vec->affinity_mask);
+	irq_update_affinity_hint(r_vec->irq_vector, &r_vec->affinity_mask);
 
 	nn_dbg(nn, "RV%02d: irq=%03d/%03d\n", idx, r_vec->irq_vector,
 	       r_vec->irq_entry);
@@ -840,7 +840,7 @@  nfp_net_prepare_vector(struct nfp_net *nn, struct nfp_net_r_vector *r_vec,
 static void
 nfp_net_cleanup_vector(struct nfp_net *nn, struct nfp_net_r_vector *r_vec)
 {
-	irq_set_affinity_hint(r_vec->irq_vector, NULL);
+	irq_update_affinity_hint(r_vec->irq_vector, NULL);
 	nfp_net_napi_del(&nn->dp, r_vec);
 	free_irq(r_vec->irq_vector, r_vec);
 }