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

John Baldwin jhb at FreeBSD.org
Wed Jan 4 16:26:46 UTC 2012


Author: jhb
Date: Wed Jan  4 16:26:45 2012
New Revision: 229499
URL: http://svn.freebsd.org/changeset/base/229499

Log:
  MFC 226039:
  Ignore SRAT memory entries if the memory range does not overlap with an
  existing phys_avail[] entry.  If a hw.physmem setting causes a memory
  domain to not be present in phys_avail[], the SRAT table will now be
  ignored rather than triggering a panic when a CPU in the missing domain
  tries to allocate a page.

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	Wed Jan  4 16:24:33 2012	(r229498)
+++ stable/9/sys/x86/acpica/srat.c	Wed Jan  4 16:26:45 2012	(r229499)
@@ -59,6 +59,26 @@ static vm_paddr_t srat_physaddr;
 
 static void	srat_walk_table(acpi_subtable_handler *handler, void *arg);
 
+/*
+ * Returns true if a memory range overlaps with at least one range in
+ * phys_avail[].
+ */
+static int
+overlaps_phys_avail(vm_paddr_t start, vm_paddr_t end)
+{
+	int i;
+
+	for (i = 0; phys_avail[i] != 0 && phys_avail[i + 1] != 0; i += 2) {
+		if (phys_avail[i + 1] < start)
+			continue;
+		if (phys_avail[i] < end)
+			return (1);
+		break;
+	}
+	return (0);
+	
+}
+
 static void
 srat_parse_entry(ACPI_SUBTABLE_HEADER *entry, void *arg)
 {
@@ -111,6 +131,12 @@ srat_parse_entry(ACPI_SUBTABLE_HEADER *e
 			    "enabled" : "disabled");
 		if (!(mem->Flags & ACPI_SRAT_MEM_ENABLED))
 			break;
+		if (!overlaps_phys_avail(mem->BaseAddress,
+		    mem->BaseAddress + mem->Length)) {
+			printf("SRAT: Ignoring memory at addr %jx\n",
+			    (uintmax_t)mem->BaseAddress);
+			break;
+		}
 		if (num_mem == VM_PHYSSEG_MAX) {
 			printf("SRAT: Too many memory regions\n");
 			*(int *)arg = ENXIO;


More information about the svn-src-stable mailing list