Blame SOURCES/0438-watchdog-ensure-that-module-is-loaded-as-early-as-po.patch

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