While reserving memory at boot time via uvm_physseg_unplug(9),

in the case of a disappearing segment (due to a segment sized msgbuf)
make sure segment offsets are read off before the segment disappears.

This should fix some of the recent boot time hard resets reported on
i386 recently.

Thanks to kre@ for pointing this out to me.


CVS: ----------------------------------------------------------------------
CVS: CVSROOT  cvs.NetBSD.org:/cvsroot
CVS: please use "PR category/123" to have the commitmsg appended to PR 123
CVS:
CVS: Please evaluate your changes and consider the following.
CVS: Abort checkin if you answer no.
CVS: => For all changes:
CVS: Do the changed files compile?
CVS: Has the change been tested?
CVS: => If you are not completely familiar with the changed components:
CVS: Has the change been posted for review?
CVS: Have you allowed enough time for feedback?
CVS: => If the change is major:
CVS: => If the change adds files to, or removes files from $DESTDIR:
CVS: => If you are changing a library or kernel interface:
CVS: Have you successfully run "./build.sh release"?
This commit is contained in:
cherry 2017-01-10 09:48:22 +00:00
parent 5714904ce2
commit 94ed870bbb

View File

@ -1,4 +1,4 @@
/* $NetBSD: x86_machdep.c,v 1.80 2016/12/26 17:54:07 cherry Exp $ */
/* $NetBSD: x86_machdep.c,v 1.81 2017/01/10 09:48:22 cherry 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.80 2016/12/26 17:54:07 cherry Exp $");
__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.81 2017/01/10 09:48:22 cherry Exp $");
#include "opt_modular.h"
#include "opt_physmem.h"
@ -933,12 +933,12 @@ init_x86_msgbuf(void)
if (uvm_physseg_get_avail_end(x) - uvm_physseg_get_avail_start(x) < atop(sz))
sz = ctob(uvm_physseg_get_avail_end(x) - uvm_physseg_get_avail_start(x));
uvm_physseg_unplug(uvm_physseg_get_end(x) - atop(sz), atop(sz));
msgbuf_p_seg[msgbuf_p_cnt].sz = sz;
msgbuf_p_seg[msgbuf_p_cnt++].paddr = ctob(uvm_physseg_get_avail_end(x));
msgbuf_p_seg[msgbuf_p_cnt++].paddr = ctob(uvm_physseg_get_avail_end(x)) - sz;
uvm_physseg_unplug(uvm_physseg_get_end(x) - atop(sz), atop(sz));
/* Now find where the new avail_end is. */
avail_end = ctob(uvm_physseg_get_avail_end(x));
avail_end = ctob(uvm_physseg_get_highest_frame());
if (sz == reqsz)
return;