summaryrefslogtreecommitdiff
path: root/usr/src/uts/common
diff options
context:
space:
mode:
authorDan McDonald <danmcd@joyent.com>2021-07-01 13:27:16 -0400
committerGitHub <noreply@github.com>2021-07-01 13:27:16 -0400
commit1fef3b89560b821bfc30ca13f87ed2c0d876ee17 (patch)
treeac9d8ca9247cf806d445001c5f382ff4eb4d5ce3 /usr/src/uts/common
parent0402a6962cad4cc9a83682bb49b6496264a913c3 (diff)
downloadillumos-joyent-release-20210701.tar.gz
OS-8288 Pull in 13902 and 13915 early (#370)release-20210701
Portions contributed by: Jerry Jelinek <gjelinek@gmail.com>
Diffstat (limited to 'usr/src/uts/common')
-rw-r--r--usr/src/uts/common/brand/lx/os/lx_misc.c4
-rw-r--r--usr/src/uts/common/disp/thread.c30
-rw-r--r--usr/src/uts/common/fs/zfs/spa_misc.c3
-rw-r--r--usr/src/uts/common/os/kcpc.c5
-rw-r--r--usr/src/uts/common/os/schedctl.c4
-rw-r--r--usr/src/uts/common/sys/proc.h5
6 files changed, 38 insertions, 13 deletions
diff --git a/usr/src/uts/common/brand/lx/os/lx_misc.c b/usr/src/uts/common/brand/lx/os/lx_misc.c
index 726c3c7915..8d48d2ea59 100644
--- a/usr/src/uts/common/brand/lx/os/lx_misc.c
+++ b/usr/src/uts/common/brand/lx/os/lx_misc.c
@@ -121,7 +121,7 @@ lx_exec()
lwpd->br_ntv_stack_current = 0;
installctx(lwptot(lwp), lwp, lx_save, lx_restore, NULL, NULL, lx_save,
- NULL);
+ NULL, NULL);
/*
* clear out the tls array
@@ -499,7 +499,7 @@ lx_initlwp(klwp_t *lwp, void *lwpbd)
lwpd->br_lpid = NULL;
installctx(lwptot(lwp), lwp, lx_save, lx_restore, NULL, NULL,
- lx_save, NULL);
+ lx_save, NULL, NULL);
/*
* Install branded system call hooks for this LWP:
diff --git a/usr/src/uts/common/disp/thread.c b/usr/src/uts/common/disp/thread.c
index bf1f121b67..c9e0216dbe 100644
--- a/usr/src/uts/common/disp/thread.c
+++ b/usr/src/uts/common/disp/thread.c
@@ -21,7 +21,7 @@
/*
* Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2019 Joyent, Inc.
+ * Copyright 2021 Joyent, Inc.
*/
#include <sys/types.h>
@@ -1025,7 +1025,28 @@ reapq_add(kthread_t *t)
}
/*
+ * Provide an allocation function for callers of installctx() that, for
+ * reasons of incomplete context-op initialization, must call installctx()
+ * in a kpreempt_disable() block. The caller, therefore, must call this
+ * without being in such a block.
+ */
+struct ctxop *
+installctx_preallocate(void)
+{
+ /*
+ * NOTE: We could ASSERT/VERIFY that we are not in a place where
+ * a KM_SLEEP allocation could block indefinitely.
+ *
+ * ASSERT(curthread->t_preempt == 0);
+ */
+
+ return (kmem_alloc(sizeof (struct ctxop), KM_SLEEP));
+}
+
+/*
* Install thread context ops for the current thread.
+ * The caller can pass in a preallocated struct ctxop, eliminating the need
+ * for the requirement of entering with kernel preemption still enabled.
*/
void
installctx(
@@ -1036,11 +1057,12 @@ installctx(
void (*fork)(void *, void *),
void (*lwp_create)(void *, void *),
void (*exit)(void *),
- void (*free)(void *, int))
+ void (*free)(void *, int),
+ struct ctxop *ctx)
{
- struct ctxop *ctx;
+ if (ctx == NULL)
+ ctx = kmem_alloc(sizeof (struct ctxop), KM_SLEEP);
- ctx = kmem_alloc(sizeof (struct ctxop), KM_SLEEP);
ctx->save_op = save;
ctx->restore_op = restore;
ctx->fork_op = fork;
diff --git a/usr/src/uts/common/fs/zfs/spa_misc.c b/usr/src/uts/common/fs/zfs/spa_misc.c
index dd44829a43..af87d4611c 100644
--- a/usr/src/uts/common/fs/zfs/spa_misc.c
+++ b/usr/src/uts/common/fs/zfs/spa_misc.c
@@ -322,7 +322,8 @@ int zfs_deadman_enabled = -1;
* the FPU state? This is currently off by default due to stability issues in
* the kernel FPU routines; e.g., see bug 13717.
*/
-int zfs_fpu_enabled = 0;
+/* XXX SmartOS now includes fixes for 13902 and 13915, so re-enable it. */
+int zfs_fpu_enabled = 1;
#endif
/*
diff --git a/usr/src/uts/common/os/kcpc.c b/usr/src/uts/common/os/kcpc.c
index 977d243400..33486aaff3 100644
--- a/usr/src/uts/common/os/kcpc.c
+++ b/usr/src/uts/common/os/kcpc.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2021 Joyent, Inc.
*/
#include <sys/param.h>
@@ -318,7 +319,7 @@ kcpc_bind_thread(kcpc_set_t *set, kthread_t *t, int *subcode)
* Add a device context to the subject thread.
*/
installctx(t, ctx, kcpc_save, kcpc_restore, NULL,
- kcpc_lwp_create, NULL, kcpc_free);
+ kcpc_lwp_create, NULL, kcpc_free, NULL);
/*
* Ask the backend to program the hardware.
@@ -1424,7 +1425,7 @@ kcpc_lwp_create(kthread_t *t, kthread_t *ct)
}
installctx(ct, cctx, kcpc_save, kcpc_restore,
- NULL, kcpc_lwp_create, NULL, kcpc_free);
+ NULL, kcpc_lwp_create, NULL, kcpc_free, NULL);
}
/*
diff --git a/usr/src/uts/common/os/schedctl.c b/usr/src/uts/common/os/schedctl.c
index 18b396a765..34f72995a2 100644
--- a/usr/src/uts/common/os/schedctl.c
+++ b/usr/src/uts/common/os/schedctl.c
@@ -22,7 +22,7 @@
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
- * Copyright 2016 Joyent, Inc.
+ * Copyright 2021 Joyent, Inc.
*/
#include <sys/types.h>
@@ -113,7 +113,7 @@ schedctl(void)
bzero(ssp, sizeof (*ssp));
installctx(t, ssp, schedctl_save, schedctl_restore,
- schedctl_fork, NULL, NULL, NULL);
+ schedctl_fork, NULL, NULL, NULL, NULL);
thread_lock(t); /* protect against ts_tick and ts_update */
t->t_schedctl = ssp;
diff --git a/usr/src/uts/common/sys/proc.h b/usr/src/uts/common/sys/proc.h
index bb6f62f83f..90007bda1b 100644
--- a/usr/src/uts/common/sys/proc.h
+++ b/usr/src/uts/common/sys/proc.h
@@ -21,7 +21,7 @@
/*
* Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2018 Joyent, Inc.
+ * Copyright 2021 Joyent, Inc.
* Copyright 2020 Oxide Computer Company
*/
@@ -720,8 +720,9 @@ extern void thread_free(kthread_t *);
extern void thread_rele(kthread_t *);
extern void thread_join(kt_did_t);
extern int reaper(void);
+extern struct ctxop *installctx_preallocate(void);
extern void installctx(kthread_t *, void *, void (*)(), void (*)(),
- void (*)(), void (*)(), void (*)(), void (*)());
+ void (*)(), void (*)(), void (*)(), void (*)(), struct ctxop *);
extern int removectx(kthread_t *, void *, void (*)(), void (*)(),
void (*)(), void (*)(), void (*)(), void (*)());
extern void savectx(kthread_t *);