diff options
author | Kenji Aoyama <aoyama@cvs.openbsd.org> | 2020-05-26 11:55:11 +0000 |
---|---|---|
committer | Kenji Aoyama <aoyama@cvs.openbsd.org> | 2020-05-26 11:55:11 +0000 |
commit | 88d2df2cc7ac91a364da1553b07cd3e70fdde9a4 (patch) | |
tree | 71ac3ba2084dbde422852b265b8995324ae57db4 /sys/arch/m88k/include | |
parent | 309f8c473e7b76119a0d2f45904c6a492bf96f36 (diff) |
Rewrite m88k mutex code as a slight variation of the MI mutex code.
This will make mutex spinning time visible in top(1), and also might
improve stability.
The major change in this is that the old assembly code acquires
mutexes with an atomic exchange operation, but releases them with a
regular store, but the new code always uses atomic exchange
operations.
The mutex.h changes to the macros conform to <sys/mutex.h> to be able
to reset the system while in ddb.
Suggested from Miod Vallat, tested by me. The stability in heavy load
is greatly improved in my case.
Diffstat (limited to 'sys/arch/m88k/include')
-rw-r--r-- | sys/arch/m88k/include/mutex.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/arch/m88k/include/mutex.h b/sys/arch/m88k/include/mutex.h index 2656398b590..5752a427f42 100644 --- a/sys/arch/m88k/include/mutex.h +++ b/sys/arch/m88k/include/mutex.h @@ -1,6 +1,6 @@ #ifndef _M88K_MUTEX_H_ #define _M88K_MUTEX_H_ -/* $OpenBSD: mutex.h,v 1.7 2018/01/13 15:18:11 mpi Exp $ */ +/* $OpenBSD: mutex.h,v 1.8 2020/05/26 11:55:10 aoyama Exp $ */ /* * Copyright (c) 2005, Miodrag Vallat. @@ -30,7 +30,7 @@ #include <sys/_lock.h> struct mutex { - volatile int mtx_lock; /* mutex.S relies upon this field being first */ + volatile int mtx_lock; int mtx_wantipl; int mtx_oldipl; volatile void *mtx_owner; @@ -68,12 +68,12 @@ void __mtx_init(struct mutex *, int); #ifdef DIAGNOSTIC #define MUTEX_ASSERT_LOCKED(mtx) do { \ - if ((mtx)->mtx_owner != curcpu()) \ + if (((mtx)->mtx_owner != curcpu()) && !(panicstr || db_active)) \ panic("mutex %p not held in %s", (mtx), __func__); \ } while (0) #define MUTEX_ASSERT_UNLOCKED(mtx) do { \ - if ((mtx)->mtx_owner == curcpu()) \ + if (((mtx)->mtx_owner == curcpu()) && !(panicstr || db_active)) \ panic("mutex %p held in %s", (mtx), __func__); \ } while (0) |