(unknown charset) wdog_kern_pat: liberate from SW_WATCHDOG

From: (unknown charset) Andriy Gapon <avg_at_FreeBSD.org>
Date: Wed, 16 May 2012 12:11:29 +0300
I would like to commit something like the following patch.
I think that in-kernel watchdog patting during crash dump is useful with
hardware watchdogs too.  The code seems to work fine here.
In fact, I am not sure why wdog_kern_pat was originally tied to SW_WATCHDOG.

commit 59329ca52f5e25266772f157e0640628b223d305
Author: Andriy Gapon <avg_at_icyb.net.ua>
Date:   Fri Nov 25 09:59:53 2011 +0200

    [test] kernel watchdog patting makes sense with hardware watchdogs too

diff --git a/sys/amd64/amd64/minidump_machdep.c b/sys/amd64/amd64/minidump_machdep.c
index 057d81d..9be642e 100644
--- a/sys/amd64/amd64/minidump_machdep.c
+++ b/sys/amd64/amd64/minidump_machdep.c
_at__at_ -37,9 +37,7 _at__at_ __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/vm_page.h>
 #include <vm/pmap.h>
_at__at_ -177,9 +175,9 _at__at_ blk_write
 			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/i386/i386/minidump_machdep.c b/sys/i386/i386/minidump_machdep.c
index d57de3a..e0cd1ff 100644
--- a/sys/i386/i386/minidump_machdep.c
+++ b/sys/i386/i386/minidump_machdep.c
_at__at_ -36,9 +36,7 _at__at_ __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>
_at__at_ -143,9 +141,9 _at__at_ blk_write
 			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/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c
index 2f7a391..54eca2a 100644
--- a/sys/kern/kern_shutdown.c
+++ b/sys/kern/kern_shutdown.c
_at__at_ -66,9 +66,7 _at__at_ __FBSDID("$FreeBSD$");
 #include <sys/sysctl.h>
 #include <sys/sysproto.h>
 #include <sys/vnode.h>
-#ifdef SW_WATCHDOG
 #include <sys/watchdog.h>
-#endif

 #include <ddb/ddb.h>

_at__at_ -334,9 +332,7 _at__at_ kern_reboot(int howto)

 		waittime = 0;

-#ifdef SW_WATCHDOG
 		wdog_kern_pat(WD_LASTVAL);
-#endif
 		sys_sync(curthread, NULL);

 		/*
_at__at_ -362,9 +358,8 _at__at_ kern_reboot(int howto)
 			if (nbusy < pbusy)
 				iter = 0;
 			pbusy = nbusy;
-#ifdef SW_WATCHDOG
+
 			wdog_kern_pat(WD_LASTVAL);
-#endif
 			sys_sync(curthread, NULL);

 #ifdef PREEMPTION
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index a06ba31..6e1333b 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
_at__at_ -73,9 +73,7 _at__at_ __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>

_at__at_ -1868,10 +1866,10 _at__at_ 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/x86/x86/dump_machdep.c b/sys/x86/x86/dump_machdep.c
index 4e6546d..5c874f4 100644
--- a/sys/x86/x86/dump_machdep.c
+++ b/sys/x86/x86/dump_machdep.c
_at__at_ -36,9 +36,7 _at__at_ __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>
_at__at_ -198,9 +196,9 _at__at_ 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;

-- 
Andriy Gapon
Received on Wed May 16 2012 - 07:11:33 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:26 UTC