mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-01-13 04:41:17 +00:00
libnvdimm: Add sysfs numa_node to NVDIMM devices
Add support of sysfs 'numa_node' to I/O-related NVDIMM devices under /sys/bus/nd/devices, regionN, namespaceN.0, and bttN.x. An example of numa_node values on a 2-socket system with a single NVDIMM range on each socket is shown below. /sys/bus/nd/devices |-- btt0.0/numa_node:0 |-- btt1.0/numa_node:1 |-- btt1.1/numa_node:1 |-- namespace0.0/numa_node:0 |-- namespace1.0/numa_node:1 |-- region0/numa_node:0 |-- region1/numa_node:1 These numa_node files are then linked under the block class of their device names. /sys/class/block/pmem0/device/numa_node:0 /sys/class/block/pmem1s/device/numa_node:1 This enables numactl(8) to accept 'block:' and 'file:' paths of pmem and btt devices as shown in the examples below. numactl --preferred block:pmem0 --show numactl --preferred file:/dev/pmem1s --show Signed-off-by: Toshi Kani <toshi.kani@hp.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
parent
41d7a6d637
commit
74ae66c3b1
@ -873,6 +873,7 @@ static const struct attribute_group *acpi_nfit_region_attribute_groups[] = {
|
|||||||
&nd_region_attribute_group,
|
&nd_region_attribute_group,
|
||||||
&nd_mapping_attribute_group,
|
&nd_mapping_attribute_group,
|
||||||
&nd_device_attribute_group,
|
&nd_device_attribute_group,
|
||||||
|
&nd_numa_attribute_group,
|
||||||
&acpi_nfit_region_attribute_group,
|
&acpi_nfit_region_attribute_group,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
@ -293,6 +293,7 @@ static struct attribute_group nd_btt_attribute_group = {
|
|||||||
static const struct attribute_group *nd_btt_attribute_groups[] = {
|
static const struct attribute_group *nd_btt_attribute_groups[] = {
|
||||||
&nd_btt_attribute_group,
|
&nd_btt_attribute_group,
|
||||||
&nd_device_attribute_group,
|
&nd_device_attribute_group,
|
||||||
|
&nd_numa_attribute_group,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -280,6 +280,36 @@ struct attribute_group nd_device_attribute_group = {
|
|||||||
};
|
};
|
||||||
EXPORT_SYMBOL_GPL(nd_device_attribute_group);
|
EXPORT_SYMBOL_GPL(nd_device_attribute_group);
|
||||||
|
|
||||||
|
static ssize_t numa_node_show(struct device *dev,
|
||||||
|
struct device_attribute *attr, char *buf)
|
||||||
|
{
|
||||||
|
return sprintf(buf, "%d\n", dev_to_node(dev));
|
||||||
|
}
|
||||||
|
static DEVICE_ATTR_RO(numa_node);
|
||||||
|
|
||||||
|
static struct attribute *nd_numa_attributes[] = {
|
||||||
|
&dev_attr_numa_node.attr,
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
static umode_t nd_numa_attr_visible(struct kobject *kobj, struct attribute *a,
|
||||||
|
int n)
|
||||||
|
{
|
||||||
|
if (!IS_ENABLED(CONFIG_NUMA))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return a->mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* nd_numa_attribute_group - NUMA attributes for all devices on an nd bus
|
||||||
|
*/
|
||||||
|
struct attribute_group nd_numa_attribute_group = {
|
||||||
|
.attrs = nd_numa_attributes,
|
||||||
|
.is_visible = nd_numa_attr_visible,
|
||||||
|
};
|
||||||
|
EXPORT_SYMBOL_GPL(nd_numa_attribute_group);
|
||||||
|
|
||||||
int nvdimm_bus_create_ndctl(struct nvdimm_bus *nvdimm_bus)
|
int nvdimm_bus_create_ndctl(struct nvdimm_bus *nvdimm_bus)
|
||||||
{
|
{
|
||||||
dev_t devt = MKDEV(nvdimm_bus_major, nvdimm_bus->id);
|
dev_t devt = MKDEV(nvdimm_bus_major, nvdimm_bus->id);
|
||||||
|
@ -1228,6 +1228,7 @@ static struct attribute_group nd_namespace_attribute_group = {
|
|||||||
static const struct attribute_group *nd_namespace_attribute_groups[] = {
|
static const struct attribute_group *nd_namespace_attribute_groups[] = {
|
||||||
&nd_device_attribute_group,
|
&nd_device_attribute_group,
|
||||||
&nd_namespace_attribute_group,
|
&nd_namespace_attribute_group,
|
||||||
|
&nd_numa_attribute_group,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ enum {
|
|||||||
extern struct attribute_group nvdimm_bus_attribute_group;
|
extern struct attribute_group nvdimm_bus_attribute_group;
|
||||||
extern struct attribute_group nvdimm_attribute_group;
|
extern struct attribute_group nvdimm_attribute_group;
|
||||||
extern struct attribute_group nd_device_attribute_group;
|
extern struct attribute_group nd_device_attribute_group;
|
||||||
|
extern struct attribute_group nd_numa_attribute_group;
|
||||||
extern struct attribute_group nd_region_attribute_group;
|
extern struct attribute_group nd_region_attribute_group;
|
||||||
extern struct attribute_group nd_mapping_attribute_group;
|
extern struct attribute_group nd_mapping_attribute_group;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user