lkml.org 
[lkml]   [2019]   [Jul]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject[patch V2 00/25] x86/apic: Support for IPI shorthands
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.

Changes vs. V1(https://lkml.kernel.org/r/20190703105431.096822793@linutronix.de)

- Fix an 11 years old bug in kgdb

- Move the shorthand decision logic into the callers (Nadav)

- Make native_send_call_func_ipi() smarter (Nadav)

- Consolidate more duplicated code

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<------------
a/arch/x86/include/asm/apic_flat_64.h | 8 -
a/arch/x86/include/asm/ipi.h | 109 ---------------------
a/arch/x86/kernel/apic/x2apic.h | 9 -
arch/x86/include/asm/apic.h | 11 +-
arch/x86/include/asm/bugs.h | 2
arch/x86/include/asm/processor.h | 2
arch/x86/include/asm/smp.h | 1
arch/x86/kernel/apic/apic.c | 157 +++++++++++++++++++------------
arch/x86/kernel/apic/apic_flat_64.c | 66 ++-----------
arch/x86/kernel/apic/apic_noop.c | 18 ---
arch/x86/kernel/apic/apic_numachip.c | 8 -
arch/x86/kernel/apic/bigsmp_32.c | 9 -
arch/x86/kernel/apic/ipi.c | 170 +++++++++++++++++++++++++---------
arch/x86/kernel/apic/probe_32.c | 41 --------
arch/x86/kernel/apic/probe_64.c | 21 ----
arch/x86/kernel/apic/x2apic_cluster.c | 20 +---
arch/x86/kernel/apic/x2apic_phys.c | 25 ++---
arch/x86/kernel/apic/x2apic_uv_x.c | 30 +-----
arch/x86/kernel/cpu/bugs.c | 2
arch/x86/kernel/cpu/common.c | 11 ++
arch/x86/kernel/kgdb.c | 2
arch/x86/kernel/nmi.c | 3
arch/x86/kernel/reboot.c | 7 -
arch/x86/kernel/smp.c | 44 --------
arch/x86/kernel/smpboot.c | 13 ++
b/arch/x86/kernel/apic/local.h | 68 +++++++++++++
include/linux/bitmap.h | 23 ++++
include/linux/cpumask.h | 16 +++
kernel/cpu.c | 11 +-
lib/bitmap.c | 20 ++++
30 files changed, 450 insertions(+), 477 deletions(-)



\
 
 \ /
  Last update: 2019-07-04 18:36    [W:0.312 / U:0.836 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site