Hi Dave,

The lsinitrd call is subject to the variable maxloglvl, and maxloglvl is
generated by:

for lvl in $stdloglvl $sysloglvl $fileloglvl $kmsgloglvl;
    do(( $lvl > $maxloglvl_l )) && maxloglvl_l=$lvl
done
readonly maxloglvl=$maxloglvl_l
export maxloglvl

so -L option(controlling stdloglvl) won't work.

BTW sysloglvl=2 works. I'll make a new patch for that.

On Tue, May 9, 2017 at 1:00 PM, Dave Young <dyoung@redhat.com> wrote:
Hi Ziyue,

On 05/09/17 at 10:01am, Ziyue Yang wrote:
> Currently in Fedora/RedHat dracut installs its fedora.conf.example
> as the default config file, in which sysloglvl is set 5. This leads
> to maxloglvl=5 in dracut calls, making unnecessary lsinitrd calls
> during initramfs builds.
>
> This patch makes use of --conf and --confdir arguments of dracut,
> creates temp config directory before mkdumprd(dracut) calls. It
> appends sysloglvl=0 option by creating a 99-kdumpctl.conf file in
> the temp config directory.
>
> 1) Before this patch
> $ kdumpctl stop; touch /etc/kdump.conf; time kdumpctl start
> kexec: unloaded kdump kernel
> Stopping kdump: [OK]
> Detected change(s) in the following file(s):
>   /etc/kdump.conf
> Rebuilding /boot/initramfs-4.10.10-200.fc25.x86_64kdump.img 4.10.10-200.fc25_x86_64
> kexec: loaded kdump kernel
> Starting kdump: [OK]
> real    0m18.716s
> user    0m13.863s
> sys     0m3.269s
>
> 2) After this patch
> $ kdumpctl stop; touch /etc/kdump.conf; time kdumpctl start
> kexec: unloaded kdump kernel
> Stopping kdump: [OK]
> Detected change(s) in the following file(s):
>   /etc/kdump.conf
> Rebuilding /boot/initramfs-4.10.10-200.fc25.x86_64kdump.img 4.10.10-200.fc25_x86_64
> kexec: loaded kdump kernel
> Starting kdump: [OK]
> real    0m13.665s
> user    0m10.945s
> sys     0m2.907s
>
> Signed-off-by: Ziyue Yang <ziyang@redhat.com>
> ---
>  kdumpctl | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/kdumpctl b/kdumpctl
> index 4d6b3e8..0612294 100755
> --- a/kdumpctl
> +++ b/kdumpctl
> @@ -5,7 +5,6 @@ KDUMP_KERNELVER=""
>  KDUMP_COMMANDLINE=""
>  KEXEC_ARGS=""
>  KDUMP_CONFIG_FILE="/etc/kdump.conf"
> -MKDUMPRD="/sbin/mkdumprd -f"
>  SAVE_PATH=/var/crash
>  SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
>  INITRD_CHECKSUM_LOCATION="/boot/.fadump_initrd_checksum"
> @@ -20,6 +19,18 @@ DEFAULT_DUMP_MODE="kdump"
>  image_time=0
>
>  [[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
> +
> +# lower dracut's default sysloglvl to speedup initramfs build
> +DRACUT_SYSLOGLVL="0"
> +# make temp dir for dracut conf files
> +[[ $dracutconfdir ]] || dracutconfdir=/tmp/kdumpctl.dracut.conf
> +mkdir -p $dracutconfdir/dracut.conf.d
> +[[ -e $dracutbasedir/dracut.conf.d ]] && cp -rf $dracutbasedir/dracut.conf.d $dracutconfdir/
> +[[ -e $dracutbasedir/dracut.conf ]] && cp -rf $dracutbasedir/dracut.conf $dracutconfdir/
> +echo "sysloglvl=$DRACUT_SYSLOGLVL" > $dracutconfdir/dracut.conf.d/99-kdumpctl.conf
> +
> +MKDUMPRD="/sbin/mkdumprd --conf $dracutconfdir/dracut.conf --confdir $dracutconfdir/dracut.conf.d -f"
> +

Looking at dracut manpage, there is an option --stdlog or -L,
       -L, --stdlog <level>
           [0-6] Specify logging level (to standard error)

                     0 - suppress any messages
                     1 - only fatal errors
                     2 - all errors
                     3 - warnings
                     4 - info
                     5 - debug info (here starts lots of output)
                     6 - trace info (and even more)

Can you try if this option works instead of copying the dracut config
files?

OTOH, use '0' seems mute all messages, but it is worth to try 2 and 1,
see if it also works, if 2 works then it would be better.

>  . $dracutbasedir/dracut-functions.sh
>  . /lib/kdump/kdump-lib.sh
>
> @@ -284,6 +295,9 @@ rebuild_initrd()
>               rebuild_kdump_initrd
>       fi
>
> +     # delete tmp conf folder for dracut
> +     rm -rf /tmp/kdumpctl.dracut.conf
> +
>       return $?
>  }
>
> --
> 2.9.3
> _______________________________________________
> kexec mailing list -- kexec@lists.fedoraproject.org
> To unsubscribe send an email to kexec-leave@lists.fedoraproject.org

Thanks
Dave