]> git.baikalelectronics.ru Git - kernel.git/commit
kgdb: Fix spurious true from in_dbg_master()
authorDaniel Thompson <daniel.thompson@linaro.org>
Wed, 6 May 2020 16:42:23 +0000 (17:42 +0100)
committerDaniel Thompson <daniel.thompson@linaro.org>
Thu, 7 May 2020 14:12:27 +0000 (15:12 +0100)
commit3d73367f9b04591b4b5fbb761c40889b838c12ae
tree2f5e9d9bcb2fe20a664fc26f9683f06117374fde
parenta3c98f842c1888b4df27e091ed5a315b6f7c1aa9
kgdb: Fix spurious true from in_dbg_master()

Currently there is a small window where a badly timed migration could
cause in_dbg_master() to spuriously return true. Specifically if we
migrate to a new core after reading the processor id and the previous
core takes a breakpoint then we will evaluate true if we read
kgdb_active before we get the IPI to bring us to halt.

Fix this by checking irqs_disabled() first. Interrupts are always
disabled when we are executing the kgdb trap so this is an acceptable
prerequisite. This also allows us to replace raw_smp_processor_id()
with smp_processor_id() since the short circuit logic will prevent
warnings from PREEMPT_DEBUG.

Fixes: 35ff3c1d9df1 ("kgdb: core changes to support kdb")
Suggested-by: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20200506164223.2875760-1-daniel.thompson@linaro.org
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
include/linux/kgdb.h