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

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