Files
kernel/kernel-std/centos/patches/0019-ixgbe-Use-irq_update_affinity_hint.patch
M. Vefa Bicakci 19ca0df55a kernel: Backport IRQ affinity patches
This commit backports IRQ affinity commits from the mainline kernel tree
to the StarlingX kernel. (Links to the patch series can be found at the
end of this commit message.) The intent is to be able to let certain
device drivers (such as i40e, iavf, ice, ixgbe and mlx5) use the global
IRQ affinity setting specified by 'irqaffinity=' on the kernel command
line.

In summary, a number of device drivers use the irq_set_affinity_hint
function to provide a hint to the userspace about the ideal affinity to
use with an IRQ. However, this function also sets the IRQ affinity,
which makes the IRQ use the hinted affinity rather than the global IRQ
affinity provided by the irqaffinity= argument. This is problematic for
StarlingX, as interrupts are, in general, expected to be affined
according to irqaffinity=, which is adjusted by Puppet.

The patch series deprecates the kernel function irq_set_affinity_hint,
and provides two replacements: (1) irq_set_affinity_and_hint and (2)
irq_update_affinity_hint. Replacement function (1) sets both the
affinity hint and the actual affinity, whereas (2) only sets the
affinity hint. The original function -- irq_set_affinity_hint -- remains
as a wrapper around (1), likely for backwards compatibility.

The remaining patches in the series modify a number of device drivers to
use the replacement functions. Of these patches, only the patch for the
ixgbe driver is kept, for two reasons:
- This commit aims to fix the IRQ affinities for network device drivers
  only.
- StarlingX has out-of-tree modules for most of the remaining network
  device drivers, and these will be modified with a separate commit.

Note that the first patch in this commit is included as a dependency for
the others: genirq-Export-affinity-setter-for-modules.patch

Finally, we should note that older versions of StarlingX that used
CentOS 7's v3.10-based kernel did not have this issue, because of a
CentOS 7-specific patch in that kernel that allowed the irqaffinity=
kernel command line argument to take precedence over the device
driver-provided IRQ affinity hints.

Testing:
- An ISO image was successfully built using a monolithic build
  procedure.

- The ISO image was installed and bootstrapped successfully with an
  All-in-One simplex system (physical server) in low-latency mode. This
  server has a management/OAM Ethernet controller managed by the ixgbe
  driver, whose operation was observed to not have been negatively
  affected.

- On another physical All-in-One simplex system which had one
  non-management/non-OAM Ethernet controller handled by the ixgbe
  driver, the IRQ affinities were confirmed to be set correctly by the
  changes in this commit.

  This was achieved by modifying two init scripts (affine-platfrom.sh
  and affine-interrupts.sh) so that they do not manipulate IRQ
  affinities, and observing IRQ affinities for ixgbe's interfaces with
  and without this patch.

Change-Id: Ibf47fd301a460638f3bb4c49865adc3b2429e06d
Partial-Bug: 1958417
Link: https://lore.kernel.org/netdev/20210903152430.244937-1-nitesh@redhat.com/
Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=147cc5838c0f5c76e908b816e924ca378e0d4735
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
2022-02-07 17:32:19 -05:00

65 lines
2.6 KiB
Diff

From 07298341feaa2c35fdd225735b4ee5299efb112f Mon Sep 17 00:00:00 2001
From: Nitesh Narayan Lal <nitesh@redhat.com>
Date: Fri, 3 Sep 2021 11:24:25 -0400
Subject: [PATCH] ixgbe: Use irq_update_affinity_hint()
The driver uses irq_set_affinity_hint() to update the affinity_hint mask
that is consumed by the userspace to distribute the interrupts. However,
under the hood irq_set_affinity_hint() also applies the provided cpumask
(if not NULL) as the affinity for the given interrupt which is an
undocumented side effect.
To remove this side effect irq_set_affinity_hint() has been marked
as deprecated and new interfaces have been introduced. Hence, replace the
irq_set_affinity_hint() with the new interface irq_update_affinity_hint()
that only updates the affinity_hint pointer.
Signed-off-by: Nitesh Narayan Lal <nitesh@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Link: https://lore.kernel.org/r/20210903152430.244937-10-nitesh@redhat.com
(cherry picked from commit cc493264c01d055742a34cfbaecaffb258dcc58c)
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index ffe322136c58..fe10776d8479 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -3250,8 +3250,8 @@ static int ixgbe_request_msix_irqs(struct ixgbe_adapter *adapter)
/* If Flow Director is enabled, set interrupt affinity */
if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) {
/* assign the mask for this irq */
- irq_set_affinity_hint(entry->vector,
- &q_vector->affinity_mask);
+ irq_update_affinity_hint(entry->vector,
+ &q_vector->affinity_mask);
}
}
@@ -3267,8 +3267,8 @@ static int ixgbe_request_msix_irqs(struct ixgbe_adapter *adapter)
free_queue_irqs:
while (vector) {
vector--;
- irq_set_affinity_hint(adapter->msix_entries[vector].vector,
- NULL);
+ irq_update_affinity_hint(adapter->msix_entries[vector].vector,
+ NULL);
free_irq(adapter->msix_entries[vector].vector,
adapter->q_vector[vector]);
}
@@ -3401,7 +3401,7 @@ static void ixgbe_free_irq(struct ixgbe_adapter *adapter)
continue;
/* clear the affinity_mask in the IRQ descriptor */
- irq_set_affinity_hint(entry->vector, NULL);
+ irq_update_affinity_hint(entry->vector, NULL);
free_irq(entry->vector, q_vector);
}
--
2.29.2