Module Name: src
Committed By: maxv
Date: Fri Feb 10 10:39:36 UTC 2017
Modified Files:
src/sys/arch/x86/x86: x86_machdep.c
Log Message:
If the segment list is full, print a warning on the console and launch the
system with the available segments.
High memory systems may have more than VM_PHYSSEG_MAX segments; it is
better to truncate the memory and allow the system to work rather than
just panicking. The user can still increase VM_PHYSSEG_MAX (or ask us to).
Fixes issues such as PR/47093.
Note: the warning is logged but does not appear in dmesg, this too needs
to be fixed for the rest of the bootstrap procedure.
To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/arch/x86/x86/x86_machdep.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/x86/x86/x86_machdep.c
diff -u src/sys/arch/x86/x86/x86_machdep.c:1.86 src/sys/arch/x86/x86/x86_machdep.c:1.87
--- src/sys/arch/x86/x86/x86_machdep.c:1.86 Fri Feb 10 10:02:26 2017
+++ src/sys/arch/x86/x86/x86_machdep.c Fri Feb 10 10:39:36 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: x86_machdep.c,v 1.86 2017/02/10 10:02:26 maxv Exp $ */
+/* $NetBSD: x86_machdep.c,v 1.87 2017/02/10 10:39:36 maxv Exp $ */
/*-
* Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi,
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.86 2017/02/10 10:02:26 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.87 2017/02/10 10:39:36 maxv Exp $");
#include "opt_modular.h"
#include "opt_physmem.h"
@@ -583,8 +583,9 @@ x86_add_cluster(uint64_t seg_start, uint
return 0;
if (mem_cluster_cnt >= VM_PHYSSEG_MAX) {
- panic("%s: too many memory segments (increase VM_PHYSSEG_MAX)",
- __func__);
+ printf("WARNING: too many memory segments"
+ "(increase VM_PHYSSEG_MAX)");
+ return -1;
}
#ifdef PHYSMEM_MAX_ADDR
@@ -715,10 +716,13 @@ x86_parse_clusters(struct btinfo_common
"0x%"PRIx64"/0x%"PRIx64"/0x%x\n", seg_start,
seg_end - seg_start, type);
- x86_add_cluster(seg_start, IOM_BEGIN, type);
- x86_add_cluster(IOM_END, seg_end, type);
+ if (x86_add_cluster(seg_start, IOM_BEGIN, type) == -1)
+ break;
+ if (x86_add_cluster(IOM_END, seg_end, type) == -1)
+ break;
} else {
- x86_add_cluster(seg_start, seg_end, type);
+ if (x86_add_cluster(seg_start, seg_end, type) == -1)
+ break;
}
}