Skip to contentSkip to conversation

bnxt_en: use irq_update_affinity_hint()

PATCH Applied Mohammad Heib 4 participants 4 messages Nov 6, 2024 – Nov 12, 2024

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

PATCH 1/1 bnxt_en: use irq_update_affinity_hint()

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. bnxt_en device reopening will resets the affinity

    in bnxt_open().

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

---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +3 -3
index 99d025b69079..cd82f93b20a1 100644
@@ -10885,7 +10885,7 @@ static void bnxt_free_irq(struct bnxt *bp)
 		irq = &bp->irq_tbl[map_idx];
 		if (irq->requested) {
 			if (irq->have_cpumask) {
-				irq_set_affinity_hint(irq->vector, NULL);
+				irq_update_affinity_hint(irq->vector, NULL);
 				free_cpumask_var(irq->cpu_mask);
 				irq->have_cpumask = 0;
 			}
@@ -10940,10 +10940,10 @@ static int bnxt_request_irq(struct bnxt *bp)
 			irq->have_cpumask = 1;
 			cpumask_set_cpu(cpumask_local_spread(i, numa_node),
 					irq->cpu_mask);
-			rc = irq_set_affinity_hint(irq->vector, irq->cpu_mask);
+			rc = irq_update_affinity_hint(irq->vector, irq->cpu_mask);
 			if (rc) {
 				netdev_warn(bp->dev,
-					    "Set affinity failed, IRQ = %d\n",
+					    "Update affinity hint failed, IRQ = %d\n",
 					    irq->vector);
 				break;
 			}
Signature · 1 line
2.34.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Mohammad Heib

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.

Quoted 6 lines

2. bnxt_en device reopening will resets the affinity

    in bnxt_open().

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

Thanks for the patch. This seems inline with what have been done in other drivers.

Quoted 1 line
Quoted 33 lines
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +3 -3
index 99d025b69079..cd82f93b20a1 100644
@@ -10885,7 +10885,7 @@ static void bnxt_free_irq(struct bnxt *bp)
 		irq = &bp->irq_tbl[map_idx];
 		if (irq->requested) {
 			if (irq->have_cpumask) {
-				irq_set_affinity_hint(irq->vector, NULL);
+				irq_update_affinity_hint(irq->vector, NULL);
 				free_cpumask_var(irq->cpu_mask);
 				irq->have_cpumask = 0;
 			}
@@ -10940,10 +10940,10 @@ static int bnxt_request_irq(struct bnxt *bp)
 			irq->have_cpumask = 1;
 			cpumask_set_cpu(cpumask_local_spread(i, numa_node),
 					irq->cpu_mask);
-			rc = irq_set_affinity_hint(irq->vector, irq->cpu_mask);
+			rc = irq_update_affinity_hint(irq->vector, irq->cpu_mask);
 			if (rc) {
 				netdev_warn(bp->dev,
-					    "Set affinity failed, IRQ = %d\n",
+					    "Update affinity hint failed, IRQ = %d\n",
 					    irq->vector);
 				break;
 			}
Signature · 1 line
2.34.3
Reviewed-by
#2 lore raw
Quoted 51 lines · Andy Gospodarek
Quoted 11 lines · Mohammad Heib

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.

Quoted 6 lines

2. bnxt_en device reopening will resets the affinity

    in bnxt_open().

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

Thanks for the patch. This seems inline with what have been done in other drivers.

Quoted 1 line
Quoted 25 lines
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +2 -2
index 99d025b69079..cd82f93b20a1 100644
@@ -10885,7 +10885,7 @@ static void bnxt_free_irq(struct bnxt *bp)
              irq = &bp->irq_tbl[map_idx];
              if (irq->requested) {
                      if (irq->have_cpumask) {
-                             irq_set_affinity_hint(irq->vector, NULL);
+                             irq_update_affinity_hint(irq->vector, NULL);
                              free_cpumask_var(irq->cpu_mask);
                              irq->have_cpumask = 0;
                      }
@@ -10940,10 +10940,10 @@ static int bnxt_request_irq(struct bnxt *bp)
                      irq->have_cpumask = 1;
                      cpumask_set_cpu(cpumask_local_spread(i, numa_node),
                                      irq->cpu_mask);
-                     rc = irq_set_affinity_hint(irq->vector, irq->cpu_mask);
+                     rc = irq_update_affinity_hint(irq->vector, irq->cpu_mask);
                      if (rc) {
                              netdev_warn(bp->dev,
Quoted 9 lines
Quoted 8 lines
drivers/net/ethernet/broadcom/bnxt/bnxt.c +1 -2
-                                         "Set affinity failed, IRQ = %d\n",
+                                         "Update affinity hint failed, IRQ = %d\n",
                                          irq->vector);
                              break;
                      }
--

2.34.3

#3 lore raw
In reply to Mohammad Heib
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Wed, 6 Nov 2024 20:08:11 +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] bnxt_en: use irq_update_affinity_hint()

    https://git.kernel.org/netdev/net-next/c/fcf42409c6e1

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html