summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/boot/lib/libstand/zfs/libzfs.h31
-rw-r--r--usr/src/boot/sys/boot/i386/common/bootargs.h18
-rw-r--r--usr/src/cmd/mdb/Makefile.libstand7
-rw-r--r--usr/src/cmd/nvmeadm/nvmeadm.c164
-rw-r--r--usr/src/cmd/nvmeadm/nvmeadm.h6
-rw-r--r--usr/src/cmd/nvmeadm/nvmeadm_print.c156
-rw-r--r--usr/src/common/util/THIRDPARTYLICENSE.multi3311
-rw-r--r--usr/src/common/util/THIRDPARTYLICENSE.multi3.descrip1
-rw-r--r--usr/src/common/util/multi3.c63
-rw-r--r--usr/src/lib/libc/port/mapfile-vers4
-rw-r--r--usr/src/lib/libc/port/sys/epoll.c8
-rw-r--r--usr/src/lib/libc/sparcv9/Makefile.com3
-rw-r--r--usr/src/man/man3c/epoll_ctl.3c20
-rw-r--r--usr/src/pkg/manifests/system-library.mf2
-rw-r--r--usr/src/stand/lib/sa/Makefile8
-rw-r--r--usr/src/test/os-tests/tests/sockfs/rights.c10
-rw-r--r--usr/src/uts/common/io/blkdev/blkdev.c49
-rw-r--r--usr/src/uts/common/io/nvme/nvme.c22
-rw-r--r--usr/src/uts/common/rpc/svc.c4
-rw-r--r--usr/src/uts/common/sys/epoll.h2
-rw-r--r--usr/src/uts/common/sys/nvme.h27
-rw-r--r--usr/src/uts/sparc/Makefile.files7
22 files changed, 826 insertions, 97 deletions
diff --git a/usr/src/boot/lib/libstand/zfs/libzfs.h b/usr/src/boot/lib/libstand/zfs/libzfs.h
index a8430290f1..7a6fcf57ea 100644
--- a/usr/src/boot/lib/libstand/zfs/libzfs.h
+++ b/usr/src/boot/lib/libstand/zfs/libzfs.h
@@ -25,7 +25,7 @@
*/
#ifndef _BOOT_LIBZFS_H_
-#define _BOOT_LIBZFS_H_
+#define _BOOT_LIBZFS_H_
#define ZFS_MAXNAMELEN 256
@@ -38,31 +38,14 @@ struct zfs_devdesc {
uint64_t root_guid;
};
-struct zfs_boot_args
-{
- uint32_t size;
- uint32_t reserved;
- uint64_t pool;
- uint64_t root;
- uint64_t primary_pool;
- uint64_t primary_vdev;
-};
-
-int zfs_parsedev(struct zfs_devdesc *dev, const char *devspec,
- const char **path);
-char *zfs_bootfs(void *vdev);
-char *zfs_fmtdev(void *vdev);
-int zfs_probe_dev(const char *devname, uint64_t *pool_guid);
-int zfs_list(const char *name);
+int zfs_parsedev(struct zfs_devdesc *, const char *, const char **);
+char *zfs_bootfs(void *);
+char *zfs_fmtdev(void *);
+int zfs_probe_dev(const char *, uint64_t *);
+int zfs_list(const char *);
uint64_t ldi_get_size(void *);
-#ifdef __FreeBSD__
-void init_zfs_bootenv(char *currdev);
-int zfs_bootenv(const char *name);
-int zfs_belist_add(const char *name, uint64_t __unused);
-int zfs_set_env(void);
-#endif
extern struct devsw zfs_dev;
extern struct fs_ops zfs_fsops;
-#endif /*_BOOT_LIBZFS_H_*/
+#endif /* _BOOT_LIBZFS_H_ */
diff --git a/usr/src/boot/sys/boot/i386/common/bootargs.h b/usr/src/boot/sys/boot/i386/common/bootargs.h
index 4768d68ae1..0bd446e18e 100644
--- a/usr/src/boot/sys/boot/i386/common/bootargs.h
+++ b/usr/src/boot/sys/boot/i386/common/bootargs.h
@@ -1,4 +1,4 @@
-/*-
+/*
* Copyright (c) 2012 Andriy Gapon <avg@FreeBSD.org>
* All rights reserved.
*
@@ -11,8 +11,6 @@
* implied warranties, including, without limitation, the implied
* warranties of merchantability and fitness for a particular
* purpose.
- *
- * $FreeBSD$
*/
#ifndef _BOOT_I386_ARGS_H_
@@ -43,8 +41,7 @@
#ifndef __ASSEMBLER__
-struct bootargs
-{
+struct bootargs {
uint32_t howto;
uint32_t bootdev;
uint32_t bootflags;
@@ -64,6 +61,15 @@ struct bootargs
*/
};
-#endif /*__ASSEMBLER__*/
+struct zfs_boot_args {
+ uint32_t size;
+ uint32_t reserved;
+ uint64_t pool;
+ uint64_t root;
+ uint64_t primary_pool;
+ uint64_t primary_vdev;
+};
+
+#endif /* __ASSEMBLER__ */
#endif /* !_BOOT_I386_ARGS_H_ */
diff --git a/usr/src/cmd/mdb/Makefile.libstand b/usr/src/cmd/mdb/Makefile.libstand
index 935469472a..9668bbaafb 100644
--- a/usr/src/cmd/mdb/Makefile.libstand
+++ b/usr/src/cmd/mdb/Makefile.libstand
@@ -29,7 +29,7 @@
include ../../Makefile.libstand
-SRCS += \
+SRCS_COMMON += \
bcmp.c \
bcopy.c \
bsearch.c \
@@ -49,6 +49,11 @@ SRCS += \
strtol.c \
strtoul.c
+sparcv9_SRCS= \
+ multi3.c
+
+SRCS += $(SRCS_COMMON) $($(MACH64)_SRCS)
+
# We don't want thread-specific errno's in kmdb, as we're single-threaded.
DTS_ERRNO=
diff --git a/usr/src/cmd/nvmeadm/nvmeadm.c b/usr/src/cmd/nvmeadm/nvmeadm.c
index f53475db5b..294ef29a0a 100644
--- a/usr/src/cmd/nvmeadm/nvmeadm.c
+++ b/usr/src/cmd/nvmeadm/nvmeadm.c
@@ -13,6 +13,7 @@
* Copyright 2016 Nexenta Systems, Inc.
* Copyright 2017 Joyent, Inc.
* Copyright 2019 Western Digital Corporation.
+ * Copyright 2020 Oxide Computer Company
*/
/*
@@ -75,7 +76,7 @@ struct nvme_feature {
uint8_t f_feature;
size_t f_bufsize;
uint_t f_getflags;
- int (*f_get)(int, const nvme_feature_t *, nvme_identify_ctrl_t *);
+ int (*f_get)(int, const nvme_feature_t *, const nvme_process_arg_t *);
void (*f_print)(uint64_t, void *, size_t, nvme_identify_ctrl_t *);
};
@@ -106,9 +107,11 @@ static int do_get_logpage_health(int, const nvme_process_arg_t *);
static int do_get_logpage_fwslot(int, const nvme_process_arg_t *);
static int do_get_logpage(int, const nvme_process_arg_t *);
static int do_get_feat_common(int, const nvme_feature_t *,
- nvme_identify_ctrl_t *);
+ const nvme_process_arg_t *);
static int do_get_feat_intr_vect(int, const nvme_feature_t *,
- nvme_identify_ctrl_t *);
+ const nvme_process_arg_t *);
+static int do_get_feat_temp_thresh(int, const nvme_feature_t *,
+ const nvme_process_arg_t *);
static int do_get_features(int, const nvme_process_arg_t *);
static int do_format(int, const nvme_process_arg_t *);
static int do_secure_erase(int, const nvme_process_arg_t *);
@@ -217,7 +220,7 @@ static const nvme_feature_t features[] = {
do_get_feat_common, nvme_print_feat_lba_range },
{ "Temperature Threshold", "",
NVME_FEAT_TEMPERATURE, 0, NVMEADM_CTRL,
- do_get_feat_common, nvme_print_feat_temperature },
+ do_get_feat_temp_thresh, nvme_print_feat_temperature },
{ "Error Recovery", "",
NVME_FEAT_ERROR, 0, NVMEADM_CTRL,
do_get_feat_common, nvme_print_feat_error },
@@ -694,7 +697,7 @@ do_get_logpage_health(int fd, const nvme_process_arg_t *npa)
return (-1);
(void) printf("%s: ", npa->npa_name);
- nvme_print_health_log(hlog, npa->npa_idctl);
+ nvme_print_health_log(hlog, npa->npa_idctl, npa->npa_version);
free(hlog);
@@ -777,7 +780,7 @@ usage_get_features(const char *c_name)
static int
do_get_feat_common(int fd, const nvme_feature_t *feat,
- nvme_identify_ctrl_t *idctl)
+ const nvme_process_arg_t *npa)
{
void *buf = NULL;
size_t bufsize = feat->f_bufsize;
@@ -788,15 +791,154 @@ do_get_feat_common(int fd, const nvme_feature_t *feat,
return (EINVAL);
nvme_print(2, feat->f_name, -1, NULL);
- feat->f_print(res, buf, bufsize, idctl);
+ feat->f_print(res, buf, bufsize, npa->npa_idctl);
free(buf);
return (0);
}
static int
+do_get_feat_temp_thresh_one(int fd, const nvme_feature_t *feat,
+ const char *label, uint16_t tmpsel, uint16_t thsel,
+ const nvme_process_arg_t *npa)
+{
+ uint64_t res;
+ void *buf = NULL;
+ size_t bufsize = feat->f_bufsize;
+ nvme_temp_threshold_t tt;
+
+ tt.r = 0;
+ tt.b.tt_tmpsel = tmpsel;
+ tt.b.tt_thsel = thsel;
+
+ if (!nvme_get_feature(fd, feat->f_feature, tt.r, &res, &bufsize,
+ &buf)) {
+ return (EINVAL);
+ }
+
+ feat->f_print(res, (void *)label, 0, npa->npa_idctl);
+ free(buf);
+ return (0);
+}
+
+/*
+ * In NVMe 1.2, the specification allowed for up to 8 sensors to be on the
+ * device and changed the main device to have a composite temperature sensor. As
+ * a result, there is a set of thresholds for each sensor. In addition, they
+ * added both an over-temperature and under-temperature threshold. Since most
+ * devices don't actually implement all the sensors, we get the health page and
+ * see which sensors have a non-zero value to determine how to proceed.
+ */
+static int
+do_get_feat_temp_thresh(int fd, const nvme_feature_t *feat,
+ const nvme_process_arg_t *npa)
+{
+ int ret;
+ size_t bufsize = sizeof (nvme_health_log_t);
+ nvme_health_log_t *hlog;
+
+ nvme_print(2, feat->f_name, -1, NULL);
+ if ((ret = do_get_feat_temp_thresh_one(fd, feat,
+ "Composite Over Temp. Threshold", 0, NVME_TEMP_THRESH_OVER,
+ npa)) != 0) {
+ return (ret);
+ }
+
+ if (!NVME_VERSION_ATLEAST(npa->npa_version, 1, 2)) {
+ return (0);
+ }
+
+ if ((ret = do_get_feat_temp_thresh_one(fd, feat,
+ "Composite Under Temp. Threshold", 0, NVME_TEMP_THRESH_UNDER,
+ npa)) != 0) {
+ return (ret);
+ }
+
+ hlog = nvme_get_logpage(fd, NVME_LOGPAGE_HEALTH, &bufsize);
+ if (hlog == NULL) {
+ warnx("failed to get health log page, unable to get "
+ "thresholds for additional sensors");
+ return (0);
+ }
+
+ if (hlog->hl_temp_sensor_1 != 0) {
+ (void) do_get_feat_temp_thresh_one(fd, feat,
+ "Temp. Sensor 1 Over Temp. Threshold", 1,
+ NVME_TEMP_THRESH_OVER, npa);
+ (void) do_get_feat_temp_thresh_one(fd, feat,
+ "Temp. Sensor 1 Under Temp. Threshold", 1,
+ NVME_TEMP_THRESH_UNDER, npa);
+ }
+
+ if (hlog->hl_temp_sensor_2 != 0) {
+ (void) do_get_feat_temp_thresh_one(fd, feat,
+ "Temp. Sensor 2 Over Temp. Threshold", 2,
+ NVME_TEMP_THRESH_OVER, npa);
+ (void) do_get_feat_temp_thresh_one(fd, feat,
+ "Temp. Sensor 2 Under Temp. Threshold", 2,
+ NVME_TEMP_THRESH_UNDER, npa);
+ }
+
+ if (hlog->hl_temp_sensor_3 != 0) {
+ (void) do_get_feat_temp_thresh_one(fd, feat,
+ "Temp. Sensor 3 Over Temp. Threshold", 3,
+ NVME_TEMP_THRESH_OVER, npa);
+ (void) do_get_feat_temp_thresh_one(fd, feat,
+ "Temp. Sensor 3 Under Temp. Threshold", 3,
+ NVME_TEMP_THRESH_UNDER, npa);
+ }
+
+ if (hlog->hl_temp_sensor_4 != 0) {
+ (void) do_get_feat_temp_thresh_one(fd, feat,
+ "Temp. Sensor 4 Over Temp. Threshold", 4,
+ NVME_TEMP_THRESH_OVER, npa);
+ (void) do_get_feat_temp_thresh_one(fd, feat,
+ "Temp. Sensor 4 Under Temp. Threshold", 4,
+ NVME_TEMP_THRESH_UNDER, npa);
+ }
+
+ if (hlog->hl_temp_sensor_5 != 0) {
+ (void) do_get_feat_temp_thresh_one(fd, feat,
+ "Temp. Sensor 5 Over Temp. Threshold", 5,
+ NVME_TEMP_THRESH_OVER, npa);
+ (void) do_get_feat_temp_thresh_one(fd, feat,
+ "Temp. Sensor 5 Under Temp. Threshold", 5,
+ NVME_TEMP_THRESH_UNDER, npa);
+ }
+
+ if (hlog->hl_temp_sensor_6 != 0) {
+ (void) do_get_feat_temp_thresh_one(fd, feat,
+ "Temp. Sensor 6 Over Temp. Threshold", 6,
+ NVME_TEMP_THRESH_OVER, npa);
+ (void) do_get_feat_temp_thresh_one(fd, feat,
+ "Temp. Sensor 6 Under Temp. Threshold", 6,
+ NVME_TEMP_THRESH_UNDER, npa);
+ }
+
+ if (hlog->hl_temp_sensor_7 != 0) {
+ (void) do_get_feat_temp_thresh_one(fd, feat,
+ "Temp. Sensor 7 Over Temp. Threshold", 7,
+ NVME_TEMP_THRESH_OVER, npa);
+ (void) do_get_feat_temp_thresh_one(fd, feat,
+ "Temp. Sensor 7 Under Temp. Threshold", 7,
+ NVME_TEMP_THRESH_UNDER, npa);
+ }
+
+ if (hlog->hl_temp_sensor_8 != 0) {
+ (void) do_get_feat_temp_thresh_one(fd, feat,
+ "Temp. Sensor 8 Over Temp. Threshold", 8,
+ NVME_TEMP_THRESH_OVER, npa);
+ (void) do_get_feat_temp_thresh_one(fd, feat,
+ "Temp. Sensor 8 Under Temp. Threshold", 8,
+ NVME_TEMP_THRESH_UNDER, npa);
+ }
+ free(hlog);
+ return (0);
+}
+
+static int
do_get_feat_intr_vect(int fd, const nvme_feature_t *feat,
- nvme_identify_ctrl_t *idctl)
+ const nvme_process_arg_t *npa)
{
uint64_t res;
uint64_t arg;
@@ -814,7 +956,7 @@ do_get_feat_intr_vect(int fd, const nvme_feature_t *feat,
== B_FALSE)
return (EINVAL);
- feat->f_print(res, NULL, 0, idctl);
+ feat->f_print(res, NULL, 0, npa->npa_idctl);
}
return (0);
@@ -842,7 +984,7 @@ do_get_features(int fd, const nvme_process_arg_t *npa)
(feat->f_getflags & NVMEADM_CTRL) == 0))
continue;
- (void) feat->f_get(fd, feat, npa->npa_idctl);
+ (void) feat->f_get(fd, feat, npa);
}
return (0);
@@ -887,7 +1029,7 @@ do_get_features(int fd, const nvme_process_arg_t *npa)
header_printed = B_TRUE;
}
- if (feat->f_get(fd, feat, npa->npa_idctl) != 0) {
+ if (feat->f_get(fd, feat, npa) != 0) {
warnx("unsupported feature: %s", feat->f_name);
continue;
}
diff --git a/usr/src/cmd/nvmeadm/nvmeadm.h b/usr/src/cmd/nvmeadm/nvmeadm.h
index a542f98be7..57d237ce57 100644
--- a/usr/src/cmd/nvmeadm/nvmeadm.h
+++ b/usr/src/cmd/nvmeadm/nvmeadm.h
@@ -12,6 +12,7 @@
/*
* Copyright 2016 Nexenta Systems, Inc.
* Copyright 2019 Western Digital Corporation
+ * Copyright 2020 Oxide Computer Company
*/
#ifndef _NVMEADM_H
@@ -29,14 +30,15 @@ extern int verbose;
extern int debug;
/* printing functions */
-extern void nvme_print(int, char *, int, const char *, ...);
+extern void nvme_print(int, const char *, int, const char *, ...);
extern void nvme_print_ctrl_summary(nvme_identify_ctrl_t *, nvme_version_t *);
extern void nvme_print_nsid_summary(nvme_identify_nsid_t *);
extern void nvme_print_identify_ctrl(nvme_identify_ctrl_t *,
nvme_capabilities_t *, nvme_version_t *);
extern void nvme_print_identify_nsid(nvme_identify_nsid_t *, nvme_version_t *);
extern void nvme_print_error_log(int, nvme_error_log_entry_t *);
-extern void nvme_print_health_log(nvme_health_log_t *, nvme_identify_ctrl_t *);
+extern void nvme_print_health_log(nvme_health_log_t *, nvme_identify_ctrl_t *,
+ nvme_version_t *);
extern void nvme_print_fwslot_log(nvme_fwslot_log_t *);
extern void nvme_print_feat_arbitration(uint64_t, void *, size_t,
diff --git a/usr/src/cmd/nvmeadm/nvmeadm_print.c b/usr/src/cmd/nvmeadm/nvmeadm_print.c
index 0eb81a4e91..b43836326f 100644
--- a/usr/src/cmd/nvmeadm/nvmeadm_print.c
+++ b/usr/src/cmd/nvmeadm/nvmeadm_print.c
@@ -12,6 +12,7 @@
/*
* Copyright 2016 Nexenta Systems, Inc.
* Copyright 2019 Western Digital Corporation
+ * Copyright 2020 Oxide Computer Company
*/
/*
@@ -32,11 +33,15 @@
static int nvme_strlen(const char *, int);
-static void nvme_print_str(int, char *, int, const char *, int);
-static void nvme_print_double(int, char *, double, int, char *);
-static void nvme_print_uint64(int, char *, uint64_t, const char *, char *);
-static void nvme_print_uint128(int, char *, nvme_uint128_t, char *, int, int);
-static void nvme_print_bit(int, char *, int, char *, char *);
+static void nvme_print_str(int, const char *, int, const char *, int);
+static void nvme_print_double(int, const char *, double, int, const char *);
+static void nvme_print_int64(int, const char *, uint64_t, const char *,
+ const char *);
+static void nvme_print_uint64(int, const char *, uint64_t, const char *,
+ const char *);
+static void nvme_print_uint128(int, const char *, nvme_uint128_t, const char *,
+ int, int);
+static void nvme_print_bit(int, const char *, int, const char *, const char *);
#define ARRAYSIZE(x) (sizeof (x) / sizeof (*(x)))
@@ -163,7 +168,7 @@ static const char *lba_range_types[] = {
#define NVME_PRINT_ALIGN 43
void
-nvme_print(int indent, char *name, int index, const char *fmt, ...)
+nvme_print(int indent, const char *name, int index, const char *fmt, ...)
{
int align = NVME_PRINT_ALIGN - (indent + strlen(name) + 1);
va_list ap;
@@ -209,7 +214,8 @@ nvme_strlen(const char *str, int len)
* nvme_print_str -- print a string up to the specified length
*/
static void
-nvme_print_str(int indent, char *name, int index, const char *value, int len)
+nvme_print_str(int indent, const char *name, int index, const char *value,
+ int len)
{
if (len == 0)
len = strlen(value);
@@ -222,7 +228,8 @@ nvme_print_str(int indent, char *name, int index, const char *value, int len)
* optional unit
*/
static void
-nvme_print_double(int indent, char *name, double value, int places, char *unit)
+nvme_print_double(int indent, const char *name, double value, int places,
+ const char *unit)
{
if (unit == NULL)
unit = "";
@@ -231,12 +238,12 @@ nvme_print_double(int indent, char *name, double value, int places, char *unit)
}
/*
- * nvme_print_uint64 -- print uint64_t with optional unit in decimal or another
+ * nvme_print_int64 -- print int64_t with optional unit in decimal or another
* format specified
*/
static void
-nvme_print_uint64(int indent, char *name, uint64_t value, const char *fmt,
- char *unit)
+nvme_print_int64(int indent, const char *name, uint64_t value, const char *fmt,
+ const char *unit)
{
char *tmp_fmt;
@@ -247,6 +254,43 @@ nvme_print_uint64(int indent, char *name, uint64_t value, const char *fmt,
fmt = "%"PRId64;
if (asprintf(&tmp_fmt, "%s%%s", fmt) < 0)
+ err(-1, "nvme_print_int64()");
+
+ nvme_print(indent, name, -1, tmp_fmt, value, unit);
+
+ free(tmp_fmt);
+}
+
+/*
+ * nvme_print_temp -- The NVMe specification passes most temperature values as
+ * uint16_t values that are encoded in kelvin. This converts them in one place
+ * to Celsius.
+ */
+static void
+nvme_print_temp(int indent, const char *name, uint16_t value)
+{
+ int64_t temp = (int64_t)value;
+ temp -= 273;
+ nvme_print_int64(indent, name, temp, NULL, "C");
+}
+
+/*
+ * nvme_print_uint64 -- print uint64_t with optional unit in decimal or another
+ * format specified
+ */
+static void
+nvme_print_uint64(int indent, const char *name, uint64_t value, const char *fmt,
+ const char *unit)
+{
+ char *tmp_fmt;
+
+ if (unit == NULL)
+ unit = "";
+
+ if (fmt == NULL)
+ fmt = "%"PRIu64;
+
+ if (asprintf(&tmp_fmt, "%s%%s", fmt) < 0)
err(-1, "nvme_print_uint64()");
nvme_print(indent, name, -1, tmp_fmt, value, unit);
@@ -259,8 +303,8 @@ nvme_print_uint64(int indent, char *name, uint64_t value, const char *fmt,
* binary and/or decimal shifting
*/
static void
-nvme_print_uint128(int indent, char *name, nvme_uint128_t value, char *unit,
- int scale_bits, int scale_tens)
+nvme_print_uint128(int indent, const char *name, nvme_uint128_t value,
+ const char *unit, int scale_bits, int scale_tens)
{
const char hex[] = "0123456789abcdef";
uint8_t o[(128 + scale_bits) / 3];
@@ -360,7 +404,8 @@ nvme_print_uint128(int indent, char *name, nvme_uint128_t value, char *unit,
* nvme_print_bit -- print a bit with optional names for both states
*/
static void
-nvme_print_bit(int indent, char *name, int value, char *s_true, char *s_false)
+nvme_print_bit(int indent, const char *name, int value, const char *s_true,
+ const char *s_false)
{
if (s_true == NULL)
s_true = "supported";
@@ -784,7 +829,8 @@ nvme_print_error_log(int nlog, nvme_error_log_entry_t *elog)
* of the log if verbose is set.
*/
void
-nvme_print_health_log(nvme_health_log_t *hlog, nvme_identify_ctrl_t *idctl)
+nvme_print_health_log(nvme_health_log_t *hlog, nvme_identify_ctrl_t *idctl,
+ nvme_version_t *vers)
{
nvme_print(0, "SMART/Health Information", -1, NULL);
nvme_print(2, "Critical Warnings", -1, NULL);
@@ -800,8 +846,7 @@ nvme_print_health_log(nvme_health_log_t *hlog, nvme_identify_ctrl_t *idctl)
nvme_print_bit(4, "Volatile Memory Backup",
hlog->hl_crit_warn.cw_volatile, "failed", "OK");
- nvme_print_uint64(2, "Temperature",
- hlog->hl_temp - 273, NULL, "C");
+ nvme_print_temp(2, "Temperature", hlog->hl_temp);
nvme_print_uint64(2, "Available Spare Capacity",
hlog->hl_avail_spare, NULL, "%");
@@ -817,7 +862,7 @@ nvme_print_health_log(nvme_health_log_t *hlog, nvme_identify_ctrl_t *idctl)
/*
* The following two fields are in 1000 512 byte units. Convert that to
- * GB by doing binary shifts (9 left and 30 right) and muliply by 10^3.
+ * GB by doing binary shifts (9 left and 30 right) and multiply by 10^3.
*/
nvme_print_uint128(2, "Data Read",
hlog->hl_data_read, "GB", 30 - 9, 3);
@@ -840,6 +885,76 @@ nvme_print_health_log(nvme_health_log_t *hlog, nvme_identify_ctrl_t *idctl)
hlog->hl_media_errors, NULL, 0, 0);
nvme_print_uint128(2, "Errors Logged",
hlog->hl_errors_logged, NULL, 0, 0);
+
+ if (!NVME_VERSION_ATLEAST(vers, 1, 2)) {
+ return;
+ }
+
+ if (idctl->ap_wctemp != 0) {
+ nvme_print_uint64(2, "Warning Composite Temperature Time",
+ hlog->hl_warn_temp_time, NULL, "min");
+ }
+
+ if (idctl->ap_cctemp != 0) {
+ nvme_print_uint64(2, "Critical Composite Temperature Time",
+ hlog->hl_crit_temp_time, NULL, "min");
+ }
+
+ if (hlog->hl_temp_sensor_1 != 0) {
+ nvme_print_temp(2, "Temperature Sensor 1",
+ hlog->hl_temp_sensor_1);
+ }
+
+ if (hlog->hl_temp_sensor_2 != 0) {
+ nvme_print_temp(2, "Temperature Sensor 2",
+ hlog->hl_temp_sensor_2);
+ }
+
+ if (hlog->hl_temp_sensor_3 != 0) {
+ nvme_print_temp(2, "Temperature Sensor 3",
+ hlog->hl_temp_sensor_3);
+ }
+
+ if (hlog->hl_temp_sensor_4 != 0) {
+ nvme_print_temp(2, "Temperature Sensor 4",
+ hlog->hl_temp_sensor_4);
+ }
+
+ if (hlog->hl_temp_sensor_5 != 0) {
+ nvme_print_temp(2, "Temperature Sensor 5",
+ hlog->hl_temp_sensor_5);
+ }
+
+ if (hlog->hl_temp_sensor_6 != 0) {
+ nvme_print_temp(2, "Temperature Sensor 6",
+ hlog->hl_temp_sensor_6);
+ }
+
+ if (hlog->hl_temp_sensor_7 != 0) {
+ nvme_print_temp(2, "Temperature Sensor 7",
+ hlog->hl_temp_sensor_7);
+ }
+
+ if (hlog->hl_temp_sensor_8 != 0) {
+ nvme_print_temp(2, "Temperature Sensor 8",
+ hlog->hl_temp_sensor_8);
+ }
+
+ if (!NVME_VERSION_ATLEAST(vers, 1, 3)) {
+ return;
+ }
+
+ nvme_print_uint64(2, "Thermal Management Temp 1 Transition Count",
+ hlog->hl_tmtemp_1_tc, NULL, NULL);
+
+ nvme_print_uint64(2, "Thermal Management Temp 2 Transition Count",
+ hlog->hl_tmtemp_2_tc, NULL, NULL);
+
+ nvme_print_uint64(2, "Time for Thermal Management Temp 1",
+ hlog->hl_tmtemp_1_time, NULL, "sec");
+
+ nvme_print_uint64(2, "Time for Thermal Management Temp 2",
+ hlog->hl_tmtemp_2_time, NULL, "sec");
}
/*
@@ -970,14 +1085,13 @@ void
nvme_print_feat_temperature(uint64_t res, void *b, size_t s,
nvme_identify_ctrl_t *id)
{
- _NOTE(ARGUNUSED(b));
_NOTE(ARGUNUSED(s));
_NOTE(ARGUNUSED(id));
nvme_temp_threshold_t tt;
+ char *label = b;
tt.r = (uint32_t)res;
- nvme_print_uint64(4, "Temperature Threshold", tt.b.tt_tmpth - 273,
- NULL, "C");
+ nvme_print_temp(4, label, tt.b.tt_tmpth);
}
void
diff --git a/usr/src/common/util/THIRDPARTYLICENSE.multi3 b/usr/src/common/util/THIRDPARTYLICENSE.multi3
new file mode 100644
index 0000000000..5a79a1b9d5
--- /dev/null
+++ b/usr/src/common/util/THIRDPARTYLICENSE.multi3
@@ -0,0 +1,311 @@
+==============================================================================
+The LLVM Project is under the Apache License v2.0 with LLVM Exceptions:
+==============================================================================
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+---- LLVM Exceptions to the Apache 2.0 License ----
+
+As an exception, if, as a result of your compiling your source code, portions
+of this Software are embedded into an Object form of such source code, you
+may redistribute such embedded portions in such Object form without complying
+with the conditions of Sections 4(a), 4(b) and 4(d) of the License.
+
+In addition, if you combine or link compiled forms of this Software with
+software that is licensed under the GPLv2 ("Combined Software") and if a
+court of competent jurisdiction determines that the patent provision (Section
+3), the indemnity provision (Section 9) or other Section of the License
+conflicts with the conditions of the GPLv2, you may retroactively and
+prospectively choose to deem waived or otherwise exclude such Section(s) of
+the License, but only in their entirety and only with respect to the Combined
+Software.
+
+==============================================================================
+Software from third parties included in the LLVM Project:
+==============================================================================
+The LLVM Project contains third party software which is under different license
+terms. All such code will be identified clearly using at least one of two
+mechanisms:
+1) It will be in a separate directory tree with its own `LICENSE.txt` or
+ `LICENSE` file at the top containing the specific license and restrictions
+ which apply to that software, or
+2) It will contain specific license and restriction terms at the top of every
+ file.
+
+==============================================================================
+Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy):
+==============================================================================
+
+The compiler_rt library is dual licensed under both the University of Illinois
+"BSD-Like" license and the MIT license. As a user of this code you may choose
+to use it under either license. As a contributor, you agree to allow your code
+to be used under both.
+
+Full text of the relevant licenses is included below.
+
+==============================================================================
+
+University of Illinois/NCSA
+Open Source License
+
+Copyright (c) 2009-2019 by the contributors listed in CREDITS.TXT
+
+All rights reserved.
+
+Developed by:
+
+ LLVM Team
+
+ University of Illinois at Urbana-Champaign
+
+ http://llvm.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal with
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimers.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimers in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the names of the LLVM Team, University of Illinois at
+ Urbana-Champaign, nor the names of its contributors may be used to
+ endorse or promote products derived from this Software without specific
+ prior written permission.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
+SOFTWARE.
+
+==============================================================================
+
+Copyright (c) 2009-2015 by the contributors listed in CREDITS.TXT
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/usr/src/common/util/THIRDPARTYLICENSE.multi3.descrip b/usr/src/common/util/THIRDPARTYLICENSE.multi3.descrip
new file mode 100644
index 0000000000..911d8e4ee3
--- /dev/null
+++ b/usr/src/common/util/THIRDPARTYLICENSE.multi3.descrip
@@ -0,0 +1 @@
+__multi3
diff --git a/usr/src/common/util/multi3.c b/usr/src/common/util/multi3.c
new file mode 100644
index 0000000000..b098eb37ac
--- /dev/null
+++ b/usr/src/common/util/multi3.c
@@ -0,0 +1,63 @@
+/*
+ * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+ * See https://llvm.org/LICENSE.txt for license information.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ */
+
+#include <sys/byteorder.h>
+
+#define CHAR_BIT 8
+
+typedef int di_int __attribute__((mode(DI)));
+typedef unsigned int du_int __attribute__((mode(DI)));
+typedef int ti_int __attribute__((mode(TI)));
+
+typedef union {
+ ti_int all;
+ struct {
+#if _LITTLE_ENDIAN
+ du_int low;
+ di_int high;
+#else
+ di_int high;
+ du_int low;
+#endif /* _LITTLE_ENDIAN */
+ } s;
+} twords;
+
+/* Returns: a * b */
+static
+ti_int
+__mulddi3(du_int a, du_int b)
+{
+ twords r;
+ const int bits_in_dword_2 = (int)(sizeof (di_int) * CHAR_BIT) / 2;
+ const du_int lower_mask = (du_int)~0 >> bits_in_dword_2;
+ r.s.low = (a & lower_mask) * (b & lower_mask);
+ du_int t = r.s.low >> bits_in_dword_2;
+ r.s.low &= lower_mask;
+ t += (a >> bits_in_dword_2) * (b & lower_mask);
+ r.s.low += (t & lower_mask) << bits_in_dword_2;
+ r.s.high = t >> bits_in_dword_2;
+ t = r.s.low >> bits_in_dword_2;
+ r.s.low &= lower_mask;
+ t += (b >> bits_in_dword_2) * (a & lower_mask);
+ r.s.low += (t & lower_mask) << bits_in_dword_2;
+ r.s.high += t >> bits_in_dword_2;
+ r.s.high += (a >> bits_in_dword_2) * (b >> bits_in_dword_2);
+ return (r.all);
+}
+
+/* Returns: a * b */
+ti_int
+__multi3(ti_int a, ti_int b)
+{
+ twords x;
+ x.all = a;
+ twords y;
+ y.all = b;
+ twords r;
+ r.all = __mulddi3(x.s.low, y.s.low);
+ r.s.high += x.s.high * y.s.low + x.s.low * y.s.high;
+ return (r.all);
+}
diff --git a/usr/src/lib/libc/port/mapfile-vers b/usr/src/lib/libc/port/mapfile-vers
index eb81629318..29af604724 100644
--- a/usr/src/lib/libc/port/mapfile-vers
+++ b/usr/src/lib/libc/port/mapfile-vers
@@ -3367,6 +3367,10 @@ $if sparc32
__ucmpdi2;
$endif
+$if sparcv9
+ __multi3;
+$endif
+
$if _x86
_D_cplx_lr_div;
_D_cplx_lr_div_ix;
diff --git a/usr/src/lib/libc/port/sys/epoll.c b/usr/src/lib/libc/port/sys/epoll.c
index e510b0b247..230860d391 100644
--- a/usr/src/lib/libc/port/sys/epoll.c
+++ b/usr/src/lib/libc/port/sys/epoll.c
@@ -11,6 +11,7 @@
/*
* Copyright 2017 Joyent, Inc.
+ * Copyright 2020 Oxide Computer Company
*/
#include <sys/types.h>
@@ -56,7 +57,7 @@
* Events that we ignore entirely. They can be set in events, but they will
* never be returned.
*/
-#define EPOLLIGNORED (EPOLLMSG | EPOLLWAKEUP)
+#define EPOLLIGNORED (EPOLLMSG | EPOLLWAKEUP | EPOLLEXCLUSIVE)
/*
* Events that we swizzle into other bit positions.
@@ -140,6 +141,11 @@ epoll_ctl(int epfd, int op, int fd, struct epoll_event *event)
break;
case EPOLL_CTL_MOD:
+ /* EPOLLEXCLUSIVE is prohibited for modify operations */
+ if ((event->events & EPOLLEXCLUSIVE) != 0) {
+ errno = EINVAL;
+ return (-1);
+ }
/*
* In the modify case, we pass down two events: one to
* remove the event and another to add it back.
diff --git a/usr/src/lib/libc/sparcv9/Makefile.com b/usr/src/lib/libc/sparcv9/Makefile.com
index 2a1dc8d0cd..0a826826ee 100644
--- a/usr/src/lib/libc/sparcv9/Makefile.com
+++ b/usr/src/lib/libc/sparcv9/Makefile.com
@@ -135,7 +135,8 @@ COMOBJS= \
strtol.o \
strtoul.o \
strtoll.o \
- strtoull.o
+ strtoull.o \
+ multi3.o
GENOBJS= \
_getsp.o \
diff --git a/usr/src/man/man3c/epoll_ctl.3c b/usr/src/man/man3c/epoll_ctl.3c
index 3b3dfabcba..b80efb8b33 100644
--- a/usr/src/man/man3c/epoll_ctl.3c
+++ b/usr/src/man/man3c/epoll_ctl.3c
@@ -1,5 +1,6 @@
'\" te
.\" Copyright (c) 2014, Joyent, Inc. All Rights Reserved.
+.\" Copyright 2020 Oxide Computer Company
.\" This file and its contents are supplied under the terms of the
.\" Common Development and Distribution License ("CDDL"), version 1.0.
.\" You may only use this file in accordance with the terms of version
@@ -8,7 +9,7 @@
.\" A full copy of the text of the CDDL should have accompanied this
.\" source. A copy of the CDDL is also available via the Internet at
.\" http://www.illumos.org/license/CDDL.
-.TH EPOLL_CTL 3C "April 9, 2016"
+.TH EPOLL_CTL 3C "June 29, 2020"
.SH NAME
epoll_ctl \- control an epoll instance
.SH SYNOPSIS
@@ -206,6 +207,23 @@ exclusive with \fBEPOLLIN\fR.
.sp
.ne 2
.na
+\fBEPOLLEXCLUSIVE\fR
+.ad
+.RS 14n
+This is present for binary compatibility and is effectively a no-op on illumos.
+
+The flag was added to Linux in v4.5 to provide a means to mitigate thundering
+herd problems when multiple epoll instances contain the same event source. Set
+on a specified event source during \fBEPOLL_CTL_ADD\fR (and not allowed with
+\fBEPOLL_CTL_MOD\fR), it indicates that epoll should attempt to limit the scope
+of pollers woken when a shared target resource changes state. All pollers
+without the flag set in the event will be notified and one \fIor more\fR of
+those with it set will be as well.
+.RE
+
+.sp
+.ne 2
+.na
\fBEPOLLWAKEUP\fR
.ad
.RS 14n
diff --git a/usr/src/pkg/manifests/system-library.mf b/usr/src/pkg/manifests/system-library.mf
index ba0cf527d8..6ae9fc7378 100644
--- a/usr/src/pkg/manifests/system-library.mf
+++ b/usr/src/pkg/manifests/system-library.mf
@@ -587,6 +587,8 @@ license usr/src/common/crypto/sha2/amd64/THIRDPARTYLICENSE.sha256-ni \
license=usr/src/common/crypto/sha2/amd64/THIRDPARTYLICENSE.sha256-ni
license usr/src/common/mpi/THIRDPARTYLICENSE \
license=usr/src/common/mpi/THIRDPARTYLICENSE
+license usr/src/common/util/THIRDPARTYLICENSE.multi3 \
+ license=usr/src/common/util/THIRDPARTYLICENSE.multi3
license usr/src/lib/libast/THIRDPARTYLICENSE \
license=usr/src/lib/libast/THIRDPARTYLICENSE
license usr/src/lib/libbsdmalloc/THIRDPARTYLICENSE \
diff --git a/usr/src/stand/lib/sa/Makefile b/usr/src/stand/lib/sa/Makefile
index 9c9788f4c1..98fe33a110 100644
--- a/usr/src/stand/lib/sa/Makefile
+++ b/usr/src/stand/lib/sa/Makefile
@@ -21,7 +21,7 @@
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
-#
+#
LIBRARY = libsa.a
LOCOBJS = assert.o ctype.o errno.o libintl.o malloc.o memlist.o \
@@ -32,7 +32,7 @@ CMNOBJS = cache.o diskread.o fsswitch.o promfs.o
sparc_CMNUTILOBJS = memchr.o memmove.o
CMNUTILOBJS = $($(MACH)_CMNUTILOBJS) \
bsearch.o memcmp.o memcpy.o memset.o qsort.o \
- string.o strtol.o strtoul.o
+ string.o strtol.o strtoul.o multi3.o
i386_MACHOBJS = get.o map_prog.o
sparc_MACHOBJS = prom_misc.o
@@ -49,8 +49,8 @@ include ../Makefile.com
CMNDIR = ../fs/common
CMNUTILDIR = $(TOPDIR)/common/util
SRCS = $(LOCOBJS:%.o=$(SRCDIR)/%.c) $(CMNOBJS:%.o=$(CMNDIR)/%.c) \
- $(CMNUTILOBJS:%.o=$(CMNUTILDIR)/%.c) \
- $($(MACH)_ASMOBJS:%.o=$(MACH)/%.s) \
+ $(CMNUTILOBJS:%.o=$(CMNUTILDIR)/%.c) \
+ $($(MACH)_ASMOBJS:%.o=$(MACH)/%.s) \
$($(MACH)_OBJS:%.o=$(MACH)/%.c)
LDLIBS += -lsock
diff --git a/usr/src/test/os-tests/tests/sockfs/rights.c b/usr/src/test/os-tests/tests/sockfs/rights.c
index 97987d62c5..5e8382416f 100644
--- a/usr/src/test/os-tests/tests/sockfs/rights.c
+++ b/usr/src/test/os-tests/tests/sockfs/rights.c
@@ -11,6 +11,7 @@
/*
* Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
+ * Copyright 2020 Joyent, Inc.
*/
/*
@@ -669,6 +670,15 @@ main(int argc, const char **argv)
sigset_t set;
int ret = 0;
+ /*
+ * The tests make assumptions about the number of open file descriptors
+ * present. In case we are invoked with more than just STDIN_FILENO,
+ * STDOUT_FILENO, and STDERR_FILENO open, close any other open
+ * descriptors that might exist. Otherwise their presence will violate
+ * the assumptions of the test and cause an erroneous failure.
+ */
+ closefrom(STDERR_FILENO + 1);
+
if (argc > 1 && strcmp(argv[1], "-d") == 0)
debug = _B_TRUE;
diff --git a/usr/src/uts/common/io/blkdev/blkdev.c b/usr/src/uts/common/io/blkdev/blkdev.c
index 07fa32da1d..0718aebf7b 100644
--- a/usr/src/uts/common/io/blkdev/blkdev.c
+++ b/usr/src/uts/common/io/blkdev/blkdev.c
@@ -25,6 +25,7 @@
* Copyright 2016 Nexenta Systems, Inc. All rights reserved.
* Copyright 2017 The MathWorks, Inc. All rights reserved.
* Copyright 2019 Western Digital Corporation.
+ * Copyright 2020 Joyent, Inc.
*/
#include <sys/types.h>
@@ -228,8 +229,10 @@ struct bd_queue {
static void bd_prop_update_inqstring(dev_info_t *, char *, char *, size_t);
static void bd_create_inquiry_props(dev_info_t *, bd_drive_t *);
static void bd_create_errstats(bd_t *, int, bd_drive_t *);
+static void bd_destroy_errstats(bd_t *);
static void bd_errstats_setstr(kstat_named_t *, char *, size_t, char *);
static void bd_init_errstats(bd_t *, bd_drive_t *);
+static void bd_fini_errstats(bd_t *);
static int bd_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **);
static int bd_attach(dev_info_t *, ddi_attach_cmd_t);
@@ -490,6 +493,21 @@ bd_create_errstats(bd_t *bd, int inst, bd_drive_t *drive)
bd->d_errstats->ks_private = bd;
kstat_install(bd->d_errstats);
+ bd_init_errstats(bd, drive);
+}
+
+static void
+bd_destroy_errstats(bd_t *bd)
+{
+ if (bd->d_errstats != NULL) {
+ bd_fini_errstats(bd);
+ kstat_delete(bd->d_errstats);
+ bd->d_errstats = NULL;
+ } else {
+ kmem_free(bd->d_kerr, sizeof (struct bd_errstats));
+ bd->d_kerr = NULL;
+ mutex_destroy(&bd->d_errmutex);
+ }
}
static void
@@ -707,7 +725,6 @@ bd_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
bd_create_inquiry_props(dip, &drive);
bd_create_errstats(bd, inst, &drive);
- bd_init_errstats(bd, &drive);
bd_update_state(bd);
bd->d_queues = kmem_alloc(sizeof (*bd->d_queues) * bd->d_qcount,
@@ -732,19 +749,23 @@ bd_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
drive.d_lun >= 0 ? DDI_NT_BLOCK_CHAN : DDI_NT_BLOCK,
CMLB_FAKE_LABEL_ONE_PARTITION, bd->d_cmlbh, 0);
if (rv != 0) {
- cmlb_free_handle(&bd->d_cmlbh);
- kmem_cache_destroy(bd->d_cache);
- mutex_destroy(&bd->d_ksmutex);
- mutex_destroy(&bd->d_ocmutex);
- mutex_destroy(&bd->d_statemutex);
- cv_destroy(&bd->d_statecv);
bd_queues_free(bd);
+ bd_destroy_errstats(bd);
+ cmlb_free_handle(&bd->d_cmlbh);
+
if (bd->d_ksp != NULL) {
kstat_delete(bd->d_ksp);
bd->d_ksp = NULL;
} else {
kmem_free(bd->d_kiop, sizeof (kstat_io_t));
+ bd->d_kiop = NULL;
}
+
+ kmem_cache_destroy(bd->d_cache);
+ cv_destroy(&bd->d_statecv);
+ mutex_destroy(&bd->d_statemutex);
+ mutex_destroy(&bd->d_ocmutex);
+ mutex_destroy(&bd->d_ksmutex);
ddi_soft_state_free(bd_state, inst);
return (DDI_FAILURE);
}
@@ -797,6 +818,7 @@ bd_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
default:
return (DDI_FAILURE);
}
+
if (bd->d_ksp != NULL) {
kstat_delete(bd->d_ksp);
bd->d_ksp = NULL;
@@ -804,15 +826,7 @@ bd_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
kmem_free(bd->d_kiop, sizeof (kstat_io_t));
}
- if (bd->d_errstats != NULL) {
- bd_fini_errstats(bd);
- kstat_delete(bd->d_errstats);
- bd->d_errstats = NULL;
- } else {
- kmem_free(bd->d_kerr, sizeof (struct bd_errstats));
- mutex_destroy(&bd->d_errmutex);
- }
-
+ bd_destroy_errstats(bd);
cmlb_detach(bd->d_cmlbh, 0);
cmlb_free_handle(&bd->d_cmlbh);
if (bd->d_devid)
@@ -2052,11 +2066,12 @@ bd_attach_handle(dev_info_t *dip, bd_handle_t hdl)
ddi_set_parent_data(child, hdl);
hdl->h_child = child;
- if (ndi_devi_online(child, 0) == NDI_FAILURE) {
+ if (ndi_devi_online(child, 0) != NDI_SUCCESS) {
cmn_err(CE_WARN, "%s%d: failed bringing node %s@%s online",
ddi_driver_name(dip), ddi_get_instance(dip),
hdl->h_name, hdl->h_addr);
(void) ndi_devi_free(child);
+ hdl->h_child = NULL;
return (DDI_FAILURE);
}
diff --git a/usr/src/uts/common/io/nvme/nvme.c b/usr/src/uts/common/io/nvme/nvme.c
index 317926948b..b06866e9e7 100644
--- a/usr/src/uts/common/io/nvme/nvme.c
+++ b/usr/src/uts/common/io/nvme/nvme.c
@@ -4339,7 +4339,6 @@ nvme_ioctl_get_features(nvme_t *nvme, int nsid, nvme_ioctl_t *nioc,
switch (feature) {
case NVME_FEAT_ARBITRATION:
case NVME_FEAT_POWER_MGMT:
- case NVME_FEAT_TEMPERATURE:
case NVME_FEAT_ERROR:
case NVME_FEAT_NQUEUES:
case NVME_FEAT_INTR_COAL:
@@ -4350,6 +4349,27 @@ nvme_ioctl_get_features(nvme_t *nvme, int nsid, nvme_ioctl_t *nioc,
return (EINVAL);
break;
+ case NVME_FEAT_TEMPERATURE:
+ if (nsid != 0)
+ return (EINVAL);
+ res = nioc->n_arg & 0xffffffffUL;
+ if (NVME_VERSION_ATLEAST(&nvme->n_version, 1, 2)) {
+ nvme_temp_threshold_t tt;
+
+ tt.r = res;
+ if (tt.b.tt_thsel != NVME_TEMP_THRESH_OVER &&
+ tt.b.tt_thsel != NVME_TEMP_THRESH_UNDER) {
+ return (EINVAL);
+ }
+
+ if (tt.b.tt_tmpsel > NVME_TEMP_THRESH_MAX_SENSOR) {
+ return (EINVAL);
+ }
+ } else if (res != 0) {
+ return (EINVAL);
+ }
+ break;
+
case NVME_FEAT_INTR_VECT:
if (nsid != 0)
return (EINVAL);
diff --git a/usr/src/uts/common/rpc/svc.c b/usr/src/uts/common/rpc/svc.c
index 9ea26934b5..12cd548af3 100644
--- a/usr/src/uts/common/rpc/svc.c
+++ b/usr/src/uts/common/rpc/svc.c
@@ -1026,8 +1026,8 @@ svc_xprt_cleanup(SVCMASTERXPRT *xprt, bool_t detached)
* table for an entry with a matching RPC program number `prog'
* and a version range that covers `vers'.
* - if it finds a matching entry it returns pointer to the dispatch routine
- * - otherwise it returns NULL and, if `minp' or `maxp' are not NULL,
- * fills them with, respectively, lowest version and highest version
+ * - otherwise it returns NULL and fills both vers_min and vers_max
+ * with, respectively, lowest version and highest version
* supported for the program `prog'
*/
static SVC_DISPATCH *
diff --git a/usr/src/uts/common/sys/epoll.h b/usr/src/uts/common/sys/epoll.h
index f2e4b90ab7..3b38d9f629 100644
--- a/usr/src/uts/common/sys/epoll.h
+++ b/usr/src/uts/common/sys/epoll.h
@@ -11,6 +11,7 @@
/*
* Copyright (c) 2014, Joyent, Inc. All rights reserved.
+ * Copyright 2020 Oxide Computer Company
*/
#ifndef _SYS_EPOLL_H
@@ -60,6 +61,7 @@ typedef struct epoll_event {
#define EPOLLHUP 0x0010
#define EPOLLRDHUP 0x2000
+#define EPOLLEXCLUSIVE (1UL << 28) /* sets exclusive wake-up mode */
#define EPOLLWAKEUP (1UL << 29) /* no meaning; silently ignored */
#define EPOLLONESHOT (1UL << 30) /* translated to POLLONESHOT */
#define EPOLLET (1UL << 31) /* translated to POLLET */
diff --git a/usr/src/uts/common/sys/nvme.h b/usr/src/uts/common/sys/nvme.h
index 9a0d926dc5..1d54b05f21 100644
--- a/usr/src/uts/common/sys/nvme.h
+++ b/usr/src/uts/common/sys/nvme.h
@@ -436,7 +436,23 @@ typedef struct {
nvme_uint128_t hl_unsafe_shutdn; /* Unsafe Shutdowns */
nvme_uint128_t hl_media_errors; /* Media Errors */
nvme_uint128_t hl_errors_logged; /* Number of errors logged */
- uint8_t hl_rsvd2[512 - 192];
+ /* Added in NVMe 1.2 */
+ uint32_t hl_warn_temp_time; /* Warning Composite Temp Time */
+ uint32_t hl_crit_temp_time; /* Critical Composite Temp Time */
+ uint16_t hl_temp_sensor_1; /* Temperature Sensor 1 */
+ uint16_t hl_temp_sensor_2; /* Temperature Sensor 2 */
+ uint16_t hl_temp_sensor_3; /* Temperature Sensor 3 */
+ uint16_t hl_temp_sensor_4; /* Temperature Sensor 4 */
+ uint16_t hl_temp_sensor_5; /* Temperature Sensor 5 */
+ uint16_t hl_temp_sensor_6; /* Temperature Sensor 6 */
+ uint16_t hl_temp_sensor_7; /* Temperature Sensor 7 */
+ uint16_t hl_temp_sensor_8; /* Temperature Sensor 8 */
+ /* Added in NVMe 1.3 */
+ uint32_t hl_tmtemp_1_tc; /* Thermal Mgmt Temp 1 Transition # */
+ uint32_t hl_tmtemp_2_tc; /* Thermal Mgmt Temp 1 Transition # */
+ uint32_t hl_tmtemp_1_time; /* Time in Thermal Mgmt Temp 1 */
+ uint32_t hl_tmtemp_2_time; /* Time in Thermal Mgmt Temp 2 */
+ uint8_t hl_rsvd2[512 - 232];
} nvme_health_log_t;
/*
@@ -551,11 +567,18 @@ typedef struct {
typedef union {
struct {
uint16_t tt_tmpth; /* Temperature Threshold */
- uint16_t tt_rsvd;
+ uint16_t tt_tmpsel:4; /* Temperature Select */
+ uint16_t tt_thsel:2; /* Temperature Type */
+ uint16_t tt_resv:10;
} b;
uint32_t r;
} nvme_temp_threshold_t;
+#define NVME_TEMP_THRESH_MAX_SENSOR 8
+#define NVME_TEMP_THRESH_ALL 0xf
+#define NVME_TEMP_THRESH_OVER 0x00
+#define NVME_TEMP_THRESH_UNDER 0x01
+
/* Error Recovery Feature */
typedef union {
struct {
diff --git a/usr/src/uts/sparc/Makefile.files b/usr/src/uts/sparc/Makefile.files
index 86ab983b7a..d81abd33fd 100644
--- a/usr/src/uts/sparc/Makefile.files
+++ b/usr/src/uts/sparc/Makefile.files
@@ -33,7 +33,8 @@
CORE_OBJS += ddi_arch.o \
polled_io.o \
- sparc_ddi.o
+ sparc_ddi.o \
+ multi3.o
#
# generic-unix module
@@ -84,9 +85,9 @@ ZFS_OBJS += \
# misc modules
#
KRTLD_OBJS += \
- doreloc.o \
+ doreloc.o \
kobj_convrelstr.o \
- kobj_isa.o \
+ kobj_isa.o \
kobj_reloc.o
SWAPGENERIC_OBJS += swapgeneric.o