From 59e4be225c4bca5e0e76b7703594d5c03a24a825 Mon Sep 17 00:00:00 2001 From: Pawel Biernacki Date: Sun, 16 Feb 2020 17:11:54 +0000 Subject: [PATCH] Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (5 of many) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly marked). Use it in preparation for a general review of all nodes. This is non-functional change that adds annotations to SYSCTL_NODE and SYSCTL_PROC nodes using one of the soon-to-be-required flags. Reviewed by: imp, kib Approved by: kib (mentor) Differential Revision: https://reviews.freebsd.org/D23633 --- sys/dev/drm2/drm_pci.c | 3 ++- sys/dev/drm2/drm_sysctl.c | 18 ++++++------------ sys/dev/pci/pci.c | 3 ++- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/sys/dev/drm2/drm_pci.c b/sys/dev/drm2/drm_pci.c index f2c5bbd2dc5e..1fc21fecad67 100644 --- a/sys/dev/drm2/drm_pci.c +++ b/sys/dev/drm2/drm_pci.c @@ -42,7 +42,8 @@ __FBSDID("$FreeBSD$"); #include static int drm_msi = 1; /* Enable by default. */ -SYSCTL_NODE(_hw, OID_AUTO, drm, CTLFLAG_RW, NULL, "DRM device"); +SYSCTL_NODE(_hw, OID_AUTO, drm, CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, + "DRM device"); SYSCTL_INT(_hw_drm, OID_AUTO, msi, CTLFLAG_RDTUN, &drm_msi, 1, "Enable MSI interrupts for drm devices"); diff --git a/sys/dev/drm2/drm_sysctl.c b/sys/dev/drm2/drm_sysctl.c index 1afa399d17b1..6b1f2e7e6e3f 100644 --- a/sys/dev/drm2/drm_sysctl.c +++ b/sys/dev/drm2/drm_sysctl.c @@ -69,7 +69,7 @@ int drm_sysctl_init(struct drm_device *dev) /* Add the sysctl node for DRI if it doesn't already exist */ drioid = SYSCTL_ADD_NODE(&info->ctx, SYSCTL_CHILDREN(&sysctl___hw), OID_AUTO, - "dri", CTLFLAG_RW, NULL, "DRI Graphics"); + "dri", CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, "DRI Graphics"); if (!drioid) { free(dev->sysctl, DRM_MEM_DRIVER); dev->sysctl = NULL; @@ -92,23 +92,17 @@ int drm_sysctl_init(struct drm_device *dev) info->name[0] = '0' + i; info->name[1] = 0; top = SYSCTL_ADD_NODE(&info->ctx, SYSCTL_CHILDREN(drioid), - OID_AUTO, info->name, CTLFLAG_RW, NULL, NULL); + OID_AUTO, info->name, CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, NULL); if (!top) { drm_sysctl_cleanup(dev); return (-ENOMEM); } for (i = 0; i < DRM_SYSCTL_ENTRIES; i++) { - oid = SYSCTL_ADD_OID(&info->ctx, - SYSCTL_CHILDREN(top), - OID_AUTO, - drm_sysctl_list[i].name, - CTLTYPE_STRING | CTLFLAG_RD, - dev, - 0, - drm_sysctl_list[i].f, - "A", - NULL); + oid = SYSCTL_ADD_OID(&info->ctx, SYSCTL_CHILDREN(top), + OID_AUTO, drm_sysctl_list[i].name, + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, + dev, 0, drm_sysctl_list[i].f, "A", NULL); if (!oid) { drm_sysctl_cleanup(dev); return (-ENOMEM); diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 697d1e749ad5..896aa811e9ea 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -332,7 +332,8 @@ uint32_t pci_numdevs = 0; static int pcie_chipset, pcix_chipset; /* sysctl vars */ -SYSCTL_NODE(_hw, OID_AUTO, pci, CTLFLAG_RD, 0, "PCI bus tuning parameters"); +SYSCTL_NODE(_hw, OID_AUTO, pci, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, + "PCI bus tuning parameters"); static int pci_enable_io_modes = 1; SYSCTL_INT(_hw_pci, OID_AUTO, enable_io_modes, CTLFLAG_RWTUN,