tuna: Make --isolate/--include operations affect /proc/irq/default_smp_affinity

When isolating CPUs we affect the IRQ smp_affinity masks, but that will not
affect new devices, to make the isolation operation to stick for that case too we
need to remove the isolated CPUs from the /proc/irq/default_smp_affinity file,
that is what is used to set the initial affinity mask for new device IRQs.

E.g.:

[root@emilia git]# tuna -q enp21s0f0-* -Q
   # users            affinity
  66 enp21s0f0-TxRx-0     0xff  ixgbe
  67 enp21s0f0-TxRx-1     0xff  ixgbe
  68 enp21s0f0-TxRx-2     0xff  ixgbe
  69 enp21s0f0-TxRx-3     0xff  ixgbe
[root@emilia git]# cat /proc/irq/default_smp_affinity
ff
[root@emilia git]# tuna -S1 --isolate
[root@emilia git]# tuna -q enp21s0f0-* -Q
   # users            affinity
  66 enp21s0f0-TxRx-0  0,2,4,6  ixgbe
  67 enp21s0f0-TxRx-1  0,2,4,6  ixgbe
  68 enp21s0f0-TxRx-2  0,2,4,6  ixgbe
  69 enp21s0f0-TxRx-3  0,2,4,6  ixgbe
[root@emilia git]# cat /proc/irq/default_smp_affinity
55
>>> hex((1 << 0) | (1 << 2) | (1 << 4) | (1 << 6))
'0x55'
[root@emilia git]# tuna --cpu 6 --isolate
[root@emilia git]# tuna -q enp21s0f0-* -Q
   # users            affinity
  66 enp21s0f0-TxRx-0    0,2,4  ixgbe
  67 enp21s0f0-TxRx-1    0,2,4  ixgbe
  68 enp21s0f0-TxRx-2    0,2,4  ixgbe
  69 enp21s0f0-TxRx-3    0,2,4  ixgbe
[root@emilia git]# cat /proc/irq/default_smp_affinity
15
>>> hex((1 << 0) | (1 << 2) | (1 << 4))
'0x15'
[root@emilia git]# tuna --cpu 1 --include
[root@emilia git]# tuna -q enp21s0f0-* -Q
   # users            affinity
  66 enp21s0f0-TxRx-0  0,1,2,4  ixgbe
  67 enp21s0f0-TxRx-1  0,1,2,4  ixgbe
  68 enp21s0f0-TxRx-2  0,1,2,4  ixgbe
  69 enp21s0f0-TxRx-3  0,1,2,4  ixgbe
[root@emilia git]# cat /proc/irq/default_smp_affinity
17
>>> hex((1 << 0) | (1 << 1) | (1 << 2) | (1 << 4))
'0x17'

Requested-by: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Clark Williams <williams@redhat.com>
Cc: Guy Streeter <streeter@redhat.com>
Cc: Jeremy Eder <jeder@redhat.com>
Cc: Jiri Kastner <jkastner@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 file changed