Commit Graph

8 Commits

Author SHA1 Message Date
Tao Liu
a501dcbd7b Set zstd as recommented for kexec-tools
resolves: bz1896698
upstream: fedora
conflict: none

commit b8ec5cbda89610244fdd4711e5974350f78e63e3
Author: Tao Liu <ltao@redhat.com>
Date:   Fri Jan 7 19:47:06 2022 +0800

    Set zstd as recommented for kexec-tools

    This patch will make zstd as recommended instead of required for
    kexec-tools. If zstd command/package is unavaliable, it can failback to invoke
    gzip when making kdump initramfs.

    Fixes: 0311f6e ("Set zstd as the default compression method for kdump initrd")

    Signed-off-by: Tao Liu <ltao@redhat.com>
    Acked-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-01-11 10:02:52 +08:00
Tao Liu
96dc819c25 Set zstd as the default compression method for kdump initrd
resolves: bz1896698
upstream: fedora
conflict: none

commit 0311f6e25b
Author: Tao Liu <ltao@redhat.com>
Date:   Wed Jan 5 17:42:12 2022 +0800

    Set zstd as the default compression method for kdump initrd

    zstd has better compression ratio and time consumption balance.
    When no customized compression method specified in kdump.conf,
    we will use zstd as the default compression method.

    **The test method:

    I installed kexec-tools with and without the patch, executing the following
    command for 4 times, and calculate the averange time:

    $ rm -f /boot/initramfs-*kdump.img && time kdumpctl rebuild && \
      ls -ail /boot/initramfs-*kdump.img

    **The test result:

    Bare metal x86_64 machine:
            dracut with squash module
             zlib     lzo      xz       lz4        zstd
    real     10.6282  11.0398  11.395   8.6424    10.1676
    user      9.8932  11.9072  14.2304  2.8286     8.6468
    sys       3.523    3.4626   3.6028  3.5        3.4942
    size of
    kdump.img 30575616 31419392 27102208 36666368 29236224

            dracut without squash module
            zlib      lzo      xz       lz4        zstd
    real     9.509    19.4876  11.6724  9.0338    10.267
    user    10.6028   14.516   17.8662  4.0476     9.0936
    sys      2.942     2.9184   3.0662  2.9232     3.0662
    size of
    kdump.img 19247949 19958120 14505056 21112544 17007764

    PowerVM hosted ppc64le VM:
            dracut with squash module | dracut without sqaush module
             zlib        zstd         |  zlib          zstd
    real     10.6742     10.7572      |   9.7676       10.5722
    user     18.754      19.8338      |  20.7932       13.179
    sys       1.8358      1.864       |   1.637         1.663
                                      |
    size of                           |
    kdump.img 36917248   35467264     |  21441323      19007108

    **discussion

    zstd has a better compression ratio and time consumption balance.

    Acked-by: Coiby Xu <coxu@redhat.com>
    Signed-off-by: Tao Liu <ltao@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2022-01-06 14:36:29 +08:00
Tao Liu
b494b7f193 bash scripts: reformat with shfmt
upstream: fedora
resolves: bz2003832
conflict:
    function load_kdump_kernel_key() not exist in rhel9,
    so related patch hunk is removed.

commit 0e4b66b1ab
Author: Kairui Song <kasong@redhat.com>
Date:   Tue Sep 14 02:25:40 2021 +0800

    bash scripts: reformat with shfmt

    This is a batch update done with:
    shfmt -s -w mkfadumprd mkdumprd kdumpctl *-module-setup.sh

    Clean up code style and reduce code base size, no behaviour change.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 21:42:45 +08:00
Tao Liu
63308480fc bash scripts: declare and assign separately
upstream: fedora
resolves: bz2003832
conflict: none

commit 4f75e16700
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 18 02:04:45 2021 +0800

    bash scripts: declare and assign separately

    Declare and assign separately to avoid masking return values:
    https://github.com/koalaman/shellcheck/wiki/SC2155

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 21:37:15 +08:00
Tao Liu
dcb59c30d5 bash scripts: replace '[ ]' with '[[ ]]' for bash scripts
upstream: fedora
resolves: bz2003832
conflict:
    function load_kdump_kernel_key() not presented in rhel9,
    so related patch hunk are removed.

commit 70978c00e5
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Sep 8 17:20:51 2021 +0800

    bash scripts: replace '[ ]' with '[[ ]]' for bash scripts

    kdumpctl, mkdumprd, *-module-setup.sh only target bash, since they
    only run in first kernel and depend on dracut, and dracut depends
    on bash. So use '[[ ]]' to replace '[ ]'.

    This is a batch update done with following command:
    `sed -i -e 's/\(\s\)\[\s\([^]]*\)\s\]/\1\[\[\ \2 \]\]/g' kdumpctl, mkdumprd, *-module-setup.sh`
    and replaced [ ... -a ... ] with [[ ... ]] && [[ ... ]] manually.

    See https://tldp.org/LDP/abs/html/testconstructs.html for more details
    on '[[ ]]', it's more versatile, safer, and slightly faster than '[ ]'.

    This will also help shfmt to clean up the code in later commits.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-09 21:13:59 +08:00
Tao Liu
caa2405338 mkfadumprd: make _dracut_isolate_args an array
upstream: fedora
resolves: bz2003832
conflict: none

commit 982205d607
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 4 03:06:57 2021 +0800

    mkfadumprd: make _dracut_isolate_args an array

    To make arguments list work as expected, array is preferred.

    Check following link for details:
    https://github.com/koalaman/shellcheck/wiki/SC2089

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-03 16:13:10 +08:00
Kairui Song
8e51ebe6fb fadump: kdumpctl should check the modules used by the fadump initramfs
Resolves: bz1924115
Conflict: None
Upstream: Fedora

commit bf6671b60d
Author: Kairui Song <kasong@redhat.com>
Date:   Fri Jun 25 14:44:45 2021 +0800

    fadump: kdumpctl should check the modules used by the fadump initramfs

    After fadump embedded the fadump initramfs in the normal initramfs,
    kdumpctl will mistakenly rebuild the initramfs everytime.

    kdumpctl checks the hostonly-kernel-modules.txt file in initramfs
    to check if required drivers are included, but the normal initramfs
    is built in non-hostonly mode, so it doesn't have a
    hostonly-kernel-modules.txt file. The check will always fail.

    So let mkfadumprd make a copy of the hostonly-kernel-modules.txt in the
    fadump initramfs and let kdumpctl check that file instead.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Hari Bathini <hbathini@linux.ibm.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-07-20 15:43:26 +08:00
Kairui Song
96a3fc1ac8 fadump: isolate fadump initramfs image within the default one
Resolves: bz1924115
Conflict: None
Upstream: Fedora

commit fa9201b240 (devel)
Author: Hari Bathini <hbathini@linux.ibm.com>
Date:   Wed Jun 23 20:06:48 2021 +0530

    fadump: isolate fadump initramfs image within the default one

    In case of fadump, the initramfs image has to be built to boot into
    the production environment as well as to offload the active crash dump
    to the specified dump target (for boot after crash). As the same image
    would be used for both boot scenarios, it could not be built optimally
    while accommodating both cases.

    Use --include to include the initramfs image built for offloading
    active crash dump to the specified dump target. Also, introduce a new
    out-of-tree dracut module (99zz-fadumpinit) that installs a customized
    init program while moving the default /init to /init.dracut. This
    customized init program is leveraged to isolate fadump image within
    the default initramfs image by kicking off default boot process
    (exec /init.dracut) for regular boot scenario and activating fadump
    initramfs image, if the system is booting after a crash.

    If squash is available, ensure default initramfs image is also built
    with squash module to reduce memory consumption in capture kernel.

    Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-07-20 15:43:11 +08:00