summaryrefslogtreecommitdiffstats
path: root/sys/kern/bus_if.m
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2016-05-09 20:50:21 +0000
committerjhb <jhb@FreeBSD.org>2016-05-09 20:50:21 +0000
commit6bae79f8842b4f026c5eb55ae62aaa98dd23758d (patch)
treeaf412c855aeec6fd0582f885ff22d5e9bcb786e0 /sys/kern/bus_if.m
parentd9dcbf122a91dc40fc5a03b50adf8fb347ddccfe (diff)
downloadFreeBSD-src-6bae79f8842b4f026c5eb55ae62aaa98dd23758d.zip
FreeBSD-src-6bae79f8842b4f026c5eb55ae62aaa98dd23758d.tar.gz
Add a new bus method to fetch device-specific CPU sets.
bus_get_cpus() returns a specified set of CPUs for a device. It accepts an enum for the second parameter that indicates the type of cpuset to request. Currently two valus are supported: - LOCAL_CPUS (on x86 this returns all the CPUs in the package closest to the device when DEVICE_NUMA is enabled) - INTR_CPUS (like LOCAL_CPUS but only returns 1 SMT thread for each core) For systems that do not support NUMA (or if it is not enabled in the kernel config), LOCAL_CPUS fails with EINVAL. INTR_CPUS is mapped to 'all_cpus' by default. The idea is that INTR_CPUS should always return a valid set. Device drivers which want to use per-CPU interrupts should start using INTR_CPUS instead of simply assigning interrupts to all available CPUs. In the future we may wish to add tunables to control the policy of INTR_CPUS (e.g. should it be local-only or global, should it ignore SMT threads or not). The x86 nexus driver exposes the internal set of interrupt CPUs from the the x86 interrupt code via INTR_CPUS. The ACPI bus driver and PCI bridge drivers use _PXM to return a suitable LOCAL_CPUS set when _PXM exists and DEVICE_NUMA is enabled. They also and the global INTR_CPUS set from the nexus driver with the per-domain set from _PXM to generate a local INTR_CPUS set for child devices. Compared to the r298933, this version uses 'struct _cpuset' in <sys/bus.h> instead of 'cpuset_t' to avoid requiring <sys/param.h> (<sys/_cpuset.h> still requires <sys/param.h> for MAXCPU even though <sys/_bitset.h> does not after recent changes).
Diffstat (limited to 'sys/kern/bus_if.m')
-rw-r--r--sys/kern/bus_if.m18
1 files changed, 18 insertions, 0 deletions
diff --git a/sys/kern/bus_if.m b/sys/kern/bus_if.m
index 56673a4..f0115e8 100644
--- a/sys/kern/bus_if.m
+++ b/sys/kern/bus_if.m
@@ -731,3 +731,21 @@ METHOD int get_domain {
device_t _child;
int *_domain;
} DEFAULT bus_generic_get_domain;
+
+/**
+ * @brief Request a set of CPUs
+ *
+ * @param _dev the bus device
+ * @param _child the child device
+ * @param _op type of CPUs to request
+ * @param _setsize the size of the set passed in _cpuset
+ * @param _cpuset a pointer to a cpuset to receive the requested
+ * set of CPUs
+ */
+METHOD int get_cpus {
+ device_t _dev;
+ device_t _child;
+ enum cpu_sets _op;
+ size_t _setsize;
+ cpuset_t *_cpuset;
+} DEFAULT bus_generic_get_cpus;
OpenPOWER on IntegriCloud