Commit Graph

370 Commits

Author SHA1 Message Date
Coiby Xu
74e1022fae Install the driver of physical device for a SR-IOV virtual device
Related: https://issues.redhat.com/browse/RHEL-7028
Conflict: None

Upstream Status: git@github.com:rhkdump/kdump-utils.git

commit 7a8edc8de67dccae23b01461bc3b17c0ad42aa5f
Author: Coiby Xu <coxu@redhat.com>
Date:   Wed Sep 27 09:31:39 2023 +0800

    Install the driver of physical device for a SR-IOV virtual device

    Currently, network dumping failed over a NIC that is a Single Root I/O
    Virtualization (SR-IOV) virtual device. Usually the driver of the
    virtual device won't specify the dependency on the driver of the
    physical device. So to fix this issue, the driver of the physical device
    needs to be found and installed as well.

    Fixes: a65dde2d ("Reduce kdump memory consumption by only installing needed NIC drivers")
    Signed-off-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2024-05-09 13:41:05 +08:00
Coiby Xu
ce8f796720 Try to install PHY and MDIO bus drivers explicitly
Resolves: https://issues.redhat.com/browse/RHEL-7028
Conflict: None

Upstream Status: git@github.com:rhkdump/kdump-utils.git

commit d057153a1c3c36612a14143b29c0ff0be34e4fc2
Author: Coiby Xu <coxu@redhat.com>
Date:   Thu Sep 21 11:50:14 2023 +0800

    Try to install PHY and MDIO bus drivers explicitly

    Resolves: https://issues.redhat.com/browse/RHEL-7028

    Currently, nfs dumping fails on some machines that has a dedicated PHY
    driver (dealing with the physical layer) or MDIO bus (connecting the MAC
    to PHY devices) driver. This is because kexec-tools doesn't install
    dedicated PHY or MDIO driver explicitly. Usually a NIC driver shouldn't
    specify the dependency on the needed PHY or MDIO driver because it
    shouldn't a NIC (medium access control, MAC) driver is for dealing with
    the Data link layer and a PHY driver is for physical layer. So as long
    as a MAC driver can talk to the PHY layer via APIs, it shouldn't care
    which PHY driver or device it's talking to. So when the
    dependency on a PHY driver or MDIO driver is not found by dracut's
    instmods, the PHY or MDIO driver won't be installed.

    This patch passes =drivers/net/phy and =drivers/net/mdio to dracut's
    instmods which will only install in-use PHY or MDIO driver(s).

    Note ideally we should find out which PHY driver is used by a NIC but
    unfortunately currently no universal way can be found
    (/sys/class/net/NIC_NAME/phydev/driver/module can be used to find the
     name of the PHY driver for some NICs but it doesn't exist for some NICs
    like Qualcomm Atheros AR8031). So is it for a MDIO bus driver.
    Fortunately currently no huge memory consumption is found for a PHY or
    MDIO driver.

    Fixes: a65dde2d ("Reduce kdump memory consumption by only installing needed NIC drivers")
    Reported-by: Doreen Alongi <dalongi@redhat.com>
    Signed-off-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2024-05-09 13:40:43 +08:00
Tao Liu
c5989636c3 Release 2.0.27-9
Resolves: RHEL-35640

Signed-off-by: Tao Liu <ltao@redhat.com>
2024-05-08 17:09:34 +08:00
Baoquan He
a2cf60284d kexec_file: add kexec_file flag to support debug printing
Resolves: https://issues.redhat.com/browse/RHEL-35640
Upstream Status: git://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git
Conflict: None

commit 9d9cf8de8b2ad8273861a30476a46f34cd34871a
Author: Baoquan He <bhe@redhat.com>
Date:   Tue Nov 14 23:20:30 2023 +0800

    kexec_file: add kexec_file flag to support debug printing

    This add KEXEC_FILE_DEBUG to kexec_file_flags so that it can be passed
    to kernel when '-d' is added with kexec_file_load interface. With that
    flag enabled, kernel can enable the debugging message printing.

    Signed-off-by: Baoquan He <bhe@redhat.com>
    Signed-off-by: Simon Horman <horms@kernel.org>

Signed-off-by: Baoquan He <bhe@redhat.com>
2024-05-07 20:26:22 +08:00
Tao Liu
0a09d12d89 Release 2.0.27-8
Resolves: RHEL-13996

Signed-off-by: Tao Liu <ltao@redhat.com>
2024-01-30 16:16:52 +08:00
Lichen Liu
78e19be071 dracut-module-setup: Skip initrd-cleanup and initrd-parse-etc in kdump
Resolves: https://issues.redhat.com/browse/RHEL-13996
Upstream: Fedora
Conflict: None

commit 468336700d
Author: Lichen Liu <lichliu@redhat.com>
Date:   Mon Jan 22 15:59:09 2024 +0800

    dracut-module-setup: Skip initrd-cleanup and initrd-parse-etc in kdump

    When using multipath devices as the target for kdump, if user_friendly_name
    is also specified, devices default to names like "mpath*", e.g., mpatha.
    In dracut, we obtain a persistent device name via get_persistent_dev. However,
    dracut currently believes using /dev/mapper/mpath* could cause issues, thus
    alternatively names are used, here it's /dev/disk/by-uuid/<FS_UUID>.

    During the kdump boot progress, the /dev/disk/by-uuid/<FS_UUID> will exist as
    soon as one of the path devices exists, but it won't be usable by systemd,
    since multipathd will claim that device as a path device. Then multipathd will
    get stopped before it can create the multipath device.

    Without user_friendly_name, /dev/mapper/<WWID> is considered a persistent
    device name, avoiding the issue.

    The exit of multipathd is due to two dependencies in the current dracut module
    90multipath/multipathd.service, "Before=initrd-cleanup.service" and
    "Conflicts=initrd-cleanup.service".

    As per man 5 systemd.unit, if A.service has "Conflicts=B.service", starting
    B.service will stop A.service.

    This is useful during normal boot. However, we will never switch-root after
    capturing vmcore in kdump.

    We need to ensure that multipathd is not killed due to such dependency issue.
    Without modifying multipathd.service, we add ConditionPathExists=!/proc/vmcore
    to skip initrd-cleanup.service in kdump. This approach is beneficial as
    it avoid the potential termination of other services that conflict with
    initrd-cleanup.service. Also skip initrd-parse-etc.service as it will try to
    start initrd-cleanup.service. Both of these services are used for switch root,
    so they can be safely skipped in kdump.

    Suggested-by: Benjamin Marzinski <bmarzins@redhat.com>
    Suggested-by: Dave Young <dyoung@redhat.com>
    Signed-off-by: Lichen Liu <lichliu@redhat.com>
    Reviewed-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Lichen Liu <lichliu@redhat.com>
2024-01-24 15:51:18 +08:00
Tao Liu
63f60a767f Release 2.0.27-7
Resolves: RHEL-17451
Resolves: RHEL-11897

Signed-off-by: Tao Liu <ltao@redhat.com>
2024-01-03 09:42:22 +08:00
Coiby Xu
83698d84aa Explain the auto_reset_crashkernel option in more details
Resolves: https://issues.redhat.com/browse/RHEL-17451
Upstream: Fedora
Conflict: None

commit c752cbb2d3
Author: Coiby Xu <coxu@redhat.com>
Date:   Wed Dec 6 16:15:50 2023 +0800

    Explain the auto_reset_crashkernel option in more details

    Resolves: https://issues.redhat.com/browse/RHEL-17451

    Explain what factors affect the default crashkernel value and ask users
    to reset it manually if needed.

    Cc: Baoquan He <bhe@redhat.com>
    Cc: Jie Li <jieli@redhat.com>
    Acked-by: Baoquan He <bhe@redhat.com>
    Signed-off-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2024-01-02 10:11:33 +00:00
Coiby Xu
c179f45e05 Use the same /etc/resolve.conf in kdump initrd if it's managed manually
Resolves: https://issues.redhat.com/browse/RHEL-11897
Upstream: Fedora
Conflict: None

commit 38d9990389
Author: Coiby Xu <coxu@redhat.com>
Date:   Tue Dec 26 11:17:29 2023 +0800

    Use the same /etc/resolve.conf in kdump initrd if it's managed manually

    Resolves: https://issues.redhat.com/browse/RHEL-11897

    Previously fix 0177e248 ("Use the same /etc/resolve.conf in kdump initrd
    if it's managed manually") is problematic,
       1) it generated .conf file unrecognized by NetowrkManager ;
       2) this .conf file was installed to current file system instead of to the kdump initrd;
       3) this incorrect .conf file prevented the starting of NetworkManager.

    This patch fixes the above issues and also suppresses a harmless warning
    when systemd-resolved.service doesn't exist,

        # systemctl -q is-enabled systemd-resolved
        Failed to get unit file state for systemd-resolved.service: No such file or directory

    Fixes: 0177e248 ("Use the same /etc/resolve.conf in kdump initrd if it's managed manually")
    Reported-by: Jie Li <jieli@redhat.com>
    Cc: Dave Young <dyoung@redhat.com>
    Reviewed-by: Dave Young <dyoung@redhat.com>
    Signed-off-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2023-12-26 12:46:10 +08:00
Tao Liu
366ae8b601 Release 2.0.27-6
Resolves: RHEL-11897

Signed-off-by: Tao Liu <ltao@redhat.com>
2023-12-20 13:37:38 +08:00
Coiby Xu
6e359f067f Use the same /etc/resolve.conf in kdump initrd if it's managed manually
Resolves: https://issues.redhat.com/browse/RHEL-11897
Upstream: Fedora
Conflict: None

commit 0177e24832
Author: Coiby Xu <coxu@redhat.com>
Date:   Tue Nov 7 08:28:59 2023 +0800

    Use the same /etc/resolve.conf in kdump initrd if it's managed manually

    Resolves: https://issues.redhat.com/browse/RHEL-11897

    Some users may choose to manage /etc/resolve.conf manually [1]
    by setting dns=none or use a symbolic link resolve.conf [2].
    In this case, network dumping will not work because DNS resolution
    fails. Use the same /etc/resolve.conf in kdump initrd to fix this
    problem.

    [1] https://bugzilla.gnome.org/show_bug.cgi?id=690404
    [2] https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_networking/manually-configuring-the-etc-resolv-conf-file_configuring-and-managing-networking

    Fixes: 63c3805c ("Set up kdump network by directly copying NM connection profile to initrd")
    Reported-by: Curtis Taylor <cutaylor@redhat.com>
    Cc: Jie Li <jieli@redhat.com>
    Signed-off-by: Coiby Xu <coxu@redhat.com>
    Reviewed-by: Dave Young <dyoung@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2023-12-05 18:01:01 +08:00
Tao Liu
767749d9da Release 2.0.27-5
Resolves: RHEL-10484

Signed-off-by: Tao Liu <ltao@redhat.com>
2023-11-24 12:54:16 +08:00
Lichen Liu
4ab1df8671 kdumpctl: Only returns immediately after an error occurs in check_*_modified
Resolves: https://issues.redhat.com/browse/RHEL-10484
Upstream: Fedora
Conflict: Missing upstream patch d4e8772("kdumpctl: make do_estimate more
robust")

commit 741861164e
Author: Lichen Liu <lichliu@redhat.com>
Date:   Mon Oct 30 14:51:59 2023 +0800

    kdumpctl: Only returns immediately after an error occurs in check_*_modified

    Currently is_system_modified will return immediately when check_*_modified
    return a non-zero value, and the remaining checks will not be executed.

    For example, if there is a fs-related error exists, and someone changes the
    kdump.conf, check_files_modified will return 1 and is_system_modified will
    return 1 immediately. This will cause kdumpctl to skip check_fs/drivers_modified,
    kdump.service will rebuild the initrd and start successfully, however, any
    errors should prevent kdump.service from starting.

    This patch will cause check_*_modifed to continue running until an error occurs
    or all execution ends.

    Signed-off-by: Lichen Liu <lichliu@redhat.com>
    Acked-by: Tao Liu <ltao@redhat.com>

Signed-off-by: Lichen Liu <lichliu@redhat.com>
2023-11-21 11:56:17 +08:00
Tao Liu
209852b908 Release 2.0.27-4
Resolves: RHEL-8727
Resolves: RHEL-8710

Signed-off-by: Tao Liu <ltao@redhat.com>
2023-11-16 09:49:38 +08:00
Baoquan He
1d7a651e6d kdump-lib.sh: add extra 64M to default crashkernel if sme/sev is active
Resolves: https://issues.redhat.com/browse/RHEL-8727
Resolves: https://issues.redhat.com/browse/RHEL-8710
Upstream: Fedora
Conflict: The 1st hunk is merged manualy because of conflict caused
          by context.

commit 4841bc6a6d
Author: Baoquan He <bhe@redhat.com>
Date:   Thu Sep 21 18:01:02 2023 +0800

    kdump-lib.sh: add extra 64M to default crashkernel if sme/sev is active

    It's reported that kdump kernel failed to boot and can't dump vmcore
    when crashkernel=192M and SME/SEV is active.

    This is because swiotlb will be enabled and reserves 64M memory by
    default on system with SME/SEV enabled. Then kdump kernel will be out of
    memory after taking 64M away for swiotlb init.

    So here add extra 64M memory to default crashkernel value so that kdump
    kernel can function well as before. When doing that, search journalctl
    for the "Memory Encryption Features active: AMD" to check if SME or SEV
    is active. This line of log is printed out in kernel function as below
    and the type SME is mutual exclusive with type SEV.
      ***:
      arch/x86/mm/mem_encrypt.c:print_mem_encrypt_feature_info()

    Note:
    1) The conditional check is relying on journalctl log because I didn't
       find available system interface to check if SEV is active. Even
       though we can check if SME is active via /proc/cpuinfo. For
       consistency, I take the same check for both SME and SEV by searching
       journalctl.

    2) The conditional check is relying on journalctl log, means it won't
       work for crashkernel setting in anoconda because the installation
       kernel doesn't have the SME/SEV setting. So customer need manually
       run 'kdumpctl reset-crashkernel' to reset crashkernel to add the
       extra 64M after OS installation.

    3) We need watch the line of log printing in
       print_mem_encrypt_feature_info() in kernel just in case people may
       change it in the future.

    Signed-off-by: Baoquan He <bhe@redhat.com>
    Reviewed-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Baoquan He <bhe@redhat.com>
2023-11-15 03:16:55 -05:00
Baoquan He
01ea017106 Allow _crashkernel_add to address larger memory ranges
Resolves: https://issues.redhat.com/browse/RHEL-8727
Resolves: https://issues.redhat.com/browse/RHEL-8710
Upstream: Fedora
Conflict: spec/kdump-lib_spec.sh doesn't exist in RHEL, so I remove
          the hunk directly.

commit 3d253ab811
Author: Coiby Xu <coxu@redhat.com>
Date:   Tue Oct 10 14:31:36 2023 +0800

    Allow _crashkernel_add to address larger memory ranges

    Currently _crashkernel_add can't deal with larger memory ranges like
    terabyte. For example, '_crashkernel_add "128G-1T:4G" "0"' actually
    returns empty result. This patch allows _crashkernel_add to address
    terabyte, petabyte and exabyte memory ranges.

    Fixes: 64f2827a ("kdump-lib: Harden _crashkernel_add")
    Signed-off-by: Coiby Xu <coxu@redhat.com>
    Acked-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Baoquan He <bhe@redhat.com>
2023-11-15 03:16:55 -05:00
Baoquan He
0778b6add9 kdump-lib: Harden _crashkernel_add
Resolves: https://issues.redhat.com/browse/RHEL-8727
Resolves: https://issues.redhat.com/browse/RHEL-8710
Upstream: Fedora
Conflict: spec/kdump-lib_spec.sh doesn't exist in RHEL, so I remove
          the hunk directly.

commit 64f2827a4b
Author: Philipp Rudo <prudo@redhat.com>
Date:   Wed Sep 6 10:49:47 2023 +0200

    kdump-lib: Harden _crashkernel_add

    _crashkernel_add currently always assumes the good case, i.e. that the
    value of the crashkernel parameter has the correct syntax and that the
    delta added is a number. Both doesn't have to be true when the values
    are provided by users. Thus add some additional checks.

    Furthermore require the delta to have a explicit unit, i.e. no longer
    assume that is in megabytes, i.e. 100 -> 100M.

    Signed-off-by: Philipp Rudo <prudo@redhat.com>
    Reviewed-by: Pingfan Liu <piliu@redhat.com>
Signed-off-by: Baoquan He <bhe@redhat.com>
2023-11-15 03:16:55 -05:00
Tao Liu
0094f46c37 Release 2.0.27-3
Rebase makedumpfile to v1.7.4

resolves: RHEL-9050
resolves: RHEL-14003

Signed-off-by: Tao Liu <ltao@redhat.com>
2023-11-08 10:10:37 +08:00
Coiby Xu
24020b226a powerpc: update kdumpctl to load kernel signing key for fadump
Resolves: https://issues.redhat.com/browse/RHEL-14003
Upstream: Fedora
Conflict: None

commit 4fa17b2ee4
Author: Nayna Jain <nayna@linux.ibm.com>
Date:   Tue Oct 3 23:41:47 2023 -0400

    powerpc: update kdumpctl to load kernel signing key for fadump

    On secure boot enabled systems with static keys, kexec with kexec_file_load(-s)
    fails as "Permission Denied" when fadump is enabled.

    Similar to kdump, load kernel signing key for fadump as well.

    Reported-by: Sachin P Bappalige <sachinpb@linux.vnet.ibm.com>
    Signed-off-by: Nayna Jain <nayna@linux.ibm.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2023-11-08 01:36:58 +00:00
Coiby Xu
b3263494ef powerpc: update kdumpctl to remove deletion of kernel signing key once loaded
Resolves: https://issues.redhat.com/browse/RHEL-14003
Upstream: Fedora
Conflict: None

commit fe6eb30e67
Author: Nayna Jain <nayna@linux.ibm.com>
Date:   Tue Oct 3 23:41:46 2023 -0400

    powerpc: update kdumpctl to remove deletion of kernel signing key once loaded

    Kernel signing key is deleted once kdump is loaded. This causes confusion in
    debugging since key is no longer visible. Unless someone knows how
    kdumpctl script works, it is difficult to find out how kdump could be
    loaded when there is no key on .ima keyring.

    Remove deletion of kernel signing key once loaded. And then to prevent
    multiple loading of same key when kdump service is disabled/enabled, update
    key description field as well.

    Suggested-by: Mimi Zohar <zohar@linux.ibm.com>
    Signed-off-by: Nayna Jain <nayna@linux.ibm.com>
    Reviewed-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2023-11-08 01:36:58 +00:00
Tao Liu
4920367607 Release 2.0.27-2
Resolves: RHEL-14000

Signed-off-by: Tao Liu <ltao@redhat.com>
2023-11-06 13:01:18 +08:00
Lichen Liu
30eecb0312 kexec: update manpage with explicit mention of clean kexec
Resolves: RHEL-14000
Upstream: https://github.com/horms/kexec-tools
Conflict: None

commit bd0200c47c45dd420244b39ddabcecdab1fb9a8e
Author: Hari Bathini <hbathini@linux.ibm.com>
Date:   Wed Sep 20 17:29:27 2023 +0530

    kexec: update manpage with explicit mention of clean kexec

    While the manpage does mention about kexec boot with a clean shutdown,
    it is not explicit about it. Make it explicit.

    Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
    Signed-off-by: Simon Horman <horms@kernel.org>

Signed-off-by: Lichen Liu <lichliu@redhat.com>
2023-10-31 13:21:58 +08:00
Pingfan Liu
332f2041dc Release 2.0.27-1
Resolves: RHEL-9433
JIRA: https://issues.redhat.com/browse/RHEL-9433

Signed-off-by: Pingfan Liu <piliu@redhat.com>
2023-10-16 11:43:32 +08:00
Tao Liu
054aead983 Release 2.0.26-9
Resolves: bz2232499

Signed-off-by: Tao Liu <ltao@redhat.com>
2023-09-26 13:41:53 +08:00
Lichen Liu
549f1f9495 Introduce a function to get reserved memory size
Resolves: bz2232499
Upstream: Fedora Rawhide
Conflict: None

commit 4b7b7736ee
Author: Sourabh Jain <sourabhjain@linux.ibm.com>
Date:   Wed Aug 2 20:36:48 2023 +0530

    Introduce a function to get reserved memory size

    The size of the reserved memory in the functions show_reserved_mem,
    check_crash_mem_reserved, and do_estimate are fetched from the sysfs
    node `/sys/kernel/kexec_crash_size`. However, in the case of fadump,
    the reserved area size is instead present in
    /sys/kernel/fadump/mem_reserved.

    For example:

    $ kdumpctl showmem
    kdump: Dump mode is fadump
    kdump: Reserved 0MB memory for crash kernel

    The above command showed 0MB for Reserved memory which is incorrect, the
    actual reservation was 2048MB.

    To resolve this issue a new helper function is introduced to fetch
    reserved memory size based on the dump mode. For "fadump" mode,
    it looks in `/sys/kernel/fadump/mem_reserved`, otherwise, it uses
    `/sys/kernel/kexec_crash_size`. And all functions that previously
    fetching reserved memory directly from `/sys/kernel/kexec_crash_size`
    sysfs node are now updated to use this new function to get the reserved
    memory size.

    With the fix in place, the `kdumpctl showmem` command will now display
    correct reserved memory size.

    $ kdumpctl showmem
    kdump: Dump mode is fadump
    kdump: Reserved 2048MB memory for crash kernel

    Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
    Reported-by: Sachin P Bappalige <sachinpb@linux.vnet.ibm.com>
    Reviewed-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Lichen Liu <lichliu@redhat.com>
2023-09-21 16:24:52 +08:00
Lichen Liu
4a138852ab powerpc: update fadump sysfs node path
Resolves: bz2232499
Upstream: Fedora Rawhide
Conflict: Some newer patches has been rebased, which caused git am to
encounter some problems.

commit fc7c65312a
Author: Sourabh Jain <sourabhjain@linux.ibm.com>
Date:   Thu Aug 17 16:38:35 2023 +0530

    powerpc: update fadump sysfs node path

    The fadump sysfs nodes /sys/kernel/fadump_[enabled|registered], have
    been relocated to /sys/kernel/fadump/[enabled|registered] by kernel
    commits d418b19f34ed ("powerpc/fadump: Reorganize /sys/kernel/fadump_*
    sysfs files").

    To ensure compatibility, symbolic links were added for each relocated
    sysfs entry. Nonetheless, note that these symbolic links might be
    removed later, as they have been deprecated by kernel commit
    3f5f1f22ef10 ("Documentation/ABI: Mark /sys/kernel/fadump_* sysfs files
    deprecated")

    This patch updates the scripts to use the updated fadump sysfs files.

    Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
    Reviewed-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Lichen Liu <lichliu@redhat.com>
2023-09-21 15:06:07 +08:00
Lichen Liu
cbb7720e4f kdumpctl: merge check_current_{kdump,fadump}_status
Resolves: bz2232499
Upstream: Fedora Rawhide
Conflict: Some newer patches has been rebased, which caused git am to
encounter some problems.

commit b9fd7a4076
Author: Philipp Rudo <prudo@redhat.com>
Date:   Thu Jan 12 16:31:02 2023 +0100

    kdumpctl: merge check_current_{kdump,fadump}_status

    Both functions are almost identical. The only differences are (1) the
    sysfs node the status is read from and (2) the fact the fadump version
    doesn't verify if the file it's trying to read actually exists. Thus
    merge the two functions and get rid of the check_current_status wrapper.

    While at it rename the function to is_kernel_loaded which explains
    better what the function does.

    Finally, after moving FADUMP_REGISTER_SYS_NODE shellcheck can no longer
    access the definition and starts complaining about it not being quoted.
    Thus quote all uses of FADUMP_REGISTER_SYS_NODE.

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

Signed-off-by: Lichen Liu <lichliu@redhat.com>
2023-09-21 15:02:51 +08:00
Lichen Liu
64c0bfcc53 kdumpctl: remove unnecessary uses of $?
Resolves: bz2232499
Upstream: Fedora Rawhide
Conflict: None

commit b49083126f
Author: Philipp Rudo <prudo@redhat.com>
Date:   Fri Mar 25 15:47:00 2022 +0100

    kdumpctl: remove unnecessary uses of $?

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

Signed-off-by: Lichen Liu <lichliu@redhat.com>
2023-09-21 14:29:58 +08:00
Tao Liu
cb4e527a85 Release 2.0.26-8
Resolves: bz2165018

Signed-off-by: Tao Liu <ltao@redhat.com>
2023-07-04 17:48:08 +08:00
Lichen Liu
fe8c4d3981 spec: kdump/ppc64: make servicelog_notify silent when there are no errors
Resolves: bz2165018
Upstream: Fedora Rawhide
Conflict: None

commit daa829f79e
Author: Lichen Liu <lichliu@redhat.com>
Date:   Mon Jun 12 17:17:43 2023 +0800

    spec: kdump/ppc64: make servicelog_notify silent when there are no errors

    There is confusing message in /var/log/anaconda/packaging.log when installing
    kexec-tools during the system installation on ppc64le:

            Event Notification Registration successful (id: 1)

    Make servicelog_notify slient when there are no erros.

    Signed-off-by: Lichen Liu <lichliu@redhat.com>
    Reviewed-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Lichen Liu <lichliu@redhat.com>
2023-06-27 09:25:17 +08:00
Tao Liu
96de0f6101 Release 2.0.26-7
Resolves: bz2215606
Resolves: bz2165839

Signed-off-by: Tao Liu <ltao@redhat.com>
2023-06-21 16:06:41 +08:00
Tao Liu
401619f484 kdumpctl: Fix temporary directory location
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2215606
Upstream: Fedora Rawhide
Conflict: None

commit dda81d72c2
Author: Philipp Rudo <prudo@redhat.com>
Date:   Mon Jun 19 14:31:48 2023 +0200

    kdumpctl: Fix temporary directory location

    The temporary directory is currently created under the current working
    directory. That alone isn't ideal but works most of the time. However,
    it will fail when the current working directory is not writable. So make
    sure the directory is created within TMPDIR.

    Fixes: ea00b7d ("kdumpctl: Move temp file in get_kernel_size to global temp dir")
    Signed-off-by: Philipp Rudo <prudo@redhat.com>
    Reviewed-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
2023-06-21 16:02:14 +08:00
Pingfan Liu
d8ee87cfda kdump-lib: Match 64k debug kernel in prepare_kdump_bootinfo()
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2165839
Upstream: Fedora
Conflict: None

commit f3139012f2
Author: Pingfan Liu <piliu@redhat.com>
Date:   Tue Jun 20 08:50:31 2023 +0800

    kdump-lib: Match 64k debug kernel in prepare_kdump_bootinfo()

    For kernel 64k variant, it terminates with substring 64k-debug, e.g.
    vmlinuz-5.14.0-327.el9.aarch64+64k-debug.

    Providing an extra matching pattern to filter out it.

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

Signed-off-by: Pingfan Liu <piliu@redhat.com>
2023-06-20 14:56:52 +08:00
Tao Liu
87bde04c4d Release 2.0.26-6
Resolves: bz2160676
Resolves: bz2165839

Signed-off-by: Tao Liu <ltao@redhat.com>
2023-06-15 17:05:08 +08:00
Pingfan Liu
6189736a11 kdumpctl: Fix the matching of plus symbol by grep's EREs
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2160676
Upstream: Fedora rawhide
Conflict: None

commit 64d93c886f
Author: Pingfan Liu <piliu@redhat.com>
Date:   Fri Jun 9 16:04:29 2023 +0800

    kdumpctl: Fix the matching of plus symbol by grep's EREs

    After introducing 64k variant kernel on aarch64, an example kernel name
    looks like "vmlinuz-5.14.0-316.el9.aarch64+64k". To match the plus
    symbol, it demands an escape charater.

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

Signed-off-by: Pingfan Liu <piliu@redhat.com>
2023-06-15 10:36:54 +08:00
Pingfan Liu
df074ee3de kdump-lib: Evaluate the memory consumption by smmu and mlx5 separately
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2160676
Upstream: Fedora rawhide
Conflict: None

commit 7a2c4cbc3b
Author: Pingfan Liu <piliu@redhat.com>
Date:   Tue Jun 13 17:43:23 2023 +0800

    kdump-lib: Evaluate the memory consumption by smmu and mlx5 separately

    On 4k and 64k kernels, the typical consumption values for SMMU are 36MB
    and 384MB, respectively. Hence for 64k kernel, the consumption by smmu
    should be taken into account carefully.

    To do it by adding the extra 384MB value if installing a 64k kernel.
    The upper limit value 384MB is calculated according to the formula in
    the kernel smmu driver.

    As for mlx5 network cards, it is measured by a pratical test, 200M for
    64k variant, 150M for 4k variant

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

Signed-off-by: Pingfan Liu <piliu@redhat.com>
2023-06-15 10:35:43 +08:00
Pingfan Liu
cde55285bd kdump-lib: add support for 64K aarch64
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2160676
Upstream: Fedora rawhide
Conflict: None

commit 05c4861443
Author: Pingfan Liu <piliu at redhat.com>
Date:   Tue Jun 13 17:43:22 2023 +0800

    kdump-lib: add support for 64K aarch64

    On aarch64, both 4K and 64K kernel can be installed, while they demand
    different size reserved memory for kdump kernel.

    'get_conf PAGE_SIZE' can not work if installing a 64K kernel when
    running a 4K kernel. Hence resorting to the kernel release naming rules.
    At present, the 64K kernel has the keyword '64k' in its suffix.

    The base line for 64K is decided based on 4K. The diff 100M is picked up
    since on a high end machine without smmu enabled, the diff of MemFree is
    82M.

    As for the smmu case, a huge difference in the memory consumption lies
    between 64k and 4k driver. And it should be calculated separatedly.

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

Signed-off-by: Pingfan Liu <piliu@redhat.com>
2023-06-15 10:34:54 +08:00
Pingfan Liu
78e9625b62 kdump-lib: Introduce parse_kver_from_path() to get kernel version from its path name
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2160676
Upstream: Fedora rawhide
Conflict: None

commit d8b961be37
Author: Pingfan Liu <piliu@redhat.com>
Date:   Tue Jun 13 17:43:21 2023 +0800

    kdump-lib: Introduce parse_kver_from_path() to get kernel version from its path name

    kdump_get_arch_recommend_crashkernel() expects the kernel version info,
    while _update_kernel() provides the absolute path, which contains the
    kernel version info.

    This patch introduce a dedicated function parse_kver_from_path() to
    extract the kernel info from the path

    Credit to Philipp, who contributes the original code.

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

Signed-off-by: Pingfan Liu <piliu@redhat.com>
2023-06-15 10:34:05 +08:00
Pingfan Liu
37de94d02a kdump-lib: Introduce a help function _crashkernel_add()
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2160676
Upstream: Fedora rawhide
Conflict: Drop shellspec test case

commit 51efbcf83e
Author: Pingfan Liu <piliu@redhat.com>
Date:   Tue Jun 13 17:43:20 2023 +0800

    kdump-lib: Introduce a help function _crashkernel_add()

    This help function can manipulate the crashkernel cmdline by adding an
    number for each item. Also a basic test case for _crashkernel_add() is
    provided in this patch.

    Credit to Philipp, who contributes the original code.

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

Signed-off-by: Pingfan Liu <piliu@redhat.com>
2023-06-15 10:32:36 +08:00
Pingfan Liu
cb850aec26 Simplify the management of the kernel parameter crashkernel
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2160676
Upstream: Fedora rawhide
Conflict: applied manually due to slight difference in context

commit 5b31b099ae
Author: Coiby Xu <coxu@redhat.com>
Date:   Wed Apr 26 04:48:25 2023 +0800

    Simplify the management of the kernel parameter crashkernel

    Currently, kexec-tools only updates the crashkernel to a new default
    value only when both two conditions are met,
     - auto_reset_crashkernel=yes in kdump.conf
     - existing kernels or current running kernel should use the old default
       value.

    To address seen corner cases, the logic to tell if the second condition
    is met becomes quite complex. Instead of making the logic more complex
    to support aarch64-64k, this patch drops the second condition to
    simplify the management of the crashkernel kernel parameter.

    Another change brought by this simplification is kexec-tools will also
    set up the kernel crashkernel parameter for a fresh install (previously
    it's limited to osbuild).

    Note
    1. This patch also stop trying to update /etc/default/grub because
       a) it only affects the static file /boot/grub2/grub.cfg
       b) grubby is recommended to change the kernel command-line parameters
          for both Fedora [1] and RHEL9 [2][3]
       c) For the cases of aarch64 and POWER, different kernels could have
          different default crashkernel value.

    2. Starting with Fedora 37,  posttrans rpm scriplet distinguish between
       package install and upgrade.

    [1] https://fedoraproject.org/wiki/GRUB_2
    [2] https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/managing_monitoring_and_updating_the_kernel/configuring-kernel-command-line-parameters_managing-monitoring-and-updating-the-kernel#changing-kernel-command-line-parameters-for-all-boot-entries_configuring-kernel-command-line-parameters
    [3] https://access.redhat.com/solutions/1136173

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

Signed-off-by: Pingfan Liu <piliu@redhat.com>
2023-06-15 10:30:53 +08:00
Pingfan Liu
47391b4a6d kdump-lib: fix the matching pattern for debug-kernel
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2165839
Upstream: Fedora
Conflict: None

commit 81d3cc344d
Author: Pingfan Liu <piliu@redhat.com>
Date:   Thu Apr 20 11:26:34 2023 +0800

    kdump-lib: fix the matching pattern for debug-kernel

    On aarch64, a 64k kernel's name looks like:
    vmlinuz-5.14.0-300.el9.aarch64+64k and the corresponding debug kernel's
    name looks like: vmlinuz-5.14.0-300.el9.aarch64+64k-debug, which ends
    with the suffix -debug instead of +debug.

    Fix the matching pattern by [+|-]debug

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

Signed-off-by: Pingfan Liu <piliu@redhat.com>
2023-06-07 11:59:42 +08:00
Pingfan Liu
4454163cb4 kdump-lib: always specify version in is_squash_available
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2165839
Upstream: Fedora
Conflict: None

commit 88919b73f0
Author: Philipp Rudo <prudo@redhat.com>
Date:   Thu Jan 12 16:31:04 2023 +0100

    kdump-lib: always specify version in is_squash_available

    is_squash_available is only used in dracut-module-setup.sh and mkdumprd.
    Neither of the two scripts calls prepare_kdump_bootinfo which determines
    and sets KDUMP_KERNELVER. Thus KDUMP_KERNELVER is only non-zero if it
    explicitly specified by the user in /etc/sysconfig/kdump (and the file
    gets sourced, which is not the case for drachu-module-setup.sh).

    In theory this can even lead to bugs. For example consider the case when
    a debug kernel is running. In that case kdumpctl will try to use the
    non-debug version of the kernel while is_squash_available will make its
    decision based on the debug version. So in case the debug kernel has
    squash available but the non-debug kernel doesn't mkdumprd will try to
    add it nevertheless.

    Thus factor out the kernel version detection from prepare_kdump_bootinfo
    and make use of the new function when checking for the availability of
    those kernel modules.

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

Signed-off-by: Pingfan Liu <piliu@redhat.com>
2023-06-07 11:59:24 +08:00
Tao Liu
2c6e1b5d4c Release 2.0.26-5
Resolves: bz2144731

Signed-off-by: Tao Liu <ltao@redhat.com>
2023-06-02 11:22:59 +08:00
Tao Liu
6622a1f79e Add lvm thin provision to kdump supported-kdump-targets.txt
Resolves: bz2144731
Upstream: RHEL-only

Signed-off-by: Tao Liu <ltao@redhat.com>
2023-06-02 11:15:37 +08:00
Coiby Xu
26f00a75f0 mkdumprd: Use the correct syntax to redirect the stderr to null
Resolves: https://issues.redhat.com/browse/RHEL-518
Upstream: Fedora
Conflict: None

commit e42a823dae
Author: Coiby Xu <coxu@redhat.com>
Date:   Thu Jun 1 16:05:05 2023 +0800

    mkdumprd: Use the correct syntax to redirect the stderr to null

    A space was added by mistake and unfortunately fips-mode-setup refuses
    an extra parameter,

        # fips-mode-setup --is-enabled 2 > /dev/null
        # echo $?
        2
        # fips-mode-setup --is-enabled 2
        Check, enable, or disable the system FIPS mode.
        usage: /usr/bin/fips-mode-setup --enable|--disable [--no-bootcfg]
        usage: /usr/bin/fips-mode-setup --check
        usage: /usr/bin/fips-mode-setup --is-enabled

    So in this case mkdumprd can never detect if FIPS is enabled. Fix this
    mistake.

    Fixes: 443a43e0 ("mkdumprd: call dracut with --add-device to install the drivers needed by /boot partition automatically for FIPS")
    Signed-off-by: Coiby Xu <coxu@redhat.com>
    Reviewed-by: Tao Liu <ltao@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
2023-06-01 16:42:27 +08:00
Tao Liu
8f66aa349f Release 2.0.26-4
Resovles: bz2169720
Resovles: https://issues.redhat.com/browse/RHEL-512

Signed-off-by: Tao Liu <ltao@redhat.com>
2023-05-31 15:18:12 +08:00
Tao Liu
206f59eaa6 kdumpctl: Add basic UKI support
Resolves: bz2169720
Upstream: src.fedoraproject.org/rpms/kexec-tools.git
Conflicts: Small context difference in kexec-tools.spec

commit ea7be0608e
Author: Philipp Rudo <prudo@redhat.com>
Date:   Fri May 5 17:14:42 2023 +0200

    kdumpctl: Add basic UKI support

    A Unified Kernel Image (UKI) is a single EFI PE executable combining an
    EFI stub, a kernel image, an initrd image, and the kernel command line.
    They are defined in the Boot Loader Specification [1] as type #2
    entries. UKIs have the advantage that all code as well as meta data that
    is required to boot the system, not only the kernel image, is combined
    in a single PE file and can be signed for EFI SecureBoot. This extends
    the coverage of SecureBoot extensively.

    For RHEL support for UKI were included into kernel-ark with 16c7e3ee836e
    ("redhat: Add sub-RPM with a EFI unified kernel image for virtual
    machines").

    There are two problems with UKIs from the kdump point of view at the
    moment. First, they cannot be directly loaded via kexec_file_load and
    second, the initrd included isn't suitable for kdump. In order to enable
    kdump on systems with UKIs build the kdump initrd as usual and extract
    the kernel image before loading the crash kernel.

    [1] https://uapi-group.org/specifications/specs/boot_loader_specification/

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

Signed-off-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
2023-05-31 15:11:31 +08:00
Tao Liu
bcd5eb5a45 kdumpctl: Move temp file in get_kernel_size to global temp dir
Resolves: bz2169720
Upstream: src.fedoraproject.org/rpms/kexec-tools.git
Conflicts: None

commit ea00b7db43
Author: Philipp Rudo <prudo@redhat.com>
Date:   Fri May 5 17:14:41 2023 +0200

    kdumpctl: Move temp file in get_kernel_size to global temp dir

    Others will need to use a temporary files, too. In order to avoid
    potential clashes of multiple trap handlers move the local temp file
    into a global temp dir.

    While at it make sure that the trap handler returns the correct exit
    code.

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

Signed-off-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
2023-05-31 15:10:30 +08:00
Tao Liu
27f67f14ee kdumpctl: Move get_kernel_size to kdumpctl
Resolves: bz2169720
Upstream: src.fedoraproject.org/rpms/kexec-tools.git
Conflicts: None

commit 81d89c885f
Author: Philipp Rudo <prudo@redhat.com>
Date:   Fri May 5 17:14:40 2023 +0200

    kdumpctl: Move get_kernel_size to kdumpctl

    The function is only used in do_estimate. Move it to kdumpctl to
    prevent confusion.

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

Signed-off-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
2023-05-31 15:09:37 +08:00
Tao Liu
411b20cb4a kdump-lib: fix prepare_cmdline
Resolves: bz2169720
Upstream: src.fedoraproject.org/rpms/kexec-tools.git
Conflicts: drop removal of irqpoll in prepare_cmdline due to missing
           d55a056 ("kdumpctl: move aws workaround to kdump-lib") and
           d593bfa ("KDUMP_COMMANDLINE: remove irqpoll parameter on aws aarch64 platform")

commit 0f6ad91be8
Author: Philipp Rudo <prudo@redhat.com>
Date:   Thu Jan 12 16:31:07 2023 +0100

    kdump-lib: fix prepare_cmdline

    A recently added unit test found that prepare_cmdline has several
    problems. For example an empty remove list will remove all spaces or
    when the cmdline contains a parameter with quoted values containing
    spaces will only remove the beginning up to the first space. Furthermore
    the old design requires lots of subshells and pipes.

    This patch rewrites prepare_cmdline in a way that makes the unit test
    happy and tries to use as many bash built-ins as possible.

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

Signed-off-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
2023-05-31 15:08:42 +08:00