import CS kexec-tools-2.0.27-15.el9

This commit is contained in:
eabdullin 2024-09-30 15:44:39 +00:00
parent 576349899b
commit 4895d8186b
13 changed files with 182 additions and 36 deletions

View File

@ -391,10 +391,18 @@ _get_hpyerv_physical_driver() {
_get_nic_driver "$_physical_nic"
}
_get_physical_function_driver() {
local _physfn_dir=/sys/class/net/"$1"/device/physfn
if [[ -e "$_physfn_dir" ]]; then
basename "$(readlink -f "$_physfn_dir"/driver)"
fi
}
kdump_install_nic_driver() {
local _netif _driver _drivers
_drivers=()
_drivers=('=drivers/net/phy' '=drivers/net/mdio')
for _netif in $1; do
[[ $_netif == lo ]] && continue
@ -418,6 +426,9 @@ kdump_install_nic_driver() {
fi
_drivers+=("$_driver")
# For a Single Root I/O Virtualization (SR-IOV) virtual device,
# the driver of physical device needs to be installed as well
_drivers+=("$(_get_physical_function_driver "$_netif")")
done
[[ -n ${_drivers[*]} ]] || return
@ -483,6 +494,24 @@ _find_znet_nmconnection() {
"$1"/*.nmconnection | LC_ALL=C sed -e "$2"
}
kdump_setup_ovs() {
local _netdev="$1"
local _dev _phy_if
_phy_if=$(ovs_find_phy_if "$_netdev")
if kdump_is_bridge "$_phy_if"; then
kdump_setup_vlan "$_phy_if"
elif kdump_is_bond "$_phy_if"; then
kdump_setup_bond "$_phy_if" || return 1
elif kdump_is_team "$_phy_if"; then
derror "Ovs bridge over team is not supported!"
exit 1
fi
_save_kdump_netifs "$_phy_if"
}
# setup s390 znet
#
# Note part of code is extracted from ccw_init provided by s390utils
@ -534,6 +563,28 @@ kdump_get_remote_ip() {
echo "$_remote"
}
# Find the physical interface of Open vSwitch (Ovs) bridge
#
# The physical network interface has the same MAC address as the Ovs bridge
ovs_find_phy_if() {
local _mac _dev
_mac=$(kdump_get_mac_addr $1)
for _dev in $(ovs-vsctl list-ifaces $1); do
if [[ $_mac == $(</sys/class/net/$_dev/address) ]]; then
echo -n "$_dev"
return
fi
done
return 1
}
# Tell if a network interface is an Open vSwitch (Ovs) bridge
kdump_is_ovs_bridge() {
[[ $(_get_nic_driver $1) == openvswitch ]]
}
# Collect netifs needed by kdump
# $1: destination host
kdump_collect_netif_usage() {
@ -557,6 +608,9 @@ kdump_collect_netif_usage() {
kdump_setup_team "$_netdev"
elif kdump_is_vlan "$_netdev"; then
kdump_setup_vlan "$_netdev"
elif kdump_is_ovs_bridge "$_netdev"; then
has_ovs_bridge=yes
kdump_setup_ovs "$_netdev"
fi
_save_kdump_netifs "$_netdev"
@ -603,6 +657,29 @@ kdump_install_resolv_conf() {
fi
}
kdump_install_ovs_deps() {
[[ $has_ovs_bridge == yes ]] || return 0
inst_multiple -o $(rpm -ql NetworkManager-ovs) $(rpm -ql $(rpm -qf /usr/lib/systemd/system/openvswitch.service)) /sbin/sysctl /usr/bin/uuidgen /usr/bin/hostname /usr/bin/touch /usr/bin/expr /usr/bin/id /usr/bin/install /usr/bin/setpriv /usr/bin/nice /usr/bin/df
# 1. Overwrite the copied /etc/sysconfig/openvswitch so
# ovsdb-server.service can run as the default user root.
# /etc/sysconfig/openvswitch by default intructs ovsdb-server.service to
# run as USER=openvswitch, However openvswitch doesn't have the permission
# to write to /tmp in kdump initrd and ovsdb-server.servie will fail
# with the error "ovs-ctl[1190]: ovsdb-server: failed to create temporary
# file (Permission denied)". So run ovsdb-server.service as root instead
#
# 2. Bypass the error "referential integrity violation: Table Port column
# interfaces row" caused by we changing the connection profiles
echo "OPTIONS=\"--ovsdb-server-options='--disable-file-column-diff'\"" >"${initdir}/etc/sysconfig/openvswitch"
KDUMP_DROP_IN_DIR="${initdir}/etc/systemd/system/nm-initrd.service.d"
mkdir -p "$KDUMP_DROP_IN_DIR"
printf "[Unit]\nAfter=openvswitch.service\n" >$KDUMP_DROP_IN_DIR/01-after-ovs.conf
$SYSTEMCTL -q --root "$initdir" enable openvswitch.service
$SYSTEMCTL -q --root "$initdir" add-wants basic.target openvswitch.service
}
# Setup dracut to bring up network interface that enable
# initramfs accessing giving destination
kdump_install_net() {
@ -616,6 +693,7 @@ kdump_install_net() {
kdump_install_nm_netif_allowlist "$_netifs"
kdump_install_nic_driver "$_netifs"
kdump_install_resolv_conf
kdump_install_ovs_deps
fi
}
@ -1030,7 +1108,7 @@ remove_cpu_online_rule() {
install() {
declare -A unique_netifs ipv4_usage ipv6_usage
local arch
local arch has_ovs_bridge
kdump_module_init
kdump_install_conf
@ -1077,6 +1155,9 @@ install() {
# Also redirect dracut-emergency to kdump error handler
ln_r "$systemdsystemunitdir/emergency.service" "$systemdsystemunitdir/dracut-emergency.service"
# Disable ostree as we only need the physical root
systemctl -q --root "$initdir" mask ostree-prepare-root.service
# Check for all the devices and if any device is iscsi, bring up iscsi
# target. Ideally all this should be pushed into dracut iscsi module
# at some point of time.

View File

@ -101,8 +101,15 @@ get_fs_type_from_target()
get_mntpoint_from_target()
{
# --source is applied to ensure non-bind mount is returned
get_mount_info TARGET source "$1" -f
local SOURCE TARGET
findmnt -k --pairs -o SOURCE,TARGET "$1" | while read line; do
eval "$line"
# omit sources that are bind mounts i.e. they contain a [/path/to/subpath].
if [[ ! "$SOURCE" =~ \[ ]]; then
echo $TARGET
break
fi
done
}
is_ssh_dump_target()

View File

@ -15,7 +15,7 @@ is_uki()
img="$1"
[[ -f "$img" ]] || return
[[ "$(file -b --mime-type "$img")" == application/x-dosexec ]] || return
[[ "$(objdump -a "$img" 2> /dev/null)" =~ pei-(x86-64|aarch64-little) ]] || return
objdump -h -j .linux "$img" &> /dev/null
}
@ -213,7 +213,7 @@ get_bind_mount_source()
_fsroot=${_src#${_src_nofsroot}[}
_fsroot=${_fsroot%]}
_mnt=$(get_mount_info TARGET source "$_src_nofsroot" -f)
_mnt=$(get_mntpoint_from_target "$_src_nofsroot")
# for btrfs, _fsroot will also contain the subvol value as well, strip it
if [[ $_fstype == btrfs ]]; then

View File

@ -21,7 +21,7 @@ KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swio
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE
KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 reset_devices novmcoredd cma=0 hugetlb_cma=0"
KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices novmcoredd cma=0 hugetlb_cma=0"
# Any additional kexec arguments required. In most situations, this should
# be left empty

View File

@ -21,7 +21,7 @@ KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swio
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE
KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd hugetlb_cma=0"
KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd hugetlb_cma=0"
# Any additional kexec arguments required. In most situations, this should
# be left empty

View File

@ -21,7 +21,7 @@ KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swio
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE
KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd hugetlb_cma=0"
KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd hugetlb_cma=0"
# Any additional kexec arguments required. In most situations, this should
# be left empty

View File

@ -21,7 +21,7 @@ KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug quiet log_buf_len swio
# This variable lets us append arguments to the current kdump commandline
# after processed by KDUMP_COMMANDLINE_REMOVE
KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 acpi_no_memhotplug transparent_hugepage=never nokaslr hest_disable novmcoredd cma=0 hugetlb_cma=0"
KDUMP_COMMANDLINE_APPEND="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 acpi_no_memhotplug transparent_hugepage=never nokaslr hest_disable novmcoredd cma=0 hugetlb_cma=0 pcie_ports=compat"
# Any additional kexec arguments required. In most situations, this should
# be left empty

View File

@ -5,7 +5,6 @@ KDUMP_KERNELVER=""
KDUMP_KERNEL=""
KDUMP_COMMANDLINE=""
KEXEC_ARGS=""
KDUMP_LOG_PATH="/var/log"
MKDUMPRD="/sbin/mkdumprd -f"
MKFADUMPRD="/sbin/mkfadumprd"
DRACUT_MODULES_FILE="/usr/lib/dracut/modules.txt"
@ -21,7 +20,7 @@ TARGET_INITRD=""
DEFAULT_DUMP_MODE="kdump"
image_time=0
standard_kexec_args="-d -p"
standard_kexec_args="-p"
# Some default values in case /etc/sysconfig/kdump doesn't include
KDUMP_COMMANDLINE_REMOVE="hugepages hugepagesz slub_debug"
@ -639,7 +638,7 @@ function load_kdump_kernel_key()
# as the currently running kernel.
load_kdump()
{
local ret uki
local uki
KEXEC_ARGS=$(prepare_kexec_args "${KEXEC_ARGS}")
KDUMP_COMMANDLINE=$(prepare_cmdline "${KDUMP_COMMANDLINE}" "${KDUMP_COMMANDLINE_REMOVE}" "${KDUMP_COMMANDLINE_APPEND}")
@ -656,26 +655,12 @@ load_kdump()
ddebug "$KEXEC $KEXEC_ARGS $standard_kexec_args --command-line=$KDUMP_COMMANDLINE --initrd=$TARGET_INITRD $KDUMP_KERNEL"
# The '12' represents an intermediate temporary file descriptor
# to store the standard error file descriptor '2', and later
# restore the error file descriptor with the file descriptor '12'
# and release it.
exec 12>&2
exec 2>> $KDUMP_LOG_PATH/kdump.log
chmod 600 $KDUMP_LOG_PATH/kdump.log
PS4='+ $(date "+%Y-%m-%d %H:%M:%S") ${BASH_SOURCE}@${LINENO}: '
set -x
# shellcheck disable=SC2086
$KEXEC $KEXEC_ARGS $standard_kexec_args \
--command-line="$KDUMP_COMMANDLINE" \
--initrd="$TARGET_INITRD" "$KDUMP_KERNEL"
ret=$?
set +x
exec 2>&12 12>&-
if [[ $ret == 0 ]]; then
if [[ $? == 0 ]]; then
dinfo "kexec: loaded kdump kernel"
return 0
else
@ -1658,6 +1643,7 @@ reset_crashkernel()
_old_crashkernel=$(get_grub_kernel_boot_parameter "$_kernel" crashkernel)
_old_fadump_val=$(get_grub_kernel_boot_parameter "$_kernel" fadump)
[[ "$_new_fadump_val" == off ]] && _new_fadump_val=""
if [[ $_old_crashkernel != "$_new_crashkernel" || $_old_fadump_val != "$_new_fadump_val" ]]; then
_update_kernel_cmdline "$_kernel" "$_new_crashkernel" "$_new_dump_mode" "$_new_fadump_val"
if [[ $_reboot != yes ]]; then

View File

@ -62,6 +62,10 @@ grubby's kernel-path=ALL and kernel-path=DEFAULT. ppc64le supports FADump and
supports an additional [--fadump=[on|off|nocma]] parameter to toggle FADump
on/off.
If the optional parameter [--reboot] is provided the system will automatically
reboot for changes to take effect. If no changes were made to the kernel
command line the reboot is omitted.
Note: The memory requirements for kdump varies heavily depending on the
used hardware and system configuration. Thus the recommended
crashkernel might not work for your specific setup. Please test if

View File

@ -1016,12 +1016,7 @@ Debugging Tips
and the second kernel.
In the first kernel, you can find the historical logs with the journalctl
command and check kdump service debugging information. In addition, the
'kexec -d' debugging messages are also saved to /var/log/kdump.log in the
first kernel. For example:
[root@ibm-z-109 ~]# ls -al /var/log/kdump.log
-rw-r--r--. 1 root root 63238 Oct 28 06:40 /var/log/kdump.log
command and check kdump service debugging information.
If you want to get the debugging information of building kdump initramfs, you
can enable the '--debug' option for the dracut_args in the /etc/kdump.conf, and

View File

@ -0,0 +1,44 @@
From 9d9cf8de8b2ad8273861a30476a46f34cd34871a Mon Sep 17 00:00:00 2001
From: Baoquan He <bhe@redhat.com>
Date: Tue, 14 Nov 2023 23:20:30 +0800
Subject: [PATCH] kexec_file: add kexec_file flag to support debug printing
Content-type: text/plain
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>
---
kexec/kexec-syscall.h | 1 +
kexec/kexec.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h
index 2559bffb93da..73e52543e1b0 100644
--- a/kexec/kexec-syscall.h
+++ b/kexec/kexec-syscall.h
@@ -119,6 +119,7 @@ static inline long kexec_file_load(int kernel_fd, int initrd_fd,
#define KEXEC_FILE_UNLOAD 0x00000001
#define KEXEC_FILE_ON_CRASH 0x00000002
#define KEXEC_FILE_NO_INITRAMFS 0x00000004
+#define KEXEC_FILE_DEBUG 0x00000008
/* These values match the ELF architecture values.
* Unless there is a good reason that should continue to be the case.
diff --git a/kexec/kexec.c b/kexec/kexec.c
index 9d0ec46e5657..222f79e3112e 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -1477,6 +1477,7 @@ int main(int argc, char *argv[])
return 0;
case OPT_DEBUG:
kexec_debug = 1;
+ kexec_file_flags |= KEXEC_FILE_DEBUG;
break;
case OPT_NOIFDOWN:
skip_ifdown = 1;
--
2.41.0

View File

@ -257,7 +257,7 @@ check_user_configured_target()
verify_core_collector()
{
local _cmd="${1%% *}"
local _params="${1#* }"
local _params="${1#${_cmd}}"
if [[ $_cmd != "makedumpfile" ]]; then
if is_raw_dump_target; then

View File

@ -5,7 +5,7 @@
Name: kexec-tools
Version: 2.0.27
Release: 8%{?dist}
Release: 15%{?dist}
License: GPLv2
Summary: The kexec/kdump userspace component
@ -114,6 +114,7 @@ Requires: systemd-udev%{?_isa}
# Patches 601 onward are generic patches
#
Patch601: kexec-update-manpage-with-explicit-mention-of-clean-.patch
Patch602: kexec_file-add-kexec_file-flag-to-support-debug-prin.patch
%description
kexec-tools provides /sbin/kexec binary that facilitates a new
@ -130,6 +131,7 @@ tar -z -x -v -f %{SOURCE9}
tar -z -x -v -f %{SOURCE19}
%patch601 -p1
%patch602 -p1
%ifarch ppc
%define archdef ARCH=ppc
@ -408,6 +410,33 @@ fi
%endif
%changelog
* Wed Aug 7 2024 Tao Liu <ltao@redhat.com> - 2.0.27-15
- Support setting up Open vSwitch (Ovs) Bridge network
* Wed Jul 24 2024 Tao Liu <ltao@redhat.com> - 2.0.27-14
- lib: Ensure we don't find bind mounts for device target
- dracut: Disable ostree-prepare-root
* Tue Jul 16 2024 Tao Liu <ltao@redhat.com> - 2.0.27-13
- kdump-lib: Drop 'file' dependency in is_uki
- kdumpctl.8: Add description to reset-crashkernel --reboot
- kdumpctl: Fix misleading message and erratic reboot in reset_crashkernel
- kdumpctl: Drop default kexec '-d' option
* Thu Jun 27 2024 Tao Liu <ltao@redhat.com> - 2.0.27-12
- ppc64le: replace kernel cmdline maxcpu=1 with nr_cpus=1
* Fri May 31 2024 Tao Liu <ltao@redhat.com> - 2.0.27-11
- sysconfig: add pcie_ports compat to KDUMP_COMMANDLINE_APPEND on x86_64
* Tue May 14 2024 Tao Liu <ltao@redhat.com> - 2.0.27-10
- mkdumprd: Fix makedumpfile parameter check.
- Install the driver of physical device for a SR-IOV virtual device
- Try to install PHY and MDIO bus drivers explicitly
* Wed May 08 2024 Tao Liu <ltao@redhat.com> - 2.0.27-9
- kexec_file: add kexec_file flag to support debug printing
* Tue Jan 30 2024 Tao Liu <ltao@redhat.com> - 2.0.27-8
- dracut-module-setup: Skip initrd-cleanup and initrd-parse-etc in kdump