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

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