Re: [PATCH smp 0/2] Provide CSD lock timeout diagnostics

From: Paul E. McKenney
Date: Mon Jul 27 2020 - 19:54:01 EST


This is version 2 of a sneak preview of a series providing diagnostics
to help track down problems that would result in excessive csd_unlock()

1. Add source and destination CPUs to __call_single_data.
I freely admit that I found the union declaration a
bit confusing!

2. Provide CSD lock timeout diagnostics.

3. Add "static" to a local variable.

Changes since v1:

o Fix stack-out-of-bounds read in csd_lock_record located by syzbot.

o Fix KASAN-detected use-after-free issue reported by Qian Cai.

o Fix botched nr_cpu_ids comparison reported by Dan Carpenter.

o Fix numerous issues reported by Peter Zijlstra, including
annoying CPP macros, #ifdef consolidation, another use-after-free
issue, memory-ordering/comment issues, {} code-style issues.

This now has no effect unless CONFIG_CSD_LOCK_WAIT_DEBUG=y.
It also uses NSEC_PER_MSEC instead of cubing 1000.
Times are now printed in nanoseconds instead of decimal seconds.
Switched to C-language Classic Comment style.
Moved to x-mas tree variable-declaration order from alphabetic.
Avoided two prints via "CPU-1".

o This version still "handles" 32-bit VDSO build errors by
prohibiting CONFIG_CSD_LOCK_WAIT_DEBUG=y in 32-bit builds.

Thanx, Paul


include/linux/smp.h | 3 +
include/linux/smp_types.h | 3 +
kernel/smp.c | 136 +++++++++++++++++++++++++++++++++++++++++++++-
lib/Kconfig.debug | 11 +++
4 files changed, 152 insertions(+), 1 deletion(-)