Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/x86 If the segment list is full, print a warnin...



details:   https://anonhg.NetBSD.org/src/rev/501476965d53
branches:  trunk
changeset: 821595:501476965d53
user:      maxv <maxv%NetBSD.org@localhost>
date:      Fri Feb 10 10:39:36 2017 +0000

description:
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.

diffstat:

 sys/arch/x86/x86/x86_machdep.c |  18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diffs (47 lines):

diff -r b83bcf77d0e0 -r 501476965d53 sys/arch/x86/x86/x86_machdep.c
--- a/sys/arch/x86/x86/x86_machdep.c    Fri Feb 10 10:02:26 2017 +0000
+++ b/sys/arch/x86/x86/x86_machdep.c    Fri Feb 10 10:39:36 2017 +0000
@@ -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 @@
                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 @@
                            "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;
                }
        }
 



Home | Main Index | Thread Index | Old Index