summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/lib/libc/port/fp/sigfpe.c3
-rw-r--r--usr/src/lib/libscf/common/midlevel.c15
-rw-r--r--usr/src/man/man9f/semaphore.9f344
-rw-r--r--usr/src/uts/common/io/mr_sas/mr_sas_tbolt.c6
-rw-r--r--usr/src/uts/common/io/sata/adapters/ahci/ahci.c15
-rw-r--r--usr/src/uts/common/os/dumpsubr.c82
-rw-r--r--usr/src/uts/common/os/semaphore.c36
7 files changed, 276 insertions, 225 deletions
diff --git a/usr/src/lib/libc/port/fp/sigfpe.c b/usr/src/lib/libc/port/fp/sigfpe.c
index 9ba6c6ce72..9b1942423f 100644
--- a/usr/src/lib/libc/port/fp/sigfpe.c
+++ b/usr/src/lib/libc/port/fp/sigfpe.c
@@ -33,8 +33,6 @@
* California.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/* Swap handler for SIGFPE codes. */
#include "lint.h"
@@ -155,6 +153,7 @@ _sigfpe_master(int sig, siginfo_t *siginfo, void *arg)
default: /* The common default treatment is to abort. */
break;
}
+ /* FALLTHROUGH */
case ((intptr_t)(SIGFPE_ABORT)):
abort();
break;
diff --git a/usr/src/lib/libscf/common/midlevel.c b/usr/src/lib/libscf/common/midlevel.c
index 3037e85113..69d5bd09d3 100644
--- a/usr/src/lib/libscf/common/midlevel.c
+++ b/usr/src/lib/libscf/common/midlevel.c
@@ -22,6 +22,7 @@
/*
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2018 RackTop Systems.
*/
#include "libscf_impl.h"
@@ -2601,6 +2602,13 @@ scf_read_propvec(const char *fmri, const char *pgname, boolean_t running,
scf_propvec_t *prop;
int error = 0;
+ for (prop = properties; prop->pv_prop != NULL; prop++) {
+ if (prop->pv_type == SCF_TYPE_OPAQUE)
+ ((scf_opaque_t *)prop->pv_ptr)->so_addr = NULL;
+ else if (scf_true_base_type(prop->pv_type) == SCF_TYPE_ASTRING)
+ *((char **)prop->pv_ptr) = NULL;
+ }
+
if (h == NULL || s == NULL || i == NULL || (running && snap == NULL) ||
pg == NULL || p == NULL || v == NULL)
goto scferror;
@@ -2630,13 +2638,6 @@ scf_read_propvec(const char *fmri, const char *pgname, boolean_t running,
goto scferror;
for (prop = properties; prop->pv_prop != NULL; prop++) {
- if (prop->pv_type == SCF_TYPE_OPAQUE)
- ((scf_opaque_t *)prop->pv_ptr)->so_addr = NULL;
- else if (scf_true_base_type(prop->pv_type) == SCF_TYPE_ASTRING)
- *((char **)prop->pv_ptr) = NULL;
- }
-
- for (prop = properties; prop->pv_prop != NULL; prop++) {
int ret = 0;
if (scf_pg_get_property(pg, prop->pv_prop, p) == -1 ||
diff --git a/usr/src/man/man9f/semaphore.9f b/usr/src/man/man9f/semaphore.9f
index b5b3cda2e8..2bed7a3899 100644
--- a/usr/src/man/man9f/semaphore.9f
+++ b/usr/src/man/man9f/semaphore.9f
@@ -1,171 +1,179 @@
-'\" te
-.\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved
-.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
-.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
-.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH SEMAPHORE 9F "May 7, 1997"
-.SH NAME
-semaphore, sema_init, sema_destroy, sema_p, sema_p_sig, sema_v, sema_tryp \-
-semaphore functions
-.SH SYNOPSIS
-.LP
-.nf
-#include <sys/ksynch.h>
-
-
-
-\fBvoid\fR \fBsema_init\fR(\fBksema_t *\fR\fIsp\fR, \fBuint_t\fR \fIval\fR, \fBchar *\fR\fIname\fR, \fBksema_type_t\fR \fItype\fR,
- \fBvoid *\fR\fIarg\fR);
-.fi
-
-.LP
-.nf
-\fBvoid\fR \fBsema_destroy\fR(\fBksema_t *\fR\fIsp\fR);
-.fi
-
-.LP
-.nf
-\fBvoid\fR \fBsema_p\fR(\fBksema_t *\fR\fIsp\fR);
-.fi
-
-.LP
-.nf
-\fBvoid\fR \fBsema_v\fR(\fBksema_t *\fR\fIsp\fR);
-.fi
-
-.LP
-.nf
-\fBint\fR \fBsema_p_sig\fR(\fBksema_t *\fR\fIsp\fR);
-.fi
-
-.LP
-.nf
-\fBint\fR \fBsema_tryp\fR(\fBksema_t *\fR\fIsp\fR);
-.fi
-
-.SH INTERFACE LEVEL
-.sp
-.LP
-Solaris \fBDDI\fR specific (Solaris \fBDDI\fR).
-.SH PARAMETERS
-.sp
-.ne 2
-.na
-\fB\fIsp\fR\fR
-.ad
-.RS 8n
-A pointer to a semaphore, type \fBksema_t\fR.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIval\fR\fR
-.ad
-.RS 8n
+.\"
+.\" The contents of this file are subject to the terms of the
+.\" Common Development and Distribution License (the "License").
+.\" You may not use this file except in compliance with the License.
+.\"
+.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+.\" or http://www.opensolaris.org/os/licensing.
+.\" See the License for the specific language governing permissions
+.\" and limitations under the License.
+.\"
+.\" When distributing Covered Code, include this CDDL HEADER in each
+.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+.\" If applicable, add the following below this CDDL HEADER, with the
+.\" fields enclosed by brackets "[]" replaced with your own identifying
+.\" information: Portions Copyright [yyyy] [name of copyright owner]
+.\"
+.\"
+.\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved
+.\" Copyright 2018 Nexenta Systems, Inc.
+.\"
+.Dd July 30, 2018
+.Dt SEMAPHORE 9F
+.Os
+.Sh NAME
+.Nm semaphore ,
+.Nm sema_init ,
+.Nm sema_destroy ,
+.Nm sema_p ,
+.Nm sema_p_sig ,
+.Nm sema_v ,
+.Nm sema_tryp
+.Nd semaphore functions
+.Sh SYNOPSIS
+.In sys/ksynch.h
+.Ft void
+.Fo sema_init
+.Fa "ksema_t *sp"
+.Fa "uint_t val"
+.Fa "char *name"
+.Fa "ksema_type_t type"
+.Fa "void *arg"
+.Fc
+.Ft void
+.Fo sema_destroy
+.Fa "ksema_t *sp"
+.Fc
+.Ft void
+.Fo sema_p
+.Fa "ksema_t *sp"
+.Fc
+.Ft void
+.Fo sema_v
+.Fa "ksema_t *sp"
+.Fc
+.Ft int
+.Fo sema_p_sig
+.Fa "ksema_t *sp"
+.Fc
+.Ft int
+.Fo sema_tryp
+.Fa "ksema_t *sp"
+.Fc
+.Sh INTERFACE LEVEL
+illumos DDI specific (illumos DDI).
+.Sh PARAMETERS
+.Bl -tag -width Ds
+.It Fa sp
+A pointer to a semaphore, type
+.Vt ksema_t .
+.It Fa val
Initial value for semaphore.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIname\fR\fR
-.ad
-.RS 8n
-Descriptive string. This is obsolete and should be \fINULL\fR. (Non-\fINULL\fR
-strings are legal, but they are a waste of kernel memory.)
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fItype\fR\fR
-.ad
-.RS 8n
-Variant type of the semaphore. Currently, only \fBSEMA_DRIVER\fR is supported.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fIarg\fR\fR
-.ad
-.RS 8n
-Type-specific argument; should be \fINULL\fR.
-.RE
-
-.SH DESCRIPTION
-.sp
-.LP
-These functions implement counting semaphores as described by Dijkstra. A
-semaphore has a value which is atomically decremented by \fBsema_p()\fR and
-atomically incremented by \fBsema_v()\fR. The value must always be greater than
-or equal to zero. If \fBsema_p()\fR is called and the value is zero, the
-calling thread is blocked until another thread performs a \fBsema_v()\fR
+.It Fa name
+Descriptive string.
+This is obsolete and should be
+.Dv NULL .
+.Po Non- Ns
+.Dv NULL
+strings are legal, but they are a waste of kernel memory.
+.Pc
+.It Fa type
+Variant type of the semaphore.
+Currently, only
+.Dv SEMA_DRIVER
+is supported.
+.It Fa arg
+Type-specific argument; should be
+.Dv NULL .
+.El
+.Sh DESCRIPTION
+These functions implement counting semaphores as described by Dijkstra.
+A semaphore has a value which is atomically decremented by
+.Fn sema_p
+and atomically incremented by
+.Fn sema_v .
+The value must always be greater than or equal to zero.
+If
+.Fn sema_p
+is called and the value is zero, the calling thread is blocked until another
+thread performs a
+.Fn sema_v
operation on the semaphore.
-.sp
-.LP
-Semaphores are initialized by calling \fBsema_init()\fR. The argument,
-\fBval\fR, gives the initial value for the semaphore. The semaphore storage is
-provided by the caller but more may be dynamically allocated, if necessary, by
-\fBsema_init()\fR. For this reason, \fBsema_destroy()\fR should be called
-before deallocating the storage containing the semaphore.
-.sp
-.LP
-The \fBsema_p_sig()\fR function decrements the semaphore, as does
-\fBsema_p()\fR. However, if the semaphore value is zero, \fBsema_p_sig()\fR
-will return without decrementing the value if a signal (that is, from
-\fBkill\fR(2)) is pending for the thread.
-.sp
-.LP
-The \fBsema_tryp()\fR function will decrement the semaphore value only if it is
-greater than zero, and will not block.
-.SH RETURN VALUES
-.sp
-.ne 2
-.na
-\fB\fB0\fR\fR
-.ad
-.RS 5n
-\fBsema_tryp()\fR could not decrement the semaphore value because it was zero.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB1\fR\fR
-.ad
-.RS 5n
-\fBsema_p_sig()\fR was not able to decrement the semaphore value and detected a
-pending signal.
-.RE
-
-.SH CONTEXT
-.sp
-.LP
+.Pp
+Semaphores are initialized by calling
+.Fn sema_init .
+The argument,
+.Fa val ,
+gives the initial value for the semaphore.
+The semaphore storage is provided by the caller but more may be dynamically
+allocated, if necessary, by
+.Fn sema_init .
+For this reason,
+.Fn sema_destroy
+should be called before deallocating the storage containing the semaphore.
+.Pp
+The
+.Fn sema_p_sig
+function decrements the semaphore, as does
+.Fn sema_p .
+However, if the semaphore value is zero,
+.Fn sema_p_sig
+will return without decrementing the value if a signal
+.Po that is, from
+.Xr kill 2
+.Pc
+is pending for the thread.
+.Pp
+The
+.Fn sema_tryp
+function will decrement the semaphore value only if it is greater than zero, and
+will not block.
+.Sh CONTEXT
These functions can be called from user, interrupt, or kernel context, except
-for \fBsema_init()\fR and \fBsema_destroy()\fR, which can be called from user
-or kernel context only. None of these functions can be called from a high-level
-interrupt context. In most cases, \fBsema_v()\fR and \fBsema_p()\fR should not
-be called from any interrupt context.
-.sp
-.LP
-If \fBsema_p()\fR is used from interrupt context, lower-priority interrupts
-will not be serviced during the wait. This means that if the thread that will
-eventually perform the \fBsema_v()\fR becomes blocked on anything that requires
-the lower-priority interrupt, the system will hang.
-.sp
-.LP
-For example, the thread that will perform the \fBsema_v()\fR may need to first
-allocate memory. This memory allocation may require waiting for paging
-\fBI/O\fR to complete, which may require a lower-priority disk or network
-interrupt to be serviced. In general, situations like this are hard to predict,
-so it is advisable to avoid waiting on semaphores or condition variables in an
-interrupt context.
-.SH SEE ALSO
-.sp
-.LP
-\fBkill\fR(2), \fBcondvar\fR(9F), \fBmutex\fR(9F)
-.sp
-.LP
-\fIWriting Device Drivers\fR
+for
+.Fn sema_init
+and
+.Fn sema_destroy ,
+which can be called from user or kernel context only.
+None of these functions can be called from a high-level interrupt context.
+In most cases,
+.Fn sema_v
+and
+.Fn sema_p
+should not be called from any interrupt context.
+.Pp
+If
+.Fn sema_p
+is used from interrupt context, lower-priority interrupts will not be serviced
+during the wait.
+This means that if the thread that will eventually perform the
+.Fn sema_v
+becomes blocked on anything that requires the lower-priority interrupt, the
+system will hang.
+.Pp
+For example, the thread that will perform the
+.Fn sema_v
+may need to first allocate memory.
+This memory allocation may require waiting for paging I/O to complete, which may
+require a lower-priority disk or network interrupt to be serviced.
+In general, situations like this are hard to predict, so it is advisable to
+avoid waiting on semaphores or condition variables in an interrupt context.
+.Pp
+Similar to many other synchronization mechanisms, semaphores should not be used
+in any code path that requires synchronization while handling system panic, at
+which time many of the semaphore operations become no-ops.
+.Sh RETURN VALUES
+.Bl -tag -width Ds
+.It Li 0
+.Fn sema_tryp
+could not decrement the semaphore value because it was zero.
+.It Li 1
+.Fn sema_p_sig
+was not able to decrement the semaphore value and detected a pending signal.
+.El
+.Sh SEE ALSO
+.Xr kill 2 ,
+.Xr condvar 9F ,
+.Xr mutex 9F
+.Pp
+.Em Writing Device Drivers
diff --git a/usr/src/uts/common/io/mr_sas/mr_sas_tbolt.c b/usr/src/uts/common/io/mr_sas/mr_sas_tbolt.c
index fd8d417884..0018a13457 100644
--- a/usr/src/uts/common/io/mr_sas/mr_sas_tbolt.c
+++ b/usr/src/uts/common/io/mr_sas/mr_sas_tbolt.c
@@ -16,7 +16,7 @@
*/
/*
- * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2018 Nexenta Systems, Inc.
* Copyright 2015, 2017 Citrus IT Limited. All rights reserved.
* Copyright 2015 Garrett D'Amore <garrett@damore.org>
*/
@@ -52,7 +52,7 @@ extern uint32_t mrsas_tbolt_max_cap_maxxfer;
extern struct ddi_device_acc_attr endian_attr;
extern int debug_level_g;
extern unsigned int enable_fp;
-volatile int dump_io_wait_time = 90;
+volatile int dump_io_wait_time = 900;
extern volatile int debug_timeout_g;
extern int mrsas_issue_pending_cmds(struct mrsas_instance *);
extern int mrsas_complete_pending_cmds(struct mrsas_instance *instance);
@@ -1108,7 +1108,7 @@ wait_for_outstanding_poll_io(struct mrsas_instance *instance)
if (instance->fw_outstanding <= 2) {
break;
}
- drv_usecwait(10*MILLISEC);
+ drv_usecwait(MILLISEC);
/* complete commands from reply queue */
(void) mr_sas_tbolt_process_outstanding_cmd(instance);
}
diff --git a/usr/src/uts/common/io/sata/adapters/ahci/ahci.c b/usr/src/uts/common/io/sata/adapters/ahci/ahci.c
index 87e172c6ad..07466f8c77 100644
--- a/usr/src/uts/common/io/sata/adapters/ahci/ahci.c
+++ b/usr/src/uts/common/io/sata/adapters/ahci/ahci.c
@@ -21,7 +21,7 @@
/*
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2018 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2018, Joyent, Inc.
*/
@@ -1907,15 +1907,19 @@ ahci_do_sync_start(ahci_ctl_t *ahci_ctlp, ahci_port_t *ahci_portp,
drv_usectohz((clock_t)spkt->satapkt_time * 1000000);
while (spkt->satapkt_reason == SATA_PKT_BUSY) {
- mutex_exit(&ahci_portp->ahciport_mutex);
-
/* Simulate the interrupt */
+ mutex_exit(&ahci_portp->ahciport_mutex);
ahci_port_intr(ahci_ctlp, ahci_portp, port);
+ mutex_enter(&ahci_portp->ahciport_mutex);
- drv_usecwait(AHCI_10MS_USECS);
+ if (spkt->satapkt_reason != SATA_PKT_BUSY)
+ break;
+ mutex_exit(&ahci_portp->ahciport_mutex);
+ drv_usecwait(AHCI_1MS_USECS);
mutex_enter(&ahci_portp->ahciport_mutex);
- pkt_timeout_ticks -= AHCI_10MS_TICKS;
+
+ pkt_timeout_ticks -= AHCI_1MS_TICKS;
if (pkt_timeout_ticks < 0) {
cmn_err(CE_WARN, "!ahci%d: ahci_do_sync_start "
"port %d satapkt 0x%p timed out\n",
@@ -1927,6 +1931,7 @@ ahci_do_sync_start(ahci_ctl_t *ahci_ctlp, ahci_port_t *ahci_portp,
mutex_enter(&ahci_portp->ahciport_mutex);
}
}
+
ahci_portp->ahciport_flags &= ~AHCI_PORT_FLAG_POLLING;
return (AHCI_SUCCESS);
diff --git a/usr/src/uts/common/os/dumpsubr.c b/usr/src/uts/common/os/dumpsubr.c
index ee654074ba..a30f4841d7 100644
--- a/usr/src/uts/common/os/dumpsubr.c
+++ b/usr/src/uts/common/os/dumpsubr.c
@@ -22,6 +22,7 @@
/*
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2018 Joyent, Inc.
+ * Copyright 2018 Nexenta Systems, Inc. All rights reserved.
*/
#include <sys/types.h>
@@ -71,6 +72,7 @@
#include <vm/seg_kmem.h>
#include <sys/clock_impl.h>
#include <sys/hold_page.h>
+#include <sys/cpu.h>
#include <bzip2/bzlib.h>
@@ -440,6 +442,15 @@ typedef struct dumpbuf {
dumpbuf_t dumpbuf; /* I/O buffer */
/*
+ * For parallel dump, defines maximum time main task thread will wait
+ * for at least one helper to register in dumpcfg.helpermap, before
+ * assuming there are no helpers and falling back to serial mode.
+ * Value is chosen arbitrary and provides *really* long wait for any
+ * available helper to register.
+ */
+#define DUMP_HELPER_MAX_WAIT 1000 /* millisec */
+
+/*
* The dump I/O buffer must be at least one page, at most xfer_size
* bytes, and should scale with physmem in between. The transfer size
* passed in will either represent a global default (maxphys) or the
@@ -491,8 +502,8 @@ dumpbuf_resize(void)
/*
* dump_update_clevel is called when dumpadm configures the dump device.
- * Calculate number of helpers and buffers.
- * Allocate the minimum configuration for now.
+ * Calculate number of helpers and buffers.
+ * Allocate the minimum configuration for now.
*
* When the dump file is configured we reserve a minimum amount of
* memory for use at crash time. But we reserve VA for all the memory
@@ -512,15 +523,15 @@ dumpbuf_resize(void)
* The actual values are defined via DUMP_PLAT_*_MINCPU macros.
*
* Architecture Threshold Algorithm
- * sun4u < 51 parallel lzjb
- * sun4u >= 51 parallel bzip2(*)
- * sun4u OPL < 8 parallel lzjb
- * sun4u OPL >= 8 parallel bzip2(*)
- * sun4v < 128 parallel lzjb
- * sun4v >= 128 parallel bzip2(*)
+ * sun4u < 51 parallel lzjb
+ * sun4u >= 51 parallel bzip2(*)
+ * sun4u OPL < 8 parallel lzjb
+ * sun4u OPL >= 8 parallel bzip2(*)
+ * sun4v < 128 parallel lzjb
+ * sun4v >= 128 parallel bzip2(*)
* x86 < 11 parallel lzjb
* x86 >= 11 parallel bzip2(*)
- * 32-bit N/A single-threaded lzjb
+ * 32-bit N/A single-threaded lzjb
*
* (*) bzip2 is only chosen if there is sufficient available
* memory for buffers at dump time. See dumpsys_get_maxmem().
@@ -2301,28 +2312,46 @@ dumpsys_main_task(void *arg)
cbuf_t *cp;
pgcnt_t baseoff, pfnoff;
pfn_t base, pfn;
- int i, dumpserial;
+ boolean_t dumpserial;
+ int i;
/*
* Fall back to serial mode if there are no helpers.
* dump_plat_mincpu can be set to 0 at any time.
* dumpcfg.helpermap must contain at least one member.
+ *
+ * It is possible that the helpers haven't registered
+ * in helpermap yet; wait up to DUMP_HELPER_MAX_WAIT for
+ * at least one helper to register.
*/
- dumpserial = 1;
-
+ dumpserial = B_TRUE;
if (dump_plat_mincpu != 0 && dumpcfg.clevel != 0) {
- for (i = 0; i < BT_BITOUL(NCPU); ++i) {
- if (dumpcfg.helpermap[i] != 0) {
- dumpserial = 0;
+ hrtime_t hrtmax = MSEC2NSEC(DUMP_HELPER_MAX_WAIT);
+ hrtime_t hrtstart = gethrtime();
+
+ for (;;) {
+ for (i = 0; i < BT_BITOUL(NCPU); ++i) {
+ if (dumpcfg.helpermap[i] != 0) {
+ dumpserial = B_FALSE;
+ break;
+ }
+ }
+
+ if ((!dumpserial) ||
+ ((gethrtime() - hrtstart) >= hrtmax)) {
break;
}
+
+ SMT_PAUSE();
}
- }
- if (dumpserial) {
- dumpcfg.clevel = 0;
- if (dumpcfg.helper[0].lzbuf == NULL)
- dumpcfg.helper[0].lzbuf = dumpcfg.helper[1].page;
+ if (dumpserial) {
+ dumpcfg.clevel = 0;
+ if (dumpcfg.helper[0].lzbuf == NULL) {
+ dumpcfg.helper[0].lzbuf =
+ dumpcfg.helper[1].page;
+ }
+ }
}
dump_init_memlist_walker(&mlw);
@@ -2467,12 +2496,11 @@ dumpsys_main_task(void *arg)
*/
if (dumpserial) {
dumpsys_lzjb_page(dumpcfg.helper, cp);
- break;
+ } else {
+ /* pass mapped pages to a helper */
+ CQ_PUT(helperq, cp, CBUF_INREADY);
}
- /* pass mapped pages to a helper */
- CQ_PUT(helperq, cp, CBUF_INREADY);
-
/* the last page was done */
if (bitnum >= dumpcfg.bitmapsize)
CQ_CLOSE(helperq);
@@ -2577,8 +2605,12 @@ dumpsys_metrics(dumpsync_t *ds, char *buf, size_t size)
P("Found small pages,%ld\n", cfg->foundsm);
P("Compression level,%d\n", cfg->clevel);
- P("Compression type,%s %s\n", cfg->clevel == 0 ? "serial" : "parallel",
+ P("Compression type,%s %s", cfg->clevel == 0 ? "serial" : "parallel",
cfg->clevel >= DUMP_CLEVEL_BZIP2 ? "bzip2" : "lzjb");
+ if (cfg->clevel >= DUMP_CLEVEL_BZIP2)
+ P(" (level %d)\n", dump_bzip2_level);
+ else
+ P("\n");
P("Compression ratio,%d.%02d\n", compress_ratio / 100, compress_ratio %
100);
P("nhelper_used,%d\n", cfg->nhelper_used);
diff --git a/usr/src/uts/common/os/semaphore.c b/usr/src/uts/common/os/semaphore.c
index ad25db33b3..04c28008de 100644
--- a/usr/src/uts/common/os/semaphore.c
+++ b/usr/src/uts/common/os/semaphore.c
@@ -24,7 +24,9 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright 2018 Nexenta Systems, Inc. All rights reserved.
+ */
/*
* This file contains the semaphore operations.
@@ -227,15 +229,15 @@ sema_p(ksema_t *sp)
sema_impl_t *s;
disp_lock_t *sqlp;
+ /* no-op during panic */
+ if (panicstr)
+ return;
+
s = (sema_impl_t *)sp;
sqlp = &SQHASH(s)->sq_lock;
disp_lock_enter(sqlp);
ASSERT(s->s_count >= 0);
while (s->s_count == 0) {
- if (panicstr) {
- disp_lock_exit(sqlp);
- return;
- }
thread_lock_high(curthread);
SEMA_BLOCK(s, sqlp);
thread_unlock_nopreempt(curthread);
@@ -329,17 +331,17 @@ sema_p_sig(ksema_t *sp)
void
sema_v(ksema_t *sp)
{
- sema_impl_t *s;
- kthread_t *sq, *tp;
+ sema_impl_t *s;
+ kthread_t *sq, *tp;
disp_lock_t *sqlp;
+ /* no-op during panic */
+ if (panicstr)
+ return;
+
s = (sema_impl_t *)sp;
sqlp = &SQHASH(s)->sq_lock;
disp_lock_enter(sqlp);
- if (panicstr) {
- disp_lock_exit(sqlp);
- return;
- }
s->s_count++;
sq = s->s_slpq;
if (sq != NULL) {
@@ -373,6 +375,10 @@ sema_tryp(ksema_t *sp)
int gotit = 0;
+ /* no-op during panic */
+ if (panicstr)
+ return (1);
+
s = (sema_impl_t *)sp;
sqh = SQHASH(s);
disp_lock_enter(&sqh->sq_lock);
@@ -389,10 +395,10 @@ sema_held(ksema_t *sp)
{
sema_impl_t *s;
-
- s = (sema_impl_t *)sp;
+ /* no-op during panic */
if (panicstr)
return (1);
- else
- return (s->s_count <= 0);
+
+ s = (sema_impl_t *)sp;
+ return (s->s_count <= 0);
}