Source-Changes-HG archive

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

[src/netbsd-6]: src/sys/arch Pull up following revision(s) (requested by mrg ...



details:   https://anonhg.NetBSD.org/src/rev/0644523adb2d
branches:  netbsd-6
changeset: 773950:0644523adb2d
user:      riz <riz%NetBSD.org@localhost>
date:      Thu Mar 22 22:50:48 2012 +0000

description:
Pull up following revision(s) (requested by mrg in ticket #126):
        sys/arch/amd64/amd64/machdep.c: revision 1.180
        sys/arch/i386/i386/machdep.c: revision 1.724
make i386 and amd64 cpu_reboot() more similar.  in particular, bring
in the unmount/sync code from i386 to amd64, and call doshutdownhooks()
for i386.  the amd64 changes avoid umass triggering an assert later
when sd@umass is trying to sync the cache.
XXX merge x86 cpu_reboot(), but there's non-trivially different still.

diffstat:

 sys/arch/amd64/amd64/machdep.c |  50 ++++++++++++++++++++++++++++++-----------
 sys/arch/i386/i386/machdep.c   |  20 ++++++++--------
 2 files changed, 46 insertions(+), 24 deletions(-)

diffs (161 lines):

diff -r 32fd6c80e2c6 -r 0644523adb2d sys/arch/amd64/amd64/machdep.c
--- a/sys/arch/amd64/amd64/machdep.c    Wed Mar 21 16:16:00 2012 +0000
+++ b/sys/arch/amd64/amd64/machdep.c    Thu Mar 22 22:50:48 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.175.2.2 2012/03/05 20:18:01 sborrill Exp $       */
+/*     $NetBSD: machdep.c,v 1.175.2.3 2012/03/22 22:50:48 riz Exp $    */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.175.2.2 2012/03/05 20:18:01 sborrill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.175.2.3 2012/03/22 22:50:48 riz Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -316,6 +316,8 @@
 void   dodumpsys(void);
 void   dumpsys(void);
 
+extern int time_adjusted;      /* XXX no common header */
+
 void dump_misc_init(void);
 void dump_seg_prep(void);
 int dump_seg_iter(int (*)(paddr_t, paddr_t));
@@ -751,12 +753,12 @@
        l->l_md.md_flags |= MDP_IRET;
 }
 
-int    waittime = -1;
 struct pcb dumppcb;
 
 void
 cpu_reboot(int howto, char *bootstr)
 {
+       static bool syncdone = false;
        int s = IPL_NONE;
 
        if (cold) {
@@ -765,15 +767,37 @@
        }
 
        boothowto = howto;
-       if ((howto & RB_NOSYNC) == 0 && waittime < 0) {
-               waittime = 0;
-               vfs_shutdown();
-               /*
-                * If we've been adjusting the clock, the todr
-                * will be out of synch; adjust it now.
-                */
-               resettodr();
-       }
+
+       /* i386 maybe_dump() */
+
+       /*
+        * If we've panic'd, don't make the situation potentially
+        * worse by syncing or unmounting the file systems.
+        */
+       if ((howto & RB_NOSYNC) == 0 && panicstr == NULL) {
+               if (!syncdone) {
+                       syncdone = true;
+                       /* XXX used to force unmount as well, here */
+                       vfs_sync_all(curlwp);
+                       /*
+                        * If we've been adjusting the clock, the todr
+                        * will be out of synch; adjust it now.
+                        *
+                        * XXX used to do this after unmounting all
+                        * filesystems with vfs_shutdown().
+                        */
+                       if (time_adjusted != 0)
+                               resettodr();
+               }
+
+               while (vfs_unmountall1(curlwp, false, false) ||
+                      config_detach_all(boothowto) ||
+                      vfs_unmount_forceone(curlwp))
+                       ;       /* do nothing */
+       } else
+               suspendsched();
+
+       pmf_system_shutdown(boothowto);
 
        /* Disable interrupts. */
        s = splhigh();
@@ -785,8 +809,6 @@
 haltsys:
        doshutdownhooks();
 
-       pmf_system_shutdown(boothowto);
-
         if ((howto & RB_POWERDOWN) == RB_POWERDOWN) {
 #ifndef XEN
 #if NACPICA > 0
diff -r 32fd6c80e2c6 -r 0644523adb2d sys/arch/i386/i386/machdep.c
--- a/sys/arch/i386/i386/machdep.c      Wed Mar 21 16:16:00 2012 +0000
+++ b/sys/arch/i386/i386/machdep.c      Thu Mar 22 22:50:48 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.717.2.5 2012/03/07 23:31:41 riz Exp $    */
+/*     $NetBSD: machdep.c,v 1.717.2.6 2012/03/22 22:50:48 riz Exp $    */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.717.2.5 2012/03/07 23:31:41 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.717.2.6 2012/03/22 22:50:48 riz Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_ibcs2.h"
@@ -884,11 +884,7 @@
 cpu_reboot(int howto, char *bootstr)
 {
        static bool syncdone = false;
-       struct lwp *l;
-       int s;
-
-       s = IPL_NONE;
-       l = (curlwp == NULL) ? &lwp0 : curlwp;
+       int s = IPL_NONE;
 
        if (cold) {
                howto |= RB_HALT;
@@ -910,7 +906,7 @@
                if (!syncdone) {
                        syncdone = true;
                        /* XXX used to force unmount as well, here */
-                       vfs_sync_all(l);
+                       vfs_sync_all(curlwp);
                        /*
                         * If we've been adjusting the clock, the todr
                         * will be out of synch; adjust it now.
@@ -922,9 +918,9 @@
                                resettodr();
                }
 
-               while (vfs_unmountall1(l, false, false) ||
+               while (vfs_unmountall1(curlwp, false, false) ||
                       config_detach_all(boothowto) ||
-                      vfs_unmount_forceone(l))
+                      vfs_unmount_forceone(curlwp))
                        ;       /* do nothing */
        } else
                suspendsched();
@@ -932,7 +928,11 @@
        pmf_system_shutdown(boothowto);
 
        s = splhigh();
+
+       /* amd64 maybe_dump() */
+
 haltsys:
+       doshutdownhooks();
 
        if ((howto & RB_POWERDOWN) == RB_POWERDOWN) {
 #ifdef XEN



Home | Main Index | Thread Index | Old Index