From: Antoine Verheijen Date: Mon, 8 Feb 2010 21:57:51 +0000 (-0700) Subject: OpenBSD: don't use AFS_GLOBAL_SUNLOCK on single processor system X-Git-Tag: openafs-devel-1_5_72~27 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=6219c84243706ed46b922c2e037cceab2684d645 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 --- diff --git a/src/afs/OBSD/osi_machdep.h b/src/afs/OBSD/osi_machdep.h index 5e03708..e1b9000 100644 --- a/src/afs/OBSD/osi_machdep.h +++ b/src/afs/OBSD/osi_machdep.h @@ -154,70 +154,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.obsd44.h b/src/config/param.obsd44.h index f950b50..9d9db33 100644 --- a/src/config/param.obsd44.h +++ b/src/config/param.obsd44.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__) diff --git a/src/config/param.obsd45.h b/src/config/param.obsd45.h index 9fd79f0..a268c1a 100644 --- a/src/config/param.obsd45.h +++ b/src/config/param.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__) diff --git a/src/config/param.obsd46.h b/src/config/param.obsd46.h index 38786ad..24a9228 100644 --- a/src/config/param.obsd46.h +++ b/src/config/param.obsd46.h @@ -55,7 +55,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__)