From: Radim <rkrcmar@redhat.com>
To: Marc Zyngier <marc.zyngier@arm.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
Drew <drjones@redhat.com>,
Shlomo Pongratz <shlomo.pongratz@huawei.com>,
Shlomo Pongratz <shlomopongratz@gmail.com>,
Pavel Fedin <p.fedin@samsung.com>,
QEMU Developers <qemu-devel@nongnu.org>,
Shannon Zhao <shannon.zhao@linaro.org>,
Ashok Kumar <ashoks@broadcom.com>,
Igor Mammedov <imammedo@redhat.com>,
"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>
Subject: Re: [Qemu-devel] should KVM or userspace be the one which decides what MIPIDR/affinity values to assign to vcpus?
Date: Wed, 10 Jun 2015 13:22:55 +0200 [thread overview]
Message-ID: <20150610112255.GA27945@potion.brq.redhat.com> (raw)
In-Reply-To: <55781205.90303@arm.com>
2015-06-10 11:31+0100, Marc Zyngier:
>On 10/06/15 10:54, Igor Mammedov wrote:
>> On Tue, 09 Jun 2015 15:35:21 +0100
>> Marc Zyngier <marc.zyngier@arm.com> wrote:
>>> Indeed. I also missed the step that says "kernel is able to convert
>>> arbitrary MPIDR to vcpu_id in an efficient manner...". GICv3 is
>>> definitely going to require this.
>> x86 probably already has code that does this for APIC ID -> vcpu_id
>
> Apparently not. kvm_irq_delivery_to_apic seems to iterate over the vcpus
> to find a match, and kvm_irq_delivery_to_apic_fast seems to rely on
> knowing some form of topology (and some more iteration).
kvm_irq_delivery_to_apic_fast optimizes APIC ID -> vcpu_id, by using
simple lookup arrays for various modes, with fallback to iteration for
broadcast and unlikely configurations.
Fast path only does iteration for multicast. The APIC ID space is
sliced by 4(clustered xAPIC)/8(flat xAPIC)/16(x2APIC) APICs and any
number of APICs in a slice can be selected for delivery.
The guest can configure topology (xAPIC) or it is set by hardware
(x2APIC) and matches "real" topology only in rare cases. ("Real"
topology is encoded in x2APIC ID by reserving bit ranges for "levels".)
> Overall, this looks awfully architecture specific, so it seems unlikely
> we can reuse that aspect.
Yes, the most that can be reused is an idea for a structure that gets
recomputed every time MPIDR -> vcpu_id mapping changes.
> I'm inclined to go for an rbtree mapping
> MPIDRs to vcpus. As this is likely to be on the fast path, I'd like this
> to me as lockless as possible though, which probably means that MPIDR
> would become RO as soon as any vcpu has started executing.
x86 KVM uses RCU protected structure for it, and even though APIC IDs
can be sparse, x86 prefers a single array. (IDs usually aren't very
sparse, so a more complicated structure would be slower, harder to
handle, and take up more memory.)
next prev parent reply other threads:[~2015-06-10 11:23 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-08 10:52 [Qemu-devel] should KVM or userspace be the one which decides what MIPIDR/affinity values to assign to vcpus? Peter Maydell
2015-06-09 10:52 ` Marc Zyngier
2015-06-09 11:24 ` Peter Maydell
2015-06-09 11:54 ` Igor Mammedov
2015-06-09 12:27 ` Marc Zyngier
2015-06-09 13:16 ` Peter Maydell
2015-06-09 14:00 ` Marc Zyngier
2015-06-09 14:01 ` Peter Maydell
2015-06-09 14:35 ` Marc Zyngier
2015-06-10 9:54 ` Igor Mammedov
2015-06-10 10:31 ` Marc Zyngier
2015-06-10 11:22 ` Radim [this message]
2015-06-25 8:00 ` Christoffer Dall
2015-06-25 9:06 ` Peter Maydell
2015-06-25 12:41 ` Christoffer Dall
2015-06-25 12:51 ` Peter Maydell
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=20150610112255.GA27945@potion.brq.redhat.com \
--to=rkrcmar@redhat.com \
--cc=ashoks@broadcom.com \
--cc=drjones@redhat.com \
--cc=imammedo@redhat.com \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=marc.zyngier@arm.com \
--cc=p.fedin@samsung.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=shannon.zhao@linaro.org \
--cc=shlomo.pongratz@huawei.com \
--cc=shlomopongratz@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).