svn commit: r230078 - stable/9/sys/x86/acpica

John Baldwin jhb at FreeBSD.org
Fri Jan 13 19:54:01 UTC 2012


Author: jhb
Date: Fri Jan 13 19:54:00 2012
New Revision: 230078
URL: http://svn.freebsd.org/changeset/base/230078

Log:
  MFC 229427:
  Fix a few bugs in the SRAT parsing code:
  - Actually increment ndomain when building our list of known domains
    so that we can properly renumber them to be 0-based and dense.
  - If the number of domains exceeds the configured maximum (VM_NDOMAIN),
    bail out of processing the SRAT and disable NUMA rather than hitting an
    obscure panic later.
  - Don't bother parsing the SRAT at all if VM_NDOMAIN is set to 1 to
    disable NUMA (the default).

Modified:
  stable/9/sys/x86/acpica/srat.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)

Modified: stable/9/sys/x86/acpica/srat.c
==============================================================================
--- stable/9/sys/x86/acpica/srat.c	Fri Jan 13 19:51:15 2012	(r230077)
+++ stable/9/sys/x86/acpica/srat.c	Fri Jan 13 19:54:00 2012	(r230078)
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
 
 #include <dev/acpica/acpivar.h>
 
+#if VM_NDOMAIN > 1
 struct cpu_info {
 	int enabled:1;
 	int has_memory:1;
@@ -237,9 +238,9 @@ check_phys_avail(void)
 
 /*
  * Renumber the memory domains to be compact and zero-based if not
- * already.
+ * already.  Returns an error if there are too many domains.
  */
-static void
+static int
 renumber_domains(void)
 {
 	int domains[VM_PHYSSEG_MAX];
@@ -261,6 +262,11 @@ renumber_domains(void)
 		for (j = ndomain; j > slot; j--)
 			domains[j] = domains[j - 1];
 		domains[slot] = mem_info[i].domain;
+		ndomain++;
+		if (ndomain > VM_NDOMAIN) {
+			printf("SRAT: Too many memory domains\n");
+			return (EFBIG);
+		}
 	}
 
 	/* Renumber each domain to its index in the sorted 'domains' list. */
@@ -280,6 +286,7 @@ renumber_domains(void)
 			if (cpus[j].enabled && cpus[j].domain == domains[i])
 				cpus[j].domain = i;
 	}
+	return (0);
 }
 
 /*
@@ -306,13 +313,12 @@ parse_srat(void *dummy)
 	srat_walk_table(srat_parse_entry, &error);
 	acpi_unmap_table(srat);
 	srat = NULL;
-	if (error || check_domains() != 0 || check_phys_avail() != 0) {
+	if (error || check_domains() != 0 || check_phys_avail() != 0 ||
+	    renumber_domains() != 0) {
 		srat_physaddr = 0;
 		return;
 	}
 
-	renumber_domains();
-
 	/* Point vm_phys at our memory affinity table. */
 	mem_affinity = mem_info;
 }
@@ -354,3 +360,4 @@ srat_set_cpus(void *dummy)
 	}
 }
 SYSINIT(srat_set_cpus, SI_SUB_CPU, SI_ORDER_ANY, srat_set_cpus, NULL);
+#endif /* VM_NDOMAIN > 1 */


More information about the svn-src-stable-9 mailing list