Fedora dracut-044-75 release has all the component needed to support initrd rebuild in case of watchdog state change. Therefore sending these patches for inclusion in kexec-tools.
Please note that these patches should only be added in those fedora versions which has dracut version dracut-044-75 or latter. Anyway, we already have dependency specified in spec file as well.
Testing: Most of the rebuild test cases have been mentioned in the commit log of 2/5. Other than that, I have also tested effect of adding either "-o watchdog" or "-a watchdog" or none of them. They have been found to behave as expected. So, when we pass -o watchdog in dracut_args, it does not include kernel watchdog module whether state is active or inactive. In all other cases, it adds kernel module only when state is active.
Changes since V2: - Removed NOWDT argument. Using dracut_args instead. - Removed man page update. Included notes in howto - Reorganized mkdumprd code for watchdog dracut argument addition
Changes since V1: - Removed patch 4/5 which was updating kdumpctl man page. - Added all necessary information in kdump.conf man page (patch 2/4).
Pratyush Anand (5): mkdumprd: Add dracut watchdog module as default option kdumpctl: force rebuild in case of watchdog state change howto: Notes on watchdog module handling watchdog: do not add watchdog module in rd.driver.pre now spec: Update to add dependency on dracut version >= 044-75
dracut-module-setup.sh | 9 --------- kdump-lib.sh | 29 +++++++++++++++++++++++++++++ kdumpctl | 32 ++++++++++++++++++++++++++++++++ kexec-kdump-howto.txt | 16 ++++++++++++++++ kexec-tools.spec | 3 ++- mkdumprd | 5 ++++- 6 files changed, 83 insertions(+), 11 deletions(-)
If dracut watchdog module is enabled then, it includes kernel watchdog module of active watchdog device in initramfs.
kdump.conf has an option to modify dracut_args. So, if an user passes "-a watchdog" in dracut_args then dracut will add kernel watchdog module of active watchdog device in initramfs.
Since, kexec-tools always requires to add kernel watchdog module of active watchdog device in initramfs, therefore even when an user does not pass any watchdog option then also kexec-tools adds "-a watchdog" in dracut args.
Therefore, if an user does not want to add kernel watchdog module in initramfs then he/she must pass "-o watchdog" in dracut_args.
Signed-off-by: Pratyush Anand panand@redhat.com --- kdump-lib.sh | 29 +++++++++++++++++++++++++++++ mkdumprd | 5 ++++- 2 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 141a5614f1d5..bd1d95ea4bfd 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -382,3 +382,32 @@ get_ifcfg_filename() {
echo -n "${ifcfg_file}" } + +# returns 0 when omission of watchdog module is desired in dracut_args +# returns 1 when addition of watchdog module is desired in dracut_args +# returns 2 when there is no option for watchdog module in dracut_args +check_wdt_mod_omission() { + local dracut_args + local ret=2 + + dracut_args=$(grep "^dracut_args" /etc/kdump.conf) + [[ -z $dracut_args ]] && return $ret + + eval set -- $dracut_args + while :; do + [[ -z $1 ]] && break + case $1 in + -o|--omit) + echo $2 | grep -qw "watchdog" + [[ $? == 0 ]] && ret=0 + shift;; + -a|--add) + echo $2 | grep -qw "watchdog" + [[ $? == 0 ]] && ret=1 + shift;; + esac + shift + done + + return $ret +} diff --git a/mkdumprd b/mkdumprd index eb0d5e06fac9..f964940555ee 100644 --- a/mkdumprd +++ b/mkdumprd @@ -16,8 +16,11 @@ SAVE_PATH=$(grep ^path $conf_file| cut -d' ' -f2) # strip the duplicated "/" SAVE_PATH=$(echo $SAVE_PATH | tr -s /)
+check_wdt_mod_omission +[[ $? -eq 2 ]] && WDTCFG="-a watchdog" + extra_modules="" -dracut_args=("--hostonly" "-o" "plymouth dash resume ifcfg") +dracut_args=("--hostonly" "-o" "plymouth dash resume ifcfg" $WDTCFG) OVERRIDE_RESETTABLE=0
add_dracut_arg() {
Hi, Pratyush
On 07/13/16 at 01:37pm, Pratyush Anand wrote:
If dracut watchdog module is enabled then, it includes kernel watchdog module of active watchdog device in initramfs.
kdump.conf has an option to modify dracut_args. So, if an user passes "-a watchdog" in dracut_args then dracut will add kernel watchdog module of active watchdog device in initramfs.
Since, kexec-tools always requires to add kernel watchdog module of active watchdog device in initramfs, therefore even when an user does not pass any watchdog option then also kexec-tools adds "-a watchdog" in dracut args.
Therefore, if an user does not want to add kernel watchdog module in initramfs then he/she must pass "-o watchdog" in dracut_args.
Signed-off-by: Pratyush Anand panand@redhat.com
kdump-lib.sh | 29 +++++++++++++++++++++++++++++ mkdumprd | 5 ++++- 2 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 141a5614f1d5..bd1d95ea4bfd 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -382,3 +382,32 @@ get_ifcfg_filename() {
echo -n "${ifcfg_file}"
}
+# returns 0 when omission of watchdog module is desired in dracut_args +# returns 1 when addition of watchdog module is desired in dracut_args +# returns 2 when there is no option for watchdog module in dracut_args +check_wdt_mod_omission() {
- local dracut_args
- local ret=2
- dracut_args=$(grep "^dracut_args" /etc/kdump.conf)
- [[ -z $dracut_args ]] && return $ret
- eval set -- $dracut_args
- while :; do
[[ -z $1 ]] && break
case $1 in
-o|--omit)
echo $2 | grep -qw "watchdog"
[[ $? == 0 ]] && ret=0
shift;;
-a|--add)
echo $2 | grep -qw "watchdog"
[[ $? == 0 ]] && ret=1
shift;;
esac
shift
- done
- return $ret
+}
It looks over complex.
I did below test:
dracut -H -f a.img --printsize `uname -r` - no watchdog added
dracut -a watchdog -o watchdog -H -f a.img --printsize `uname -r` - no watchdog added
dracut -o watchdog -a watchdog -H -f a.img --printsize `uname -r` - no watchdog added
dracut -a watchdog -H -f a.img --printsize `uname -r` - watchdog being added
What ever options if one use -o watchdog in dracut_args the "-a" will be discarded. So how about just add -a watchdog in code if needed and add a code comment that dracut_args options "-o watchdog" will overwrite the "-a watchdog"? If one specify -a watchdog in dracut_args it does not matter as well
diff --git a/mkdumprd b/mkdumprd index eb0d5e06fac9..f964940555ee 100644 --- a/mkdumprd +++ b/mkdumprd @@ -16,8 +16,11 @@ SAVE_PATH=$(grep ^path $conf_file| cut -d' ' -f2) # strip the duplicated "/" SAVE_PATH=$(echo $SAVE_PATH | tr -s /)
+check_wdt_mod_omission +[[ $? -eq 2 ]] && WDTCFG="-a watchdog"
extra_modules="" -dracut_args=("--hostonly" "-o" "plymouth dash resume ifcfg") +dracut_args=("--hostonly" "-o" "plymouth dash resume ifcfg" $WDTCFG) OVERRIDE_RESETTABLE=0
add_dracut_arg() {
2.5.5 _______________________________________________ kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/admin/lists/kexec@lists.fedoraproject.org
Thanks Dave
Hi, Pratyush
On 07/14/16 at 10:45am, Dave Young wrote:
Hi, Pratyush
On 07/13/16 at 01:37pm, Pratyush Anand wrote:
If dracut watchdog module is enabled then, it includes kernel watchdog module of active watchdog device in initramfs.
kdump.conf has an option to modify dracut_args. So, if an user passes "-a watchdog" in dracut_args then dracut will add kernel watchdog module of active watchdog device in initramfs.
Since, kexec-tools always requires to add kernel watchdog module of active watchdog device in initramfs, therefore even when an user does not pass any watchdog option then also kexec-tools adds "-a watchdog" in dracut args.
Therefore, if an user does not want to add kernel watchdog module in initramfs then he/she must pass "-o watchdog" in dracut_args.
Signed-off-by: Pratyush Anand panand@redhat.com
kdump-lib.sh | 29 +++++++++++++++++++++++++++++ mkdumprd | 5 ++++- 2 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 141a5614f1d5..bd1d95ea4bfd 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -382,3 +382,32 @@ get_ifcfg_filename() {
echo -n "${ifcfg_file}"
}
+# returns 0 when omission of watchdog module is desired in dracut_args +# returns 1 when addition of watchdog module is desired in dracut_args +# returns 2 when there is no option for watchdog module in dracut_args +check_wdt_mod_omission() {
- local dracut_args
- local ret=2
- dracut_args=$(grep "^dracut_args" /etc/kdump.conf)
- [[ -z $dracut_args ]] && return $ret
- eval set -- $dracut_args
- while :; do
[[ -z $1 ]] && break
case $1 in
-o|--omit)
echo $2 | grep -qw "watchdog"
[[ $? == 0 ]] && ret=0
shift;;
-a|--add)
echo $2 | grep -qw "watchdog"
[[ $? == 0 ]] && ret=1
shift;;
esac
shift
- done
- return $ret
+}
It looks over complex.
I did below test:
dracut -H -f a.img --printsize `uname -r`
- no watchdog added
dracut -a watchdog -o watchdog -H -f a.img --printsize `uname -r`
- no watchdog added
dracut -o watchdog -a watchdog -H -f a.img --printsize `uname -r`
- no watchdog added
dracut -a watchdog -H -f a.img --printsize `uname -r`
- watchdog being added
What ever options if one use -o watchdog in dracut_args the "-a" will be discarded. So how about just add -a watchdog in code if needed and add a code comment that dracut_args options "-o watchdog" will overwrite the "-a watchdog"? If one specify -a watchdog in dracut_args it does not matter as well
BTW, watchdog should be added when there is active watchdog in 1st kernel Ideally we can do that in dracut module check() function (hostonly case) so we do not need anything in our code to check it. What do you think?
diff --git a/mkdumprd b/mkdumprd index eb0d5e06fac9..f964940555ee 100644 --- a/mkdumprd +++ b/mkdumprd @@ -16,8 +16,11 @@ SAVE_PATH=$(grep ^path $conf_file| cut -d' ' -f2) # strip the duplicated "/" SAVE_PATH=$(echo $SAVE_PATH | tr -s /)
+check_wdt_mod_omission +[[ $? -eq 2 ]] && WDTCFG="-a watchdog"
extra_modules="" -dracut_args=("--hostonly" "-o" "plymouth dash resume ifcfg") +dracut_args=("--hostonly" "-o" "plymouth dash resume ifcfg" $WDTCFG) OVERRIDE_RESETTABLE=0
add_dracut_arg() {
2.5.5 _______________________________________________ kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/admin/lists/kexec@lists.fedoraproject.org
Thanks Dave
Thanks Dave
Hi Dave,
On 14/07/2016:10:57:11 AM, Dave Young wrote:
Hi, Pratyush
On 07/14/16 at 10:45am, Dave Young wrote:
Hi, Pratyush
On 07/13/16 at 01:37pm, Pratyush Anand wrote:
If dracut watchdog module is enabled then, it includes kernel watchdog module of active watchdog device in initramfs.
kdump.conf has an option to modify dracut_args. So, if an user passes "-a watchdog" in dracut_args then dracut will add kernel watchdog module of active watchdog device in initramfs.
Since, kexec-tools always requires to add kernel watchdog module of active watchdog device in initramfs, therefore even when an user does not pass any watchdog option then also kexec-tools adds "-a watchdog" in dracut args.
Therefore, if an user does not want to add kernel watchdog module in initramfs then he/she must pass "-o watchdog" in dracut_args.
Signed-off-by: Pratyush Anand panand@redhat.com
kdump-lib.sh | 29 +++++++++++++++++++++++++++++ mkdumprd | 5 ++++- 2 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 141a5614f1d5..bd1d95ea4bfd 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -382,3 +382,32 @@ get_ifcfg_filename() {
echo -n "${ifcfg_file}"
}
+# returns 0 when omission of watchdog module is desired in dracut_args +# returns 1 when addition of watchdog module is desired in dracut_args +# returns 2 when there is no option for watchdog module in dracut_args +check_wdt_mod_omission() {
- local dracut_args
- local ret=2
- dracut_args=$(grep "^dracut_args" /etc/kdump.conf)
- [[ -z $dracut_args ]] && return $ret
- eval set -- $dracut_args
- while :; do
[[ -z $1 ]] && break
case $1 in
-o|--omit)
echo $2 | grep -qw "watchdog"
[[ $? == 0 ]] && ret=0
shift;;
-a|--add)
echo $2 | grep -qw "watchdog"
[[ $? == 0 ]] && ret=1
shift;;
esac
shift
- done
- return $ret
+}
It looks over complex.
I did below test:
dracut -H -f a.img --printsize `uname -r`
- no watchdog added
dracut -a watchdog -o watchdog -H -f a.img --printsize `uname -r`
- no watchdog added
dracut -o watchdog -a watchdog -H -f a.img --printsize `uname -r`
- no watchdog added
dracut -a watchdog -H -f a.img --printsize `uname -r`
- watchdog being added
What ever options if one use -o watchdog in dracut_args the "-a" will be discarded. So how about just add -a watchdog in code if needed and add a code comment that dracut_args options "-o watchdog" will overwrite the "-a watchdog"? If one specify -a watchdog in dracut_args it does not matter as well
BTW, watchdog should be added when there is active watchdog in 1st kernel
It is still same. When we pass "-a watchdog" in dracut_args, only dracut watchdog module is added. kernel watchdog driver will be added by dracut only when there will be active watchdog.
Ideally we can do that in dracut module check() function (hostonly case) so we do not need anything in our code to check it. What do you think?
You meant that even when one adds dracut watchdog module, check() should not pass if there was not active watchdog? I am not sure if that is possible. We can confirm from Harald. My understanding is that if one adds module with "-a watchdog", that takes precedence over check() function. Not sure if it would be acceptable to dracut, if we modify check() for default option, so that check() returns success in case of active watchdog is present.
~Pratyush
diff --git a/mkdumprd b/mkdumprd index eb0d5e06fac9..f964940555ee 100644 --- a/mkdumprd +++ b/mkdumprd @@ -16,8 +16,11 @@ SAVE_PATH=$(grep ^path $conf_file| cut -d' ' -f2) # strip the duplicated "/" SAVE_PATH=$(echo $SAVE_PATH | tr -s /)
+check_wdt_mod_omission +[[ $? -eq 2 ]] && WDTCFG="-a watchdog"
extra_modules="" -dracut_args=("--hostonly" "-o" "plymouth dash resume ifcfg") +dracut_args=("--hostonly" "-o" "plymouth dash resume ifcfg" $WDTCFG) OVERRIDE_RESETTABLE=0
add_dracut_arg() {
2.5.5 _______________________________________________ kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/admin/lists/kexec@lists.fedoraproject.org
Thanks Dave
Thanks Dave
Hi, Pratyush
On 07/14/16 at 10:30am, Pratyush Anand wrote:
Hi Dave,
On 14/07/2016:10:57:11 AM, Dave Young wrote:
Hi, Pratyush
On 07/14/16 at 10:45am, Dave Young wrote:
Hi, Pratyush
On 07/13/16 at 01:37pm, Pratyush Anand wrote:
If dracut watchdog module is enabled then, it includes kernel watchdog module of active watchdog device in initramfs.
kdump.conf has an option to modify dracut_args. So, if an user passes "-a watchdog" in dracut_args then dracut will add kernel watchdog module of active watchdog device in initramfs.
Since, kexec-tools always requires to add kernel watchdog module of active watchdog device in initramfs, therefore even when an user does not pass any watchdog option then also kexec-tools adds "-a watchdog" in dracut args.
Therefore, if an user does not want to add kernel watchdog module in initramfs then he/she must pass "-o watchdog" in dracut_args.
Signed-off-by: Pratyush Anand panand@redhat.com
kdump-lib.sh | 29 +++++++++++++++++++++++++++++ mkdumprd | 5 ++++- 2 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 141a5614f1d5..bd1d95ea4bfd 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -382,3 +382,32 @@ get_ifcfg_filename() {
echo -n "${ifcfg_file}"
}
+# returns 0 when omission of watchdog module is desired in dracut_args +# returns 1 when addition of watchdog module is desired in dracut_args +# returns 2 when there is no option for watchdog module in dracut_args +check_wdt_mod_omission() {
- local dracut_args
- local ret=2
- dracut_args=$(grep "^dracut_args" /etc/kdump.conf)
- [[ -z $dracut_args ]] && return $ret
- eval set -- $dracut_args
- while :; do
[[ -z $1 ]] && break
case $1 in
-o|--omit)
echo $2 | grep -qw "watchdog"
[[ $? == 0 ]] && ret=0
shift;;
-a|--add)
echo $2 | grep -qw "watchdog"
[[ $? == 0 ]] && ret=1
shift;;
esac
shift
- done
- return $ret
+}
It looks over complex.
I did below test:
dracut -H -f a.img --printsize `uname -r`
- no watchdog added
dracut -a watchdog -o watchdog -H -f a.img --printsize `uname -r`
- no watchdog added
dracut -o watchdog -a watchdog -H -f a.img --printsize `uname -r`
- no watchdog added
dracut -a watchdog -H -f a.img --printsize `uname -r`
- watchdog being added
What ever options if one use -o watchdog in dracut_args the "-a" will be discarded. So how about just add -a watchdog in code if needed and add a code comment that dracut_args options "-o watchdog" will overwrite the "-a watchdog"? If one specify -a watchdog in dracut_args it does not matter as well
BTW, watchdog should be added when there is active watchdog in 1st kernel
It is still same. When we pass "-a watchdog" in dracut_args, only dracut watchdog module is added. kernel watchdog driver will be added by dracut only when there will be active watchdog.
Right for kernel drivers but dracut will still install useless scripts..
Ideally we can do that in dracut module check() function (hostonly case) so we do not need anything in our code to check it. What do you think?
You meant that even when one adds dracut watchdog module, check() should not pass if there was not active watchdog? I am not sure if that is possible. We can confirm from Harald. My understanding is that if one adds module with "-a watchdog", that takes precedence over check() function. Not sure if it would be acceptable to dracut, if we modify check() for default option, so that check() returns success in case of active watchdog is present.
Just for hostonly mode it should be fine, but check with Harald will be better..
~Pratyush
diff --git a/mkdumprd b/mkdumprd index eb0d5e06fac9..f964940555ee 100644 --- a/mkdumprd +++ b/mkdumprd @@ -16,8 +16,11 @@ SAVE_PATH=$(grep ^path $conf_file| cut -d' ' -f2) # strip the duplicated "/" SAVE_PATH=$(echo $SAVE_PATH | tr -s /)
+check_wdt_mod_omission +[[ $? -eq 2 ]] && WDTCFG="-a watchdog"
extra_modules="" -dracut_args=("--hostonly" "-o" "plymouth dash resume ifcfg") +dracut_args=("--hostonly" "-o" "plymouth dash resume ifcfg" $WDTCFG) OVERRIDE_RESETTABLE=0
add_dracut_arg() {
2.5.5 _______________________________________________ kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/admin/lists/kexec@lists.fedoraproject.org
Thanks Dave
Thanks Dave
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/admin/lists/kexec@lists.fedoraproject.org
Hi Dave,
On 14/07/2016:10:45:13 AM, Dave Young wrote:
Hi, Pratyush
On 07/13/16 at 01:37pm, Pratyush Anand wrote:
If dracut watchdog module is enabled then, it includes kernel watchdog module of active watchdog device in initramfs.
kdump.conf has an option to modify dracut_args. So, if an user passes "-a watchdog" in dracut_args then dracut will add kernel watchdog module of active watchdog device in initramfs.
Since, kexec-tools always requires to add kernel watchdog module of active watchdog device in initramfs, therefore even when an user does not pass any watchdog option then also kexec-tools adds "-a watchdog" in dracut args.
Therefore, if an user does not want to add kernel watchdog module in initramfs then he/she must pass "-o watchdog" in dracut_args.
Signed-off-by: Pratyush Anand panand@redhat.com
kdump-lib.sh | 29 +++++++++++++++++++++++++++++ mkdumprd | 5 ++++- 2 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 141a5614f1d5..bd1d95ea4bfd 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -382,3 +382,32 @@ get_ifcfg_filename() {
echo -n "${ifcfg_file}"
}
+# returns 0 when omission of watchdog module is desired in dracut_args +# returns 1 when addition of watchdog module is desired in dracut_args +# returns 2 when there is no option for watchdog module in dracut_args +check_wdt_mod_omission() {
- local dracut_args
- local ret=2
- dracut_args=$(grep "^dracut_args" /etc/kdump.conf)
- [[ -z $dracut_args ]] && return $ret
- eval set -- $dracut_args
- while :; do
[[ -z $1 ]] && break
case $1 in
-o|--omit)
echo $2 | grep -qw "watchdog"
[[ $? == 0 ]] && ret=0
shift;;
-a|--add)
echo $2 | grep -qw "watchdog"
[[ $? == 0 ]] && ret=1
shift;;
esac
shift
- done
- return $ret
+}
It looks over complex.
I did below test:
dracut -H -f a.img --printsize `uname -r`
- no watchdog added
Correct
dracut -a watchdog -o watchdog -H -f a.img --printsize `uname -r`
- no watchdog added
Correct
dracut -o watchdog -a watchdog -H -f a.img --printsize `uname -r`
- no watchdog added
Hummm, this seem a bit unexpected. I had impression that last option should take precedence and overwrite previous options. Isn't it a bug in dracut which should be fixed.
dracut -a watchdog -H -f a.img --printsize `uname -r`
- watchdog being added
Correct
What ever options if one use -o watchdog in dracut_args the "-a" will be discarded. So how about just add -a watchdog in code if needed and add a code comment that dracut_args options "-o watchdog" will overwrite the "-a watchdog"? If one specify -a watchdog in dracut_args it does not matter as well
OK. Still most part of the above function check_wdt_mod_omission() will still be there with some modification. I will still have to parse dracut_args to look for -o|--omit watchdog.
diff --git a/mkdumprd b/mkdumprd index eb0d5e06fac9..f964940555ee 100644 --- a/mkdumprd +++ b/mkdumprd @@ -16,8 +16,11 @@ SAVE_PATH=$(grep ^path $conf_file| cut -d' ' -f2) # strip the duplicated "/" SAVE_PATH=$(echo $SAVE_PATH | tr -s /)
+check_wdt_mod_omission +[[ $? -eq 2 ]] && WDTCFG="-a watchdog"
extra_modules="" -dracut_args=("--hostonly" "-o" "plymouth dash resume ifcfg") +dracut_args=("--hostonly" "-o" "plymouth dash resume ifcfg" $WDTCFG) OVERRIDE_RESETTABLE=0
add_dracut_arg() {
2.5.5 _______________________________________________ kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/admin/lists/kexec@lists.fedoraproject.org
~Pratyush
Hi, Pratyush
On 07/14/16 at 10:16am, Pratyush Anand wrote:
Hi Dave,
On 14/07/2016:10:45:13 AM, Dave Young wrote:
Hi, Pratyush
On 07/13/16 at 01:37pm, Pratyush Anand wrote:
If dracut watchdog module is enabled then, it includes kernel watchdog module of active watchdog device in initramfs.
kdump.conf has an option to modify dracut_args. So, if an user passes "-a watchdog" in dracut_args then dracut will add kernel watchdog module of active watchdog device in initramfs.
Since, kexec-tools always requires to add kernel watchdog module of active watchdog device in initramfs, therefore even when an user does not pass any watchdog option then also kexec-tools adds "-a watchdog" in dracut args.
Therefore, if an user does not want to add kernel watchdog module in initramfs then he/she must pass "-o watchdog" in dracut_args.
Signed-off-by: Pratyush Anand panand@redhat.com
kdump-lib.sh | 29 +++++++++++++++++++++++++++++ mkdumprd | 5 ++++- 2 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 141a5614f1d5..bd1d95ea4bfd 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -382,3 +382,32 @@ get_ifcfg_filename() {
echo -n "${ifcfg_file}"
}
+# returns 0 when omission of watchdog module is desired in dracut_args +# returns 1 when addition of watchdog module is desired in dracut_args +# returns 2 when there is no option for watchdog module in dracut_args +check_wdt_mod_omission() {
- local dracut_args
- local ret=2
- dracut_args=$(grep "^dracut_args" /etc/kdump.conf)
- [[ -z $dracut_args ]] && return $ret
- eval set -- $dracut_args
- while :; do
[[ -z $1 ]] && break
case $1 in
-o|--omit)
echo $2 | grep -qw "watchdog"
[[ $? == 0 ]] && ret=0
shift;;
-a|--add)
echo $2 | grep -qw "watchdog"
[[ $? == 0 ]] && ret=1
shift;;
esac
shift
- done
- return $ret
+}
It looks over complex.
I did below test:
dracut -H -f a.img --printsize `uname -r`
- no watchdog added
Correct
dracut -a watchdog -o watchdog -H -f a.img --printsize `uname -r`
- no watchdog added
Correct
dracut -o watchdog -a watchdog -H -f a.img --printsize `uname -r`
- no watchdog added
Hummm, this seem a bit unexpected. I had impression that last option should take precedence and overwrite previous options. Isn't it a bug in dracut which should be fixed.
-o has higer priority in dracut, so if one use -o unless force-add the module will be omitted. I think it is not a bug.
dracut -a watchdog -H -f a.img --printsize `uname -r`
- watchdog being added
Correct
What ever options if one use -o watchdog in dracut_args the "-a" will be discarded. So how about just add -a watchdog in code if needed and add a code comment that dracut_args options "-o watchdog" will overwrite the "-a watchdog"? If one specify -a watchdog in dracut_args it does not matter as well
OK. Still most part of the above function check_wdt_mod_omission() will still be there with some modification. I will still have to parse dracut_args to look for -o|--omit watchdog.
diff --git a/mkdumprd b/mkdumprd index eb0d5e06fac9..f964940555ee 100644 --- a/mkdumprd +++ b/mkdumprd @@ -16,8 +16,11 @@ SAVE_PATH=$(grep ^path $conf_file| cut -d' ' -f2) # strip the duplicated "/" SAVE_PATH=$(echo $SAVE_PATH | tr -s /)
+check_wdt_mod_omission +[[ $? -eq 2 ]] && WDTCFG="-a watchdog"
extra_modules="" -dracut_args=("--hostonly" "-o" "plymouth dash resume ifcfg") +dracut_args=("--hostonly" "-o" "plymouth dash resume ifcfg" $WDTCFG) OVERRIDE_RESETTABLE=0
add_dracut_arg() {
2.5.5 _______________________________________________ kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/admin/lists/kexec@lists.fedoraproject.org
~Pratyush _______________________________________________ kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/admin/lists/kexec@lists.fedoraproject.org
If state of a watchdog device is changed by an user after kdumpctl restart then initramfs must be rebuilt on the basis of new watchdog status.
Testing: ------------------------------------------------------- Initramfs wdt state Prev Current Result ------------------------------------------------------- Not Exist NA X Rebuild Exist Inact Inact No Rebuild Exist Inact Act Force Rebuild Exist Act Inact Force Rebuild Exist Act Act(Same wdt) No Rebuild Exist Act Act(Diff wdt) Force Rebuild
Signed-off-by: Pratyush Anand panand@redhat.com Acked-by: Dave Young dyoung@redhat.com --- kdumpctl | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
diff --git a/kdumpctl b/kdumpctl index c8fc54fc7677..802761375556 100755 --- a/kdumpctl +++ b/kdumpctl @@ -427,6 +427,32 @@ check_dump_fs_modified() return 1 }
+check_wdt_modified() +{ + check_wdt_mod_omission + [[ $? -eq 0 ]] && return 0 + [[ -d /sys/class/watchdog/ ]] || return 0 + + for dir in /sys/class/watchdog/*; do + [[ -d "$dir" ]] || continue + [[ -f "$dir/state" ]] || continue + wdtdrv=$(< "$dir/device/modalias") + wdtdrv=$(modinfo $wdtdrv | grep filename | awk -F"kernel/" '{print $2}') + active=$(< "$dir/state") + # rebuild when: + # module for this watchdog is not found and watchdog is active + # module for this watchdog is found and watchdog is inactive + lsinitrd $TARGET_INITRD | grep $wdtdrv &> /dev/null + if [ $? -ne 0 ]; then + [[ "$active" = "active" ]] && return 1 + else + [[ "$active" = "inactive" ]] && return 1 + fi + done + + return 0 +} + # returns 0 if system is not modified # returns 1 if system is modified # returns 2 if system modification is invalid @@ -448,6 +474,12 @@ check_system_modified() return $ret fi
+ check_wdt_modified + if [ $? -ne 0 ]; then + echo "Detected change in watchdog state" + return 1 + fi + return 0 }
Update howto with notes on dracut and kernel watchdog module handling.
Signed-off-by: Pratyush Anand panand@redhat.com --- kexec-kdump-howto.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/kexec-kdump-howto.txt b/kexec-kdump-howto.txt index b4cdc2227f1d..1cf726670981 100644 --- a/kexec-kdump-howto.txt +++ b/kexec-kdump-howto.txt @@ -616,6 +616,22 @@ options are copied from /proc/cmdline. In general it is best to append command line options using "KDUMP_COMMANDLINE_APPEND=" instead of replacing the original command line completely.
+Notes on watchdog module handling: + +If a watchdog is active in first kernel then, we must have it's module +loaded in crash kernel, so that either watchdog is deactivated or started +being kicked in second kernel. Otherwise, we might face watchdog reboot +when vmcore was being saved. When dracut watchdog module is enabled, it +installs kernel watchdog module of active watchdog device in initrd. Thus, +an user can control addition or omission of active watchdog module in crash +kernel by adding "-a watchdog" or "-o watchdog" in dracut_args of +kdump.conf respectively. When none of these options is passed in +dracut_args then addition is taken as default by kexec-tools. If a +watchdog module (such as hp_wdt) has not been written using watchdog-core +framework then this option will not have any effect and module will not be +added. Please note that only systemd watchdog daemon is supported as +watchdog kick application. + Parallel Dumping Operation ========================== Kexec allows kdump using multiple cpus. So parallel feature can accelerate
Now dracut takes care to add module for active watchdog. Therefore we do not need to pass iTCO_wdt and lpc_ich module in rd.driver.pre specifically here.
Signed-off-by: Pratyush Anand panand@redhat.com Acked-by: Dave Young dyoung@redhat.com --- dracut-module-setup.sh | 9 --------- 1 file changed, 9 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index aa204f871e25..f5c0218b36ed 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -729,12 +729,3 @@ install() { # at some point of time. kdump_check_iscsi_targets } - -installkernel() { - wdt=$(lsmod|cut -f1 -d' '|grep "wdt$") - if [ -n "$wdt" ]; then - [ "$wdt" = "iTCO_wdt" ] && instmods lpc_ich && - echo "rd.driver.pre=lpc_ich,iTCO_wdt " >> ${initdir}/etc/cmdline.d/00-wdt.conf - instmods $wdt - fi -}
Fedora dracut version >= 044-75 must be installed to work with this set of kexec-tools patches. Therefore adding dependency for them.
Signed-off-by: Pratyush Anand panand@redhat.com --- kexec-tools.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kexec-tools.spec b/kexec-tools.spec index 312965039ffc..b171e8c77d19 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -45,7 +45,8 @@ Requires(post): systemd-units Requires(preun): systemd-units Requires(postun): systemd-units Requires(pre): coreutils sed zlib -Requires: dracut, dracut-network, ethtool +Requires: dracut >= 044-75 +Requires: dracut-network, ethtool BuildRequires: zlib-devel zlib zlib-static elfutils-devel-static glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel BuildRequires: pkgconfig intltool gettext BuildRequires: systemd-units