All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Mihai Neagu <mihai.neagu@ni.com>
Cc: kvm@vger.kernel.org, adrian.papp@ni.com, vicentiu.neagoe@ni.com
Subject: Re: IRQ affinity on Linux guest
Date: Thu, 20 Aug 2015 16:20:55 -0700	[thread overview]
Message-ID: <20150820232051.GA23600@potion.redhat.com> (raw)
In-Reply-To: <55D5E12C.9050704@ni.com>

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.

  reply	other threads:[~2015-08-20 23:20 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ář [this message]
2015-08-21 12:33   ` Mihai Neagu
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=20150820232051.GA23600@potion.redhat.com \
    --to=rkrcmar@redhat.com \
    --cc=adrian.papp@ni.com \
    --cc=kvm@vger.kernel.org \
    --cc=mihai.neagu@ni.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.