Subject: port-i386/17199: NetBSD-1.6_BETA unable to boot on old HP Vectra PC
To: None <gnats-bugs@gnats.netbsd.org>
From: None <urban@boquist.net>
List: netbsd-bugs
Date: 06/09/2002 12:53:37
>Number:         17199
>Category:       port-i386
>Synopsis:       cannot boot: immediate panic in uvm_page_physload()
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jun 09 03:54:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Urban Boquist
>Release:        NetBSD-1.6_BETA (200205300000 snapshot from releng.netbsd.org)
>Organization:
Carlstedt Research & Technology AB, Sweden
>Environment:
System:
Architecture: i386
Machine: i386
>Description:
I tried to boot NetBSD-1.6_BETA on an old "HP Vectra VL Series 4
5/133" (Pentium-133).

With DEBUG_MEMLOAD the kernel startup goes:

BIOS MEMORY MAP (8 ENTRIES):
.
.
addr 0x1000000 size 0x3000000 type 0x1
.
.
loading 0x1000000-0x3000000 (0x1000-0x1000)
panic: uvm_page_physload: start >= end

The problem is in arch/i386/i386/machdep.c, in function init386(). The
code checks if a segment spans the magic 16M limit, and if it does
splits the segment and makes two calls to uvm_page_physload(). The
problem is that the code does not work as intended for the case where
a segment starts at exactly 16M. If that happens the code will result
in a call to uvm_page_physload() with zero size, which panics.

With the patch below, the system boots and runs without problems.

>How-To-Repeat:

Boot NetBSD-1.6* on HP Vectra VL 5/133.

>Fix:
Index: machdep.c
===================================================================
RCS file: /anoncvs/syssrc/sys/arch/i386/i386/machdep.c,v
retrieving revision 1.472
diff -u -r1.472 machdep.c
--- machdep.c	2002/05/31 17:46:51	1.472
+++ machdep.c	2002/06/09 10:40:28
@@ -2919,6 +2919,7 @@
 					tmp = (16 * 1024 * 1024);
 				else
 					tmp = seg_end;
+				if (seg_start != tmp) {
 #ifdef DEBUG_MEMLOAD
 				printf("loading 0x%qx-0x%qx (0x%lx-0x%lx)\n",
 				    seg_start, tmp,
@@ -2927,6 +2928,7 @@
 				uvm_page_physload(atop(seg_start),
 				    atop(tmp), atop(seg_start),
 				    atop(tmp), first16q);
+				}
 				seg_start = tmp;
 			}
 
@@ -2952,6 +2954,7 @@
 					tmp = (16 * 1024 * 1024);
 				else
 					tmp = seg_end1;
+				if (seg_start1 != tmp) {
 #ifdef DEBUG_MEMLOAD
 				printf("loading 0x%qx-0x%qx (0x%lx-0x%lx)\n",
 				    seg_start1, tmp,
@@ -2960,6 +2963,7 @@
 				uvm_page_physload(atop(seg_start1),
 				    atop(tmp), atop(seg_start1),
 				    atop(tmp), first16q);
+				}
 				seg_start1 = tmp;
 			}
 
# EOF
>Release-Note:
>Audit-Trail:
>Unformatted: