acpi/hmat: Register performance attributes
authorKeith Busch <keith.busch@intel.com>
Mon, 11 Mar 2019 20:56:04 +0000 (14:56 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Apr 2019 16:41:21 +0000 (18:41 +0200)
Save the best performance access attributes and register these with the
memory's node if HMAT provides the locality table. While HMAT does make
it possible to know performance for all possible initiator-target
pairings, we export only the local pairings at this time.

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Tested-by: Brice Goglin <Brice.Goglin@inria.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/acpi/hmat/Kconfig
drivers/acpi/hmat/hmat.c

index 13cddd612a529686f7d2c2b8471ee76101681d1f..95a29964dbeae7a17892d1aad09fcfe4a4ba81e9 100644 (file)
@@ -2,7 +2,10 @@
 config ACPI_HMAT
        bool "ACPI Heterogeneous Memory Attribute Table Support"
        depends on ACPI_NUMA
+       select HMEM_REPORTING
        help
         If set, this option has the kernel parse and report the
         platform's ACPI HMAT (Heterogeneous Memory Attributes Table),
-        and register memory initiators with their targets.
+        register memory initiators with their targets, and export
+        performance attributes through the node's sysfs device if
+        provided.
index 01a6eddac6f7ab23404f749a1fbce6480bb4b25d..7a3a2b50caddee68827f7b732235106de3f0ac8e 100644 (file)
@@ -545,12 +545,20 @@ static __init void hmat_register_target_initiators(struct memory_target *target)
        }
 }
 
+static __init void hmat_register_target_perf(struct memory_target *target)
+{
+       unsigned mem_nid = pxm_to_node(target->memory_pxm);
+       node_set_perf_attrs(mem_nid, &target->hmem_attrs, 0);
+}
+
 static __init void hmat_register_targets(void)
 {
        struct memory_target *target;
 
-       list_for_each_entry(target, &targets, node)
+       list_for_each_entry(target, &targets, node) {
                hmat_register_target_initiators(target);
+               hmat_register_target_perf(target);
+       }
 }
 
 static __init void hmat_free_structures(void)