public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] KVM: APIC improvements (with bonus mixed mode)
@ 2015-02-12 18:41 Radim Krčmář
  2015-02-12 18:41 ` [PATCH v2 1/4] KVM: x86: use MDA for interrupt matching Radim Krčmář
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Radim Krčmář @ 2015-02-12 18:41 UTC (permalink / raw)
  To: linux-kernel; +Cc: kvm, Paolo Bonzini, Nadav Amit, Gleb Natapov

Each patch has a diff from v1, here is only a prologue on the mythical
mixed xAPIC and x2APIC mode:

There is one interesting alias in xAPIC and x2APIC ICR destination, the
0xff000000, which is a broadcast in xAPIC and either a physical message
to high x2APIC ID or a message to an empty set in x2APIC cluster.

This corner case in mixed mode can be triggered by a weird message
 1) when we have no x2APIC ID 0xff000000, but send x2APIC message there

or after something that isn't forbidden in SDM most likely because they
didn't think that anyone would ever consider it
 2) we have x2APIC ID 0xff000000 and reset other x2APICs into xAPIC mode

Current KVM doesn't need to consider (2), so there only is a slim chance
that some hobbyist OS pushes the specification to its limits.

The problem is that SDM for xAPIC doesn't believably specify[1] if all
messages beginning with 0xff are considered as broadcasts, 10.6.2.1:
  A broadcast IPI (bits 28-31 of the MDA are 1's)

No volunteer came to clear this up, so I hacked Linux to have one x2APIC
core between xAPIC ones.  Physical IPI to 0xff000000 got delivered only
to CPU0, like most other destinations, Logical IPI to 0xff000000 got
dropped and only 0xffffffff worked as a broadcast in both modes.

I think it is because Intel never considered mixed mode to be valid, and
seen delivery might be an emergent feature of QPI routing.
Luckily, broadcast from xAPIC isn't delivered to x2APIC.

Real exploration would require greater modifications to Linux (ideally
writing a custom kernel), so this series implements something that makes
some sense and isn't too far from reality.


Radim Krčmář (4):
  KVM: x86: use MDA for interrupt matching
  KVM: x86: fix mixed APIC mode broadcast
  KVM: x86: avoid logical_map when it is invalid
  KVM: x86: simplify kvm_apic_map

 arch/x86/include/asm/kvm_host.h |   8 ++-
 arch/x86/kvm/lapic.c            | 138 +++++++++++++++++++++++-----------------
 arch/x86/kvm/lapic.h            |  15 -----
 3 files changed, 85 insertions(+), 76 deletions(-)

-- 
2.3.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-04-07 12:38 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-12 18:41 [PATCH v2 0/4] KVM: APIC improvements (with bonus mixed mode) Radim Krčmář
2015-02-12 18:41 ` [PATCH v2 1/4] KVM: x86: use MDA for interrupt matching Radim Krčmář
2015-02-12 18:41 ` [PATCH v2 2/4] KVM: x86: fix mixed APIC mode broadcast Radim Krčmář
2015-02-12 18:41 ` [PATCH v2 3/4] KVM: x86: avoid logical_map when it is invalid Radim Krčmář
2015-02-12 18:41 ` [PATCH v2 4/4] KVM: x86: simplify kvm_apic_map Radim Krčmář
2015-04-07 12:38   ` Paolo Bonzini
2015-02-26  1:55 ` [PATCH v2 0/4] KVM: APIC improvements (with bonus mixed mode) Marcelo Tosatti
2015-02-26  8:49   ` Nadav Amit
2015-02-26 22:31     ` Marcelo Tosatti
2015-02-27 15:22       ` Radim Krčmář
2015-02-27 15:12   ` Radim Krčmář

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox