Home Home > GIT Browse > SLE12-SP4-AZURE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-02-20 12:39:52 +0100
committerTakashi Iwai <tiwai@suse.de>2019-02-20 12:39:55 +0100
commit3b4a4c9e91a779c8618b25aab70866c6e9f8c531 (patch)
tree0ca8ca3786678af72ae691036de4bcb2ea180dfe
parenta3c1af647758be617fdc5276ee53ab31f8e69b27 (diff)
of, numa: Validate some distance map rules (bsc#1051510).
-rw-r--r--patches.drivers/of-numa-Validate-some-distance-map-rules.patch84
-rw-r--r--series.conf1
2 files changed, 85 insertions, 0 deletions
diff --git a/patches.drivers/of-numa-Validate-some-distance-map-rules.patch b/patches.drivers/of-numa-Validate-some-distance-map-rules.patch
new file mode 100644
index 0000000000..1766f57b42
--- /dev/null
+++ b/patches.drivers/of-numa-Validate-some-distance-map-rules.patch
@@ -0,0 +1,84 @@
+From 89c38422e072bb453e3045b8f1b962a344c3edea Mon Sep 17 00:00:00 2001
+From: John Garry <john.garry@huawei.com>
+Date: Thu, 8 Nov 2018 18:17:03 +0800
+Subject: [PATCH] of, numa: Validate some distance map rules
+Git-commit: 89c38422e072bb453e3045b8f1b962a344c3edea
+Patch-mainline: v4.20-rc2
+References: bsc#1051510
+
+Currently the NUMA distance map parsing does not validate the distance
+table for the distance-matrix rules 1-2 in [1].
+
+However the arch NUMA code may enforce some of these rules, but not all.
+Such is the case for the arm64 port, which does not enforce the rule that
+the distance between separates nodes cannot equal LOCAL_DISTANCE.
+
+The patch adds the following rules validation:
+- distance of node to self equals LOCAL_DISTANCE
+- distance of separate nodes > LOCAL_DISTANCE
+
+This change avoids a yet-unresolved crash reported in [2].
+
+A note on dealing with symmetrical distances between nodes:
+
+Validating symmetrical distances between nodes is difficult. If it were
+mandated in the bindings that every distance must be recorded in the
+table, then it would be easy. However, it isn't.
+
+In addition to this, it is also possible to record [b, a] distance only
+(and not [a, b]). So, when processing the table for [b, a], we cannot
+assert that current distance of [a, b] != [b, a] as invalid, as [a, b]
+distance may not be present in the table and current distance would be
+default at REMOTE_DISTANCE.
+
+As such, we maintain the policy that we overwrite distance [a, b] = [b, a]
+for b > a. This policy is different to kernel ACPI SLIT validation, which
+allows non-symmetrical distances (ACPI spec SLIT rules allow it). However,
+the distance debug message is dropped as it may be misleading (for a distance
+which is later overwritten).
+
+Some final notes on semantics:
+
+- It is implied that it is the responsibility of the arch NUMA code to
+ reset the NUMA distance map for an error in distance map parsing.
+
+- It is the responsibility of the FW NUMA topology parsing (whether OF or
+ ACPI) to enforce NUMA distance rules, and not arch NUMA code.
+
+[1] Documents/devicetree/bindings/numa.txt
+[2] https://www.spinics.net/lists/arm-kernel/msg683304.html
+
+Cc: stable@vger.kernel.org # 4.7
+Signed-off-by: John Garry <john.garry@huawei.com>
+Acked-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Rob Herring <robh@kernel.org>
+Acked-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ drivers/of/of_numa.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/of/of_numa.c b/drivers/of/of_numa.c
+index 35c64a4295e0..fe6b13608e51 100644
+--- a/drivers/of/of_numa.c
++++ b/drivers/of/of_numa.c
+@@ -104,9 +104,14 @@ static int __init of_numa_parse_distance_map_v1(struct device_node *map)
+ distance = of_read_number(matrix, 1);
+ matrix++;
+
++ if ((nodea == nodeb && distance != LOCAL_DISTANCE) ||
++ (nodea != nodeb && distance <= LOCAL_DISTANCE)) {
++ pr_err("Invalid distance[node%d -> node%d] = %d\n",
++ nodea, nodeb, distance);
++ return -EINVAL;
++ }
++
+ numa_set_distance(nodea, nodeb, distance);
+- pr_debug("distance[node%d -> node%d] = %d\n",
+- nodea, nodeb, distance);
+
+ /* Set default distance of node B->A same as A->B */
+ if (nodeb > nodea)
+--
+2.16.4
+
diff --git a/series.conf b/series.conf
index 71e3f71ff6..df413cd4f3 100644
--- a/series.conf
+++ b/series.conf
@@ -19476,6 +19476,7 @@
patches.suse/0001-block-make-sure-discard-bio-is-aligned-with-logical-.patch
patches.suse/0001-block-cleanup-__blkdev_issue_discard.patch
patches.suse/0001-block-make-sure-writesame-bio-is-aligned-with-logica.patch
+ patches.drivers/of-numa-Validate-some-distance-map-rules.patch
patches.fixes/lib-raid6-Fix-arm64-test-build.patch
patches.fixes/0001-xen-fix-xen_qlock_wait.patch
patches.drivers/clk-fixed-factor-fix-of_node_get-put-imbalance.patch