From mboxrd@z Thu Jan 1 00:00:00 1970 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Subject: Re: IRQ affinity on Linux guest Date: Thu, 20 Aug 2015 16:20:55 -0700 Message-ID: <20150820232051.GA23600@potion.redhat.com> References: <55D5E12C.9050704@ni.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, adrian.papp@ni.com, vicentiu.neagoe@ni.com To: Mihai Neagu Return-path: Received: from mx1.redhat.com ([209.132.183.28]:43337 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751276AbbHTXU5 (ORCPT ); Thu, 20 Aug 2015 19:20:57 -0400 Content-Disposition: inline In-Reply-To: <55D5E12C.9050704@ni.com> Sender: kvm-owner@vger.kernel.org List-ID: 2015-08-20 17:16+0300, Mihai Neagu: > 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: > 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. KVM's APIC balances interrupts -- until you set the affinity (probably near the end of boot process), both CPUs are going to receive roughly the same amount but after directing subsequent interrupts to CPU0, CPU1 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 suspect that it works as expected.) Thanks.