RFC Introduce KGDB_DEBUG_SPINLOCKS
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest2 patches 2 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | debug: Convert dbg_slave_lock to an atomickernel/ | +4 | 1 reply | |
| 2/2 | locking/spinlock/debug: Add checks for kgdb trap safetyinclude/ kernel/ lib/ | +31 | 1 reply |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [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