Skip to content

Commit

Permalink
nfp: use irq_update_affinity_hint()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Reviewed-by: Louis Peens <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
[James: backport and add compat]
Signed-off-by: James Hershaw <[email protected]>
Signed-off-by: Louis Peens <[email protected]>
  • Loading branch information
mohammadheib authored and louis-peens committed Nov 14, 2024
1 parent 02eb7ce commit a0f50ef
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ $(eval $(call add_compat_flag,$(srctree)/include/linux/bpf.h,"^void bpf_map_inc(
# Check for udp_tunnel_nic_add/del_port
$(eval $(call add_compat_flag,$(srctree)/include/net/udp_tunnel.h,"udp_tunnel_nic_add_port",COMPAT__UDP_TUN_NIC_PORT))

# Check for irq_set_affinity_hint() deprecation
$(eval $(call add_compat_flag,$(srctree)/include/linux/interrupt.h,"^irq_update_affinity_hint(unsigned int irq, const struct cpumask *m)",COMPAT__IRQ_SET_AFFINITY_HINT_DEPR))

utsrelease_h_path :=$(srctree)/include/generated/utsrelease.h
# Check for BC Linux
$(eval $(call add_compat_flag,$(utsrelease_h_path),bclinux,COMPAT_BCLINUX=1))
Expand Down
8 changes: 8 additions & 0 deletions src/nfp_net_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,11 @@ nfp_net_prepare_vector(struct nfp_net *nn, struct nfp_net_r_vector *r_vec,
disable_irq(r_vec->irq_vector);
#endif

#ifndef COMPAT__IRQ_SET_AFFINITY_HINT_DEPR
irq_set_affinity_hint(r_vec->irq_vector, &r_vec->affinity_mask);
#else
irq_update_affinity_hint(r_vec->irq_vector, &r_vec->affinity_mask);
#endif

nn_dbg(nn, "RV%02d: irq=%03d/%03d\n", idx, r_vec->irq_vector,
r_vec->irq_entry);
Expand All @@ -911,7 +915,11 @@ 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)
{
#ifndef COMPAT__IRQ_SET_AFFINITY_HINT_DEPR
irq_set_affinity_hint(r_vec->irq_vector, NULL);
#else
irq_update_affinity_hint(r_vec->irq_vector, NULL);
#endif
nfp_net_napi_del(&nn->dp, r_vec);
free_irq(r_vec->irq_vector, r_vec);
}
Expand Down

0 comments on commit a0f50ef

Please sign in to comment.