bus: mark sysctls MPSAFE
Mark the sysctls MPSAFE and pickup the bus topo lock while processing them. Sponsored by: Netflix Reviewed by: mav, jhb Differential Revision: https://reviews.freebsd.org/D31832
This commit is contained in:
parent
c6df6f5322
commit
815a0973b2
@ -267,6 +267,7 @@ device_sysctl_handler(SYSCTL_HANDLER_ARGS)
|
||||
|
||||
sbuf_new_for_sysctl(&sb, NULL, 1024, req);
|
||||
sbuf_clear_flags(&sb, SBUF_INCLUDENUL);
|
||||
bus_topo_lock();
|
||||
switch (arg2) {
|
||||
case DEVICE_SYSCTL_DESC:
|
||||
sbuf_cat(&sb, dev->desc ? dev->desc : "");
|
||||
@ -284,10 +285,12 @@ device_sysctl_handler(SYSCTL_HANDLER_ARGS)
|
||||
sbuf_cat(&sb, dev->parent ? dev->parent->nameunit : "");
|
||||
break;
|
||||
default:
|
||||
sbuf_delete(&sb);
|
||||
return (EINVAL);
|
||||
error = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
error = sbuf_finish(&sb);
|
||||
out:
|
||||
bus_topo_unlock();
|
||||
sbuf_delete(&sb);
|
||||
return (error);
|
||||
}
|
||||
@ -307,33 +310,33 @@ device_sysctl_init(device_t dev)
|
||||
dev->nameunit + strlen(dc->name),
|
||||
CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "", "device_index");
|
||||
SYSCTL_ADD_PROC(&dev->sysctl_ctx, SYSCTL_CHILDREN(dev->sysctl_tree),
|
||||
OID_AUTO, "%desc", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT,
|
||||
OID_AUTO, "%desc", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE,
|
||||
dev, DEVICE_SYSCTL_DESC, device_sysctl_handler, "A",
|
||||
"device description");
|
||||
SYSCTL_ADD_PROC(&dev->sysctl_ctx, SYSCTL_CHILDREN(dev->sysctl_tree),
|
||||
OID_AUTO, "%driver",
|
||||
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT,
|
||||
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE,
|
||||
dev, DEVICE_SYSCTL_DRIVER, device_sysctl_handler, "A",
|
||||
"device driver name");
|
||||
SYSCTL_ADD_PROC(&dev->sysctl_ctx, SYSCTL_CHILDREN(dev->sysctl_tree),
|
||||
OID_AUTO, "%location",
|
||||
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT,
|
||||
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE,
|
||||
dev, DEVICE_SYSCTL_LOCATION, device_sysctl_handler, "A",
|
||||
"device location relative to parent");
|
||||
SYSCTL_ADD_PROC(&dev->sysctl_ctx, SYSCTL_CHILDREN(dev->sysctl_tree),
|
||||
OID_AUTO, "%pnpinfo",
|
||||
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT,
|
||||
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE,
|
||||
dev, DEVICE_SYSCTL_PNPINFO, device_sysctl_handler, "A",
|
||||
"device identification");
|
||||
SYSCTL_ADD_PROC(&dev->sysctl_ctx, SYSCTL_CHILDREN(dev->sysctl_tree),
|
||||
OID_AUTO, "%parent",
|
||||
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT,
|
||||
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE,
|
||||
dev, DEVICE_SYSCTL_PARENT, device_sysctl_handler, "A",
|
||||
"parent device");
|
||||
if (bus_get_domain(dev, &domain) == 0)
|
||||
SYSCTL_ADD_INT(&dev->sysctl_ctx,
|
||||
SYSCTL_CHILDREN(dev->sysctl_tree), OID_AUTO, "%domain",
|
||||
CTLFLAG_RD, NULL, domain, "NUMA domain");
|
||||
CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, domain, "NUMA domain");
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user