From d23bc2a3969f03d068975170cbbfe4ce274e8c6b Mon Sep 17 00:00:00 2001 From: Antoine Verheijen Date: Mon, 8 Feb 2010 14:57:51 -0700 Subject: [PATCH] OpenBSD: don't use AFS_GLOBAL_SUNLOCK on single processor system Put back the header directives that only turns on AFS_GLOBAL_SUNLOCK when compiling for multiprocessors system. When enabled on a single processor OpenBSD system, it is possible to put the entire system into a lengthy (minutes) lock state when performing multiple AFS activities. The system behaves MUCH better when AFS_GLOBAL_SUNLOCK is not set (no problems encopuntered). This whole locking mechanism needs a bit more examination on OpenBSD before this is useful in single processor mode. Change-Id: I19813b78ad8d705b4f043ccb3a38c83e278972e9 Reviewed-on: http://gerrit.openafs.org/1276 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear (cherry picked from commit 6219c84243706ed46b922c2e037cceab2684d645) Change-Id: I9891c469aae9de3ca1b7a334d3f54757c97ddc5f Reviewed-on: http://gerrit.openafs.org/1257 --- src/afs/OBSD/osi_machdep.h | 52 +++++++++++++++++----------------- src/config/param.i386_obsd44.h | 2 ++ src/config/param.i386_obsd45.h | 2 ++ 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/src/afs/OBSD/osi_machdep.h b/src/afs/OBSD/osi_machdep.h index 229e27f82..3864ff1dc 100644 --- a/src/afs/OBSD/osi_machdep.h +++ b/src/afs/OBSD/osi_machdep.h @@ -153,70 +153,70 @@ extern int afs_vget(); extern struct lock afs_global_lock; extern struct proc *afs_global_owner; -#ifdef AFS_GLOBAL_SUNLOCK +# ifdef AFS_GLOBAL_SUNLOCK -#if defined(LOCKDEBUG) +# if defined(LOCKDEBUG) -#define AFS_GLOCK() \ +# define AFS_GLOCK() \ do { \ _lockmgr(&afs_global_lock, LK_EXCLUSIVE, NULL, __FILE__, __LINE__); \ } while(0); -#define AFS_GUNLOCK() \ +# define AFS_GUNLOCK() \ do { \ _lockmgr(&afs_global_lock, LK_RELEASE, NULL, __FILE__, __LINE__); \ } while(0); -#else +# else /* LOCKDEBUG */ -#define AFS_GLOCK() \ +# define AFS_GLOCK() \ do { \ lockmgr(&afs_global_lock, LK_EXCLUSIVE, NULL); \ } while(0); -#define AFS_GUNLOCK() \ +# define AFS_GUNLOCK() \ do { \ lockmgr(&afs_global_lock, LK_RELEASE, NULL); \ } while(0); -#endif /* LOCKDEBUG */ -#define ISAFS_GLOCK() (lockstatus(&afs_global_lock) == LK_EXCLUSIVE) -#else +# endif /* LOCKDEBUG */ +# define ISAFS_GLOCK() (lockstatus(&afs_global_lock) == LK_EXCLUSIVE) +# else /* AFS_GLOBAL_SUNLOCK */ extern struct lock afs_global_lock; -#define AFS_GLOCKP(p) -#define AFS_GUNLOCKP(p) -#define AFS_ASSERT_GLOCK() -#define ISAFS_GLOCK() 1 -#endif +# define AFS_GLOCK() +# define AFS_GUNLOCK() +# define AFS_ASSERT_GLOCK() +# define ISAFS_GLOCK() 1 +# endif -#else +#else /* AFS_OBSD44_ENV */ /* I don't see doing locks this way for older kernels, either, * but, smart folks wrote this */ #define AFS_GLOCK() AFS_GLOCKP(curproc) #define AFS_GUNLOCK() AFS_GUNLOCKP(curproc) -#ifdef AFS_GLOBAL_SUNLOCK +# ifdef AFS_GLOBAL_SUNLOCK extern struct proc *afs_global_owner; extern struct lock afs_global_lock; -#define AFS_GLOCKP(p) \ +# define AFS_GLOCKP(p) \ do { \ osi_Assert(p); \ afs_osi_lockmgr(&afs_global_lock, LK_EXCLUSIVE, 0, (p)); \ osi_Assert(afs_global_owner == NULL); \ afs_global_owner = (p); \ } while (0) -#define AFS_GUNLOCKP(p) \ +# define AFS_GUNLOCKP(p) \ do { \ osi_Assert(p); \ osi_Assert(afs_global_owner == (p)); \ afs_global_owner = NULL; \ afs_osi_lockmgr(&afs_global_lock, LK_RELEASE, 0, (p)); \ } while(0) -#define ISAFS_GLOCK() (afs_global_owner == curproc && curproc) -#else +# define ISAFS_GLOCK() (afs_global_owner == curproc && curproc) +# else /* AFS_GLOBAL_SUNLOCK */ extern struct lock afs_global_lock; -#define AFS_GLOCKP(p) -#define AFS_GUNLOCKP(p) -#define AFS_ASSERT_GLOCK() -#define ISAFS_GLOCK() 1 -#endif +# define AFS_GLOCKP(p) +# define AFS_GUNLOCKP(p) +# define AFS_ASSERT_GLOCK() +# define ISAFS_GLOCK() 1 +# endif #endif /* AFS_OBSD44_ENV */ diff --git a/src/config/param.i386_obsd44.h b/src/config/param.i386_obsd44.h index 25866ba16..ed6b5592e 100644 --- a/src/config/param.i386_obsd44.h +++ b/src/config/param.i386_obsd44.h @@ -53,7 +53,9 @@ /* Extra kernel definitions (from kdefs file) */ #ifdef _KERNEL +#ifdef MULTIPROCESSOR #define AFS_GLOBAL_SUNLOCK 1 +#endif #define AFS_SHORTGID 0 /* are group id's short? */ #if !defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__) diff --git a/src/config/param.i386_obsd45.h b/src/config/param.i386_obsd45.h index 766415755..c6da6d597 100644 --- a/src/config/param.i386_obsd45.h +++ b/src/config/param.i386_obsd45.h @@ -54,7 +54,9 @@ /* Extra kernel definitions (from kdefs file) */ #ifdef _KERNEL +#ifdef MULTIPROCESSOR #define AFS_GLOBAL_SUNLOCK 1 +#endif #define AFS_SHORTGID 0 /* are group id's short? */ #if !defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__) -- 2.39.5