From 11ef1d975f61f728a25727fcb89b340b5433713c Mon Sep 17 00:00:00 2001 From: Vladimir Kondratyev Date: Thu, 27 Jan 2022 01:27:01 +0300 Subject: Revert "LinuxKPI: Allow spin_lock_irqsave to be called within a critical section" This change results in deadlocks on UP systems This reverts commit 7dea0c9e6eba4dc127cd67667c81fa2c250f1024. Requested by: kib, hselasky --- .../linuxkpi/common/include/linux/spinlock.h | 27 ++++------------------ 1 file changed, 4 insertions(+), 23 deletions(-) (limited to 'sys/compat/linuxkpi/common') diff --git a/sys/compat/linuxkpi/common/include/linux/spinlock.h b/sys/compat/linuxkpi/common/include/linux/spinlock.h index 31d47fa73986..a87cb7180b28 100644 --- a/sys/compat/linuxkpi/common/include/linux/spinlock.h +++ b/sys/compat/linuxkpi/common/include/linux/spinlock.h @@ -37,7 +37,6 @@ #include #include #include -#include #include #include @@ -118,32 +117,14 @@ typedef struct { local_bh_disable(); \ } while (0) -#define __spin_trylock_nested(_l, _n) ({ \ - int __ret; \ - if (SPIN_SKIP()) { \ - __ret = 1; \ - } else { \ - __ret = mtx_trylock_flags(&(_l)->m, MTX_DUPOK); \ - if (likely(__ret != 0)) \ - local_bh_disable(); \ - } \ - __ret; \ -}) - -#define spin_lock_irqsave(_l, flags) do { \ - (flags) = 0; \ - if (unlikely(curthread->td_critnest != 0)) \ - while (!spin_trylock(_l)) {} \ - else \ - spin_lock(_l); \ +#define spin_lock_irqsave(_l, flags) do { \ + (flags) = 0; \ + spin_lock(_l); \ } while (0) #define spin_lock_irqsave_nested(_l, flags, _n) do { \ (flags) = 0; \ - if (unlikely(curthread->td_critnest != 0)) \ - while (!__spin_trylock_nested(_l, _n)) {} \ - else \ - spin_lock_nested(_l, _n); \ + spin_lock_nested(_l, _n); \ } while (0) #define spin_unlock_irqrestore(_l, flags) do { \ -- cgit v1.2.3