From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mihai Neagu Subject: Re: IRQ affinity on Linux guest Date: Fri, 21 Aug 2015 15:33:47 +0300 Message-ID: <55D71AAB.5040705@ni.com> References: <55D5E12C.9050704@ni.com> <20150820232051.GA23600@potion.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org, adrian.papp@ni.com, vicentiu.neagoe@ni.com To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= Return-path: Received: from skprod3.natinst.com ([130.164.80.24]:51152 "EHLO ni.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752534AbbHUMdw convert rfc822-to-8bit (ORCPT ); Fri, 21 Aug 2015 08:33:52 -0400 In-Reply-To: <20150820232051.GA23600@potion.redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Radim, Thanks for your answer. Indeed setting IRQ affinity to a specific core=20 seems to be respected. However, on software emulation and on the real machine, while IRQ=20 affinity defaults to 3, all interrupts go on CPU0, while on KVM they go= =20 on CPU1. I wonder why KVM would act differently than both the real machine and=20 the software emulation in this particular aspect. Is there a machine or processor that I can specify at KVM command line=20 to make it behave like the real x86_64 processor which defaults=20 interrupts to CPU0? Thanks, Mihai On 08/21/2015 02:20 AM, Radim Kr=C4=8Dm=C3=A1=C5=99 wrote: > 2015-08-20 17:16+0300, Mihai Neagu: >> Here is how IRQ affinity is configured on guest at startup, in an in= it.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: >> qemu-system-x86-64 -enable-kvm -kernel bzImage -hda rootfs.ext2 -app= end \ >> "root=3D/dev/sda console=3DttyS0 rw" -nographic -cpu qemu64 -snapsho= t -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 t= o 1. > KVM's APIC balances interrupts -- until you set the affinity (probabl= y > near the end of boot process), both CPUs are going to receive roughly > the same amount but after directing subsequent interrupts to CPU0, CP= U1 > shouldn't receive more. > > Please verify that CPU0 is not receiving all interrupts by doing a > difference between two `cat /proc/interrupts` after the affinity was > set. (CPU0 has higher numbers in your excerpt, which makes me suspec= t > that it works as expected.) > > Thanks. > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html