diff --git a/contrib/dlog/bin/dlogd/dl_request_queue.h b/contrib/dlog/bin/dlogd/dl_request_queue.h index 61ea7020303d..847442098275 100644 --- a/contrib/dlog/bin/dlogd/dl_request_queue.h +++ b/contrib/dlog/bin/dlogd/dl_request_queue.h @@ -61,7 +61,7 @@ struct dl_request_q_stats { int dlrq_capacity; int dlrq_requests; int dlrq_unackd; -} dlrq_stats; +}; struct dl_request_q; diff --git a/contrib/dlog/bin/dlogd/dlogd.c b/contrib/dlog/bin/dlogd/dlogd.c index 01ac8dab63fc..65584123bd41 100644 --- a/contrib/dlog/bin/dlogd/dlogd.c +++ b/contrib/dlog/bin/dlogd/dlogd.c @@ -96,6 +96,7 @@ const dlog_malloc_func dlog_alloc = malloc; const dlog_free_func dlog_free = free; /* GLobal singleton dlogd configuration */ +extern nvlist_t *dlogd_props; nvlist_t *dlogd_props; static int stop = 0; diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c index 2b410aa9fb57..a707386e6042 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c +++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c @@ -15189,7 +15189,7 @@ dtrace_state_go(dtrace_state_t *state, processorid_t *cpu) state->dts_options[DTRACEOPT_GRABANON] = opt[DTRACEOPT_GRABANON]; - *cpu = dtrace_anon.dta_beganon; + *cpu = dtrace_anon.dta_state->dts_beganon; /* * If the anonymous state is active (as it almost certainly * is if the anonymous enabling ultimately matched anything), @@ -17363,7 +17363,8 @@ dtrace_attach(dev_info_t *devi, ddi_attach_cmd_t cmd) /* * If we created any anonymous state, set it going now. */ - (void) dtrace_state_go(state, &dtrace_anon.dta_beganon); + (void) dtrace_state_go(state, + &dtrace_anon.dta_state->dts_beganon); } return (DDI_SUCCESS); @@ -18067,13 +18068,12 @@ dtrace_ioctl(dev_t dev, int cmd, intptr_t arg, int md, cred_t *cr, int *rv) } case DTRACEIOC_GO: { - processorid_t cpuid; - rval = dtrace_state_go(state, &cpuid); + rval = dtrace_state_go(state, &dtp->dts_beganon); if (rval != 0) return (rval); - if (copyout(&cpuid, (void *)arg, sizeof (cpuid)) != 0) + if (copyout(&dtp->dts_beganon, (void *)arg, sizeof(processorid_t)) != 0) return (EFAULT); return (0); diff --git a/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h b/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h index 89b8bb065c40..4117603311ba 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h +++ b/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h @@ -1177,6 +1177,7 @@ struct dtrace_state { size_t dts_nretained; /* number of retained enabs */ int dts_getf; /* number of getf() calls */ uint64_t dts_rstate[NCPU][2]; /* per-CPU random state */ + processorid_t dts_beganon; /* which CPU BEGIN ran on */ }; struct dtrace_dist { @@ -1244,7 +1245,6 @@ typedef struct dtrace_enabling { typedef struct dtrace_anon { dtrace_state_t *dta_state; /* DTrace consumer state */ dtrace_enabling_t *dta_enabling; /* pointer to enabling */ - processorid_t dta_beganon; /* which CPU BEGIN ran on */ } dtrace_anon_t; /* diff --git a/sys/cddl/dev/dtrace/dtrace_anon.c b/sys/cddl/dev/dtrace/dtrace_anon.c index b81ec5be3f11..34b02137f2ee 100644 --- a/sys/cddl/dev/dtrace/dtrace_anon.c +++ b/sys/cddl/dev/dtrace/dtrace_anon.c @@ -79,6 +79,7 @@ dtrace_anon_init(void *dummy) /* * If we created any anonymous state, set it going now. */ - (void) dtrace_state_go(state, &dtrace_anon.dta_beganon); + (void) dtrace_state_go(state, + &dtrace_anon.dta_state->dts_beganon); } } diff --git a/sys/modules/ddtrace/ddtrace.c b/sys/modules/ddtrace/ddtrace.c index 452fc860a614..db5e29fde57f 100644 --- a/sys/modules/ddtrace/ddtrace.c +++ b/sys/modules/ddtrace/ddtrace.c @@ -249,6 +249,7 @@ ddtrace_buffer_switch(dtrace_state_t *state, struct dlog_handle *handle) caddr_t cached; dtrace_bufdesc_t desc; dtrace_buffer_t *buf; + processorid_t cpu = state->dts_beganon; DL_ASSERT(state != NULL, ("DTrace state cannot be NULL\n")); DL_ASSERT(handle != NULL, ("DLog handle cannot be NULL\n")); @@ -260,11 +261,10 @@ ddtrace_buffer_switch(dtrace_state_t *state, struct dlog_handle *handle) * Persisting the buffer may involving splitting into portions portions * on a record boundary. */ - for (int cpu = 0; cpu < mp_ncpus; cpu++) { + for (int i = 0; i < mp_ncpus; i++) { - /* NOTE: - * Unlike in the BUFSNAP ioctl it is unnecessary to acquire - * dtrace_lock. + /* NOTE: Unlike in the BUFSNAP ioctl it is unnecessary to + * acquire dtrace_lock. */ buf = &state->dts_buffer[cpu]; @@ -307,6 +307,9 @@ ddtrace_buffer_switch(dtrace_state_t *state, struct dlog_handle *handle) */ if (desc.dtbd_size != 0) ddtrace_persist_trace(state, handle, &desc); + + /* Increment the CPU */ + cpu = (cpu + 1) % mp_ncpus; } } @@ -362,7 +365,7 @@ ddtrace_persist_trace(dtrace_state_t *state, struct dlog_handle *hdl, { dtrace_epid_t epid; size_t msg_start = 0, msg_size = 0, size = 0; - + DL_ASSERT(state != NULL, ("DTrace state cannot be NULL.")); DL_ASSERT(hdl != NULL, ("DLog handle cannot be NULL.")); DL_ASSERT(desc != NULL, @@ -371,7 +374,7 @@ ddtrace_persist_trace(dtrace_state_t *state, struct dlog_handle *hdl, ("ddtrace_persist_trace called with NULL buffer.")); DL_ASSERT(desc->dtbd_size != 0, ("ddtrace_persist_trace called with empty buffer.")); - + while (size < desc->dtbd_size) { epid = *(dtrace_epid_t *) ((uintptr_t) desc->dtbd_data + size); @@ -388,7 +391,6 @@ ddtrace_persist_trace(dtrace_state_t *state, struct dlog_handle *hdl, break; } - /* Check whether the record would take the msg_size * over the MTU configured for the distributed log. */ @@ -439,7 +441,7 @@ ddtrace_persist_trace(dtrace_state_t *state, struct dlog_handle *hdl, */ if (msg_size == desc->dtbd_size) { if (dlog_produce(hdl, - DDTRACE_KEY, strlen(DDTRACE_KEY), + DDTRACE_KEY, strlen(DDTRACE_KEY), &desc->dtbd_data[msg_start], msg_size) != 0) {