Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/ddtrace' into cadets
Browse files Browse the repository at this point in the history
  • Loading branch information
amstrnad committed Mar 26, 2019
2 parents 194520f + 03f83bf commit 2484ffe
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion contrib/dlog/bin/dlogd/dl_request_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct dl_request_q_stats {
int dlrq_capacity;
int dlrq_requests;
int dlrq_unackd;
} dlrq_stats;
};

struct dl_request_q;

Expand Down
1 change: 1 addition & 0 deletions contrib/dlog/bin/dlogd/dlogd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;

/*
Expand Down
3 changes: 2 additions & 1 deletion sys/cddl/dev/dtrace/dtrace_anon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
18 changes: 10 additions & 8 deletions sys/modules/ddtrace/ddtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand All @@ -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];
Expand Down Expand Up @@ -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;
}
}

Expand Down Expand Up @@ -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,
Expand All @@ -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);
Expand All @@ -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.
*/
Expand Down Expand Up @@ -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) {

Expand Down

0 comments on commit 2484ffe

Please sign in to comment.