Commit Graph

41 Commits

Author SHA1 Message Date
Tao Liu
2bc8a0d274 Revert "Remove trace_buf_size and trace_event from the kernel bootparameters of the kdump kernel"
upstream: fedora
conflict: none
resolves: bz2042726

commit 99de77bba7
Author: Tao Liu <ltao@redhat.com>
Date:   Fri Jan 21 16:08:47 2022 +0800

    Revert "Remove trace_buf_size and trace_event from the kernel bootparameters of the kdump kernel"

    There is a mechanism to keep memory consumption minimum, i.e. equal
    to trace_buf_size=1, until tracing by ftrace is actually started:

        tracing: keep ring buffer to minimum size till used
        73c5162aa3

    Since ftrace is usually never used in the kdump 2nd kernel, the kdump
    2nd kernel behaves in the same way with or without trace_buf_size=1.
    So the issue which the patch want to solve never exists. Let's revert
    the patch for better maintainance and avoid confusion.

    ref link: https://bugzilla.redhat.com/show_bug.cgi?id=2034501#c20

    This reverts commit f39000f.

    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-26 14:58:39 +08:00
Coiby Xu
80a37c95ee fix broken kdump_get_arch_recommend_size
Resolves: bz2045971
Upstream: Fedora
Conflict: None

commit 2df55984f6
Author: Coiby Xu <coxu@redhat.com>
Date:   Wed Jan 26 08:48:18 2022 +0800

    fix broken kdump_get_arch_recommend_size

    shellcheck finds the following problem,
    $ shellcheck kdump-lib.sh
    In kdump-lib.sh line 876:
            get_recommend_size "$sys_mem" "$ck_cmdline"
                                           ^---------^ SC2154: ck_cmdline is referenced but not assigned (did you mean '_ck_cmdline'?).

    s/ck_cmdline/_ck_cmdline to fix kdump_get_arch_recommend_size.

    Note s/sys_mem/_sys_mem as well to make the changes consistent.

    Fixes: 105c016 ("factor out kdump_get_arch_recommend_crashkernel")
    Signed-off-by: Coiby Xu <coxu@redhat.com>
    Acked-by: Tao Liu <ltao@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2022-01-26 14:41:01 +08:00
Coiby Xu
4e511ca370 remove the upper bound of 102400T for the range in default crashkernel
Resolves: bz2045969
Upstream: Fedora
Conflict: None

commit c67a836cde
Author: Coiby Xu <coxu@redhat.com>
Date:   Tue Jan 25 16:16:58 2022 +0800

    remove the upper bound of 102400T for the range in default crashkernel

    This patch makes the default crashkernel value consistent with previous
    one.

    Fixes: 105c016 ("factor out kdump_get_arch_recommend_crashkernel")
    Signed-off-by: Coiby Xu <coxu@redhat.com>
    Reviewed-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2022-01-26 14:40:17 +08:00
Pingfan Liu
e5c3e96985 move variable FENCE_KDUMP_SEND from kdump-lib.sh to kdump-lib-initramfs.sh
Resolves: bz2031736
Upstream: Fedora
Conflict: None

commit 3cd561fcbcb3ba4f285e746d81e1e6dae17447c3 (HEAD)
Author: Pingfan Liu <piliu@redhat.com>
Date:   Tue Jan 18 10:42:00 2022 +0800

    move variable FENCE_KDUMP_SEND from kdump-lib.sh to kdump-lib-initramfs.sh

    Since kdump-lib-initramfs.sh is included by kdump-lib.sh, and
    FENCE_KDUMP_SEND is used by both 1st and 2nd kernel, moving
    FENCE_KDUMP_SEND from kdump-lib.sh to kdump-lib-initramfs.sh.

    Signed-off-by: Pingfan Liu <piliu@redhat.com>
    Acked-by: Tao Liu <ltao@redhat.com>

Signed-off-by: Pingfan Liu <piliu@redhat.com>
2022-01-18 15:16:29 +08:00
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
90223d3c71 kdump-lib.sh: Escape '|' for 'failure_action|default' in is_dump_to_rootfs
resolves: bz2031735
upstream: fedora
conflict: none

commit 2bd59ee156 (origin/rawhide, origin/main)
Author: Tao Liu <ltao@redhat.com>
Date:   Thu Jan 6 11:46:54 2022 +0800

    kdump-lib.sh: Escape '|' for 'failure_action|default' in is_dump_to_rootfs

    The '|' in 'failure_action|default' should be replaced with '\|' when
    passed to kdump_get_conf_val function. Because '|' needs to be escaped
    to mean OR operation in sed regex, otherwise it will consider
    'failure_action|default' as a whole string.

    Fixes: ab1ef78 ("kdump-lib.sh: use kdump_get_conf_val to read config values")

    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-06 14:35:53 +08:00
Coiby Xu
1ab9685afa factor out kdump_get_arch_recommend_crashkernel
Resolves: bz1895258
Upstream: Fedora
Conflict: None

commit 105c01691a
Author: Coiby Xu <coxu@redhat.com>
Date:   Tue Nov 16 11:26:31 2021 +0800

    factor out kdump_get_arch_recommend_crashkernel

    Factor out kdump_get_arch_recommend_crashkernel to prepare for
    kdump-anaconda-plugin for example to retrieve the default crashkernel
    value.

    Note the support of crashkenrel.default is dropped.

    Reviewed-by: Pingfan Liu <piliu@redhat.com>
    Reviewed-by: Philipp Rudo <prudo@redhat.com>
    Signed-off-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2022-01-06 03:55:25 +00:00
Coiby Xu
33a9e54ff2 update default crashkernel value
Resolves: bz1895258
Upstream: Fedora
Conflict: None

commit 34d27c4c30
Author: Coiby Xu <coxu@redhat.com>
Date:   Tue Nov 16 09:12:49 2021 +0800

    update default crashkernel value

    It has been decided to increase default crashkernel value to reduce the
    possibility of OOM.

    Fixes: 7b7ddab ("kdump-lib.sh: kdump_get_arch_recommend_size uses crashkernel.default")

    Reviewed-by: Pingfan Liu <piliu@redhat.com>
    Reviewed-by: Philipp Rudo <prudo@redhat.com>
    Signed-off-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2022-01-06 03:55:25 +00:00
Coiby Xu
eb95f93880 kdumpctl: enable secure boot on ppc64le LPARs
Resolves: bz1931802
Upstream: Fedora
Conflict: The upstream commit was submitted before shfmt and .editorconfig.
          So there are issues like 4 spaces verse tab indentation, double
          brackets verse single bracket and etc.

commit 596fa0a07f
Author: Pingfan Liu <piliu@redhat.com>
Date:   Thu Feb 18 14:01:18 2021 +0800

    kdumpctl: enable secure boot on ppc64le LPARs

    On ppc64le LPAR, secure-boot is a little different from bare metal,
    Where
      host secure boot: /ibm,secure-boot/os-secureboot-enforcing DT property exists
    while
      guest secure boot: /ibm,secure-boot >= 2

    Make kexec-tools adapt to LPAR

    Signed-off-by: Pingfan Liu <piliu@redhat.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2021-11-26 12:03:07 +08:00
Tao Liu
d53e0655f1 kdump-lib.sh: reformat with shfmt
upstream: fedora
resolves: bz2003832
conflict:
    Regenerated with shfmt command because of
    too much hunk patches. When comparing with the original
    patch, only patch "kdumpctl: enable secure boot on ppc64le LPARs"
    related hunks are different.

commit 4cdce1f489
Author: Kairui Song <kasong@redhat.com>
Date:   Tue Sep 14 03:09:30 2021 +0800

    kdump-lib.sh: reformat with shfmt

    This is a batch update done with:
    shfmt -s -w kdump-lib.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-10 10:26:29 +08:00
Tao Liu
040a2e259f kdump-lib.sh: declare and assign separately
upstream: fedora
resolves: bz2003832
conflict: none

commit 20089dddd5
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Sep 8 03:48:19 2021 +0800

    kdump-lib.sh: declare and assign separately

    See: https://github.com/koalaman/shellcheck/wiki/SC2155

    Signed-off-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-10 10:26:12 +08:00
Tao Liu
653edd848c kdump-lib.sh: fix variable quoting issue
upstream: fedora
resolves: bz2003832
conflict: none

commit 4f01cb1b0a
Author: Kairui Song <kasong@redhat.com>
Date:   Mon Sep 13 01:18:04 2021 +0800

    kdump-lib.sh: fix variable quoting issue

    Fixed quoting issues found by shellcheck, no feature
    change. This should fix many errors when there is space
    in any shell variables.

    And fixed how remove_cmdline_param is being called in prepare_cmdline.
    Kernel parameters can have space like: param="spaces in here". So currently
    remove_cmdline_param is broken since its args always get split by space.
    But prepare_cmdline is expecting remove_cmdline_param to split its args
    by space and passing a list of kernel args separated by space as a whole arg.
    So fix that by using `xargs` to parse and split the args properly, then
    call remove_cmdline_param.

    Following quoting related issues are fixed (check the link
    for example code and what could go wrong):

    https://github.com/koalaman/shellcheck/wiki/SC1007
    https://github.com/koalaman/shellcheck/wiki/SC2046
    https://github.com/koalaman/shellcheck/wiki/SC2053
    https://github.com/koalaman/shellcheck/wiki/SC2060
    https://github.com/koalaman/shellcheck/wiki/SC2068
    https://github.com/koalaman/shellcheck/wiki/SC2086

    Signed-off-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-10 10:24:19 +08:00
Tao Liu
078307f19f Remove trace_buf_size and trace_event from the kernel bootparameters of the kdump kernel
upstream: fedora
resolves: bz2003832
conflict: none

commit f39000f524
Author: fj1508ic@fujitsu.com <fj1508ic@fujitsu.com>
Date:   Tue Jan 26 06:37:28 2021 +0000

    Remove trace_buf_size and trace_event from the kernel bootparameters of the kdump kernel

    The kdump kernel uses resources for ftrace because trace_buf_size, which
    specifies the ring buffer size for ftrace, and trace_event, which specifies
    a valid trace event, are not removed, but the kdump kernel does not require
    ftrace.

    trace_buf_size is ignored if the specified size is 0, so specify 1.

    Signed-off-by: Hisashi Nagaoka <fj1508ic@fujitsu.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-11-10 10:20:27 +08:00
Tao Liu
beac78b8e7 kdump-lib.sh: fix a few ambiguous or redundant code
upstream: fedora
resolves: bz2003832
conflict: none

commit 319219d23b
Author: Kairui Song <kasong@redhat.com>
Date:   Mon Sep 13 01:17:23 2021 +0800

    kdump-lib.sh: fix a few ambiguous or redundant code

    Fix a few ambiguous syntax issues and remove some unused variables.
    Also refactor some code to make it more robust.

    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:53:46 +08:00
Tao Liu
d8f8b09fa0 kdump-lib.sh: fix arithmetic operation syntax
upstream: fedora
resolves: bz2003832
conflict: none

commit c0edb80b8f
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Sep 8 13:31:31 2021 +0800

    kdump-lib.sh: fix arithmetic operation syntax

    Get rid of let, and remove useless '$' on arithmetic variables.

    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:53:37 +08:00
Tao Liu
6dbf7c2e6c kdump-lib.sh: remove useless echo and cat
upstream: fedora
resolves: bz2003832
conflict: none

commit 53813e8b9a
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Sep 8 02:48:17 2021 +0800

    kdump-lib.sh: remove useless echo and cat

    Replace echo "$(cmd)" and "var=$(cmd); echo $var" with just `cmd`.
    And remove some useless cat.

    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:53:12 +08:00
Tao Liu
c9f583baa4 kdump-lib.sh: rework nmcli related functions
upstream: fedora
resolves: bz2003832
conflict: none

commit 58d3e6db3a
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Sep 8 15:20:42 2021 +0800

    kdump-lib.sh: rework nmcli related functions

    This fixes word splitting issue with nmcli args. Current kexec-tools
    scripts won't call nmcli with correct arguments when there are space in
    network interface name.

    nmcli expects multiple parameters, but get_nmcli_value_by_field only
    accepts two params and depends on shell word splitting to split the
    _nm_show_cmd into multiple params, which is very fragile.
    So switch the param order, simplified this function and now multiple
    params can be used properly.

    And get_nmcli_connection_show_cmd_by_ifname returns multiple
    nmcli params in a single variable, it depend on shell word splitting to
    split the words when calling nmcli. But this is very fragile and break
    easily when there are any special character in the connection path.

    This function is only introduced to get and cache the nmcli command
    which contains the "connection name".

    Actually only cache the "connection path" is enough. Callers should
    just call get_nmcli_connection_apath_by_ifname to cache the path, and
    a new helper get_nmcli_field_by_conpath is introduced here to get value
    from nmcli. This way "connection path" can contain any character.

    Also get rid of another nmcli_cmd usage in
    get_nmcli_connection_apath_by_ifname which stores multiple params in a
    single bash variable separated by space.

    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:53:00 +08:00
Tao Liu
60e5a1e7a5 kdump-lib.sh: replace '[ ]' with '[[ ]]' and get rid of legacy ``
upstream: fedora
resolves: bz2003832
conflict:
    Patch hunk modified for function is_secure_boot_enforced().

commit 30090f3a15
Author: Kairui Song <kasong@redhat.com>
Date:   Mon Sep 13 01:17:05 2021 +0800

    kdump-lib.sh: replace '[ ]' with '[[ ]]' and get rid of legacy ``

    Updated file syntax with following command:

    sed -i -e 's/\(\s\)\[\s\([^]]*\)\s\]/\1\[\[\ \2 \]\]/g' kdump-lib.sh
    (replace '[ ]' with '[[ ]]')

    sed -i -e 's/`\([^`]*\)`/\$(\1)/g' kdump-lib.sh
    (replace `...` with $(...))

    And manually updated [[ ... -a ... ]] and [[ ... -o ... ]] with && and
    ||.

    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:52:36 +08:00
Tao Liu
35519c3eca kdump-lib-initramfs.sh: prepare to be a POSIX compatible lib
upstream: fedora
resolves: bz2003832
conflict: none

commit a5faa052d4
Author: Kairui Song <kasong@redhat.com>
Date:   Tue Sep 14 03:25:46 2021 +0800

    kdump-lib-initramfs.sh: prepare to be a POSIX compatible lib

    Move all functions needed in the second kernel from kdump-lib.sh
    to kdump-lib-initramfs.sh, and update shebang headers.

    Now, kdump-lib-initramfs.sh is an independent lib script, no longer
    depend on kdump-lib.sh, and kdump-lib.sh is no longer needed for
    the second kernel.

    In later commits, functions in kdump-lib-initramfs.sh will be reworked
    to be POSIX compatible, kdump-lib.sh will contain bash only functions.

    POSIX shell have very limited features, eg. `local` keyword doesn't
    exist in POSIX but we rely on that heavily. So kdump-lib.sh will
    use bash syntax and contain the most complex helper and codes.

    kdump-lib-initramfs.sh will contain the minimum set of helpers,
    and be shared by both the first and second kernel.

    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:45:15 +08:00
Tao Liu
9a937b5e22 kdump-lib.sh: use kdump_get_conf_val to read config values
upstream: fedora
resolves: bz2003832
conflict: none

commit ab1ef78aa2
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 4 01:18:48 2021 +0800

    kdump-lib.sh: use kdump_get_conf_val to read config values

    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:09:16 +08:00
Tao Liu
14205c1d6f kdump-lib.sh: add a config value retrive helper
upstream: fedora
resolves: bz2003832
conflict: none

commit 09ccf88405
Author: Kairui Song <kasong@redhat.com>
Date:   Mon Aug 16 23:25:14 2021 +0800

    kdump-lib.sh: add a config value retrive helper
    Add a helper kdump_get_conf_val to replace get_option_value.

    It can help cover more corner cases in the code, like when there are
    multiple spaces in config file, config value separated by a tab,
    heading spaces, or trailing comments.

    And this uses "sed group command" and "sed hold buffer", make it much
    faster than previous `grep <config> | tail -1`.

    This helper is supposed to provide a universal way for kexec-tools
    scripts to read in config value. Currently, different scripts are
    reading the config in many different fragile ways.

    For example, following codes are found in kexec-tools script code base:
      1. grep ^force_rebuild $KDUMP_CONFIG_FILE
	 echo $_force_rebuild | cut -d' '  -f2

      2. grep ^kdump_post $KDUMP_CONFIG_FILE | cut -d\  -f2

      3. awk '/^sshkey/ {print $2}' $conf_file

      4. grep ^path $KDUMP_CONFIG_FILE | cut -d' '  -f2-

    1, 2, and 4 will fail if the space is replaced by, e.g. a tab

    1 and 2 might fail if there are multiple spaces between config name
    and config value:
    "kdump_post  /var/crash/scripts/kdump-post.sh"
    A space will be read instead of config value.

    1, 2, 3 will fail if there are space in file path, like:
    "kdump_post /var/crash/scripts dir/kdump-post.sh"

    4 will fail if there are trailing comments:
    "path /var/crash # some comment here"

    And all will fail if there are heading space,
    " path /var/crash"

    And all will most likely cause problems if the config file contains
    the same option more than once.

    And all of them are slower than the new sed call. Old get_option_value
    is also very slow and doesn't handle heading space.

    Although we never claim to support heading space or tailing comments
    before, it's harmless to be more robust on config reading, and many
    conf files in /etc support heading spaces. And have a faster and
    safer config reading helper makes it easier to clean up the code.

    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:08:50 +08:00
Tao Liu
67b8dd1cb8 kdump-lib.sh: add a config format and read helper
upstream: fedora
resolves: bz2003832
conflict: none

commit a0282ab22c
Author: Kairui Song <kasong@redhat.com>
Date:   Tue Aug 3 19:49:51 2021 +0800

    kdump-lib.sh: add a config format and read helper

    Add a helper `kdump_read_conf` to replace read_strip_comments.
    `kdump_read_conf` does a few more things:

      - remove trailing spaces.
      - format the content, remove duplicated spaces between name and value.
      - read from KDUMP_CONFIG_FILE (/etc/kdump.conf) directly, avoid pasting
	"/etc/kdump.conf" path everywhere in the code.
      - check if config file exists, just in case.

    Also unify the environmental variable, now KDUMP_CONFIG_FILE stands for
    the default config location.

    This helps avoid some shell pitfalls about spaces when reading config.

    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:08:22 +08:00
Kairui Song
abb0c38b7f kdump-lib.sh: kdump_get_arch_recommend_size uses crashkernel.default
Resolves: bz1986281
Conflict: None
Upstream: Fedora

commit 7b7ddaba88
Author: Kairui Song <kasong@redhat.com>
Date:   Fri Jul 2 01:31:26 2021 +0800

    kdump-lib.sh: kdump_get_arch_recommend_size uses crashkernel.default

    The new `crashkernel.default` file in kernel package can be used as the
    ck_cmdline source.

    Also keep the legacy code so old kernel packages will still work.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Pingfan Liu <piliu@redhat.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-07-30 15:22:14 +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
Kairui Song
80c1913e4a Revert "kdump-lib.sh: Remove is_atomic"
Resolves: bz1974638
Upstream: Fedora
Conflict: None

commit 017903c3c4
Author: Kairui Song <kasong@redhat.com>
Date:   Fri Jun 25 03:42:19 2021 +0800

    Revert "kdump-lib.sh: Remove is_atomic"

    Now we need this helper again, for `reset-crashkernel`

    This reverts commit ff46cfb19e.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Baoquan He <bhe@redhat.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-07-08 15:40:44 +08:00
Pingfan Liu
8ce1f3c1df kdump-lib.sh: fix a warning in prepare_kdump_bootinfo()
Resolves: bz1968374
Upstream: Fedora
Conflict: None

commit 39a642b66b
Author: Hari Bathini <hbathini@linux.ibm.com>
Date:   Tue Jun 1 16:46:58 2021 +0530

    kdump-lib.sh: fix a warning in prepare_kdump_bootinfo()

    Fix the warning observed when KDUMP_KERNELVER is specified:

      kdumpctl[10926]: /lib/kdump/kdump-lib.sh: line 697: [: missing `]'

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

Signed-off-by: Pingfan Liu <piliu@redhat.com>
2021-06-25 11:39:31 +08:00
Tao Liu
5f4c5f9819 Write to /var/lib/kdump if $KDUMP_BOOTDIR not writable
Resolves: bz1965952
Upstream: Fedora
Conflict: None

commit 75bdcb7399
Author: Kelvin Fan <kfan@redhat.com>
Date:   Fri Apr 16 22:31:13 2021 +0000

    Write to `/var/lib/kdump` if $KDUMP_BOOTDIR not writable

    The `/boot` directory on some operating systems might be read-only.
    If we cannot write to `$KDUMP_BOOTDIR` when generating the kdump
    initrd, attempt to place the generated initrd at `/var/lib/kdump`
    instead.

    Signed-off by: Kelvin Fan <kelvinfan001@gmail.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
2021-06-23 09:34:40 +08:00
Pingfan Liu
73929fc549 kdump-lib.sh: fix the case if no enough total RAM for kdump in get_recommend_size()
Resolves: bz1952342
Upstream: Fedora
Conflict: None

commit 45377836b0
Author: Pingfan Liu <piliu@redhat.com>
Date:   Tue May 25 09:26:09 2021 +0800

    kdump-lib.sh: fix the case if no enough total RAM for kdump in get_recommend_size()

    For crashkernel=auto policy, if total RAM size is under a throttle,
    there is no memory reserved for kdump.

    Also correct a trivial bug by correcting the arch name.

    Signed-off-by: Pingfan Liu <piliu@redhat.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Pingfan Liu <piliu@redhat.com>
2021-05-25 10:36:01 +08:00
Kairui Song
a9fda5c885 kdumpctl: Add kdumpctl estimate
Resolves: bz1951415
Upstream: fedora
Conflict: none

commit e9e6a2c745
Author: Kairui Song <kasong@redhat.com>
Date:   Thu Apr 22 03:27:10 2021 +0800

    kdumpctl: Add kdumpctl estimate

    Add a rough esitimation support, currently, following memory usage are
    checked by this sub command:

    - System RAM
    - Kdump Initramfs size
    - Kdump Kernel image size
    - Kdump Kernel module size
    - Kdump userspace user and other runtime allocated memory (currently
      simply using a fixed value: 64M)
    - LUKS encryption memory usage

    The output of kdumpctl estimate looks like this:
      # kdumpctl estimate
      Reserved crashkernel:    256M
      Recommanded crashkernel: 160M

      Kernel image size:   47M
      Kernel modules size: 12M
      Initramfs size:      19M
      Runtime reservation: 64M
      Large modules:
          xfs: 1892352
          nouveau: 2318336

    And if the kdump target is encrypted:
      # kdumpctl estimate
      Encrypted kdump target requires extra memory, assuming using the keyslot with minimun memory requirement

      Reserved crashkernel:    256M
      Recommanded crashkernel: 655M

      Kernel image size:   47M
      Kernel modules size: 12M
      Initramfs size:      19M
      Runtime reservation: 64M
      LUKS required size:  512M
      Large modules:
          xfs: 1892352
          nouveau: 2318336
      WARNING: Current crashkernel size is lower than recommanded size 655M.

    The "Recommanded" value is calculated based on memory usages mentioned
    above, and will be adjusted accodingly to be no less than the value provided
    by kdump_get_arch_recommend_size.

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Pingfan Liu <piliu@redhat.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-05-20 16:08:16 +08:00
Kairui Song
8387b514f1 kdump-lib.sh: introduce a helper to get all crypt dev used by kdump
Resolves: bz1951415
Upstream: fedora
Conflict: None

commit 1c70cf51c7
Author: Kairui Song <kasong@redhat.com>
Date:   Tue May 18 16:13:16 2021 +0800

    kdump-lib.sh: introduce a helper to get all crypt dev used by kdump

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Pingfan Liu <piliu@redhat.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-05-20 16:08:05 +08:00
Kairui Song
ccdd4f2894 kdump-lib.sh: introduce a helper to get underlying crypt device
Resolves: bz1951415
Upstream: fedora
Conflict: None

commit 3423bbc17f
Author: Kairui Song <kasong@redhat.com>
Date:   Thu Apr 8 01:36:49 2021 +0800

    kdump-lib.sh: introduce a helper to get underlying crypt device

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Pingfan Liu <piliu@redhat.com>

Signed-off-by: Kairui Song <kasong@redhat.com>
2021-05-20 16:07:37 +08:00
Coiby Xu
b15a090483 Add helper to get nmcli connection show cmd by ifname
Resolves: bz1919052
Upstream: Fedora
Conflict: None

commit 0c292f49c7
Author: Coiby Xu <coxu@redhat.com>
Date:   Thu Apr 1 15:32:10 2021 +0800

    Add helper to get nmcli connection show cmd by ifname

    Signed-off-by: Coiby Xu <coxu@redhat.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2021-05-14 06:14:14 +00:00
Coiby Xu
2f9fc88963 Add helper to get nmcli connection apath by ifname
Resolves: bz1919052
Upstream: Fedora
Conflict: None

commit c69578ca43
Author: Coiby Xu <coxu@redhat.com>
Date:   Thu Apr 1 15:32:09 2021 +0800

    Add helper to get nmcli connection apath by ifname

    apath (a D-Bus active connection path) is used for nmcli connection operations, e.g.
      $ nmcli connection show $apath

    Signed-off-by: Coiby Xu <coxu@redhat.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2021-05-14 06:14:14 +00:00
Coiby Xu
d09dc2f45e Add helper to get value by field using "nmcli --get-values"
Resolves: bz1919052
Upstream: Fedora
Conflict: None

commit 10c309b5f7
Author: Coiby Xu <coxu@redhat.com>
Date:   Thu Apr 1 15:32:08 2021 +0800

    Add helper to get value by field using "nmcli --get-values"

    nmcli --get-values <field> connection show /org/freedesktop/NetworkManager/ActiveConnection/1
    returns the following value for the corresponding field respectively,
      Field                                  Value
      IP4.DNS                                "10.19.42.41 | 10.11.5.19 | 10.5.30.160"
      802-3-ethernet.s390-subchannels        ""
      bond.options                           "mode=balance-rr"

    Signed-off-by: Coiby Xu <coxu@redhat.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2021-05-14 06:14:14 +00:00
Pingfan Liu
540d33a082 kdump-lib.sh: introduce functions to return recommened mem size
Resolves: bz1892558
Upstream: Fedora
Conflict: None

commit 18131894b6
Author: Pingfan Liu <piliu@redhat.com>
Date:   Thu Feb 4 09:45:36 2021 +0800

    kdump-lib.sh: introduce functions to return recommened mem size

    There is requirement to decide the recommended memory size for the current
    system. And the algorithm is based on /proc/iomem, so it can align with the
    algorithm used by reserve_crashkernel() in kernel.

    Signed-off-by: Pingfan Liu <piliu@redhat.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Pingfan Liu <piliu@redhat.com>
2021-04-27 10:20:25 +08:00
DistroBaker
624a6443ca Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/kexec-tools.git#33108ef524ff033295711f888ce2c67d457951aa
2021-01-22 08:12:00 +00:00
DistroBaker
a1014067b4 Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/kexec-tools.git#d5e39c9f7b721b80d2aa1afa85c38754a5be074e
2020-11-30 11:50:38 +00:00
DistroBaker
17a51515f0 Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/kexec-tools.git#4f492cf73ea11ff74f5b062e18fcea45cb5e7eeb
2020-11-20 12:35:49 +00:00
DistroBaker
5cac7c3f96 Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/kexec-tools.git#bfd06661e81465d077bac435c90b4082134adf19
2020-11-05 05:34:29 +00:00
Petr Šabata
f5bf4978d8 RHEL 9.0.0 Alpha bootstrap
The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/kexec-tools#041ba89902961b5490a7143d9596dc00d732cba0
2020-10-15 14:45:57 +02:00