From: "Jan Beulich" Subject: [PATCH] x86/numa: fix c/s 20120 (Fix SRAT check for discontig memory) Date: Fri, 28 Aug 2009 11:27:25 +0100 Message-ID: <4A97CD2D0200007800012161@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: alex.williamson@hp.com List-Id: xen-devel@lists.xenproject.org That change converted the (wrong) assumption of contiguous nodes' memory to a similarly wrong one of assuming discontiguous memory (i.e. each node having separate E820 table entries). The code ought to be able to deal with both, though, and I hope this change makes it so. Signed-off-by: Jan Beulich --- 2009-08-24.orig/xen/arch/x86/srat.c 2009-08-28 00:00:00.000000000 = +0200 +++ 2009-08-24/xen/arch/x86/srat.c 2009-08-28 12:12:40.000000000 = +0200 @@ -249,15 +249,23 @@ static int nodes_cover_memory(void) start =3D e820.map[i].addr; end =3D e820.map[i].addr + e820.map[i].size - 1; =20 - found =3D 0; - for_each_node_mask(j, nodes_parsed) { - if (start >=3D nodes[j].start && end <=3D = nodes[j].end) { - found =3D 1; - break; - } - } + do { + found =3D 0; + for_each_node_mask(j, nodes_parsed) + if (start < nodes[j].end + && end > nodes[j].start) { + if (start >=3D nodes[j].start) { + start =3D nodes[j].end; + found =3D 1; + } + if (end <=3D nodes[j].end) { + end =3D nodes[j].start; + found =3D 1; + } + } + } while (found && start < end); =20 - if (!found) { + if (start < end) { printk(KERN_ERR "SRAT: No PXM for e820 range: " "%016Lx - %016Lx\n", start, end); return 0;