Skip to content

lockup_detector: Cure hotplug deadlocks and replace duct tape

Thomas Gleixner linux-parisc linuxppc-dev lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest29 patches 19 repliesIn review
  2. v129 patches 15 repliesSuperseded

Changes in v2 from the cover letter

- Wrapped the perf specific calls into the weak watchdog_nmi_* functions

- Fixed the compile error pointed out by Don

- Fixed the reconfiguration parameter inconsistency which broke powerpc

- Picked up the updated version of patch 11/29

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/29hardlockup_detector: Provide interface to stop/restart perf eventsinclude/linux/nmi.h kernel/watchdog_hld.c+45 -00 replies
2/29perf/x86/intel: Sanitize PMU HT bug workaroundarch/x86/events/intel/core.c+4 -70 replies
3/29lockup_detector: Provide interface to stop from poweroff()include/linux/nmi.h kernel/watchdog.c+16 -40 replies
4/29parisc: Use lockup_detector_stop()arch/parisc/kernel/process.c+1 -12 replies
5/29lockup_detector: Remove broken suspend/resume interfacesarch/powerpc/kernel/watchdog.c include/linux/nmi.h kernel/watchdog.c+1 -1030 replies
6/29lockup_detector: Rework cpu hotplug lockingkernel/watchdog.c+6 -60 replies
7/29lockup_detector: Rename watchdog_proc_mutexkernel/watchdog.c+7 -80 replies
8/29lockup_detector: Mark hardlockup_detector_disable() __initkernel/watchdog.c+1 -10 replies
9/29lockup_detector/perf: Remove broken self disable on failurekernel/watchdog.c kernel/watchdog_hld.c+7 -280 replies
10/29lockup_detector/perf: Prevent cpu hotplug deadlockinclude/linux/nmi.h kernel/cpu.c kernel/watchdog.c +1 more+65 -60 replies
11/29lockup_detector: Remove park_in_progress obfuscationinclude/linux/nmi.h kernel/watchdog.c kernel/watchdog_hld.c+19 -260 replies
12/29lockup_detector: Cleanup stub functionskernel/watchdog.c+22 -460 replies
13/29lockup_detector: Cleanup the ifdef mazekernel/watchdog.c+13 -200 replies
14/29lockup_detector: Split out cpumask write functionkernel/watchdog.c+21 -190 replies
15/29smpboot/threads: Avoid runtime allocationinclude/linux/smpboot.h kernel/smpboot.c kernel/watchdog.c+14 -330 replies
16/29lockup_detector: Create new thread handling infrastructurekernel/watchdog.c+75 -00 replies
17/29lockup_detector: Get rid of the thread teardown/setup dancekernel/watchdog.c+19 -1710 replies
18/29lockup_detector: Further simplify sysctl handlingkernel/watchdog.c+7 -200 replies
19/29lockup_detector: Cleanup header messinclude/linux/nmi.h+25 -350 replies
20/29lockup_detector/sysctl: Get rid of the ifdefferyinclude/linux/nmi.h kernel/sysctl.c+7 -50 replies
21/29lockup_detector: Cleanup sysctl variable name spaceinclude/linux/nmi.h kernel/sysctl.c kernel/watchdog.c+36 -370 replies
22/29lockup_detector: Make watchdog_nmi_reconfigure() two stagearch/powerpc/kernel/watchdog.c include/linux/nmi.h kernel/watchdog.c+33 -1711 replies
23/29lockup_detector: Get rid of the racy update loopkernel/watchdog.c+47 -480 replies
24/29lockup_detector/perf: Implement init time perf validationinclude/linux/nmi.h kernel/watchdog_hld.c+43 -20 replies
25/29lockup_detector: Implement init time detection of perfkernel/watchdog.c+12 -13 replies
26/29lockup_detector/perf: Implement CPU enable replacementinclude/linux/nmi.h kernel/watchdog_hld.c+13 -00 replies
27/29lockup_detector: Use new perf CPU enable mechanismkernel/watchdog.c kernel/watchdog_hld.c+8 -840 replies
28/29lockup_detector/perf: Simplify deferred event destroykernel/watchdog_hld.c+2 -50 replies
29/29lockup_detector: Cleanup hotplug locking messarch/powerpc/kernel/watchdog.c kernel/watchdog.c+2 -60 replies

Reviews trailers per patch

2 of 29 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchPeter ZijlstraDon ZickusHelge DellerMichael Ellerman
SeriesR-b
1/29
2/29
3/29
4/29A-b
5/29
6/29
7/29
8/29
9/29
10/29Analyzed-by
11/29
12/29
13/29
14/29
15/29
16/29
17/29
18/29
19/29
20/29
21/29
22/29Tested-and-Reviewed-by A-b
23/29
24/29
25/29
26/29
27/29
28/29
29/29

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v2 thread

Cover letter [patch V2 00/29] lockup_detector: Cure hotplug deadlocks and replace duct tape

The lockup detector is broken is several ways:

- It's deadlock prone vs. CPU hotplug in various ways. Some of these are due to recursive cpus_read_lock() others are due to cpus_read_lock() from CPU hotplug callbacks which immediately lock the machine because cpus are write locked.

- The handling of the cpu hotplug threads happens sideways to the smpboot thread infrastructure, which is racy and pointless

- The handling of the user space sysctl interface is a complete trainwreck as it fiddles directly with variables which can be modified or evaluated by the running watchdogs.

- The perf event initialization is a trainwreck as it tries to create perf events over and over even if perf is not functional (no hardware, ....). To avoid excessive dmesg spam it contains magic printk ratelimiting along with either wrong or useless messages.

- The code structure is horrible as ifdef sections are scattered all over the place which makes it unreadable

- There is more wreckage, but see the changelogs for the ugly details.

The following series sanitizes the facility and addresses the problems.

Changes since V1:

- Wrapped the perf specific calls into the weak watchdog_nmi_* functions

- Fixed the compile error pointed out by Don

- Fixed the reconfiguration parameter inconsistency which broke powerpc

- Picked up the updated version of patch 11/29

Delta patch below.

Thanks,

tglx
---
Diffstat for the series:

 arch/parisc/kernel/process.c   |    2 
 arch/powerpc/kernel/watchdog.c |   22 -
 arch/x86/events/intel/core.c   |   11 
 include/linux/nmi.h            |  121 +++----
 include/linux/smpboot.h        |    4 
 kernel/cpu.c                   |    6 
 kernel/smpboot.c               |   22 -
 kernel/sysctl.c                |   22 -
 kernel/watchdog.c              |  633 ++++++++++++++---------------------------
 kernel/watchdog_hld.c          |  193 ++++++------
 10 files changed, 434 insertions(+), 602 deletions(-)

Delta patch vs. V1
8<------------------------

arch/powerpc/kernel/watchdog.c +2 -2
@@ -355,12 +355,12 @@ static void watchdog_calc_timeouts(void)
 	wd_timer_period_ms = watchdog_thresh * 1000 * 2 / 5;
 }
 
-void watchdog_nmi_reconfigure(bool stop)
+void watchdog_nmi_reconfigure(bool run)
 {
 	int cpu;
 
 	cpus_read_lock();
-	if (stop) {
+	if (!run) {
 		for_each_cpu(cpu, &wd_cpus_enabled)
 			stop_wd_on_cpu(cpu);
 	} else {
include/linux/nmi.h +1 -1
@@ -102,7 +102,7 @@ static inline void hardlockup_detector_p
 static inline void hardlockup_detector_perf_enable(void) { }
 static inline void hardlockup_detector_perf_cleanup(void) { }
 # if !defined(CONFIG_HAVE_NMI_WATCHDOG)
-static int hardlockup_detector_perf_init(void) { return -ENODEV; }
+static inline int hardlockup_detector_perf_init(void) { return -ENODEV; }
 static inline void arch_touch_nmi_watchdog(void) {}
 # else
 static int hardlockup_detector_perf_init(void) { return 0; }
kernel/watchdog.c +25 -18

89 lines not on this page · raw message