tech-kern archive

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

dumps & shutdown order (was Re: CVS commit: src/sys/arch)



On Sat, Jun 27, 2009 at 03:59:39PM -0500, David Young wrote:
> On Sat, Jun 27, 2009 at 10:18:55AM +0200, vincent%labri.fr@localhost wrote:
> > 
> >        Hi,
> > 
> > David Young <dyoung%netbsd.org@localhost> writes:
> > 
> > > And here is the new order:
> > >
> > > A1 dump core
> > > A2 sync filesystems and TOD clock
> > 
> > I think this deserves a heads-up to users because I, for one, usually
> > hardware reboot my computer while it dumps its GBs of RAM to the disk.
> 
> You're absolutely right.  Let me see what I can do with the order of
> things.  I already have some ideas in mind.  I can give the problem some
> attention on Monday.

Looks like I can move dumps back to their customary place in the
shutdown order by opening the dump device early in cpu_reboot(9) to
prevent its detachment, running the detachment/unmount loop, closing
the device, dumping, and running the detachment/unmount loop again.
Pseudo-C for cpu_reboot(9) follows.

bool postdump = false;  /* postpone dump */
int s;

if (panicstr != NULL)
        howto |= RB_NOSYNC;

switch (howto & (RB_NOSYNC|RB_DUMP|RB_HALT)) {
case RB_DUMP|RB_NOSYNC:
        s = splhigh();
        dumpsys();
        splx(s);
        break;
case RB_DUMP:
        /* Dump after unmounting filesystems and detaching
         * most devices.  Open the dump device so that it
         * will not be detached.
         */
        if (dumpdev != NODEV)
                postdump = (bdev_open(dumpdev, FWRITE, S_IFBLK, l) == 0);
        break;
default:
        break;
}

/* sync filesystems, detach devices */

if (postdump) {
        bdev_close(dumpdev, FWRITE, S_IFBLK, l);
        s = splhigh();
        dumpsys();
        splx(s);

        /* sync filesystems and detach devices that remain */

}

/* run PMF shutdown hooks */

Dave

-- 
David Young             OJC Technologies
dyoung%ojctech.com@localhost      Urbana, IL * (217) 278-3933


Home | Main Index | Thread Index | Old Index