[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200522145510.2109799-1-daniel.thompson@linaro.org>
Date: Fri, 22 May 2020 15:55:08 +0100
From: Daniel Thompson <daniel.thompson@...aro.org>
To: sumit.garg@...aro.org, jason.wessel@...driver.com,
dianders@...omium.org
Cc: Daniel Thompson <daniel.thompson@...aro.org>,
kgdb-bugreport@...ts.sourceforge.net, linux-kernel@...r.kernel.org,
patches@...aro.org, pmladek@...e.com, sergey.senozhatsky@...il.com,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>
Subject: [RFC PATCH 0/2] Introduce KGDB_DEBUG_SPINLOCKS
The execution context for kgdb/kdb is pretty much unique. We are running
a debug trap handler with all CPUs parked in a holding loop and with
interrupts disabled. At least one CPU is in an unknowable execution
state (could be NMI, IRQ, irqs disabled, etc) and the others are either
servicing an IRQ or NMI depending on architecture.
Breakpoints (including some implicit breakpoints when serious errors
are detected) can happen on more or less any context, including when we
own important spin locks.
As such spin lock waits should never happen whilst we are executing the
kgdb trap handler used except, occasionally, via an explicit command
from a (forewarned?) local operator.
Currently kdb doesn't meet this criteria (although I think kgdb does)
so I started thinking about what tooling we could employ to reinforce
code review and bring problems to the surface.
The result is a patch that extends DEBUG_SPINLOCKS and checks whether
the execution context is safe. The "except via an explicit command"
aspect (mentioned above) convinced me to make the checks conditional
on KGDB_DEBUG_SPINLOCKS.
Daniel Thompson (2):
debug: Convert dbg_slave_lock to an atomic
locking/spinlock/debug: Add checks for kgdb trap safety
include/linux/kgdb.h | 16 ++++++++++++++++
kernel/debug/debug_core.c | 8 ++++----
kernel/locking/spinlock_debug.c | 4 ++++
lib/Kconfig.kgdb | 11 +++++++++++
4 files changed, 35 insertions(+), 4 deletions(-)
base-commit: 6a8b55ed4056ea5559ebe4f6a4b247f627870d4c
--
2.25.4
Powered by blists - more mailing lists