Changeset View
Changeset View
Standalone View
Standalone View
head/sys/cam/cam_iosched.c
Show First 20 Lines • Show All 970 Lines • ▼ Show 20 Lines | |||||
static void | static void | ||||
cam_iosched_iop_stats_sysctl_init(struct cam_iosched_softc *isc, struct iop_stats *ios, char *name) | cam_iosched_iop_stats_sysctl_init(struct cam_iosched_softc *isc, struct iop_stats *ios, char *name) | ||||
{ | { | ||||
struct sysctl_oid_list *n; | struct sysctl_oid_list *n; | ||||
struct sysctl_ctx_list *ctx; | struct sysctl_ctx_list *ctx; | ||||
ios->sysctl_tree = SYSCTL_ADD_NODE(&isc->sysctl_ctx, | ios->sysctl_tree = SYSCTL_ADD_NODE(&isc->sysctl_ctx, | ||||
SYSCTL_CHILDREN(isc->sysctl_tree), OID_AUTO, name, | SYSCTL_CHILDREN(isc->sysctl_tree), OID_AUTO, name, | ||||
CTLFLAG_RD, 0, name); | CTLFLAG_RD | CTLFLAG_MPSAFE, 0, name); | ||||
n = SYSCTL_CHILDREN(ios->sysctl_tree); | n = SYSCTL_CHILDREN(ios->sysctl_tree); | ||||
ctx = &ios->sysctl_ctx; | ctx = &ios->sysctl_ctx; | ||||
SYSCTL_ADD_UQUAD(ctx, n, | SYSCTL_ADD_UQUAD(ctx, n, | ||||
OID_AUTO, "ema", CTLFLAG_RD, | OID_AUTO, "ema", CTLFLAG_RD, | ||||
&ios->ema, | &ios->ema, | ||||
"Fast Exponentially Weighted Moving Average"); | "Fast Exponentially Weighted Moving Average"); | ||||
SYSCTL_ADD_UQUAD(ctx, n, | SYSCTL_ADD_UQUAD(ctx, n, | ||||
Show All 22 Lines | SYSCTL_ADD_INT(ctx, n, | ||||
&ios->out, 0, | &ios->out, 0, | ||||
"# of transactions completed (including with error)"); | "# of transactions completed (including with error)"); | ||||
SYSCTL_ADD_INT(ctx, n, | SYSCTL_ADD_INT(ctx, n, | ||||
OID_AUTO, "errs", CTLFLAG_RD, | OID_AUTO, "errs", CTLFLAG_RD, | ||||
&ios->errs, 0, | &ios->errs, 0, | ||||
"# of transactions completed with an error"); | "# of transactions completed with an error"); | ||||
SYSCTL_ADD_PROC(ctx, n, | SYSCTL_ADD_PROC(ctx, n, | ||||
OID_AUTO, "limiter", CTLTYPE_STRING | CTLFLAG_RW, | OID_AUTO, "limiter", | ||||
CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_NEEDGIANT, | |||||
ios, 0, cam_iosched_limiter_sysctl, "A", | ios, 0, cam_iosched_limiter_sysctl, "A", | ||||
"Current limiting type."); | "Current limiting type."); | ||||
SYSCTL_ADD_INT(ctx, n, | SYSCTL_ADD_INT(ctx, n, | ||||
OID_AUTO, "min", CTLFLAG_RW, | OID_AUTO, "min", CTLFLAG_RW, | ||||
&ios->min, 0, | &ios->min, 0, | ||||
"min resource"); | "min resource"); | ||||
SYSCTL_ADD_INT(ctx, n, | SYSCTL_ADD_INT(ctx, n, | ||||
OID_AUTO, "max", CTLFLAG_RW, | OID_AUTO, "max", CTLFLAG_RW, | ||||
&ios->max, 0, | &ios->max, 0, | ||||
"max resource"); | "max resource"); | ||||
SYSCTL_ADD_INT(ctx, n, | SYSCTL_ADD_INT(ctx, n, | ||||
OID_AUTO, "current", CTLFLAG_RW, | OID_AUTO, "current", CTLFLAG_RW, | ||||
&ios->current, 0, | &ios->current, 0, | ||||
"current resource"); | "current resource"); | ||||
SYSCTL_ADD_PROC(ctx, n, | SYSCTL_ADD_PROC(ctx, n, | ||||
OID_AUTO, "latencies", CTLTYPE_STRING | CTLFLAG_RD, | OID_AUTO, "latencies", | ||||
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, | |||||
&ios->latencies, 0, | &ios->latencies, 0, | ||||
cam_iosched_sysctl_latencies, "A", | cam_iosched_sysctl_latencies, "A", | ||||
"Array of power of 2 latency from 1ms to 1.024s"); | "Array of power of 2 latency from 1ms to 1.024s"); | ||||
} | } | ||||
static void | static void | ||||
cam_iosched_iop_stats_fini(struct iop_stats *ios) | cam_iosched_iop_stats_fini(struct iop_stats *ios) | ||||
{ | { | ||||
if (ios->sysctl_tree) | if (ios->sysctl_tree) | ||||
if (sysctl_ctx_free(&ios->sysctl_ctx) != 0) | if (sysctl_ctx_free(&ios->sysctl_ctx) != 0) | ||||
printf("can't remove iosched sysctl stats context\n"); | printf("can't remove iosched sysctl stats context\n"); | ||||
} | } | ||||
static void | static void | ||||
cam_iosched_cl_sysctl_init(struct cam_iosched_softc *isc) | cam_iosched_cl_sysctl_init(struct cam_iosched_softc *isc) | ||||
{ | { | ||||
struct sysctl_oid_list *n; | struct sysctl_oid_list *n; | ||||
struct sysctl_ctx_list *ctx; | struct sysctl_ctx_list *ctx; | ||||
struct control_loop *clp; | struct control_loop *clp; | ||||
clp = &isc->cl; | clp = &isc->cl; | ||||
clp->sysctl_tree = SYSCTL_ADD_NODE(&isc->sysctl_ctx, | clp->sysctl_tree = SYSCTL_ADD_NODE(&isc->sysctl_ctx, | ||||
SYSCTL_CHILDREN(isc->sysctl_tree), OID_AUTO, "control", | SYSCTL_CHILDREN(isc->sysctl_tree), OID_AUTO, "control", | ||||
CTLFLAG_RD, 0, "Control loop info"); | CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "Control loop info"); | ||||
n = SYSCTL_CHILDREN(clp->sysctl_tree); | n = SYSCTL_CHILDREN(clp->sysctl_tree); | ||||
ctx = &clp->sysctl_ctx; | ctx = &clp->sysctl_ctx; | ||||
SYSCTL_ADD_PROC(ctx, n, | SYSCTL_ADD_PROC(ctx, n, | ||||
OID_AUTO, "type", CTLTYPE_STRING | CTLFLAG_RW, | OID_AUTO, "type", | ||||
CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_NEEDGIANT, | |||||
clp, 0, cam_iosched_control_type_sysctl, "A", | clp, 0, cam_iosched_control_type_sysctl, "A", | ||||
"Control loop algorithm"); | "Control loop algorithm"); | ||||
SYSCTL_ADD_PROC(ctx, n, | SYSCTL_ADD_PROC(ctx, n, | ||||
OID_AUTO, "steer_interval", CTLTYPE_STRING | CTLFLAG_RW, | OID_AUTO, "steer_interval", | ||||
CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_NEEDGIANT, | |||||
&clp->steer_interval, 0, cam_iosched_sbintime_sysctl, "A", | &clp->steer_interval, 0, cam_iosched_sbintime_sysctl, "A", | ||||
"How often to steer (in us)"); | "How often to steer (in us)"); | ||||
SYSCTL_ADD_PROC(ctx, n, | SYSCTL_ADD_PROC(ctx, n, | ||||
OID_AUTO, "lolat", CTLTYPE_STRING | CTLFLAG_RW, | OID_AUTO, "lolat", | ||||
CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_NEEDGIANT, | |||||
&clp->lolat, 0, cam_iosched_sbintime_sysctl, "A", | &clp->lolat, 0, cam_iosched_sbintime_sysctl, "A", | ||||
"Low water mark for Latency (in us)"); | "Low water mark for Latency (in us)"); | ||||
SYSCTL_ADD_PROC(ctx, n, | SYSCTL_ADD_PROC(ctx, n, | ||||
OID_AUTO, "hilat", CTLTYPE_STRING | CTLFLAG_RW, | OID_AUTO, "hilat", | ||||
CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_NEEDGIANT, | |||||
&clp->hilat, 0, cam_iosched_sbintime_sysctl, "A", | &clp->hilat, 0, cam_iosched_sbintime_sysctl, "A", | ||||
"Hi water mark for Latency (in us)"); | "Hi water mark for Latency (in us)"); | ||||
SYSCTL_ADD_INT(ctx, n, | SYSCTL_ADD_INT(ctx, n, | ||||
OID_AUTO, "alpha", CTLFLAG_RW, | OID_AUTO, "alpha", CTLFLAG_RW, | ||||
&clp->alpha, 0, | &clp->alpha, 0, | ||||
"Alpha for PLL (x100) aka gain"); | "Alpha for PLL (x100) aka gain"); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 96 Lines • ▼ Show 20 Lines | SYSCTL_ADD_INT(ctx, n, | ||||
"IO Schedul qaunta to hold back trims for when accumulating"); | "IO Schedul qaunta to hold back trims for when accumulating"); | ||||
#ifdef CAM_IOSCHED_DYNAMIC | #ifdef CAM_IOSCHED_DYNAMIC | ||||
if (!do_dynamic_iosched) | if (!do_dynamic_iosched) | ||||
return; | return; | ||||
isc->sysctl_tree = SYSCTL_ADD_NODE(&isc->sysctl_ctx, | isc->sysctl_tree = SYSCTL_ADD_NODE(&isc->sysctl_ctx, | ||||
SYSCTL_CHILDREN(node), OID_AUTO, "iosched", | SYSCTL_CHILDREN(node), OID_AUTO, "iosched", | ||||
CTLFLAG_RD, 0, "I/O scheduler statistics"); | CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "I/O scheduler statistics"); | ||||
n = SYSCTL_CHILDREN(isc->sysctl_tree); | n = SYSCTL_CHILDREN(isc->sysctl_tree); | ||||
ctx = &isc->sysctl_ctx; | ctx = &isc->sysctl_ctx; | ||||
cam_iosched_iop_stats_sysctl_init(isc, &isc->read_stats, "read"); | cam_iosched_iop_stats_sysctl_init(isc, &isc->read_stats, "read"); | ||||
cam_iosched_iop_stats_sysctl_init(isc, &isc->write_stats, "write"); | cam_iosched_iop_stats_sysctl_init(isc, &isc->write_stats, "write"); | ||||
cam_iosched_iop_stats_sysctl_init(isc, &isc->trim_stats, "trim"); | cam_iosched_iop_stats_sysctl_init(isc, &isc->trim_stats, "trim"); | ||||
cam_iosched_cl_sysctl_init(isc); | cam_iosched_cl_sysctl_init(isc); | ||||
SYSCTL_ADD_INT(ctx, n, | SYSCTL_ADD_INT(ctx, n, | ||||
OID_AUTO, "read_bias", CTLFLAG_RW, | OID_AUTO, "read_bias", CTLFLAG_RW, | ||||
&isc->read_bias, 100, | &isc->read_bias, 100, | ||||
"How biased towards read should we be independent of limits"); | "How biased towards read should we be independent of limits"); | ||||
SYSCTL_ADD_PROC(ctx, n, | SYSCTL_ADD_PROC(ctx, n, | ||||
OID_AUTO, "quanta", CTLTYPE_UINT | CTLFLAG_RW, | OID_AUTO, "quanta", CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, | ||||
&isc->quanta, 0, cam_iosched_quanta_sysctl, "I", | &isc->quanta, 0, cam_iosched_quanta_sysctl, "I", | ||||
"How many quanta per second do we slice the I/O up into"); | "How many quanta per second do we slice the I/O up into"); | ||||
SYSCTL_ADD_INT(ctx, n, | SYSCTL_ADD_INT(ctx, n, | ||||
OID_AUTO, "total_ticks", CTLFLAG_RD, | OID_AUTO, "total_ticks", CTLFLAG_RD, | ||||
&isc->total_ticks, 0, | &isc->total_ticks, 0, | ||||
"Total number of ticks we've done"); | "Total number of ticks we've done"); | ||||
▲ Show 20 Lines • Show All 752 Lines • Show Last 20 Lines |