]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
libnvdimm: Set numa_node to NVDIMM devices
authorToshi Kani <toshi.kani@hp.com>
Fri, 19 Jun 2015 18:18:33 +0000 (12:18 -0600)
committerDan Williams <dan.j.williams@intel.com>
Fri, 26 Jun 2015 15:23:38 +0000 (11:23 -0400)
ACPI NFIT table has System Physical Address Range Structure entries that
describe a proximity ID of each range when ACPI_NFIT_PROXIMITY_VALID is
set in the flags.

Change acpi_nfit_register_region() to map a proximity ID to its node ID,
and set it to a new numa_node field of nd_region_desc, which is then
conveyed to the nd_region device.

The device core arranges for btt and namespace devices to inherit their
node from their parent region.

Signed-off-by: Toshi Kani <toshi.kani@hp.com>
[djbw: move set_dev_node() from region.c to bus.c]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
arch/x86/kernel/pmem.c
drivers/acpi/nfit.c
drivers/nvdimm/bus.c
drivers/nvdimm/nd.h
drivers/nvdimm/region_devs.c
include/linux/libnvdimm.h

index 0f4ef472ab9e5abc9723d7856125e23111137a34..64f90f53bb854fe1cb48b6fe854df27f3241267c 100644 (file)
@@ -67,6 +67,7 @@ static __init int register_e820_pmem(void)
                memset(&ndr_desc, 0, sizeof(ndr_desc));
                ndr_desc.res = &res;
                ndr_desc.attr_groups = e820_pmem_region_attribute_groups;
+               ndr_desc.numa_node = NUMA_NO_NODE;
                if (!nvdimm_pmem_region_create(nvdimm_bus, &ndr_desc))
                        goto err;
        }
index 1f6f1b1a54f42d1f436a8960c528b9bb50ccf56a..d96c8fe974ddafd108e39fb5b3c78969ff8012d1 100644 (file)
@@ -1392,6 +1392,12 @@ static int acpi_nfit_register_region(struct acpi_nfit_desc *acpi_desc,
        ndr_desc->res = &res;
        ndr_desc->provider_data = nfit_spa;
        ndr_desc->attr_groups = acpi_nfit_region_attribute_groups;
+       if (spa->flags & ACPI_NFIT_PROXIMITY_VALID)
+               ndr_desc->numa_node = acpi_map_pxm_to_online_node(
+                                               spa->proximity_domain);
+       else
+               ndr_desc->numa_node = NUMA_NO_NODE;
+
        list_for_each_entry(nfit_memdev, &acpi_desc->memdevs, list) {
                struct acpi_nfit_memory_map *memdev = nfit_memdev->memdev;
                struct nd_mapping *nd_mapping;
index ec59f1f26d9580a2cd57752c3238770c51e0c809..2053446438526b5d404475002905e3a8599c315e 100644 (file)
@@ -48,6 +48,12 @@ static int to_nd_device_type(struct device *dev)
 
 static int nvdimm_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
 {
+       /*
+        * Ensure that region devices always have their numa node set as
+        * early as possible.
+        */
+       if (is_nd_pmem(dev) || is_nd_blk(dev))
+               set_dev_node(dev, to_nd_region(dev)->numa_node);
        return add_uevent_var(env, "MODALIAS=" ND_DEVICE_MODALIAS_FMT,
                        to_nd_device_type(dev));
 }
index 48b09a210689081b72a82c550fa10e0bc1cb1448..c41f53e74277cb23252be136e7b94a859b6571f6 100644 (file)
@@ -97,7 +97,7 @@ struct nd_region {
        u16 ndr_mappings;
        u64 ndr_size;
        u64 ndr_start;
-       int id, num_lanes, ro;
+       int id, num_lanes, ro, numa_node;
        void *provider_data;
        struct nd_interleave_set *nd_set;
        struct nd_percpu_lane __percpu *lane;
index 482ee3e4e04a34b2945134faeb473e9a87c51a65..a5233422f9dc5f770b98d0555560fb87a5f83ff0 100644 (file)
@@ -736,6 +736,7 @@ static struct nd_region *nd_region_create(struct nvdimm_bus *nvdimm_bus,
        nd_region->nd_set = ndr_desc->nd_set;
        nd_region->num_lanes = ndr_desc->num_lanes;
        nd_region->ro = ro;
+       nd_region->numa_node = ndr_desc->numa_node;
        ida_init(&nd_region->ns_ida);
        ida_init(&nd_region->btt_ida);
        dev = &nd_region->dev;
index dc799a29ed1a2c1c951e29d91c27c1ea51013491..30b3deaafd51534477a103fc04c5572f0ce7073f 100644 (file)
@@ -89,6 +89,7 @@ struct nd_region_desc {
        struct nd_interleave_set *nd_set;
        void *provider_data;
        int num_lanes;
+       int numa_node;
 };
 
 struct nvdimm_bus;