Hello,
I'm trying to assign some IRQ affinities to core 0 by setting
smp_affinity to 1.
This is on a dual-core embedded Linux virtual machine ran with KVM.
However, ISRs continue to run on both cores.
The same technique works well with QEMU with full software emulation.
Here is the output of the following:
host> uname -a
Linux rtcon2 3.19.0-22-generic #22~14.04.1-Ubuntu SMP Wed Jun 17
10:03:13 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
guest> uname -a
Linux NI-cRIO-Linux-525400123456 3.14.40-rt37-nilrt #1 SMP PREEMPT RT
Thu Aug 6 20:35:41 EEST 2015 x86_64 GNU/Linux
host> kvm --version
QEMU emulator version 2.0.0 (Debian 2.0.0+dfsg-2ubuntu1.15), Copyright
(c) 2003-2008 Fabrice Bellard
Here is how IRQ affinity is configured on guest at startup, in an init.d
script:
echo 1 > /proc/irq/default_smp_affinity
for x in /proc/irq/*/smp_affinity;
do
echo 1 > $x
done 2> /dev/null
The command line for starting the hardware accelerated VM:
kvm -kernel bzImage -hda rootfs.ext2 -append "root=/dev/sda console=ttyS0 \
rw" -nographic -cpu qemu64 -snapshot -smp 2 -m 2048
... which actually runs this:
qemu-system-x86-64 -enable-kvm -kernel bzImage -hda rootfs.ext2 -append \
"root=/dev/sda console=ttyS0 rw" -nographic -cpu qemu64 -snapshot -smp 2 \
-m 2048
On the hardware accelerated guest, 'cat /proc/interrupts' shows:
CPU0 CPU1
0: 26 0 IO-APIC-edge timer
1: 7 4 IO-APIC-edge i8042
4: 1137 523 IO-APIC-edge serial
8: 0 1 IO-APIC-edge rtc0
9: 0 0 IO-APIC-fasteoi acpi
11: 4971 4 IO-APIC-fasteoi eth0
12: 66 64 IO-APIC-edge i8042
14: 1958 714 IO-APIC-edge ata_piix
15: 4512 63 IO-APIC-edge ata_piix
...
Interrupts are serviced on both cores, even though affinity is set to 1.
The command line for starting full software emulation VM is:
qemu-system-x86_64 -kernel bzImage -hda rootfs.ext2 -append "root=/dev/sda \
console=ttyS0 rw" -nographic -cpu qemu64 -snapshot -smp 2 -m 2048
On the full software emulation guest, 'cat /proc/interrupts' shows:
CPU0 CPU1
0: 36 0 IO-APIC-edge timer
1: 10 0 IO-APIC-edge i8042
4: 1775 0 IO-APIC-edge serial
8: 1 0 IO-APIC-edge rtc0
9: 0 0 IO-APIC-fasteoi acpi
11: 345 0 IO-APIC-fasteoi eth0
12: 125 0 IO-APIC-edge i8042
14: 1720 0 IO-APIC-edge ata_piix
15: 481 0 IO-APIC-edge ata_piix
...
Interrupts are serviced only on CPU0, therefore setting IRQ affinity worked.
Do you have any idea why KVM doesn't respect IRQ affinity on the guest?
What can I do to get it working with IRQ affinity set to 1?
Thanks,
Mihai
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html