summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/sys/thread.h
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/uts/common/sys/thread.h')
-rw-r--r--usr/src/uts/common/sys/thread.h29
1 files changed, 26 insertions, 3 deletions
diff --git a/usr/src/uts/common/sys/thread.h b/usr/src/uts/common/sys/thread.h
index d917944edf..678d356564 100644
--- a/usr/src/uts/common/sys/thread.h
+++ b/usr/src/uts/common/sys/thread.h
@@ -24,6 +24,10 @@
* Use is subject to license terms.
*/
+/*
+ * Copyright 2018 Joyent, Inc.
+ */
+
#ifndef _SYS_THREAD_H
#define _SYS_THREAD_H
@@ -67,7 +71,10 @@ typedef struct ctxop {
void (*exit_op)(void *); /* invoked during {thread,lwp}_exit() */
void (*free_op)(void *, int); /* function which frees the context */
void *arg; /* argument to above functions, ctx pointer */
- struct ctxop *next; /* next context ops */
+ struct ctxop *next; /* next context ops */
+ struct ctxop *prev; /* previous context ops */
+ hrtime_t save_ts; /* timestamp of last save */
+ hrtime_t restore_ts; /* timestamp of last restore */
} ctxop_t;
/*
@@ -345,6 +352,10 @@ typedef struct _kthread {
kmutex_t t_ctx_lock; /* protects t_ctx in removectx() */
struct waitq *t_waitq; /* wait queue */
kmutex_t t_wait_mutex; /* used in CV wait functions */
+
+ char *t_name; /* thread name */
+
+ uint64_t t_unsafe; /* unsafe to run with HT VCPU thread */
} kthread_t;
/*
@@ -366,7 +377,7 @@ typedef struct _kthread {
#define T_WOULDBLOCK 0x0020 /* for lockfs */
#define T_DONTBLOCK 0x0040 /* for lockfs */
#define T_DONTPEND 0x0080 /* for lockfs */
-#define T_SYS_PROF 0x0100 /* profiling on for duration of system call */
+#define T_SPLITSTK 0x0100 /* kernel stack is currently split */
#define T_WAITCVSEM 0x0200 /* waiting for a lwp_cv or lwp_sema on sleepq */
#define T_WATCHPT 0x0400 /* thread undergoing a watchpoint emulation */
#define T_PANIC 0x0800 /* thread initiated a system panic */
@@ -395,6 +406,7 @@ typedef struct _kthread {
#define TP_CHANGEBIND 0x1000 /* thread has a new cpu/cpupart binding */
#define TP_ZTHREAD 0x2000 /* this is a kernel thread for a zone */
#define TP_WATCHSTOP 0x4000 /* thread is stopping via holdwatch() */
+#define TP_KTHREAD 0x8000 /* in-kernel worker thread for a process */
/*
* Thread scheduler flag (t_schedflag) definitions.
@@ -407,6 +419,7 @@ typedef struct _kthread {
#define TS_SIGNALLED 0x0010 /* thread was awakened by cv_signal() */
#define TS_PROJWAITQ 0x0020 /* thread is on its project's waitq */
#define TS_ZONEWAITQ 0x0040 /* thread is on its zone's waitq */
+#define TS_VCPU 0x0080 /* thread will enter guest context */
#define TS_CSTART 0x0100 /* setrun() by continuelwps() */
#define TS_UNPAUSE 0x0200 /* setrun() by unpauselwps() */
#define TS_XSTART 0x0400 /* setrun() by SIGCONT */
@@ -414,8 +427,9 @@ typedef struct _kthread {
#define TS_RESUME 0x1000 /* setrun() by CPR resume process */
#define TS_CREATE 0x2000 /* setrun() by syslwp_create() */
#define TS_RUNQMATCH 0x4000 /* exact run queue balancing by setbackdq() */
+#define TS_BSTART 0x8000 /* setrun() by brand */
#define TS_ALLSTART \
- (TS_CSTART|TS_UNPAUSE|TS_XSTART|TS_PSTART|TS_RESUME|TS_CREATE)
+ (TS_CSTART|TS_UNPAUSE|TS_XSTART|TS_PSTART|TS_RESUME|TS_CREATE|TS_BSTART)
#define TS_ANYWAITQ (TS_PROJWAITQ|TS_ZONEWAITQ)
/*
@@ -443,6 +457,10 @@ typedef struct _kthread {
#define ISTOPPED(t) ((t)->t_state == TS_STOPPED && \
!((t)->t_schedflag & TS_PSTART))
+/* True if thread is stopped for a brand-specific reason */
+#define BSTOPPED(t) ((t)->t_state == TS_STOPPED && \
+ !((t)->t_schedflag & TS_BSTART))
+
/* True if thread is asleep and wakeable */
#define ISWAKEABLE(t) (((t)->t_state == TS_SLEEP && \
((t)->t_flag & T_WAKEABLE)))
@@ -589,10 +607,15 @@ extern disp_lock_t stop_lock; /* lock protecting stopped threads */
caddr_t thread_stk_init(caddr_t); /* init thread stack */
+void thread_setname(kthread_t *, const char *);
+
extern int default_binding_mode;
+extern int default_stksize;
#endif /* _KERNEL */
+#define THREAD_NAME_MAX 32 /* includes terminating NUL */
+
/*
* Macros to indicate that the thread holds resources that could be critical
* to other kernel threads, so this thread needs to have kernel priority