testing: Make per-CPU SAs scenarios more predictable by pinning IRQs to vCPUs

This ensures that packets on sun are processed on a particular CPU and
not randomly on one, which causes expected SAs not to get created or
other weird things.
This commit is contained in:
Tobias Brunner
2025-12-03 11:42:54 +01:00
parent b0e4a7d015
commit 1454bd7bcf
9 changed files with 50 additions and 15 deletions
@@ -1,4 +1,4 @@
#! /bin/bash
#!/bin/bash
while getopts "46idt:lr" opt
do
+28
View File
@@ -0,0 +1,28 @@
#!/bin/bash
#
# Sets the CPU affiniy of the IRQ handling inbound messages on the given
# network interface
IFACE=$1
AFFINITY=$2
if [ -z "$IFACE" -o -z "$AFFINITY" ]
then
exit 1
fi
PCI_ADDR=$(ethtool -i ${IFACE} | grep bus-info | sed -e 's/bus-info: //')
if [ -z "$PCI_ADDR" ]
then
exit 2
fi
IRQ=$(grep "MSIX-${PCI_ADDR}.*input" /proc/interrupts | awk -F ':' '{print $1}' | awk '{print $1}')
if [ -z "$IRQ" ]
then
exit 3
fi
PREV=$(cat /proc/irq/${IRQ}/smp_affinity_list)
echo "Setting affinity for IRQ ${IRQ} of ${IFACE}@${PCI_ADDR} to ${AFFINITY}, was ${PREV}"
echo ${AFFINITY} > /proc/irq/${IRQ}/smp_affinity_list