svn commit: r357262 - head/sys/powerpc/powernv

Leandro Lupori luporl at FreeBSD.org
Wed Jan 29 18:13:45 UTC 2020


Author: luporl
Date: Wed Jan 29 18:13:44 2020
New Revision: 357262
URL: https://svnweb.freebsd.org/changeset/base/357262

Log:
  [PPC64] Fix NUMA on POWER8
  
  On some POWER8 machines, 'ibm,associativity' property may have 6
  cells, which would overflow the 5 cells buffer being used.
  There was also an issue with the "check if node is root" part,
  that have been fixed too.
  
  Reviewed by:	jhibbits
  Differential Revision:	https://reviews.freebsd.org/D23414

Modified:
  head/sys/powerpc/powernv/platform_powernv.c

Modified: head/sys/powerpc/powernv/platform_powernv.c
==============================================================================
--- head/sys/powerpc/powernv/platform_powernv.c	Wed Jan 29 17:39:38 2020	(r357261)
+++ head/sys/powerpc/powernv/platform_powernv.c	Wed Jan 29 18:13:44 2020	(r357262)
@@ -517,17 +517,20 @@ powernv_node_numa_domain(platform_t platform, phandle_
 	cell_t associativity[5];
 	int i, res;
 
-	res = OF_getproplen(node, "ibm,associativity");
+	res = OF_getencprop(node, "ibm,associativity",
+		associativity, sizeof(associativity));
 
-	/* If already at the root, use default domain. */
-	if (res == 0)
-		return (0);
-	else if (res < 0)
-		/* If this node doesn't have associativity, check its parent. */
-		return (powernv_node_numa_domain(platform, OF_parent(node)));
-
-	OF_getencprop(node, "ibm,associativity",
-		associativity, res);
+	/*
+	 * If this node doesn't have associativity, or if there are not
+	 * enough elements in it, check its parent.
+	 */
+	if (res < (int)(sizeof(cell_t) * (platform_associativity + 1))) {
+		node = OF_parent(node);
+		/* If already at the root, use default domain. */
+		if (node == 0)
+			return (0);
+		return (powernv_node_numa_domain(platform, node));
+	}
 
 	for (i = 0; i < numa_max_domain; i++) {
 		if (numa_domains[i] == associativity[platform_associativity])


More information about the svn-src-all mailing list