Blame 0038-watchdog-ensure-that-module-is-loaded-as-early-as-po.patch

Harald Hoyer b38677
From e343c85763e7b981a5e9b53b04f90f0d83bffaaf Mon Sep 17 00:00:00 2001
Harald Hoyer b38677
From: Pratyush Anand <panand@redhat.com>
Harald Hoyer b38677
Date: Wed, 16 Mar 2016 09:16:24 +0530
Harald Hoyer b38677
Subject: [PATCH] watchdog: ensure that module is loaded as early as possible
Harald Hoyer b38677
Harald Hoyer b38677
It is expected that a watchdog module will disable an active watchdog when
Harald Hoyer b38677
its probe is called ie, when it is loaded. So an early load of the module
Harald Hoyer b38677
will help to disable it earlier.
Harald Hoyer b38677
This can be helpful in some corner cases where kdump and watchdog daemon
Harald Hoyer b38677
both are active.
Harald Hoyer b38677
Harald Hoyer b38677
Testing:
Harald Hoyer b38677
    -- When watchdog kernel modules were added
Harald Hoyer b38677
	# dracut --no-hostonly initramfs-test.img -a watchdog
Harald Hoyer b38677
	# lsinitrd initramfs-test.img -f etc/cmdline.d/00-watchdog.conf
Harald Hoyer b38677
 	rd.driver.pre=iTCO_wdt,lpc_ich,
Harald Hoyer b38677
Harald Hoyer b38677
Signed-off-by: Pratyush Anand <panand@redhat.com>
Harald Hoyer b38677
Cc: Dave Young <dyoung@redhat.com>
Harald Hoyer b38677
Cc: Don Zickus <dzickus@redhat.com>
Harald Hoyer b38677
Cc: Harald Hoyer <harald@redhat.com>
Harald Hoyer b38677
---
Harald Hoyer b38677
 modules.d/04watchdog/module-setup.sh | 5 +++++
Harald Hoyer b38677
 1 file changed, 5 insertions(+)
Harald Hoyer b38677
Harald Hoyer b38677
diff --git a/modules.d/04watchdog/module-setup.sh b/modules.d/04watchdog/module-setup.sh
Harald Hoyer b38677
index 0ffaa96..c9da148 100755
Harald Hoyer b38677
--- a/modules.d/04watchdog/module-setup.sh
Harald Hoyer b38677
+++ b/modules.d/04watchdog/module-setup.sh
Harald Hoyer b38677
@@ -34,6 +34,7 @@ install() {
Harald Hoyer b38677
 
Harald Hoyer b38677
 installkernel() {
Harald Hoyer b38677
     [[ -d /sys/class/watchdog/ ]] || return
Harald Hoyer b38677
+    wdtcmdline=""
Harald Hoyer b38677
     for dir in /sys/class/watchdog/*; do
Harald Hoyer b38677
 	    [[ -d "$dir" ]] || continue
Harald Hoyer b38677
 	    [[ -f "$dir/state" ]] || continue
Harald Hoyer b38677
@@ -47,6 +48,7 @@ installkernel() {
Harald Hoyer b38677
 	    # represented by modalias
Harald Hoyer b38677
 	    wdtdrv=$(modprobe -R $wdtdrv)
Harald Hoyer b38677
 	    instmods $wdtdrv
Harald Hoyer b38677
+	    wdtcmdline="$wdtcmdline$(echo $wdtdrv | tr " " ","),"
Harald Hoyer b38677
 	    # however in some cases, we also need to check that if there is
Harald Hoyer b38677
 	    # a specific driver for the parent bus/device.  In such cases
Harald Hoyer b38677
 	    # we also need to enable driver for parent bus/device.
Harald Hoyer b38677
@@ -56,7 +58,10 @@ installkernel() {
Harald Hoyer b38677
 		    wdtpdrv=$(< "$wdtppath/modalias")
Harald Hoyer b38677
 		    wdtpdrv=$(modprobe -R $wdtpdrv)
Harald Hoyer b38677
 		    instmods $wdtpdrv
Harald Hoyer b38677
+		    wdtcmdline="$wdtcmdline$(echo $wdtpdrv | tr " " ","),"
Harald Hoyer b38677
 		    wdtppath=$(readlink -f "$wdtppath/..")
Harald Hoyer b38677
 	    done
Harald Hoyer b38677
     done
Harald Hoyer b38677
+    # ensure that watchdog module is loaded as early as possible
Harald Hoyer b38677
+    [[ $wdtcmdline = "" ]] || echo "rd.driver.pre=$wdtcmdline" > ${initdir}/etc/cmdline.d/00-watchdog.conf
Harald Hoyer b38677
 }