1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

- Fix spinlock exiting to handle recursion properly and only enable

interrupts at the proper time.
- Remove an uneeded test and just always set the MTX_RECURSE bit when
  recursing on a sleep lock.
This commit is contained in:
John Baldwin 2000-09-13 18:28:14 +00:00
parent 699fbdc2ab
commit 220ca3ff5e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=65821
2 changed files with 14 additions and 10 deletions

View File

@ -312,8 +312,7 @@ void witness_restore(mtx_t *, const char *, int);
if (((mp)->mtx_lock & MTX_FLAGMASK) != (tid)) \
mtx_enter_hard(mp, (type) & MTX_HARDOPTS, 0); \
else { \
if (((mp)->mtx_lock & MTX_RECURSE) == 0) \
atomic_set_64(&(mp)->mtx_lock, MTX_RECURSE); \
atomic_set_64(&(mp)->mtx_lock, MTX_RECURSE); \
(mp)->mtx_recurse++; \
} \
} else { \
@ -379,12 +378,15 @@ void witness_restore(mtx_t *, const char *, int);
*/
#define _exitlock_spin(mp) do { \
int _ipl = (mp)->mtx_saveipl; \
alpha_mb(); \
if ((mp)->mtx_recurse == 0 || (--(mp)->mtx_recurse) == 0) \
if ((mp)->mtx_recurse == 0) { \
int _ipl = (mp)->mtx_saveipl; \
atomic_cmpset_64(&(mp)->mtx_lock, (mp)->mtx_lock, \
MTX_UNOWNED); \
alpha_pal_swpipl(_ipl); \
alpha_pal_swpipl(_ipl); \
} else { \
(mp)->mtx_recurse--; \
} \
} while (0)
/*

View File

@ -312,8 +312,7 @@ void witness_restore(mtx_t *, const char *, int);
if (((mp)->mtx_lock & MTX_FLAGMASK) != (tid)) \
mtx_enter_hard(mp, (type) & MTX_HARDOPTS, 0); \
else { \
if (((mp)->mtx_lock & MTX_RECURSE) == 0) \
atomic_set_64(&(mp)->mtx_lock, MTX_RECURSE); \
atomic_set_64(&(mp)->mtx_lock, MTX_RECURSE); \
(mp)->mtx_recurse++; \
} \
} else { \
@ -379,12 +378,15 @@ void witness_restore(mtx_t *, const char *, int);
*/
#define _exitlock_spin(mp) do { \
int _ipl = (mp)->mtx_saveipl; \
alpha_mb(); \
if ((mp)->mtx_recurse == 0 || (--(mp)->mtx_recurse) == 0) \
if ((mp)->mtx_recurse == 0) { \
int _ipl = (mp)->mtx_saveipl; \
atomic_cmpset_64(&(mp)->mtx_lock, (mp)->mtx_lock, \
MTX_UNOWNED); \
alpha_pal_swpipl(_ipl); \
alpha_pal_swpipl(_ipl); \
} else { \
(mp)->mtx_recurse--; \
} \
} while (0)
/*