From: Mihai Neagu <mihai.neagu@ni.com>
To: "Radim Krčmář" <rkrcmar@redhat.com>
Cc: kvm@vger.kernel.org, adrian.papp@ni.com, vicentiu.neagoe@ni.com
Subject: Re: IRQ affinity on Linux guest
Date: Fri, 21 Aug 2015 15:33:47 +0300 [thread overview]
Message-ID: <55D71AAB.5040705@ni.com> (raw)
In-Reply-To: <20150820232051.GA23600@potion.redhat.com>
Radim,
Thanks for your answer. Indeed setting IRQ affinity to a specific core
seems to be respected.
However, on software emulation and on the real machine, while IRQ
affinity defaults to 3, all interrupts go on CPU0, while on KVM they go
on CPU1.
I wonder why KVM would act differently than both the real machine and
the software emulation in this particular aspect.
Is there a machine or processor that I can specify at KVM command line
to make it behave like the real x86_64 processor which defaults
interrupts to CPU0?
Thanks,
Mihai
On 08/21/2015 02:20 AM, Radim Krčmář wrote:
> 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.
> --
> 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
next prev parent reply other threads:[~2015-08-21 12:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-20 14:16 IRQ affinity on Linux guest Mihai Neagu
2015-08-20 23:20 ` Radim Krčmář
2015-08-21 12:33 ` Mihai Neagu [this message]
2015-08-21 14:46 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55D71AAB.5040705@ni.com \
--to=mihai.neagu@ni.com \
--cc=adrian.papp@ni.com \
--cc=kvm@vger.kernel.org \
--cc=rkrcmar@redhat.com \
--cc=vicentiu.neagoe@ni.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.