aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAttilio Rao <attilio@FreeBSD.org>2011-04-28 16:02:05 +0000
committerAttilio Rao <attilio@FreeBSD.org>2011-04-28 16:02:05 +0000
commit2be767e069d5634f48d9dfa7ebf0930cfa7c4a9f (patch)
treea77ab94179765e48d467fa200110ca442367a27e /sys
parentcd49e305fc891c6b48d277ad182df837a67dd5de (diff)
downloadsrc-2be767e069d5634f48d9dfa7ebf0930cfa7c4a9f.tar.gz
src-2be767e069d5634f48d9dfa7ebf0930cfa7c4a9f.zip
Add the watchdogs patting during the (shutdown time) disk syncing and
disk dumping. With the option SW_WATCHDOG on, these operations are doomed to let watchdog fire, fi they take too long. I implemented the stubs this way because I really want wdog_kern_* KPI to not be dependant by SW_WATCHDOG being on (and really, the option only enables watchdog activation in hardclock) and also avoid to call them when not necessary (avoiding not-volountary watchdog activations). Sponsored by: Sandvine Incorporated Discussed with: emaste, des MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=221173
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/amd64/minidump_machdep.c8
-rw-r--r--sys/arm/arm/dump_machdep.c8
-rw-r--r--sys/arm/arm/minidump_machdep.c8
-rw-r--r--sys/i386/i386/minidump_machdep.c8
-rw-r--r--sys/ia64/ia64/dump_machdep.c8
-rw-r--r--sys/kern/kern_shutdown.c10
-rw-r--r--sys/kern/vfs_subr.c8
-rw-r--r--sys/mips/mips/dump_machdep.c8
-rw-r--r--sys/powerpc/powerpc/dump_machdep.c8
-rw-r--r--sys/x86/x86/dump_machdep.c8
10 files changed, 82 insertions, 0 deletions
diff --git a/sys/amd64/amd64/minidump_machdep.c b/sys/amd64/amd64/minidump_machdep.c
index 92b922dfaa8a..6b417f9a976a 100644
--- a/sys/amd64/amd64/minidump_machdep.c
+++ b/sys/amd64/amd64/minidump_machdep.c
@@ -27,6 +27,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include "opt_watchdog.h"
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
@@ -34,6 +36,9 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/kerneldump.h>
#include <sys/msgbuf.h>
+#ifdef SW_WATCHDOG
+#include <sys/watchdog.h>
+#endif
#include <vm/vm.h>
#include <vm/pmap.h>
#include <machine/atomic.h>
@@ -167,6 +172,9 @@ blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz)
report_progress(progress, dumpsize);
counter &= (1<<24) - 1;
}
+#ifdef SW_WATCHDOG
+ wdog_kern_pat(WD_LASTVAL);
+#endif
if (ptr) {
error = dump_write(di, ptr, 0, dumplo, len);
if (error)
diff --git a/sys/arm/arm/dump_machdep.c b/sys/arm/arm/dump_machdep.c
index 5a07dcac074b..cbff96b996ea 100644
--- a/sys/arm/arm/dump_machdep.c
+++ b/sys/arm/arm/dump_machdep.c
@@ -27,6 +27,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include "opt_watchdog.h"
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
@@ -35,6 +37,9 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/kerneldump.h>
+#ifdef SW_WATCHDOG
+#include <sys/watchdog.h>
+#endif
#include <vm/vm.h>
#include <vm/pmap.h>
#include <machine/elf.h>
@@ -189,6 +194,9 @@ cb_dumpdata(struct md_pa *mdp, int seqnr, void *arg)
cpu_tlb_flushID_SE(0);
cpu_cpwait();
}
+#ifdef SW_WATCHDOG
+ wdog_kern_pat(WD_LASTVAL);
+#endif
error = dump_write(di,
(void *)(pa - (pa & L1_ADDR_BITS)),0, dumplo, sz);
if (error)
diff --git a/sys/arm/arm/minidump_machdep.c b/sys/arm/arm/minidump_machdep.c
index c21b183ae599..a8587098b515 100644
--- a/sys/arm/arm/minidump_machdep.c
+++ b/sys/arm/arm/minidump_machdep.c
@@ -29,6 +29,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include "opt_watchdog.h"
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
@@ -36,6 +38,9 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/kerneldump.h>
#include <sys/msgbuf.h>
+#ifdef SW_WATCHDOG
+#include <sys/watchdog.h>
+#endif
#include <vm/vm.h>
#include <vm/pmap.h>
#include <machine/pmap.h>
@@ -138,6 +143,9 @@ blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz)
counter &= (1<<22) - 1;
}
+#ifdef SW_WATCHDOG
+ wdog_kern_pat(WD_LASTVAL);
+#endif
if (ptr) {
error = dump_write(di, ptr, 0, dumplo, len);
if (error)
diff --git a/sys/i386/i386/minidump_machdep.c b/sys/i386/i386/minidump_machdep.c
index 92c0b8f6ffcd..d57de3ab7c9e 100644
--- a/sys/i386/i386/minidump_machdep.c
+++ b/sys/i386/i386/minidump_machdep.c
@@ -27,6 +27,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include "opt_watchdog.h"
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
@@ -34,6 +36,9 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/kerneldump.h>
#include <sys/msgbuf.h>
+#ifdef SW_WATCHDOG
+#include <sys/watchdog.h>
+#endif
#include <vm/vm.h>
#include <vm/pmap.h>
#include <machine/atomic.h>
@@ -138,6 +143,9 @@ blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz)
printf(" %lld", PG2MB(progress >> PAGE_SHIFT));
counter &= (1<<24) - 1;
}
+#ifdef SW_WATCHDOG
+ wdog_kern_pat(WD_LASTVAL);
+#endif
if (ptr) {
error = dump_write(di, ptr, 0, dumplo, len);
if (error)
diff --git a/sys/ia64/ia64/dump_machdep.c b/sys/ia64/ia64/dump_machdep.c
index 06744e17e075..ae82c360c582 100644
--- a/sys/ia64/ia64/dump_machdep.c
+++ b/sys/ia64/ia64/dump_machdep.c
@@ -27,12 +27,17 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include "opt_watchdog.h"
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/cons.h>
#include <sys/kernel.h>
#include <sys/kerneldump.h>
+#ifdef SW_WATCHDOG
+#include <sys/watchdog.h>
+#endif
#include <vm/vm.h>
#include <vm/pmap.h>
#include <machine/efi.h>
@@ -125,6 +130,9 @@ cb_dumpdata(struct efi_md *mdp, int seqnr, void *arg)
printf("%c\b", "|/-\\"[twiddle++ & 3]);
counter &= (1<<24) - 1;
}
+#ifdef SW_WATCHDOG
+ wdog_kern_pat(WD_LASTVAL);
+#endif
error = dump_write(di, (void*)pa, 0, dumplo, sz);
if (error)
break;
diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c
index 9553a3aba3a7..001da3da8449 100644
--- a/sys/kern/kern_shutdown.c
+++ b/sys/kern/kern_shutdown.c
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
#include "opt_panic.h"
#include "opt_show_busybufs.h"
#include "opt_sched.h"
+#include "opt_watchdog.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -65,6 +66,9 @@ __FBSDID("$FreeBSD$");
#include <sys/smp.h>
#include <sys/sysctl.h>
#include <sys/sysproto.h>
+#ifdef SW_WATCHDOG
+#include <sys/watchdog.h>
+#endif
#include <ddb/ddb.h>
@@ -310,6 +314,9 @@ kern_reboot(int howto)
waittime = 0;
+#ifdef SW_WATCHDOG
+ wdog_kern_pat(WD_LASTVAL);
+#endif
sync(curthread, NULL);
/*
@@ -335,6 +342,9 @@ kern_reboot(int howto)
if (nbusy < pbusy)
iter = 0;
pbusy = nbusy;
+#ifdef SW_WATCHDOG
+ wdog_kern_pat(WD_LASTVAL);
+#endif
sync(curthread, NULL);
#ifdef PREEMPTION
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 25bfa7cdc082..dead54648dc9 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -42,6 +42,7 @@
__FBSDID("$FreeBSD$");
#include "opt_ddb.h"
+#include "opt_watchdog.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -72,6 +73,9 @@ __FBSDID("$FreeBSD$");
#include <sys/syslog.h>
#include <sys/vmmeter.h>
#include <sys/vnode.h>
+#ifdef SW_WATCHDOG
+#include <sys/watchdog.h>
+#endif
#include <machine/stdarg.h>
@@ -1839,6 +1843,10 @@ sched_sync(void)
LIST_INSERT_HEAD(next, bo, bo_synclist);
continue;
}
+#ifdef SW_WATCHDOG
+ if (first_printf == 0)
+ wdog_kern_pat(WD_LASTVAL);
+#endif
}
if (!LIST_EMPTY(gslp)) {
mtx_unlock(&sync_mtx);
diff --git a/sys/mips/mips/dump_machdep.c b/sys/mips/mips/dump_machdep.c
index 412c94d9bf41..1dd69f759c25 100644
--- a/sys/mips/mips/dump_machdep.c
+++ b/sys/mips/mips/dump_machdep.c
@@ -27,6 +27,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include "opt_watchdog.h"
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
@@ -35,6 +37,9 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/kerneldump.h>
+#ifdef SW_WATCHDOG
+#include <sys/watchdog.h>
+#endif
#include <vm/vm.h>
#include <vm/pmap.h>
#include <machine/elf.h>
@@ -182,6 +187,9 @@ cb_dumpdata(struct md_pa *mdp, int seqnr, void *arg)
counter &= (1<<24) - 1;
}
+#ifdef SW_WATCHDOG
+ wdog_kern_path(WD_LASTVAL);
+#endif
error = dump_write(di, (void *)(intptr_t)(pa),0, dumplo, sz); /* XXX fix PA */
if (error)
break;
diff --git a/sys/powerpc/powerpc/dump_machdep.c b/sys/powerpc/powerpc/dump_machdep.c
index acda5601d050..043505f41cba 100644
--- a/sys/powerpc/powerpc/dump_machdep.c
+++ b/sys/powerpc/powerpc/dump_machdep.c
@@ -27,6 +27,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include "opt_watchdog.h"
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
@@ -34,6 +36,9 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/kerneldump.h>
#include <sys/sysctl.h>
+#ifdef SW_WATCHDOG
+#include <sys/watchdog.h>
+#endif
#include <vm/vm.h>
#include <vm/pmap.h>
#include <machine/elf.h>
@@ -129,6 +134,9 @@ cb_dumpdata(struct pmap_md *md, int seqnr, void *arg)
printf("%c\b", "|/-\\"[twiddle++ & 3]);
counter &= (1<<24) - 1;
}
+#ifdef SW_WATCHDOG
+ wdog_kern_pat(WD_LASTVAL);
+#endif
error = di->dumper(di->priv, (void*)va, 0, dumplo, sz);
pmap_dumpsys_unmap(md, ofs, va);
if (error)
diff --git a/sys/x86/x86/dump_machdep.c b/sys/x86/x86/dump_machdep.c
index d0a7612f478c..4e6546d7bfb1 100644
--- a/sys/x86/x86/dump_machdep.c
+++ b/sys/x86/x86/dump_machdep.c
@@ -27,6 +27,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include "opt_watchdog.h"
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
@@ -34,6 +36,9 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <sys/kernel.h>
#include <sys/kerneldump.h>
+#ifdef SW_WATCHDOG
+#include <sys/watchdog.h>
+#endif
#include <vm/vm.h>
#include <vm/pmap.h>
#include <machine/elf.h>
@@ -193,6 +198,9 @@ cb_dumpdata(struct md_pa *mdp, int seqnr, void *arg)
a = pa + i * PAGE_SIZE;
va = pmap_kenter_temporary(trunc_page(a), i);
}
+#ifdef SW_WATCHDOG
+ wdog_kern_pat(WD_LASTVAL);
+#endif
error = dump_write(di, va, 0, dumplo, sz);
if (error)
break;