From: deraadt Date: Tue, 1 Feb 2022 20:29:53 +0000 (+0000) Subject: An old hack skips use of memory regions < 1MB size, because some machines X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=68cb1912a9ae989bbe214c5f74add71236fcdb4f;p=openbsd An old hack skips use of memory regions < 1MB size, because some machines put BIOS objects into there, and rely upon them. We are shocked, SHOCKED, to find a machine that does so in a large object (Supermicro 5019D-FTN4). So now we need to ignore memory regions < 32MB in size. If we put this memory into use, the zerothread will soon clear it, and on this particular case the machine resets because something in AML or SMI gets unhappy. Other machines with similar problems may exhibit other misbehaviours, so this could fix heisenbugs. Sadly I expect products to get worse. ok kettenis, miod --- diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index 08a20bf76ed..d7d36c5adab 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.276 2022/01/25 04:04:40 gnezdo Exp $ */ +/* $OpenBSD: machdep.c,v 1.277 2022/02/01 20:29:53 deraadt Exp $ */ /* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */ /*- @@ -1477,13 +1477,14 @@ init_x86_64(paddr_t first_avail) /* * XXX Some buggy ACPI BIOSes use memory that they - * declare as free. Typically the affected memory + * declare as free. Current worst offender is + * Supermicro 5019D-FTN4. Typically the affected memory * areas are small blocks between areas reserved for * ACPI and other BIOS goo. So skip areas smaller - * than 1 MB above the 16 MB boundary (to avoid + * than 32 MB above the 16 MB boundary (to avoid * affecting legacy stuff). */ - if (s1 > 16*1024*1024 && (e1 - s1) < 1*1024*1024) + if (s1 > 16*1024*1024 && (e1 - s1) < 32*1024*1024) continue; /* Check and adjust our segment(s) */ diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index cbc55378966..5ad53b83ddf 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.647 2022/01/25 04:04:40 gnezdo Exp $ */ +/* $OpenBSD: machdep.c,v 1.648 2022/02/01 20:29:55 deraadt Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -3348,14 +3348,15 @@ init386(paddr_t first_avail) /* * XXX Some buggy ACPI BIOSes use memory that - * they declare as free. Typically the + * they declare as free. Current worst offender + * is Supermicro 5019D-FTN4. Typically the * affected memory areas are small blocks * between areas reserved for ACPI and other - * BIOS goo. So skip areas smaller than 1 MB + * BIOS goo. So skip areas smaller than 32 MB * above the 16 MB boundary (to avoid * affecting legacy stuff). */ - if (a > 16*1024*1024 && (e - a) < 1*1024*1024) { + if (a > 16*1024*1024 && (e - a) < 32*1024*1024) { #ifdef DEBUG printf("-X"); #endif