[PATCH V4 dracut 3/3] watchdog: ensure that module is loaded as early as possible

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

 



It is expected that a watchdog module will disable an active watchdog when
its probe is called ie, when it is loaded. So an early load of the module
will help to disable it earlier.
This can be helpful in some corner cases where kdump and watchdog daemon
both are active.

Testing:
    -- When watchdog kernel modules were added
	# dracut --no-hostonly initramfs-test.img -a watchdog
	# lsinitrd initramfs-test.img -f etc/cmdline.d/04-watchdog.conf
 	rd.driver.pre=iTCO_wdt,lpc_ich,

Signed-off-by: Pratyush Anand <panand@xxxxxxxxxx>
Cc: Dave Young <dyoung@xxxxxxxxxx>
Cc: Don Zickus <dzickus@xxxxxxxxxx>
Cc: Harald Hoyer <harald@xxxxxxxxxx>
---
 modules.d/04watchdog/module-setup.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/modules.d/04watchdog/module-setup.sh b/modules.d/04watchdog/module-setup.sh
index 0ffaa9658502..d99e5b33de44 100755
--- a/modules.d/04watchdog/module-setup.sh
+++ b/modules.d/04watchdog/module-setup.sh
@@ -34,6 +34,7 @@ install() {
 
 installkernel() {
     [[ -d /sys/class/watchdog/ ]] || return
+    wdtcmdline=""
     for dir in /sys/class/watchdog/*; do
 	    [[ -d "$dir" ]] || continue
 	    [[ -f "$dir/state" ]] || continue
@@ -47,6 +48,7 @@ installkernel() {
 	    # represented by modalias
 	    wdtdrv=$(modprobe -R $wdtdrv)
 	    instmods $wdtdrv
+	    wdtcmdline="$wdtcmdline$(echo $wdtdrv | tr " " ","),"
 	    # however in some cases, we also need to check that if there is
 	    # a specific driver for the parent bus/device.  In such cases
 	    # we also need to enable driver for parent bus/device.
@@ -56,7 +58,10 @@ installkernel() {
 		    wdtpdrv=$(< "$wdtppath/modalias")
 		    wdtpdrv=$(modprobe -R $wdtpdrv)
 		    instmods $wdtpdrv
+		    wdtcmdline="$wdtcmdline$(echo $wdtpdrv | tr " " ","),"
 		    wdtppath=$(readlink -f "$wdtppath/..")
 	    done
     done
+    # ensure that watchdog module is loaded as early as possible
+    [[ $wdtcmdline = "" ]] || echo "rd.driver.pre=$wdtcmdline" > ${initdir}/etc/cmdline.d/04-watchdog.conf
 }
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux