linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 00/18] x86/apic: Support for IPI shorthands
@ 2019-07-03 10:54 Thomas Gleixner
  2019-07-03 10:54 ` [patch 01/18] x86/apic: Invoke perf_events_lapic_init() after enabling APIC Thomas Gleixner
                   ` (17 more replies)
  0 siblings, 18 replies; 23+ messages in thread
From: Thomas Gleixner @ 2019-07-03 10:54 UTC (permalink / raw)
  To: LKML; +Cc: x86, Nadav Amit, Ricardo Neri, Stephane Eranian, Feng Tang

The recent discussion about using HPET as NMI watchdog made me look into
IPI shorthand support. Also Nadav wanted to look into shorthands to speed
up certain TLB operations.

The support for IPI shorthands is rather limited right now and basically
got rendered useless by making it depend on CPU_HOTPLUG=n.

The reason for this is that shorthands are broadcasted and in case that not
all present CPUs have been brought up this might end up with a similar
effect as the dreaded MCE broadcast.

But this can be handled smarter than just preventing shorthands if CPU
hotplug is enabled. The kernel already deals with the MCE broadcast issue
for the 'nosmt' case. It brings up all present CPUs and then shuts down the
SMT siblings right away after they did the basic initialization and set
CR4.MCE.

The core CPU hotplug code keeps track of that information already, so it
can be used to decide whether IPI shorthands can be used safely or not.

If all present CPUs have been brought up at least once it's safe to switch
to IPI shorthand mode. The switch over is done with a static key and can be
prevented completely with the existing (so far 32bit only) command line
option.

As a offlined CPU still receives IPIs the offline code is changed to soft
disable the local APIC so the offline CPU will not be bothered by shorthand
based IPIs. In soft disabled state the APIC still handles NMI, INIT, SIPI
so onlining will work as before.

To support NMI based shorthand IPIs the NMI handler gets a new check right
at the beginning of the handler code which lets the handler ignore the NMI
on a offline CPU and not call through the whole spaghetti maze of NMI
handling.

Soft disabling the local APIC on the offlined CPU unearthed a KVM APIC
emulation issue which is only relevant for CPU0 hotplug testing. The fix is
in the KVM tree already, but there is no need to have this dependency here.
(0-day folks are aware of it).

The APIC setup function has also a few minor issues which are addressed in
this series as well.

Part of the series is also a consolidation of the APIC code which was
necessary to not spread all the shorthand implementation details to header
files etc.

It survived testing on a range of different machines including NMI
shorthand IPIs. Aside of the KVM APIC issue, which is only relevant in
combination with CPU0 hotplug testing, there are no known side effects.

The series is also available from git:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git WIP.x86/ipi

Thanks,

	tglx

8<-------------------
 arch/x86/include/asm/apic_flat_64.h     |    8 -
 arch/x86/include/asm/ipi.h              |  109 ----------------------
 arch/x86/kernel/apic/x2apic.h           |    9 -
 b/arch/x86/include/asm/apic.h           |    3 
 b/arch/x86/include/asm/bugs.h           |    2 
 b/arch/x86/include/asm/processor.h      |    2 
 b/arch/x86/kernel/apic/apic.c           |  155 ++++++++++++++++++++------------
 b/arch/x86/kernel/apic/apic_flat_64.c   |   41 +++-----
 b/arch/x86/kernel/apic/apic_noop.c      |   18 ---
 b/arch/x86/kernel/apic/apic_numachip.c  |    8 -
 b/arch/x86/kernel/apic/bigsmp_32.c      |    9 -
 b/arch/x86/kernel/apic/ipi.c            |  103 +++++++++++++++------
 b/arch/x86/kernel/apic/local.h          |   68 ++++++++++++++
 b/arch/x86/kernel/apic/probe_32.c       |   41 --------
 b/arch/x86/kernel/apic/probe_64.c       |   16 ---
 b/arch/x86/kernel/apic/x2apic_cluster.c |   26 +++--
 b/arch/x86/kernel/apic/x2apic_phys.c    |   29 +++--
 b/arch/x86/kernel/apic/x2apic_uv_x.c    |   28 -----
 b/arch/x86/kernel/cpu/bugs.c            |    2 
 b/arch/x86/kernel/cpu/common.c          |   11 ++
 b/arch/x86/kernel/nmi.c                 |    3 
 b/arch/x86/kernel/smpboot.c             |   13 ++
 b/include/linux/cpumask.h               |    2 
 b/kernel/cpu.c                          |   11 +-
 24 files changed, 354 insertions(+), 363 deletions(-)




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

end of thread, other threads:[~2019-07-03 21:30 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-03 10:54 [patch 00/18] x86/apic: Support for IPI shorthands Thomas Gleixner
2019-07-03 10:54 ` [patch 01/18] x86/apic: Invoke perf_events_lapic_init() after enabling APIC Thomas Gleixner
2019-07-03 10:54 ` [patch 02/18] x86/apic: Soft disable APIC before initializing it Thomas Gleixner
2019-07-03 10:54 ` [patch 03/18] x86/apic: Make apic_pending_intr_clear() more robust Thomas Gleixner
2019-07-03 10:54 ` [patch 04/18] x86/apic: Move IPI inlines into ipi.c Thomas Gleixner
2019-07-03 10:54 ` [patch 05/18] x86/apic: Cleanup the include maze Thomas Gleixner
2019-07-03 10:54 ` [patch 06/18] x86/apic: Move ipi header into apic directory Thomas Gleixner
2019-07-03 10:54 ` [patch 07/18] x86/apic: Move apic_flat_64 " Thomas Gleixner
2019-07-03 10:54 ` [patch 08/18] x86/apic: Consolidate the apic local headers Thomas Gleixner
2019-07-03 10:54 ` [patch 09/18] smp/hotplug: Track booted once CPUs in a cpumask Thomas Gleixner
2019-07-03 10:54 ` [patch 10/18] x86/cpu: Move arch_smt_update() to a neutral place Thomas Gleixner
2019-07-03 10:54 ` [patch 11/18] x86/hotplug: Silence APIC and NMI when CPU is dead Thomas Gleixner
2019-07-03 10:54 ` [patch 12/18] x86/apic: Remove dest argument from __default_send_IPI_shortcut() Thomas Gleixner
2019-07-03 10:54 ` [patch 13/18] x86/apic: Add NMI_VECTOR wait to IPI shorthand Thomas Gleixner
2019-07-03 10:54 ` [patch 14/18] x86/apic: Move no_ipi_broadcast() out of 32bit Thomas Gleixner
2019-07-03 10:54 ` [patch 15/18] x86/apic: Add static key to Control IPI shorthands Thomas Gleixner
2019-07-03 10:54 ` [patch 16/18] x86/apic: Convert 32bit to IPI shorthand static key Thomas Gleixner
2019-07-03 18:06   ` Nadav Amit
2019-07-03 20:34     ` Thomas Gleixner
2019-07-03 21:14       ` Nadav Amit
2019-07-03 21:30         ` Thomas Gleixner
2019-07-03 10:54 ` [patch 17/18] x86/apic/flat64: Add conditional IPI shorthands support Thomas Gleixner
2019-07-03 10:54 ` [patch 18/18] x86/apic/x2apic: " Thomas Gleixner

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).