[Midnightbsd-cvs] src [12384] trunk/sys/sys/lock.h: Sync with FreeBSD 11-stable
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sun Feb 16 17:40:36 EST 2020
Revision: 12384
http://svnweb.midnightbsd.org/src/?rev=12384
Author: laffer1
Date: 2020-02-16 17:40:35 -0500 (Sun, 16 Feb 2020)
Log Message:
-----------
Sync with FreeBSD 11-stable
Modified Paths:
--------------
trunk/sys/sys/lock.h
Modified: trunk/sys/sys/lock.h
===================================================================
--- trunk/sys/sys/lock.h 2020-02-16 22:40:02 UTC (rev 12383)
+++ trunk/sys/sys/lock.h 2020-02-16 22:40:35 UTC (rev 12384)
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*
* from BSDI Id: mutex.h,v 2.7.2.35 2000/04/27 03:10:26 cp
- * $FreeBSD: stable/10/sys/sys/lock.h 323870 2017-09-21 19:24:11Z marius $
+ * $FreeBSD: stable/11/sys/sys/lock.h 331722 2018-03-29 02:50:57Z eadler $
*/
#ifndef _SYS_LOCK_H_
@@ -35,6 +35,7 @@
#include <sys/queue.h>
#include <sys/_lock.h>
+#include <sys/ktr_class.h>
struct lock_list_entry;
struct thread;
@@ -125,7 +126,8 @@
* calling conventions for this debugging code in modules so that modules can
* work with both debug and non-debug kernels.
*/
-#if defined(KLD_MODULE) || defined(WITNESS) || defined(INVARIANTS) || defined(INVARIANT_SUPPORT) || defined(KTR) || defined(LOCK_PROFILING)
+#if defined(KLD_MODULE) || defined(WITNESS) || defined(INVARIANTS) || \
+ defined(INVARIANT_SUPPORT) || defined(LOCK_PROFILING) || defined(KTR)
#define LOCK_DEBUG 1
#else
#define LOCK_DEBUG 0
@@ -136,9 +138,13 @@
* operations. Otherwise, use default values to avoid the unneeded bloat.
*/
#if LOCK_DEBUG > 0
+#define LOCK_FILE_LINE_ARG_DEF , const char *file, int line
+#define LOCK_FILE_LINE_ARG , file, line
#define LOCK_FILE __FILE__
#define LOCK_LINE __LINE__
#else
+#define LOCK_FILE_LINE_ARG_DEF
+#define LOCK_FILE_LINE_ARG
#define LOCK_FILE NULL
#define LOCK_LINE 0
#endif
@@ -154,9 +160,14 @@
* file - file name
* line - line number
*/
+#if LOCK_DEBUG > 0
#define LOCK_LOG_TEST(lo, flags) \
(((flags) & LOP_QUIET) == 0 && ((lo)->lo_flags & LO_QUIET) == 0)
+#else
+#define LOCK_LOG_TEST(lo, flags) 0
+#endif
+
#define LOCK_LOG_LOCK(opname, lo, flags, recurse, file, line) do { \
if (LOCK_LOG_TEST((lo), (flags))) \
CTR6(KTR_LOCK, opname " (%s) %s %p r = %d at %s:%d", \
@@ -179,7 +190,7 @@
#define LOCK_LOG_DESTROY(lo, flags) LOCK_LOG_INIT(lo, flags)
-#define lock_initalized(lo) ((lo)->lo_flags & LO_INITIALIZED)
+#define lock_initialized(lo) ((lo)->lo_flags & LO_INITIALIZED)
/*
* Helpful macros for quickly coming up with assertions with informative
@@ -202,9 +213,7 @@
extern struct lock_class *lock_classes[];
struct lock_delay_config {
- u_int initial;
- u_int step;
- u_int min;
+ u_int base;
u_int max;
};
@@ -215,19 +224,32 @@
};
static inline void
-lock_delay_arg_init(struct lock_delay_arg *la, struct lock_delay_config *lc) {
+lock_delay_arg_init(struct lock_delay_arg *la, struct lock_delay_config *lc)
+{
la->config = lc;
- la->delay = 0;
+ la->delay = lc->base;
la->spin_cnt = 0;
}
+#define lock_delay_spin(n) do { \
+ u_int _i; \
+ \
+ for (_i = (n); _i > 0; _i--) \
+ cpu_spinwait(); \
+} while (0)
+
#define LOCK_DELAY_SYSINIT(func) \
SYSINIT(func##_ld, SI_SUB_LOCK, SI_ORDER_ANY, func, NULL)
+#define LOCK_DELAY_SYSINIT_DEFAULT(lc) \
+ SYSINIT(lock_delay_##lc##_ld, SI_SUB_LOCK, SI_ORDER_ANY, \
+ lock_delay_default_init, &lc)
+
void lock_init(struct lock_object *, struct lock_class *,
const char *, const char *, int);
void lock_destroy(struct lock_object *);
void lock_delay(struct lock_delay_arg *);
+void lock_delay_default_init(struct lock_delay_config *);
void spinlock_enter(void);
void spinlock_exit(void);
void witness_init(struct lock_object *, const char *);
More information about the Midnightbsd-cvs
mailing list