]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
watchdog: ensure that module is loaded as early as possible
authorPratyush Anand <panand@redhat.com>
Wed, 16 Mar 2016 03:46:24 +0000 (09:16 +0530)
committerPratyush Anand <panand@redhat.com>
Tue, 5 Jul 2016 07:22:16 +0000 (12:52 +0530)
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/00-watchdog.conf
  rd.driver.pre=iTCO_wdt,lpc_ich,

Signed-off-by: Pratyush Anand <panand@redhat.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Harald Hoyer <harald@redhat.com>
modules.d/04watchdog/module-setup.sh

index 4680936f45f02c572520afa890eea86e1bee079c..6b35f9f5ccd31bd6e9a1f298bdf94758147edf6e 100755 (executable)
@@ -33,6 +33,7 @@ install() {
 
 installkernel() {
     [[ -d /sys/class/watchdog/ ]] || return
+    wdtcmdline=""
     for dir in /sys/class/watchdog/*; do
            [[ -d "$dir" ]] || continue
            [[ -f "$dir/state" ]] || continue
@@ -46,6 +47,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.
@@ -55,7 +57,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/00-watchdog.conf
 }