From owner-svn-src-head@freebsd.org Wed Jan 29 18:13:45 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 061D81F85D2; Wed, 29 Jan 2020 18:13:45 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 487BSS6PcRz3Pt6; Wed, 29 Jan 2020 18:13:44 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D6B7D182BD; Wed, 29 Jan 2020 18:13:44 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00TIDi9c077390; Wed, 29 Jan 2020 18:13:44 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00TIDigl077389; Wed, 29 Jan 2020 18:13:44 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <202001291813.00TIDigl077389@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Wed, 29 Jan 2020 18:13:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r357262 - head/sys/powerpc/powernv X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: head/sys/powerpc/powernv X-SVN-Commit-Revision: 357262 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jan 2020 18:13:45 -0000 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])