ice: use irq_update_affinity_hint()
authorMichal Schmidt <mschmidt@redhat.com>
Fri, 7 Jun 2024 21:22:34 +0000 (14:22 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 11 Jun 2024 02:52:45 +0000 (19:52 -0700)
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.
On the contrary, when the driver applies 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. ice reconfigures VSIs at runtime due to a MIB change
    (ice_dcb_process_lldp_set_mib_change). Reopening a VSI resets the
    affinity in ice_vsi_req_irq_msix().
 3. ice has no idea about irqbalance's config, so it may move an IRQ to
    a banned CPU. The real-time workload suffers unacceptable latency.

I am not sure if updating the affinity hints is at all useful, because
irqbalance ignores them since 2016 ([1]), but at least it's harmless.

This ice change is similar to i40e commit d34c54d1739c ("i40e: Use
irq_update_affinity_hint()").

[1] https://github.com/Irqbalance/irqbalance/commit/dcc411e7bfdd

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
Reviewed-by: Sunil Goutham <sgoutham@marvell.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://lore.kernel.org/r/20240607-next-2024-06-03-intel-next-batch-v3-3-d1470cee3347@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/intel/ice/ice_lib.c
drivers/net/ethernet/intel/ice/ice_main.c

index 7629b0190578b3d4bf1fc8d54b54af570f1648d4..f559e60992fa5cf9575090198ed9b270a9854cd4 100644 (file)
@@ -2580,8 +2580,8 @@ void ice_vsi_free_irq(struct ice_vsi *vsi)
                if (!IS_ENABLED(CONFIG_RFS_ACCEL))
                        irq_set_affinity_notifier(irq_num, NULL);
 
-               /* clear the affinity_mask in the IRQ descriptor */
-               irq_set_affinity_hint(irq_num, NULL);
+               /* clear the affinity_hint in the IRQ descriptor */
+               irq_update_affinity_hint(irq_num, NULL);
                synchronize_irq(irq_num);
                devm_free_irq(ice_pf_to_dev(pf), irq_num, vsi->q_vectors[i]);
        }
index 1b61ca3a6eb6e15353be17e6d7f72a27708bff8b..7d9a4e856f6196c14964f77014f5d40a53f0f107 100644 (file)
@@ -2607,7 +2607,7 @@ static int ice_vsi_req_irq_msix(struct ice_vsi *vsi, char *basename)
                }
 
                /* assign the mask for this irq */
-               irq_set_affinity_hint(irq_num, &q_vector->affinity_mask);
+               irq_update_affinity_hint(irq_num, &q_vector->affinity_mask);
        }
 
        err = ice_set_cpu_rx_rmap(vsi);
@@ -2625,7 +2625,7 @@ free_q_irqs:
                irq_num = vsi->q_vectors[vector]->irq.virq;
                if (!IS_ENABLED(CONFIG_RFS_ACCEL))
                        irq_set_affinity_notifier(irq_num, NULL);
-               irq_set_affinity_hint(irq_num, NULL);
+               irq_update_affinity_hint(irq_num, NULL);
                devm_free_irq(dev, irq_num, &vsi->q_vectors[vector]);
        }
        return err;