* [PATCH V3 dracut 0/3] Install kernel module for active watchdog
@ 2016-03-07 4:24 Pratyush Anand
[not found] ` <cover.1457321591.git.panand-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Pratyush Anand @ 2016-03-07 4:24 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA
Cc: Pratyush Anand, Dave Young, Don Zickus, Harald Hoyer
Changes since V2:
-- Added one more patch to update rd.driver.pre with watchdog module name,
so that they are loaded into kernel as early as possible.
-- Removed creation of tmp/active-watchdogs. modinfo will be helpful for
kexec-tools.
-- Now we add modules for active watchdog in hostonly mode and modules for
all watchdog in no-hostonly mode.
Changes since RFC:
-- Added one more patch to take care that dracut does not add watchdog
hooks when systemd module is included. In that case systemd daemon will
manage watchdog for kicking.
-- Removed --nowdt argument. User can use -o or --omit when wathdog module
is not needed. Thanks Harald for this suggestion.
-- Now I also do not check for "hostonly" to add modules for active
watchdog. It seems reasonable to add kernel watchdog modules whenever,
dracut watchdog module has been added.
Pratyush Anand (3):
watchdog: Do not add hooks if systemd module is included
watchdog: install module for active watchdog
watchdog: ensure that module is loaded as early as possible
Cc: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Don Zickus <dzickus-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Harald Hoyer <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
modules.d/04watchdog/module-setup.sh | 42 ++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
--
2.5.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH V3 dracut 1/3] watchdog: Do not add hooks if systemd module is included
[not found] ` <cover.1457321591.git.panand-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2016-03-07 4:24 ` Pratyush Anand
2016-03-07 4:24 ` [PATCH V3 dracut 2/3] watchdog: install module for active watchdog Pratyush Anand
2016-03-07 4:24 ` [PATCH V3 dracut 3/3] watchdog: ensure that module is loaded as early as possible Pratyush Anand
2 siblings, 0 replies; 5+ messages in thread
From: Pratyush Anand @ 2016-03-07 4:24 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA
Cc: Pratyush Anand, Dave Young, Don Zickus, Harald Hoyer
When systemd is present, let it manage watchdog feed.
Signed-off-by: Pratyush Anand <panand-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Don Zickus <dzickus-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Harald Hoyer <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
modules.d/04watchdog/module-setup.sh | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/modules.d/04watchdog/module-setup.sh b/modules.d/04watchdog/module-setup.sh
index 576c589c198d..7ec757aec032 100755
--- a/modules.d/04watchdog/module-setup.sh
+++ b/modules.d/04watchdog/module-setup.sh
@@ -12,6 +12,11 @@ depends() {
# called by dracut
install() {
+ # Do not add watchdog hooks if systemd module is included
+ # In that case, systemd will manage watchdog kick
+ if dracut_module_included "systemd"; then
+ return
+ fi
inst_hook cmdline 00 "$moddir/watchdog.sh"
inst_hook cmdline 50 "$moddir/watchdog.sh"
inst_hook pre-trigger 00 "$moddir/watchdog.sh"
--
2.5.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH V3 dracut 2/3] watchdog: install module for active watchdog
[not found] ` <cover.1457321591.git.panand-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-03-07 4:24 ` [PATCH V3 dracut 1/3] watchdog: Do not add hooks if systemd module is included Pratyush Anand
@ 2016-03-07 4:24 ` Pratyush Anand
2016-03-07 4:24 ` [PATCH V3 dracut 3/3] watchdog: ensure that module is loaded as early as possible Pratyush Anand
2 siblings, 0 replies; 5+ messages in thread
From: Pratyush Anand @ 2016-03-07 4:24 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA
Cc: Pratyush Anand, Dave Young, Don Zickus, Harald Hoyer
Recently following patches have been added in upstream Linux kernel, which
(1) fixes parent of watchdog_device so that
/sys/class/watchdog/watchdogn/device is populated. (2) adds some sysfs
device attributes so that different watchdog status can be read.
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=6551881c86c791237a3bebf11eb3bd70b60ea782
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=906d7a5cfeda508e7361f021605579a00cd82815
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=33b711269ade3f6bc9d9d15e4343e6fa922d999b
With the above support, now we can find out whether a watchdog is active or
not. We can also find out the driver/module responsible for that watchdog
device.
Proposed patch uses above support and then adds module of active watchdog
in initramfs generated by dracut for hostonly mode. Kernel module for
inactive watchdog will be added as well for none hostonly mode.
When an user does not want to add kernel module, then one should exclude
complete dracut watchdog module with --omit.
Testing:
-- When watchdog is active watchdog modules were added
# cat /sys/class/watchdog/watchdog0/identity
iTCO_wdt
# cat /sys/class/watchdog/watchdog0/state
active
# dracut --hostonly initramfs-test.img -a watchdog
# lsinitrd initramfs-test.img | grep iTCO
-rw-r--r-- 1 root root 9100 Feb 24 09:19 usr/lib/modules/.../kernel/drivers/watchdog/iTCO_vendor_support.ko
-rw-r--r-- 1 root root 19252 Feb 24 09:19 usr/lib/modules/.../kernel/drivers/watchdog/iTCO_wdt.ko
-- When watchdog is inactive then watchdog modules were not added
# cat /sys/class/watchdog/watchdog0/state
inactive
# dracut --hostonly initramfs-test.img -a watchdog
# lsinitrd initramfs-test.img | grep iTCO
-- When watchdog is inactive, but no hostonly mode, watchdog modules were added
# cat /sys/class/watchdog/watchdog0/state
inactive
# dracut --no-hostonly initramfs-test.img -a watchdog
# lsinitrd initramfs-test.img | grep iTCO
-rw-r--r-- 1 root root 9100 Feb 24 09:19 usr/lib/modules/.../kernel/drivers/watchdog/iTCO_vendor_support.ko
-rw-r--r-- 1 root root 19252 Feb 24 09:19 usr/lib/modules/.../kernel/drivers/watchdog/iTCO_wdt.ko
Signed-off-by: Pratyush Anand <panand-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Don Zickus <dzickus-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Harald Hoyer <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
modules.d/04watchdog/module-setup.sh | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/modules.d/04watchdog/module-setup.sh b/modules.d/04watchdog/module-setup.sh
index 7ec757aec032..62e3fdf7829f 100755
--- a/modules.d/04watchdog/module-setup.sh
+++ b/modules.d/04watchdog/module-setup.sh
@@ -32,3 +32,33 @@ install() {
inst_multiple -o wdctl
}
+installkernel() {
+ cd /sys/class/watchdog
+ for dir in */; do
+ cd $dir
+ active=`[ -f state ] && cat state`
+ if ! [[ $hostonly ]] || [[ "$active" = "active" ]]; then
+ # device/modalias will return driver of this device
+ wdtdrv=`cat device/modalias`
+ # There can be more than one module represented by same
+ # modalias. Currently load all of them.
+ # TODO: Need to find a way to avoid any unwanted module
+ # represented by modalias
+ wdtdrv=`modprobe -R $wdtdrv | tr "\n" "," | sed 's/.$//'`
+ instmods $wdtdrv
+ # 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.
+ wdtppath="device/..";
+ while [ -f "$wdtppath/modalias" ]
+ do
+ wdtpdrv=`cat $wdtppath/modalias`
+ wdtpdrv=`modprobe -R $wdtpdrv | tr "\n" "," | sed 's/.$//'`
+ instmods $wdtpdrv
+ wdtppath="$wdtppath/.."
+ done
+ fi
+ cd ..
+ done
+}
--
2.5.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH V3 dracut 3/3] watchdog: ensure that module is loaded as early as possible
[not found] ` <cover.1457321591.git.panand-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-03-07 4:24 ` [PATCH V3 dracut 1/3] watchdog: Do not add hooks if systemd module is included Pratyush Anand
2016-03-07 4:24 ` [PATCH V3 dracut 2/3] watchdog: install module for active watchdog Pratyush Anand
@ 2016-03-07 4:24 ` Pratyush Anand
[not found] ` <28a6dc93202c66f9dfaa1ceae073040ae71508bb.1457321591.git.panand-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2 siblings, 1 reply; 5+ messages in thread
From: Pratyush Anand @ 2016-03-07 4:24 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA
Cc: Pratyush Anand, Dave Young, Don Zickus, Harald Hoyer
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.
Signed-off-by: Pratyush Anand <panand-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Don Zickus <dzickus-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Harald Hoyer <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
modules.d/04watchdog/module-setup.sh | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/modules.d/04watchdog/module-setup.sh b/modules.d/04watchdog/module-setup.sh
index 62e3fdf7829f..7667850ece8f 100755
--- a/modules.d/04watchdog/module-setup.sh
+++ b/modules.d/04watchdog/module-setup.sh
@@ -33,6 +33,7 @@ install() {
}
installkernel() {
+ wdtcmdline=""
cd /sys/class/watchdog
for dir in */; do
cd $dir
@@ -46,6 +47,7 @@ installkernel() {
# represented by modalias
wdtdrv=`modprobe -R $wdtdrv | tr "\n" "," | sed 's/.$//'`
instmods $wdtdrv
+ wdtcmdline="$wdtcmdline$wdtdrv,"
# 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
@@ -56,9 +58,14 @@ installkernel() {
wdtpdrv=`cat $wdtppath/modalias`
wdtpdrv=`modprobe -R $wdtpdrv | tr "\n" "," | sed 's/.$//'`
instmods $wdtpdrv
+ wdtcmdline="$wdtcmdline$wdtpdrv,"
wdtppath="$wdtppath/.."
done
fi
cd ..
done
+ # ensure that watchdog module is loaded as early as possible
+ if [[ $wdtcmdline ]]; then
+ echo "rd.driver.pre=$wdtcmdline" > ${initdir}/etc/cmdline.d/04-watchdog.conf
+ fi
}
--
2.5.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH V3 dracut 3/3] watchdog: ensure that module is loaded as early as possible
[not found] ` <28a6dc93202c66f9dfaa1ceae073040ae71508bb.1457321591.git.panand-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2016-03-07 5:05 ` Dracut GitHub Import Bot
0 siblings, 0 replies; 5+ messages in thread
From: Dracut GitHub Import Bot @ 2016-03-07 5:05 UTC (permalink / raw)
To: initramfs-u79uwXL29TY76Z2rM5mHXA
Patchset imported to github.
Pull request:
<https://github.com/haraldh/dracut/compare/master...dracut-mailing-devs:28a6dc93202c66f9dfaa1ceae073040ae71508bb.1457321591.git.panand%40redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-03-07 5:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-07 4:24 [PATCH V3 dracut 0/3] Install kernel module for active watchdog Pratyush Anand
[not found] ` <cover.1457321591.git.panand-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-03-07 4:24 ` [PATCH V3 dracut 1/3] watchdog: Do not add hooks if systemd module is included Pratyush Anand
2016-03-07 4:24 ` [PATCH V3 dracut 2/3] watchdog: install module for active watchdog Pratyush Anand
2016-03-07 4:24 ` [PATCH V3 dracut 3/3] watchdog: ensure that module is loaded as early as possible Pratyush Anand
[not found] ` <28a6dc93202c66f9dfaa1ceae073040ae71508bb.1457321591.git.panand-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-03-07 5:05 ` Dracut GitHub Import Bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).