]> git.itanic.dy.fi Git - linux-stable/commit
parisc: Add lightweight spinlock checks
authorHelge Deller <deller@gmx.de>
Mon, 22 May 2023 13:11:16 +0000 (15:11 +0200)
committerHelge Deller <deller@gmx.de>
Wed, 24 May 2023 12:23:07 +0000 (14:23 +0200)
commit15e64ef6520ea8702998db05b87fa5c3d3d40710
treeb7f67430b55167a2aeae50fd95fd4d4c50e2d2f8
parentb6405f0829d7b1dd926ba3ca5f691cab835abfaa
parisc: Add lightweight spinlock checks

Add a lightweight spinlock check which uses only two instructions
per spinlock call. It detects if a spinlock has been trashed by
some memory corruption and then halts the kernel. It will not detect
uninitialized spinlocks, for which CONFIG_DEBUG_SPINLOCK needs to
be enabled.

This lightweight spinlock check shouldn't influence runtime, so it's
safe to enable it by default.

The __ARCH_SPIN_LOCK_UNLOCKED_VAL constant has been choosen small enough
to be able to be loaded by one LDI assembler statement.

Signed-off-by: Helge Deller <deller@gmx.de>
arch/parisc/Kconfig.debug
arch/parisc/include/asm/spinlock.h
arch/parisc/include/asm/spinlock_types.h
arch/parisc/kernel/traps.c