Remove kdump-utils and makedumpfile
Resolves: RHEL-49401 Signed-off-by: Lichen Liu <lichliu@redhat.com>
This commit is contained in:
		
							parent
							
								
									7419c13d17
								
							
						
					
					
						commit
						d5198e30fe
					
				| @ -1,69 +0,0 @@ | ||||
| From 98087d78eda2ca58a3b55ee5dd9e0e7bad8467ef Mon Sep 17 00:00:00 2001 | ||||
| From: Tao Liu <ltao@redhat.com> | ||||
| Date: Tue, 25 Jun 2024 16:35:16 +1200 | ||||
| Subject: [PATCH] Use "grep -q <<< $(cmd)" instead of "cmd | grep -q" | ||||
| 
 | ||||
| The following line of code's exit value should be the exit value of | ||||
| grep by default: | ||||
| 
 | ||||
|     cmd | grep -q | ||||
| 
 | ||||
| However it will not always work as expected, a 141 exit code may be | ||||
| returned, see the following debug info: | ||||
| 
 | ||||
| //--- a/usr/lib/dracut/modules.d/99kdumpbase/module-setup.sh | ||||
| //+++ b/usr/lib/dracut/modules.d/99kdumpbase/module-setup.sh | ||||
| //@@ -55,6 +55,11 @@ depends() { | ||||
| //         _dep="$_dep ssh-client" | ||||
| //     fi | ||||
| // | ||||
| //+    dracut --list-modules 1>&2 | ||||
| //+    echo $? 1>&2 | ||||
| //+    dracut --list-modules | grep -q lvmthinpool-monitor | ||||
| //+    echo $? ${PIPESTATUS[0]} ${PIPESTATUS[1]} 1>&2 | ||||
| //+ | ||||
| //     if is_lvm2_thinp_dump_target; then | ||||
| //         if dracut --list-modules | grep -q lvmthinpool-monitor; then | ||||
| //             add_opt_module lvmthinpool-monitor | ||||
| 
 | ||||
| $ kdumpctl rebuild | ||||
| kdump: Rebuilding /boot/initramfs-6.10.0-0.rc4.11.el10.x86_64kdump.img | ||||
| ...snip... | ||||
| lvmmerge | ||||
| lvmthinpool-monitor | ||||
| ..snip... | ||||
| uefi-lib | ||||
| 0 | ||||
| 141 141 0 | ||||
| 
 | ||||
| The reason is, grep exits immediately when there is a match but the | ||||
| first cmd still keep writing to the pipe. Since there is no reader, | ||||
| a SIGPIPE signal is generated. As a result, a 141 exit code will be | ||||
| returned. | ||||
| 
 | ||||
| Let's use the following line of code instead, which have the same effect | ||||
| but works as expected: | ||||
| 
 | ||||
|     grep -q <<< $(cmd) | ||||
| 
 | ||||
| Signed-off-by: Tao Liu <ltao@redhat.com> | ||||
| ---
 | ||||
|  dracut-module-setup.sh | 2 +- | ||||
|  1 file changed, 1 insertion(+), 1 deletion(-) | ||||
| 
 | ||||
| diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
 | ||||
| index 89d9959..76fb5b2 100755
 | ||||
| --- a/dracut-module-setup.sh
 | ||||
| +++ b/dracut-module-setup.sh
 | ||||
| @@ -56,7 +56,7 @@ depends() {
 | ||||
|      fi | ||||
|   | ||||
|      if is_lvm2_thinp_dump_target; then | ||||
| -        if dracut --list-modules | grep -q lvmthinpool-monitor; then
 | ||||
| +        if grep -q lvmthinpool-monitor <<< $(dracut --list-modules); then
 | ||||
|              add_opt_module lvmthinpool-monitor | ||||
|          else | ||||
|              dwarning "Required lvmthinpool-monitor modules is missing! Please upgrade dracut >= 057." | ||||
| -- 
 | ||||
| 2.40.1 | ||||
| 
 | ||||
| @ -1,81 +0,0 @@ | ||||
| From a078cd8dfe9fe7956ef04c04c97b7c7354808833 Mon Sep 17 00:00:00 2001 | ||||
| From: Philipp Rudo <prudo@redhat.com> | ||||
| Date: Thu, 11 Apr 2024 16:58:34 +0200 | ||||
| Subject: [PATCH 1/7] dracut-module-setup: Fix missing systemd/system.conf | ||||
|  error | ||||
| 
 | ||||
| There is a bug report for RHEL10 about a grep error reading | ||||
| 
 | ||||
|   grep: /var/tmp/dracut.DiZuKp/initramfs/etc/systemd/system.conf*: No such file or directory | ||||
| 
 | ||||
| that shows up when rebuilding the initrd. This is caused by systemd | ||||
| v255 that allows installing the default systemd config files to | ||||
| /usr/lib/systemd instead of /etc/systemd [1][2] which is done for RHEL. | ||||
| So unless a user manually adds /etc/systemd/system.conf the file no | ||||
| longer exists. | ||||
| 
 | ||||
| However the test that requires the call to grep is somewhat wonky. IIUC | ||||
| the test is there so we don't overwrite a setting the user might have | ||||
| made. In my opinion this only makes sense as long as the timeout set is | ||||
| larger than what we would set. But this part of the logic is missing. | ||||
| So fix the error message by removing the test and add our config | ||||
| unconditionally. | ||||
| 
 | ||||
| While at it rename the created drop-ins to 99-kdump.conf to follow | ||||
| the recommended naming convention and to make sure that our value takes | ||||
| precedence. | ||||
| 
 | ||||
| Note: In case the test is still needed we can fall back to use | ||||
| 'systemd-analyse cat-config' that automatically considers all potential | ||||
| locations for the config and its drop-ins. | ||||
| 
 | ||||
| [1] 6495361c7d ("meson: add build option for install path of main config files") | ||||
| [2] 6378f257e7 ("various: use new config loader instead of config_parse_config_file()") | ||||
| 
 | ||||
| Signed-off-by: Philipp Rudo <prudo@redhat.com> | ||||
| ---
 | ||||
|  dracut-module-setup.sh | 23 +++++++++++++---------- | ||||
|  1 file changed, 13 insertions(+), 10 deletions(-) | ||||
| 
 | ||||
| diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
 | ||||
| index 7e1cb9f..acc0b28 100755
 | ||||
| --- a/dracut-module-setup.sh
 | ||||
| +++ b/dracut-module-setup.sh
 | ||||
| @@ -973,21 +973,24 @@ kdump_install_random_seed() {
 | ||||
|   | ||||
|  kdump_install_systemd_conf() { | ||||
|      # Kdump turns out to require longer default systemd mount timeout | ||||
| -    # than 1st kernel(90s by default), we use default 300s for kdump.
 | ||||
| -    if ! grep -q -r "^[[:space:]]*DefaultTimeoutStartSec=" "${initdir}/etc/systemd/system.conf"*; then
 | ||||
| -        mkdir -p "${initdir}/etc/systemd/system.conf.d"
 | ||||
| -        echo "[Manager]" > "${initdir}/etc/systemd/system.conf.d/kdump.conf"
 | ||||
| -        echo "DefaultTimeoutStartSec=300s" >> "${initdir}/etc/systemd/system.conf.d/kdump.conf"
 | ||||
| -    fi
 | ||||
| +    # than 1st kernel(45s by default), we use default 300s for kdump.
 | ||||
| +    mkdir -p "${initdir}/etc/systemd/system.conf.d"
 | ||||
| +    cat > "${initdir}/etc/systemd/system.conf.d/99-kdump.conf" << EOF
 | ||||
| +[Manager]
 | ||||
| +DefaultTimeoutStartSec=300s
 | ||||
| +EOF
 | ||||
| +
 | ||||
|   | ||||
|      # Forward logs to console directly, and don't read Kmsg, this avoids | ||||
|      # unneccessary memory consumption and make console output more useful. | ||||
|      # Only do so for non fadump image. | ||||
|      mkdir -p "${initdir}/etc/systemd/journald.conf.d" | ||||
| -    echo "[Journal]" > "${initdir}/etc/systemd/journald.conf.d/kdump.conf"
 | ||||
| -    echo "Storage=volatile" >> "${initdir}/etc/systemd/journald.conf.d/kdump.conf"
 | ||||
| -    echo "ReadKMsg=no" >> "${initdir}/etc/systemd/journald.conf.d/kdump.conf"
 | ||||
| -    echo "ForwardToConsole=yes" >> "${initdir}/etc/systemd/journald.conf.d/kdump.conf"
 | ||||
| +    cat > "${initdir}/etc/systemd/journald.conf.d/99-kdump.conf" << EOF
 | ||||
| +[Journal]
 | ||||
| +Storage=volatile
 | ||||
| +ReadKMsg=no
 | ||||
| +ForwardToConsole=yes
 | ||||
| +EOF
 | ||||
|  } | ||||
|   | ||||
|  remove_cpu_online_rule() { | ||||
| -- 
 | ||||
| 2.44.0 | ||||
| 
 | ||||
| @ -1,120 +0,0 @@ | ||||
| From 32f9ada4bfa9f9690bdcdb21de40568c81a5ea80 Mon Sep 17 00:00:00 2001 | ||||
| From: Philipp Rudo <prudo@redhat.com> | ||||
| Date: Fri, 14 Jun 2024 11:48:24 +0200 | ||||
| Subject: [PATCH 1/7] kdumpctl: Drop default kexec '-d' option | ||||
| 
 | ||||
| Kernel commits cbc2fe9d9cb2 ("kexec_file: add kexec_file flag to control | ||||
| debug printing") and a85ee18c7900 ("kexec_file: print out debugging | ||||
| message if required") added debug messages to the kexec_file_load system | ||||
| call when option -d is provided to the kexec user space tool. As | ||||
| kexec_file_load is the default and option -d is set by default these | ||||
| messages are always printed when a crash kernel is loaded. This not only | ||||
| clutters the kernel log but also potentially leaks confidential kernel | ||||
| information to users. As the messages are printed to the kernel log, not | ||||
| stderr, the redirection to /var/log/kdump.log won't catch them. This | ||||
| will become even more problematic as for RHEL10 the kernel will be built | ||||
| without support for the kexec_load system call. So kexec_file_load will | ||||
| be the only choice in the future. | ||||
| 
 | ||||
| The redirection also caused confusion in a recent bug report. There a | ||||
| user moved a working /etc/sysconfig/kdump from ppc to s390 with | ||||
| KEXEC_ARGS containing the --dt-no-old-root option. This option is arch | ||||
| specific and does not exist on s390. Thus the kexec-tools failed with an | ||||
| 'unrecognized option' error followed by the usage(). The problem was | ||||
| that the 'unrecognized option' error is printed to stderr, which got | ||||
| redirected to /var/log/kdump.log, while the usage() is printed to | ||||
| stdout, which ended up in the systemd journal. This caused confusion as | ||||
| the user only checked the journal and found the usage() without any | ||||
| error message. | ||||
| 
 | ||||
| Thus remove the default -d option and the redirection of stderr to | ||||
| /var/log/kdump.log for the kexec-tools user space tool. | ||||
| 
 | ||||
| This commit ultimately reverts 88a8b94 ("kdumpctl: add the '-d' option to | ||||
| enable the kexec loading debugging messages"). | ||||
| 
 | ||||
| Signed-off-by: Philipp Rudo <prudo@redhat.com> | ||||
| ---
 | ||||
|  kdumpctl              | 21 +++------------------ | ||||
|  kexec-kdump-howto.txt |  7 +------ | ||||
|  2 files changed, 4 insertions(+), 24 deletions(-) | ||||
| 
 | ||||
| diff --git a/kdumpctl b/kdumpctl
 | ||||
| index 30eb27d..8dc56e5 100755
 | ||||
| --- a/kdumpctl
 | ||||
| +++ b/kdumpctl
 | ||||
| @@ -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" | ||||
| @@ -17,7 +16,7 @@ TARGET_INITRD=""
 | ||||
|  #kdump shall be the default dump mode | ||||
|  DEFAULT_DUMP_MODE="kdump" | ||||
|   | ||||
| -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" | ||||
| @@ -696,7 +695,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}") | ||||
| @@ -713,26 +712,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 | ||||
| diff --git a/kexec-kdump-howto.txt b/kexec-kdump-howto.txt
 | ||||
| index 6741faf..c65d45a 100644
 | ||||
| --- a/kexec-kdump-howto.txt
 | ||||
| +++ b/kexec-kdump-howto.txt
 | ||||
| @@ -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 | ||||
| -- 
 | ||||
| 2.45.2 | ||||
| 
 | ||||
| @ -1,30 +0,0 @@ | ||||
| From d25d3d4500d1ca1357350fa4a28ac89a33f250e0 Mon Sep 17 00:00:00 2001 | ||||
| From: Philipp Rudo <prudo@redhat.com> | ||||
| Date: Tue, 18 Jun 2024 14:57:16 +0200 | ||||
| Subject: [PATCH 2/7] kdump-lib: fix sed expression in prepare_cmdline on | ||||
|  aarch64 | ||||
| 
 | ||||
| The sed expression misses a 's' for search and replace... | ||||
| 
 | ||||
| Fixes: 0f6ad91 ("kdump-lib: fix prepare_cmdline") | ||||
| Signed-off-by: Philipp Rudo <prudo@redhat.com> | ||||
| ---
 | ||||
|  kdump-lib.sh | 2 +- | ||||
|  1 file changed, 1 insertion(+), 1 deletion(-) | ||||
| 
 | ||||
| diff --git a/kdump-lib.sh b/kdump-lib.sh
 | ||||
| index 79714f9..35f0ac9 100755
 | ||||
| --- a/kdump-lib.sh
 | ||||
| +++ b/kdump-lib.sh
 | ||||
| @@ -802,7 +802,7 @@ prepare_cmdline()
 | ||||
|   | ||||
|  	# This is a workaround on AWS platform. Always remove irqpoll since it | ||||
|  	# may cause the hot-remove of some pci hotplug device. | ||||
| -	is_aws_aarch64 && out=$(echo "$out" | sed -e "/\<irqpoll\>//")
 | ||||
| +	is_aws_aarch64 && out=$(echo "$out" | sed -e "s/\<irqpoll\>//")
 | ||||
|   | ||||
|  	# Always disable gpt-auto-generator as it hangs during boot of the | ||||
|  	# crash kernel. Furthermore we know which disk will be used for dumping | ||||
| -- 
 | ||||
| 2.45.2 | ||||
| 
 | ||||
| @ -1,55 +0,0 @@ | ||||
| From 247c7a5f39b305f9a83bad2d936d00237165b7e0 Mon Sep 17 00:00:00 2001 | ||||
| From: "Mamoru Nishibe (Fujitsu)" <nishibe.mamoru@fujitsu.com> | ||||
| Date: Wed, 24 Apr 2024 08:11:12 +0000 | ||||
| Subject: [PATCH 2/7] mkdumprd: Fix makedumpfile parameter check. | ||||
| 
 | ||||
| If only "makedumpfile" is written in "core_collector" of /etc/kdump.conf | ||||
| and try to run makedumpfile without options, | ||||
| "makedumpfile --check-params" fails and terminates abnormally. | ||||
| 
 | ||||
|     # grep ^core_collector /etc/kdump.conf | ||||
|     core_collector makedumpfile | ||||
|     # /usr/bin/kdumpctl start | ||||
|     : | ||||
|     Commandline parameter is invalid. | ||||
|     Try `makedumpfile --help' for more information. | ||||
|     kdump: makedumpfile parameter check failed. | ||||
|     kdump: mkdumprd: failed to make kdump initrd | ||||
|     kdump: Starting kdump: [FAILED] | ||||
| 
 | ||||
| On the other hand, "makedumpfile --check-params" works fine without any options. | ||||
| 
 | ||||
|     # makedumpfile --check-params vmcore dumpfile | ||||
|     # echo $? | ||||
|     0 | ||||
| 
 | ||||
| In addition, before verify_core_collector() was implemented, | ||||
| initial RAM for kdump was successfully created using only "core_collector makedumpfile". | ||||
| I consider it a regression. | ||||
| 
 | ||||
| This is due to a parameter extraction error in verify_core_collector(). | ||||
| Fix it to correctly extract only the options as follows. | ||||
| 
 | ||||
| Fixes: a1c28126 ("mkdumprd: Use makedumpfile --check-params option") | ||||
| Signed-off-by: Mamoru Nishibe <nishibe.mamoru@fujitsu.com> | ||||
| Reviewed-by: Coiby Xu <coxu@redhat.com> | ||||
| ---
 | ||||
|  mkdumprd | 2 +- | ||||
|  1 file changed, 1 insertion(+), 1 deletion(-) | ||||
| 
 | ||||
| diff --git a/mkdumprd b/mkdumprd
 | ||||
| index 31c4b76..27eed5e 100644
 | ||||
| --- a/mkdumprd
 | ||||
| +++ b/mkdumprd
 | ||||
| @@ -256,7 +256,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 | ||||
| -- 
 | ||||
| 2.44.0 | ||||
| 
 | ||||
| @ -1,53 +0,0 @@ | ||||
| From d057153a1c3c36612a14143b29c0ff0be34e4fc2 Mon Sep 17 00:00:00 2001 | ||||
| From: Coiby Xu <coxu@redhat.com> | ||||
| Date: Thu, 21 Sep 2023 11:50:14 +0800 | ||||
| Subject: [PATCH 3/7] 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> | ||||
| ---
 | ||||
|  dracut-module-setup.sh | 2 +- | ||||
|  1 file changed, 1 insertion(+), 1 deletion(-) | ||||
| 
 | ||||
| diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
 | ||||
| index acc0b28..3c9bdbe 100755
 | ||||
| --- a/dracut-module-setup.sh
 | ||||
| +++ b/dracut-module-setup.sh
 | ||||
| @@ -384,7 +384,7 @@ _get_hpyerv_physical_driver() {
 | ||||
|  kdump_install_nic_driver() { | ||||
|      local _netif _driver _drivers | ||||
|   | ||||
| -    _drivers=()
 | ||||
| +    _drivers=('=drivers/net/phy' '=drivers/net/mdio')
 | ||||
|   | ||||
|      for _netif in $1; do | ||||
|          [[ $_netif == lo ]] && continue | ||||
| -- 
 | ||||
| 2.44.0 | ||||
| 
 | ||||
| @ -1,127 +0,0 @@ | ||||
| From 8ebf2874a202a2d7116a27c69816b8621ace5224 Mon Sep 17 00:00:00 2001 | ||||
| From: Philipp Rudo <prudo@redhat.com> | ||||
| Date: Thu, 1 Jun 2023 17:04:13 +0200 | ||||
| Subject: [PATCH 3/7] kdumpctl: Simplify fadump handling in reset_crashkernel | ||||
| 
 | ||||
| When handling fadump there are three cases we need to consider | ||||
| 
 | ||||
| 1) When running on non-ppc64le systems | ||||
|    In this case _dump_mode=kdump and _new_fadump='' always. In other | ||||
|    words we don't need to care updating the fadump parameter on the | ||||
|    kernel command line. We could always remove it like the code did so | ||||
|    far. But should we remove it when we never set it? In particular as | ||||
|    that might overwrite a change explicitly made by the user (for | ||||
|    whatever reason) | ||||
| 
 | ||||
| 2) When running on ppc64le and the user provided --fadump option | ||||
|    In this case _new_fadump and _dump_mode are set accordingly to what | ||||
|    the user provided. Thus we need to update both the crashkernel (in | ||||
|    case fadump was turned on/off) and the fadump (in case the fadump | ||||
|    mode changed) parameters. | ||||
| 
 | ||||
| 3) When running on ppc64le but the user did not provide --fadump option | ||||
|    In this case both _new_fadump='' and _dump_mode=''. In this case we | ||||
|    take over the previously set fadump parameter. Which means that we | ||||
|    don't need to update the fadump parameter at all. We do need to check | ||||
|    whether the _new_dump_mode is fadump or kdump though so we use the | ||||
|    correct (new) default crashkernel value. | ||||
| 
 | ||||
| In the three cases only the second one needs to update the fadump | ||||
| parameter. Reflect this discussion in code. | ||||
| 
 | ||||
| This also fixes a bug that always prints | ||||
| 
 | ||||
| 	kdump: Updated fadump= for kernel=$kernel. Please reboot the | ||||
| 	system for the change to take effect. | ||||
| 
 | ||||
| when the crashkernel= parameter is unchanged as well as reboots the | ||||
| system, if --reboot is provided. Even for non-ppc architectures. | ||||
| 
 | ||||
| Fixes: 140da74 ("rewrite reset_crashkernel to support fadump and to used by RPM scriptlet") | ||||
| Signed-off-by: Philipp Rudo <prudo@redhat.com> | ||||
| ---
 | ||||
|  kdumpctl | 38 ++++++++++++++++++++++---------------- | ||||
|  1 file changed, 22 insertions(+), 16 deletions(-) | ||||
| 
 | ||||
| diff --git a/kdumpctl b/kdumpctl
 | ||||
| index 8dc56e5..8ec638b 100755
 | ||||
| --- a/kdumpctl
 | ||||
| +++ b/kdumpctl
 | ||||
| @@ -1467,10 +1467,10 @@ _get_all_kernels_from_grubby()
 | ||||
|  reset_crashkernel() | ||||
|  { | ||||
|  	local _opt _val _reboot _grubby_kernel_path _kernel _kernels | ||||
| -	local _dump_mode _new_dump_mode
 | ||||
| +	local _dump_mode
 | ||||
|  	local _has_changed _needs_reboot | ||||
|  	local _old_ck _new_ck | ||||
| -	local _old_fadump _new_fadump
 | ||||
| +	local _old_fadump _new_fadump _opt_fadump
 | ||||
|   | ||||
|  	for _opt in "$@"; do | ||||
|  		case "$_opt" in | ||||
| @@ -1479,12 +1479,11 @@ reset_crashkernel()
 | ||||
|  					derror "Option --fadump only valid on PPC" | ||||
|  					exit 1 | ||||
|  				fi | ||||
| -				_new_fadump=${_opt#*=}
 | ||||
| -				if ! _dump_mode=$(get_dump_mode_by_fadump_val $_new_fadump); then
 | ||||
| +				_opt_fadump=${_opt#*=}
 | ||||
| +				if ! _dump_mode=$(get_dump_mode_by_fadump_val $_opt_fadump); then
 | ||||
|  					derror "failed to determine dump mode" | ||||
|  					exit | ||||
|  				fi | ||||
| -				[[ "$_new_fadump" == off ]] && _new_fadump=""
 | ||||
|  				;; | ||||
|  			--kernel=*) | ||||
|  				_val=${_opt#*=} | ||||
| @@ -1519,8 +1518,6 @@ reset_crashkernel()
 | ||||
|  		return | ||||
|  	fi | ||||
|   | ||||
| -	[[ $(uname -m) != ppc64le ]] && _dump_mode=kdump
 | ||||
| -
 | ||||
|  	# If kernel-path not specified, either | ||||
|  	#  - use KDUMP_KERNELVER if it's defined | ||||
|  	#  - use current running kernel | ||||
| @@ -1536,19 +1533,28 @@ reset_crashkernel()
 | ||||
|   | ||||
|  	for _kernel in $_kernels; do | ||||
|  		_has_changed="" | ||||
| -		if [[ -z $_dump_mode ]]; then
 | ||||
| -			_new_dump_mode=$(get_dump_mode_by_kernel "$_kernel")
 | ||||
| -			_new_fadump=$(get_grub_kernel_boot_parameter "$_kernel" fadump)
 | ||||
| +		if [[ $(uname -m) == ppc64le ]]; then
 | ||||
| +			if [[ -n "$_opt_fadump" ]]; then
 | ||||
| +				_new_ck=$(kdump_get_arch_recommend_crashkernel "$_dump_mode")
 | ||||
| +				_old_fadump=$(get_grub_kernel_boot_parameter "$_kernel" fadump)
 | ||||
| +				_new_fadump="$_opt_fadump"
 | ||||
| +				[[ "$_new_fadump" == off ]] && _new_fadump=""
 | ||||
| +				if _update_kernel_cmdline "$_kernel" fadump "$_old_fadump" "$_new_fadump"; then
 | ||||
| +					if [[ -n "$_new_fadump" ]]; then
 | ||||
| +						_has_changed="Updated fadump=$_new_fadump"
 | ||||
| +					else
 | ||||
| +						_has_changed="Removed fadump"
 | ||||
| +					fi
 | ||||
| +				fi
 | ||||
| +			else
 | ||||
| +				_dump_mode="$(get_dump_mode_by_kernel "$_kernel")"
 | ||||
| +				_new_ck=$(kdump_get_arch_recommend_crashkernel "$_dump_mode")
 | ||||
| +			fi
 | ||||
|  		else | ||||
| -			_new_dump_mode=$_dump_mode
 | ||||
| +			_new_ck=$(kdump_get_arch_recommend_crashkernel kdump)
 | ||||
|  		fi | ||||
|   | ||||
|  		_old_ck=$(get_grub_kernel_boot_parameter "$_kernel" crashkernel) | ||||
| -		_new_ck=$(kdump_get_arch_recommend_crashkernel "$_new_dump_mode")
 | ||||
| -		_old_fadump=$(get_grub_kernel_boot_parameter "$_kernel" fadump)
 | ||||
| -		if _update_kernel_cmdline "$_kernel" fadump "$_old_fadump" "$_new_fadump"; then
 | ||||
| -			_has_changed="Updated fadump=$_new_fadump"
 | ||||
| -		fi
 | ||||
|  		if _update_kernel_cmdline "$_kernel" crashkernel "$_old_ck" "$_new_ck"; then | ||||
|  			_has_changed="Updated crashkernel=$_new_ck" | ||||
|  		fi | ||||
| -- 
 | ||||
| 2.45.2 | ||||
| 
 | ||||
| @ -1,50 +0,0 @@ | ||||
| From 7a8edc8de67dccae23b01461bc3b17c0ad42aa5f Mon Sep 17 00:00:00 2001 | ||||
| From: Coiby Xu <coxu@redhat.com> | ||||
| Date: Wed, 27 Sep 2023 09:31:39 +0800 | ||||
| Subject: [PATCH 4/7] 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> | ||||
| ---
 | ||||
|  dracut-module-setup.sh | 11 +++++++++++ | ||||
|  1 file changed, 11 insertions(+) | ||||
| 
 | ||||
| diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
 | ||||
| index 3c9bdbe..89d9959 100755
 | ||||
| --- a/dracut-module-setup.sh
 | ||||
| +++ b/dracut-module-setup.sh
 | ||||
| @@ -381,6 +381,14 @@ _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 | ||||
|   | ||||
| @@ -408,6 +416,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 | ||||
| -- 
 | ||||
| 2.44.0 | ||||
| 
 | ||||
| @ -1,32 +0,0 @@ | ||||
| From de393c1bcb7d32e97d9b46bb6a73180072f03aa3 Mon Sep 17 00:00:00 2001 | ||||
| From: Philipp Rudo <prudo@redhat.com> | ||||
| Date: Mon, 1 Jul 2024 12:52:39 +0200 | ||||
| Subject: [PATCH 4/7] kdumpctl.8: Add description to reset-crashkernel --reboot | ||||
| 
 | ||||
| There is no description for parameter --reboot for reset-crashkernel. | ||||
| Thus add one. | ||||
| 
 | ||||
| Suggested-by: Lichen Liu <lichliu@redhat.com> | ||||
| Signed-off-by: Philipp Rudo <prudo@redhat.com> | ||||
| ---
 | ||||
|  kdumpctl.8 | 4 ++++ | ||||
|  1 file changed, 4 insertions(+) | ||||
| 
 | ||||
| diff --git a/kdumpctl.8 b/kdumpctl.8
 | ||||
| index 33c1115..29a6119 100644
 | ||||
| --- a/kdumpctl.8
 | ||||
| +++ b/kdumpctl.8
 | ||||
| @@ -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 | ||||
| -- 
 | ||||
| 2.45.2 | ||||
| 
 | ||||
| @ -1,32 +0,0 @@ | ||||
| From afc6ddb781079dfbdf7919803114458907fc4e6a Mon Sep 17 00:00:00 2001 | ||||
| From: Philipp Rudo <prudo@redhat.com> | ||||
| Date: Thu, 20 Jun 2024 13:19:30 +0200 | ||||
| Subject: [PATCH 5/7] dracut-kdump.sh: Save kexec-dmesg.log after | ||||
|  failure_action | ||||
| 
 | ||||
| The kexec-dmesg.log is only saved after the initial dump attempt but not | ||||
| for the failure_action. So in case the initial dump attempt failed and | ||||
| the failure_action is dump_to_rootfs the kexec-dmesg.log is missing. Fix | ||||
| that by calling save_log also after executing the failure_action. | ||||
| 
 | ||||
| Fixes: 3d70f8b ("logger: save log after all kdump progress finished") | ||||
| Signed-off-by: Philipp Rudo <prudo@redhat.com> | ||||
| ---
 | ||||
|  dracut-kdump.sh | 1 + | ||||
|  1 file changed, 1 insertion(+) | ||||
| 
 | ||||
| diff --git a/dracut-kdump.sh b/dracut-kdump.sh
 | ||||
| index 7b3ad7a..2e078c7 100755
 | ||||
| --- a/dracut-kdump.sh
 | ||||
| +++ b/dracut-kdump.sh
 | ||||
| @@ -579,6 +579,7 @@ fence_kdump_notify()
 | ||||
|  if [ "$1" = "--error-handler" ]; then | ||||
|  	get_kdump_confs | ||||
|  	do_failure_action | ||||
| +	save_log
 | ||||
|  	do_final_action | ||||
|   | ||||
|  	exit $? | ||||
| -- 
 | ||||
| 2.45.2 | ||||
| 
 | ||||
| @ -1,47 +0,0 @@ | ||||
| From 659e0aae8f00570c85e82e1317153bf89e59929c Mon Sep 17 00:00:00 2001 | ||||
| From: Baoquan He <bhe@redhat.com> | ||||
| Date: Thu, 7 Sep 2023 10:37:20 -0500 | ||||
| Subject: [PATCH 5/7] update 98-kexec rules for crash hotplug | ||||
| 
 | ||||
| In kernel, with the support of cpu/memory hotplug on crash, kdump | ||||
| reloading only needs to update the elfcorehdr. | ||||
| 
 | ||||
| To realize the benefits, we need prevent udev from updating kdump | ||||
| kernel on hot un/plug changes when detecting that the crash_hotplug | ||||
| sysfs nodes are present. | ||||
| 
 | ||||
| Link: https://lore.kernel.org/lkml/20230814214446.6659-1-eric.devolder@oracle.com/ | ||||
| Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d68b4b6f307d155475cce541f2aee938032ed22e | ||||
| Signed-off-by: Baoquan He <bhe@redhat.com> | ||||
| ---
 | ||||
|  98-kexec.rules       | 4 ++++ | ||||
|  98-kexec.rules.ppc64 | 4 ++++ | ||||
|  2 files changed, 8 insertions(+) | ||||
| 
 | ||||
| diff --git a/98-kexec.rules b/98-kexec.rules
 | ||||
| index b73b701..52b2ee8 100644
 | ||||
| --- a/98-kexec.rules
 | ||||
| +++ b/98-kexec.rules
 | ||||
| @@ -1,3 +1,7 @@
 | ||||
| +# The kernel updates the crash elfcorehdr for CPU and memory changes
 | ||||
| +SUBSYSTEM=="cpu", ATTRS{crash_hotplug}=="1", GOTO="kdump_reload_end"
 | ||||
| +SUBSYSTEM=="memory", ATTRS{crash_hotplug}=="1", GOTO="kdump_reload_end"
 | ||||
| +
 | ||||
|  SUBSYSTEM=="cpu", ACTION=="add", GOTO="kdump_reload" | ||||
|  SUBSYSTEM=="cpu", ACTION=="remove", GOTO="kdump_reload" | ||||
|  SUBSYSTEM=="memory", ACTION=="online", GOTO="kdump_reload" | ||||
| diff --git a/98-kexec.rules.ppc64 b/98-kexec.rules.ppc64
 | ||||
| index e9db276..e7735b3 100644
 | ||||
| --- a/98-kexec.rules.ppc64
 | ||||
| +++ b/98-kexec.rules.ppc64
 | ||||
| @@ -1,3 +1,7 @@
 | ||||
| +# The kernel updates the crash elfcorehdr for CPU and memory changes
 | ||||
| +SUBSYSTEM=="cpu", ATTRS{crash_hotplug}=="1", GOTO="kdump_reload_end"
 | ||||
| +SUBSYSTEM=="memory", ATTRS{crash_hotplug}=="1", GOTO="kdump_reload_end"
 | ||||
| +
 | ||||
|  SUBSYSTEM=="cpu", ACTION=="online", GOTO="kdump_reload_cpu" | ||||
|  SUBSYSTEM=="memory", ACTION=="online", GOTO="kdump_reload_mem" | ||||
|  SUBSYSTEM=="memory", ACTION=="offline", GOTO="kdump_reload_mem" | ||||
| -- 
 | ||||
| 2.44.0 | ||||
| 
 | ||||
| @ -1,43 +0,0 @@ | ||||
| From e6b134a1593036b47a2a35da3c695a0db90de73f Mon Sep 17 00:00:00 2001 | ||||
| From: Philipp Rudo <prudo@redhat.com> | ||||
| Date: Mon, 24 Jun 2024 13:44:22 +0200 | ||||
| Subject: [PATCH 6/7] Makefile: Fix early-kdump file names | ||||
| 
 | ||||
| When creating the kdump-utils subpackage the files for earlykdump were | ||||
| incorrectly renamed to kdump.sh and kdump-module-setup.sh rather than | ||||
| the expected early-kdump.sh and module-setup.sh. These incorrect file | ||||
| names then got transferred to the newly created Makefile with fe372af | ||||
| ("Upstream kdump-utils"). | ||||
| 
 | ||||
| With those incorrect file names dracut fails when trying to add the | ||||
| earlykdump module with | ||||
| 
 | ||||
| 	# dracut --add earlykdump kdump.img | ||||
| 	dracut[E]: Module 'earlykdump' cannot be installed. | ||||
| 
 | ||||
| Fix the file names to allow installing the earlykdump module. | ||||
| 
 | ||||
| Fixes: 372b4c6 ("Add kdump-utils subpackage") | ||||
| Signed-off-by: Philipp Rudo <prudo@redhat.com> | ||||
| ---
 | ||||
|  Makefile | 4 ++-- | ||||
|  1 file changed, 2 insertions(+), 2 deletions(-) | ||||
| 
 | ||||
| diff --git a/Makefile b/Makefile
 | ||||
| index e1a511c..538e4f4 100644
 | ||||
| --- a/Makefile
 | ||||
| +++ b/Makefile
 | ||||
| @@ -26,8 +26,8 @@ dracut-modules:
 | ||||
|  	install -m 644 dracut-kdump-emergency.target $(kdumpbasemoddir)/kdump-emergency.target | ||||
|   | ||||
|  	mkdir -p -m755 $(dracutmoddir)/99earlykdump | ||||
| -	install -m 755 dracut-early-kdump.sh $(dracutmoddir)/99earlykdump/kdump.sh
 | ||||
| -	install -m 755 dracut-early-kdump-module-setup.sh $(dracutmoddir)/99earlykdump/kdump-module-setup.sh
 | ||||
| +	install -m 755 dracut-early-kdump.sh $(dracutmoddir)/99earlykdump/early-kdump.sh
 | ||||
| +	install -m 755 dracut-early-kdump-module-setup.sh $(dracutmoddir)/99earlykdump/module-setup.sh
 | ||||
|   | ||||
|  ifeq ($(ARCH), $(filter ppc64le ppc64,$(ARCH))) | ||||
|  	mkdir -p -m755 $(dracutmoddir)/99zz-fadumpinit | ||||
| -- 
 | ||||
| 2.45.2 | ||||
| 
 | ||||
| @ -1,61 +0,0 @@ | ||||
| From ada6f5edf1ae06fc88759aa2f94d09e2a98d21ef Mon Sep 17 00:00:00 2001 | ||||
| From: Tao Liu <ltao@redhat.com> | ||||
| Date: Wed, 1 May 2024 16:53:19 +0800 | ||||
| Subject: [PATCH 6/7] sysconfig: add pcie_ports compat to | ||||
|  KDUMP_COMMANDLINE_APPEND on x86_64 | ||||
| 
 | ||||
| There have been some of failing cases of kdump in 2nd kernel, where | ||||
| ususally only one cpu is enabled by "nr_cpus=1", but with a large | ||||
| number of devices, which may easily exceed the maximum IRQ resources of | ||||
| one cpu can handle. As a result, the 2nd kernel will hang and kdump | ||||
| fails. This issue is often observed on machines with many cpus and many | ||||
| devices. | ||||
| 
 | ||||
| On those systems, pcieports consume quite proportion of IRQ resources, | ||||
| many following message can be seen in dmesg log: | ||||
| 
 | ||||
|    pcieport 0000:18:01.0: PME: Signaling with IRQ 109 | ||||
| 
 | ||||
| According to kernel doc[1], when "pcie_ports=compat" applied, it will disable | ||||
| native PCIe services (PME, AER, DPC, PCIe hotplug). Those functions are | ||||
| power management events, error reporting, performance, hotplug related, | ||||
| which are not the must-have functions for kdump. In addition, after | ||||
| testing, no side effects such as cannot writing vmcore into sdx, nvme | ||||
| etc been noticed. | ||||
| 
 | ||||
| This patch will disable native PCIe services for 2nd kernel, to saving the | ||||
| scarce IRQ resources and increase the kdump success. | ||||
| 
 | ||||
| Attach Prarit's comments: | ||||
| 
 | ||||
| This makes sense to me. The only concern anyone should have is that a PCIE | ||||
| error could have been responsible for taking down the kernel in the first | ||||
| place, and booting into the second kernel could then also have a fatal | ||||
| problem. I'm not sure we can ever fix that type of cascade of panics :) | ||||
| so it makes sense to disable these features. | ||||
| 
 | ||||
| [1]: https://www.kernel.org/doc/html/v6.9-rc1/admin-guide/kernel-parameters.html | ||||
| 
 | ||||
| Signed-off-by: Tao Liu <ltao@redhat.com> | ||||
| Acked-by: Prarit Bhargava <prarit@redhat.com> | ||||
| Acked-by: Dave Young <dyoung@redhat.com> | ||||
| ---
 | ||||
|  gen-kdump-sysconfig.sh | 2 +- | ||||
|  1 file changed, 1 insertion(+), 1 deletion(-) | ||||
| 
 | ||||
| diff --git a/gen-kdump-sysconfig.sh b/gen-kdump-sysconfig.sh
 | ||||
| index 78b0bb7..1a2cd92 100755
 | ||||
| --- a/gen-kdump-sysconfig.sh
 | ||||
| +++ b/gen-kdump-sysconfig.sh
 | ||||
| @@ -104,7 +104,7 @@ s390x)
 | ||||
|  x86_64) | ||||
|  	update_param KEXEC_ARGS "-s" | ||||
|  	update_param 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"
 | ||||
| +		"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"
 | ||||
|  	;; | ||||
|  *) | ||||
|  	echo "Warning: Unknown architecture '$1', using default sysconfig template." >&2 | ||||
| -- 
 | ||||
| 2.44.0 | ||||
| 
 | ||||
| @ -1,41 +0,0 @@ | ||||
| From b4e3d3724cf372493b404586126067ff66e550d6 Mon Sep 17 00:00:00 2001 | ||||
| From: Sourabh Jain <sourabhjain@linux.ibm.com> | ||||
| Date: Fri, 26 Apr 2024 18:17:49 +0530 | ||||
| Subject: [PATCH 7/7] fadump/udev: do not re-register fadump if kernel hotplug | ||||
|  ready | ||||
| 
 | ||||
| With the introduction of kernel commit c6c5b14dac0d ("powerpc: make fadump | ||||
| resilient with memory add/remove events") linux kernel now internally manages | ||||
| the update of elfcorehdr during memory add/remove events. So no need to | ||||
| re-register fadump if the /sys/kernel/fadump/hotplug_ready is set to 1. | ||||
| 
 | ||||
| No impact for kernels that do not have /sys/kernel/fadump/hotplug_ready | ||||
| sysfs. | ||||
| 
 | ||||
| Relevant kernel commit links: | ||||
| 1. https://msgid.link/20240422195932.1583833-2-sourabhjain@linux.ibm.com | ||||
| 2. https://msgid.link/20240422195932.1583833-3-sourabhjain@linux.ibm.com | ||||
| 
 | ||||
| Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com> | ||||
| ---
 | ||||
|  98-kexec.rules.ppc64 | 4 +++- | ||||
|  1 file changed, 3 insertions(+), 1 deletion(-) | ||||
| 
 | ||||
| diff --git a/98-kexec.rules.ppc64 b/98-kexec.rules.ppc64
 | ||||
| index e7735b3..85fe0b1 100644
 | ||||
| --- a/98-kexec.rules.ppc64
 | ||||
| +++ b/98-kexec.rules.ppc64
 | ||||
| @@ -15,7 +15,9 @@ GOTO="kdump_reload_end"
 | ||||
|   | ||||
|  LABEL="kdump_reload_mem" | ||||
|   | ||||
| -RUN+="/bin/sh -c '/usr/bin/systemctl is-active kdump.service || exit 0; /usr/bin/systemd-run --quiet --no-block /usr/lib/udev/kdump-udev-throttler'"
 | ||||
| +# Don't re-register fadump if /sys/kernel/fadump/hotplug_ready sysfs is set to 1.
 | ||||
| +
 | ||||
| +RUN+="/bin/sh -c '/usr/bin/systemctl is-active kdump.service || exit 0; ! test -f /sys/kernel/fadump/hotplug_ready || cat /sys/kernel/fadump/hotplug_ready | grep 1 || exit 0; /usr/bin/systemd-run --quiet --no-block /usr/lib/udev/kdump-udev-throttler'"
 | ||||
|   | ||||
|  GOTO="kdump_reload_end" | ||||
|   | ||||
| -- 
 | ||||
| 2.44.0 | ||||
| 
 | ||||
| @ -1,36 +0,0 @@ | ||||
| From efc06f21a5b1b3a30ce438c15ce4a07fdfdd2440 Mon Sep 17 00:00:00 2001 | ||||
| From: Philipp Rudo <prudo@redhat.com> | ||||
| Date: Mon, 24 Jun 2024 17:34:35 +0200 | ||||
| Subject: [PATCH 7/7] kdump-lib: Drop 'file' dependency in is_uki | ||||
| 
 | ||||
| The 'file' utility is no longer installed per default. In addition there | ||||
| was an update to it so it now reports the file type as | ||||
| application/vnd.microsoft.portable-executable. Thus fall back to use | ||||
| objdump to avoid adding yet an other dependency for kdump-utils and deal | ||||
| with different versions of 'file'. | ||||
| 
 | ||||
| Note: This has the small drawback that objdump is arch specific. I.e. | ||||
| examining a aarch64 UKI on a x86_64 machine will return an 'file format | ||||
| not recognized' error. | ||||
| 
 | ||||
| Signed-off-by: Philipp Rudo <prudo@redhat.com> | ||||
| ---
 | ||||
|  kdump-lib.sh | 2 +- | ||||
|  1 file changed, 1 insertion(+), 1 deletion(-) | ||||
| 
 | ||||
| diff --git a/kdump-lib.sh b/kdump-lib.sh
 | ||||
| index 35f0ac9..13e16e3 100755
 | ||||
| --- a/kdump-lib.sh
 | ||||
| +++ b/kdump-lib.sh
 | ||||
| @@ -18,7 +18,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 | ||||
|  } | ||||
|   | ||||
| -- 
 | ||||
| 2.45.2 | ||||
| 
 | ||||
| @ -1,132 +0,0 @@ | ||||
| From: Coiby Xu <coxu@redhat.com> | ||||
| 
 | ||||
| Subject: [PATCH] ppc64: get vmalloc start address from vmcoreinfo | ||||
| 
 | ||||
| Bugzilla: https://bugzilla.redhat.com/2269991 | ||||
| 
 | ||||
| commit 94241fd2feed059227a243618f2acc6aabf366e8 | ||||
| Author: Aditya Gupta <adityag@linux.ibm.com> | ||||
| Date:   Sat Feb 24 00:33:42 2024 +0530 | ||||
| 
 | ||||
|     [PATCH] ppc64: get vmalloc start address from vmcoreinfo | ||||
|      | ||||
|     Below error was noticed when running makedumpfile on linux-next kernel | ||||
|     crash (linux-next tag next-20240121): | ||||
|      | ||||
|         Checking for memory holes : [100.0 %] | readpage_elf: Attempt to read non-existent page at 0xc000000000000. | ||||
|         [ 17.551718] kdump.sh[404]: readmem: type_addr: 0, addr:c00c000000000000, size:16384 | ||||
|         [ 17.551793] kdump.sh[404]: __exclude_unnecessary_pages: Can't read the buffer of struct page. | ||||
|         [ 17.551864] kdump.sh[404]: create_2nd_bitmap: Can't exclude unnecessary pages. | ||||
|         [ 17.562632] kdump.sh[404]: The kernel version is not supported. | ||||
|         [ 17.562708] kdump.sh[404]: The makedumpfile operation may be incomplete. | ||||
|         [ 17.562773] kdump.sh[404]: makedumpfile Failed. | ||||
|         [ 17.564335] kdump[406]: saving vmcore failed, _exitcode:1 | ||||
|      | ||||
|     Above error was due to 'vmap_area_list' and 'vmlist' symbols missing | ||||
|     from the vmcore.  'vmap_area_list' was removed in the linux kernel | ||||
|     6.9-rc1 by the commit below: | ||||
|      | ||||
|         commit 55c49fee57af99f3c663e69dedc5b85e691bbe50 | ||||
|              mm/vmalloc: remove vmap_area_list | ||||
|      | ||||
|     Subsequently the commit also introduced 'VMALLOC_START' in vmcoreinfo to | ||||
|     get base address of vmalloc area, instead of depending on 'vmap_area_list' | ||||
|      | ||||
|     Hence if 'VMALLOC_START' symbol is there in vmcoreinfo: | ||||
|       1. Set vmalloc_start based on 'VMALLOC_START' | ||||
|       2. Don't error if vmap_area_list/vmlist are not defined | ||||
|      | ||||
|     Reported-by: Sachin Sant <sachinp@linux.ibm.com> | ||||
|     Signed-off-by: Aditya Gupta <adityag@linux.ibm.com> | ||||
| 
 | ||||
| Signed-off-by: Coiby Xu <coxu@redhat.com> | ||||
| 
 | ||||
| diff --git a/makedumpfile-1.7.4/arch/ppc64.c b/makedumpfile-1.7.4/arch/ppc64.c
 | ||||
| index 3b4f91981f71d035b94282f6c7e33323a4e4c1fd..a54f9a04db7f26eac2f1bd065b134a7e2fdaeb67 100644
 | ||||
| --- a/makedumpfile-1.7.4/arch/ppc64.c
 | ||||
| +++ b/makedumpfile-1.7.4/arch/ppc64.c
 | ||||
| @@ -568,7 +568,9 @@ get_machdep_info_ppc64(void)
 | ||||
|  	/* | ||||
|  	 * Get vmalloc_start value from either vmap_area_list or vmlist. | ||||
|  	 */ | ||||
| -	if ((SYMBOL(vmap_area_list) != NOT_FOUND_SYMBOL)
 | ||||
| +	if (NUMBER(vmalloc_start) != NOT_FOUND_NUMBER) {
 | ||||
| +		vmalloc_start = NUMBER(vmalloc_start);
 | ||||
| +	} else if ((SYMBOL(vmap_area_list) != NOT_FOUND_SYMBOL)
 | ||||
|  	    && (OFFSET(vmap_area.va_start) != NOT_FOUND_STRUCTURE) | ||||
|  	    && (OFFSET(vmap_area.list) != NOT_FOUND_STRUCTURE)) { | ||||
|  		if (!readmem(VADDR, SYMBOL(vmap_area_list) + OFFSET(list_head.next), | ||||
| @@ -689,11 +691,16 @@ vaddr_to_paddr_ppc64(unsigned long vaddr)
 | ||||
|  	if ((SYMBOL(vmap_area_list) == NOT_FOUND_SYMBOL) | ||||
|  	    || (OFFSET(vmap_area.va_start) == NOT_FOUND_STRUCTURE) | ||||
|  	    || (OFFSET(vmap_area.list) == NOT_FOUND_STRUCTURE)) { | ||||
| -		if ((SYMBOL(vmlist) == NOT_FOUND_SYMBOL)
 | ||||
| -		    || (OFFSET(vm_struct.addr) == NOT_FOUND_STRUCTURE)) {
 | ||||
| -			ERRMSG("Can't get info for vmalloc translation.\n");
 | ||||
| -			return NOT_PADDR;
 | ||||
| -		}
 | ||||
| +		/*
 | ||||
| +		 * Don't depend on vmap_area_list/vmlist if vmalloc_start is set in
 | ||||
| +		 * vmcoreinfo, in that case proceed without error
 | ||||
| +		 */
 | ||||
| +		if (NUMBER(vmalloc_start) == NOT_FOUND_NUMBER)
 | ||||
| +			if ((SYMBOL(vmlist) == NOT_FOUND_SYMBOL)
 | ||||
| +				|| (OFFSET(vm_struct.addr) == NOT_FOUND_STRUCTURE)) {
 | ||||
| +				ERRMSG("Can't get info for vmalloc translation.\n");
 | ||||
| +				return NOT_PADDR;
 | ||||
| +			}
 | ||||
|  	} | ||||
|   | ||||
|  	return ppc64_vtop_level4(vaddr); | ||||
| diff --git a/makedumpfile-1.7.4/makedumpfile.c b/makedumpfile-1.7.4/makedumpfile.c
 | ||||
| index 58c6639f289f19cdbf39ed3899be9893fdc317fe..d7f1dd41d2cab526d7d40e809ddccf656c586811 100644
 | ||||
| --- a/makedumpfile-1.7.4/makedumpfile.c
 | ||||
| +++ b/makedumpfile-1.7.4/makedumpfile.c
 | ||||
| @@ -2978,6 +2978,8 @@ read_vmcoreinfo(void)
 | ||||
|  	READ_NUMBER("PAGE_OFFLINE_MAPCOUNT_VALUE", PAGE_OFFLINE_MAPCOUNT_VALUE); | ||||
|  	READ_NUMBER("phys_base", phys_base); | ||||
|  	READ_NUMBER("KERNEL_IMAGE_SIZE", KERNEL_IMAGE_SIZE); | ||||
| +
 | ||||
| +	READ_NUMBER_UNSIGNED("VMALLOC_START", vmalloc_start);
 | ||||
|  #ifdef __aarch64__ | ||||
|  	READ_NUMBER("VA_BITS", VA_BITS); | ||||
|  	READ_NUMBER("TCR_EL1_T1SZ", TCR_EL1_T1SZ); | ||||
| @@ -2989,7 +2991,6 @@ read_vmcoreinfo(void)
 | ||||
|  	READ_NUMBER("VA_BITS", va_bits); | ||||
|  	READ_NUMBER_UNSIGNED("phys_ram_base", phys_ram_base); | ||||
|  	READ_NUMBER_UNSIGNED("PAGE_OFFSET", page_offset); | ||||
| -	READ_NUMBER_UNSIGNED("VMALLOC_START", vmalloc_start);
 | ||||
|  	READ_NUMBER_UNSIGNED("VMALLOC_END", vmalloc_end); | ||||
|  	READ_NUMBER_UNSIGNED("VMEMMAP_START", vmemmap_start); | ||||
|  	READ_NUMBER_UNSIGNED("VMEMMAP_END", vmemmap_end); | ||||
| diff --git a/makedumpfile-1.7.4/makedumpfile.h b/makedumpfile-1.7.4/makedumpfile.h
 | ||||
| index c04c330b69ecbe5fb232a2eabbd2d71f14b60cc0..c31f3a4371af8aae38dcba8cac4d6de1012b4cfd 100644
 | ||||
| --- a/makedumpfile-1.7.4/makedumpfile.h
 | ||||
| +++ b/makedumpfile-1.7.4/makedumpfile.h
 | ||||
| @@ -541,8 +541,6 @@ do { \
 | ||||
|   * The value of dependence on machine | ||||
|   */ | ||||
|  #define PAGE_OFFSET		(info->page_offset) | ||||
| -#define VMALLOC_START		(info->vmalloc_start)
 | ||||
| -#define VMALLOC_END		(info->vmalloc_end)
 | ||||
|  #define VMEMMAP_START		(info->vmemmap_start) | ||||
|  #define VMEMMAP_END		(info->vmemmap_end) | ||||
|  #define PMASK			(0x7ffffffffffff000UL) | ||||
| @@ -2263,6 +2261,9 @@ struct number_table {
 | ||||
|  	long    HUGETLB_PAGE_DTOR; | ||||
|  	long	phys_base; | ||||
|  	long	KERNEL_IMAGE_SIZE; | ||||
| +
 | ||||
| +	unsigned long vmalloc_start;
 | ||||
| +
 | ||||
|  #ifdef __aarch64__ | ||||
|  	long 	VA_BITS; | ||||
|  	long	TCR_EL1_T1SZ; | ||||
| @@ -2273,7 +2274,6 @@ struct number_table {
 | ||||
|  	long va_bits; | ||||
|  	unsigned long phys_ram_base; | ||||
|  	unsigned long page_offset; | ||||
| -	unsigned long vmalloc_start;
 | ||||
|  	unsigned long vmalloc_end; | ||||
|  	unsigned long vmemmap_start; | ||||
|  	unsigned long vmemmap_end; | ||||
| @ -1,99 +0,0 @@ | ||||
| From 985e575253f1c2de8d6876cfe685c68a24ee06e1 Mon Sep 17 00:00:00 2001 | ||||
| From: Kazuhito Hagio <k-hagio-ab@nec.com> | ||||
| Date: Thu, 30 May 2024 16:59:02 +0900 | ||||
| Subject: [PATCH 1/2] [PATCH] Fix failure of hugetlb pages exclusion on Linux | ||||
|  6.9 and later | ||||
| 
 | ||||
| * Required for kernel 6.9 | ||||
| 
 | ||||
| Kernel commit d99e3140a4d3 ("mm: turn folio_test_hugetlb into a | ||||
| PageType") moved the PG_hugetlb flag from folio._flags_1 into | ||||
| page._mapcount and introduced NUMBER(PAGE_HUGETLB_MAPCOUNT_VALUE) entry | ||||
| into vmcoreinfo. | ||||
| 
 | ||||
| Without the patch, "makedumpfile -d 8" cannot exclude hugetlb pages. | ||||
| 
 | ||||
| Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com> | ||||
| ---
 | ||||
|  makedumpfile.c | 22 ++++++++++++++++++++-- | ||||
|  makedumpfile.h |  3 +++ | ||||
|  2 files changed, 23 insertions(+), 2 deletions(-) | ||||
| 
 | ||||
| diff --git a/makedumpfile-1.7.4/makedumpfile.c b/makedumpfile-1.7.4/makedumpfile.c
 | ||||
| index d7f1dd4..437ad91 100644
 | ||||
| --- a/makedumpfile-1.7.4/makedumpfile.c
 | ||||
| +++ b/makedumpfile-1.7.4/makedumpfile.c
 | ||||
| @@ -2975,6 +2975,7 @@ read_vmcoreinfo(void)
 | ||||
|  	READ_SRCFILE("pud_t", pud_t); | ||||
|   | ||||
|  	READ_NUMBER("PAGE_BUDDY_MAPCOUNT_VALUE", PAGE_BUDDY_MAPCOUNT_VALUE); | ||||
| +	READ_NUMBER("PAGE_HUGETLB_MAPCOUNT_VALUE", PAGE_HUGETLB_MAPCOUNT_VALUE);
 | ||||
|  	READ_NUMBER("PAGE_OFFLINE_MAPCOUNT_VALUE", PAGE_OFFLINE_MAPCOUNT_VALUE); | ||||
|  	READ_NUMBER("phys_base", phys_base); | ||||
|  	READ_NUMBER("KERNEL_IMAGE_SIZE", KERNEL_IMAGE_SIZE); | ||||
| @@ -6510,6 +6511,9 @@ __exclude_unnecessary_pages(unsigned long mem_map,
 | ||||
|  		_count  = UINT(pcache + OFFSET(page._refcount)); | ||||
|  		mapping = ULONG(pcache + OFFSET(page.mapping)); | ||||
|   | ||||
| +		if (OFFSET(page._mapcount) != NOT_FOUND_STRUCTURE)
 | ||||
| +			_mapcount = UINT(pcache + OFFSET(page._mapcount));
 | ||||
| +
 | ||||
|  		compound_order = 0; | ||||
|  		compound_dtor = 0; | ||||
|  		/* | ||||
| @@ -6520,6 +6524,22 @@ __exclude_unnecessary_pages(unsigned long mem_map,
 | ||||
|  		if ((index_pg < PGMM_CACHED - 1) && isCompoundHead(flags)) { | ||||
|  			unsigned char *addr = pcache + SIZE(page); | ||||
|   | ||||
| +			/*
 | ||||
| +			 * Linux 6.9 and later kernels use _mapcount value for hugetlb pages.
 | ||||
| +			 * See kernel commit d99e3140a4d3.
 | ||||
| +			 */
 | ||||
| +			if (NUMBER(PAGE_HUGETLB_MAPCOUNT_VALUE) != NOT_FOUND_NUMBER) {
 | ||||
| +				unsigned long _flags_1 = ULONG(addr + OFFSET(page.flags));
 | ||||
| +				unsigned int PG_hugetlb = ~NUMBER(PAGE_HUGETLB_MAPCOUNT_VALUE);
 | ||||
| +
 | ||||
| +				compound_order = _flags_1 & 0xff;
 | ||||
| +
 | ||||
| +				if ((_mapcount & (PAGE_TYPE_BASE | PG_hugetlb)) == PAGE_TYPE_BASE)
 | ||||
| +					compound_dtor = IS_HUGETLB;
 | ||||
| +
 | ||||
| +				goto check_order;
 | ||||
| +			}
 | ||||
| +
 | ||||
|  			/* | ||||
|  			 * Linux 6.6 and later.  Kernels that have PG_hugetlb should also | ||||
|  			 * have the compound order in the low byte of folio._flags_1. | ||||
| @@ -6564,8 +6584,6 @@ check_order:
 | ||||
|  		if (OFFSET(page.compound_head) != NOT_FOUND_STRUCTURE) | ||||
|  			compound_head = ULONG(pcache + OFFSET(page.compound_head)); | ||||
|   | ||||
| -		if (OFFSET(page._mapcount) != NOT_FOUND_STRUCTURE)
 | ||||
| -			_mapcount = UINT(pcache + OFFSET(page._mapcount));
 | ||||
|  		if (OFFSET(page.private) != NOT_FOUND_STRUCTURE) | ||||
|  			private = ULONG(pcache + OFFSET(page.private)); | ||||
|   | ||||
| diff --git a/makedumpfile-1.7.4/makedumpfile.h b/makedumpfile-1.7.4/makedumpfile.h
 | ||||
| index 75b66ce..f08c49f 100644
 | ||||
| --- a/makedumpfile-1.7.4/makedumpfile.h
 | ||||
| +++ b/makedumpfile-1.7.4/makedumpfile.h
 | ||||
| @@ -165,6 +165,8 @@ test_bit(int nr, unsigned long addr)
 | ||||
|  #define isAnon(mapping, flags)	(((unsigned long)mapping & PAGE_MAPPING_ANON) != 0 \ | ||||
|  				&& !isSlab(flags)) | ||||
|   | ||||
| +#define PAGE_TYPE_BASE		(0xf0000000)
 | ||||
| +
 | ||||
|  #define PTOB(X)			(((unsigned long long)(X)) << PAGESHIFT()) | ||||
|  #define BTOP(X)			(((unsigned long long)(X)) >> PAGESHIFT()) | ||||
|   | ||||
| @@ -2255,6 +2257,7 @@ struct number_table {
 | ||||
|  	long    PG_hugetlb; | ||||
|   | ||||
|  	long	PAGE_BUDDY_MAPCOUNT_VALUE; | ||||
| +	long	PAGE_HUGETLB_MAPCOUNT_VALUE;
 | ||||
|  	long	PAGE_OFFLINE_MAPCOUNT_VALUE; | ||||
|  	long	SECTION_SIZE_BITS; | ||||
|  	long	MAX_PHYSMEM_BITS; | ||||
| -- 
 | ||||
| 2.40.1 | ||||
| 
 | ||||
| @ -1,129 +0,0 @@ | ||||
| From bad2a7c4fa75d37a41578441468584963028bdda Mon Sep 17 00:00:00 2001 | ||||
| From: Kazuhito Hagio <k-hagio-ab@nec.com> | ||||
| Date: Fri, 7 Jun 2024 15:34:05 +0900 | ||||
| Subject: [PATCH 2/2] [PATCH] Fix wrong exclusion of Slab pages on Linux | ||||
|  6.10-rc1 and later | ||||
| 
 | ||||
| * Required for kernel 6.10 | ||||
| 
 | ||||
| Kernel commit 46df8e73a4a3 ("mm: free up PG_slab") moved the PG_slab | ||||
| flag from page.flags into page._mapcount (slab.__page_type), and | ||||
| introduced NUMBER(PAGE_SLAB_MAPCOUNT_VALUE) entry into vmcoreinfo. | ||||
| 
 | ||||
| Without the patch, "makedumpfile -d 8" option wrongly excludes Slab | ||||
| pages and crash cannot open the dumpfile with an error like this: | ||||
| 
 | ||||
|   $ crash --kaslr auto vmlinux dumpfile | ||||
|   ... | ||||
|   please wait... (gathering task table data) | ||||
|   crash: page excluded: kernel virtual address: ffff909980440270 type: "xa_node.slots[off]" | ||||
| 
 | ||||
| Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com> | ||||
| ---
 | ||||
|  makedumpfile.c | 24 +++++++++++++++++++----- | ||||
|  makedumpfile.h |  6 +++--- | ||||
|  2 files changed, 22 insertions(+), 8 deletions(-) | ||||
| 
 | ||||
| diff --git a/makedumpfile-1.7.4/makedumpfile.c b/makedumpfile-1.7.4/makedumpfile.c
 | ||||
| index 437ad91..5b34712 100644
 | ||||
| --- a/makedumpfile-1.7.4/makedumpfile.c
 | ||||
| +++ b/makedumpfile-1.7.4/makedumpfile.c
 | ||||
| @@ -275,13 +275,26 @@ isHugetlb(unsigned long dtor)
 | ||||
|  		   && (SYMBOL(free_huge_page) == dtor)); | ||||
|  } | ||||
|   | ||||
| +static inline int
 | ||||
| +isSlab(unsigned long flags, unsigned int _mapcount)
 | ||||
| +{
 | ||||
| +	/* Linux 6.10 and later */
 | ||||
| +	if (NUMBER(PAGE_SLAB_MAPCOUNT_VALUE) != NOT_FOUND_NUMBER) {
 | ||||
| +		unsigned int PG_slab = ~NUMBER(PAGE_SLAB_MAPCOUNT_VALUE);
 | ||||
| +		if ((_mapcount & (PAGE_TYPE_BASE | PG_slab)) == PAGE_TYPE_BASE)
 | ||||
| +			return TRUE;
 | ||||
| +	}
 | ||||
| +
 | ||||
| +	return flags & (1UL << NUMBER(PG_slab));
 | ||||
| +}
 | ||||
| +
 | ||||
|  static int | ||||
|  isOffline(unsigned long flags, unsigned int _mapcount) | ||||
|  { | ||||
|  	if (NUMBER(PAGE_OFFLINE_MAPCOUNT_VALUE) == NOT_FOUND_NUMBER) | ||||
|  		return FALSE; | ||||
|   | ||||
| -	if (flags & (1UL << NUMBER(PG_slab)))
 | ||||
| +	if (isSlab(flags, _mapcount))
 | ||||
|  		return FALSE; | ||||
|   | ||||
|  	if (_mapcount == (int)NUMBER(PAGE_OFFLINE_MAPCOUNT_VALUE)) | ||||
| @@ -2977,6 +2990,7 @@ read_vmcoreinfo(void)
 | ||||
|  	READ_NUMBER("PAGE_BUDDY_MAPCOUNT_VALUE", PAGE_BUDDY_MAPCOUNT_VALUE); | ||||
|  	READ_NUMBER("PAGE_HUGETLB_MAPCOUNT_VALUE", PAGE_HUGETLB_MAPCOUNT_VALUE); | ||||
|  	READ_NUMBER("PAGE_OFFLINE_MAPCOUNT_VALUE", PAGE_OFFLINE_MAPCOUNT_VALUE); | ||||
| +	READ_NUMBER("PAGE_SLAB_MAPCOUNT_VALUE", PAGE_SLAB_MAPCOUNT_VALUE);
 | ||||
|  	READ_NUMBER("phys_base", phys_base); | ||||
|  	READ_NUMBER("KERNEL_IMAGE_SIZE", KERNEL_IMAGE_SIZE); | ||||
|   | ||||
| @@ -6043,7 +6057,7 @@ static int
 | ||||
|  page_is_buddy_v3(unsigned long flags, unsigned int _mapcount, | ||||
|  			unsigned long private, unsigned int _count) | ||||
|  { | ||||
| -	if (flags & (1UL << NUMBER(PG_slab)))
 | ||||
| +	if (isSlab(flags, _mapcount))
 | ||||
|  		return FALSE; | ||||
|   | ||||
|  	if (_mapcount == (int)NUMBER(PAGE_BUDDY_MAPCOUNT_VALUE)) | ||||
| @@ -6618,7 +6632,7 @@ check_order:
 | ||||
|  		 */ | ||||
|  		else if ((info->dump_level & DL_EXCLUDE_CACHE) | ||||
|  		    && is_cache_page(flags) | ||||
| -		    && !isPrivate(flags) && !isAnon(mapping, flags)) {
 | ||||
| +		    && !isPrivate(flags) && !isAnon(mapping, flags, _mapcount)) {
 | ||||
|  			pfn_counter = &pfn_cache; | ||||
|  		} | ||||
|  		/* | ||||
| @@ -6626,7 +6640,7 @@ check_order:
 | ||||
|  		 */ | ||||
|  		else if ((info->dump_level & DL_EXCLUDE_CACHE_PRI) | ||||
|  		    && is_cache_page(flags) | ||||
| -		    && !isAnon(mapping, flags)) {
 | ||||
| +		    && !isAnon(mapping, flags, _mapcount)) {
 | ||||
|  			if (isPrivate(flags)) | ||||
|  				pfn_counter = &pfn_cache_private; | ||||
|  			else | ||||
| @@ -6638,7 +6652,7 @@ check_order:
 | ||||
|  		 *  - hugetlbfs pages | ||||
|  		 */ | ||||
|  		else if ((info->dump_level & DL_EXCLUDE_USER_DATA) | ||||
| -			 && (isAnon(mapping, flags) || isHugetlb(compound_dtor))) {
 | ||||
| +			 && (isAnon(mapping, flags, _mapcount) || isHugetlb(compound_dtor))) {
 | ||||
|  			pfn_counter = &pfn_user; | ||||
|  		} | ||||
|  		/* | ||||
| diff --git a/makedumpfile-1.7.4/makedumpfile.h b/makedumpfile-1.7.4/makedumpfile.h
 | ||||
| index f08c49f..6b43a8b 100644
 | ||||
| --- a/makedumpfile-1.7.4/makedumpfile.h
 | ||||
| +++ b/makedumpfile-1.7.4/makedumpfile.h
 | ||||
| @@ -161,9 +161,8 @@ test_bit(int nr, unsigned long addr)
 | ||||
|  #define isSwapBacked(flags)	test_bit(NUMBER(PG_swapbacked), flags) | ||||
|  #define isHWPOISON(flags)	(test_bit(NUMBER(PG_hwpoison), flags) \ | ||||
|  				&& (NUMBER(PG_hwpoison) != NOT_FOUND_NUMBER)) | ||||
| -#define isSlab(flags)		test_bit(NUMBER(PG_slab), flags)
 | ||||
| -#define isAnon(mapping, flags)	(((unsigned long)mapping & PAGE_MAPPING_ANON) != 0 \
 | ||||
| -				&& !isSlab(flags))
 | ||||
| +#define isAnon(mapping, flags, _mapcount) \
 | ||||
| +	(((unsigned long)mapping & PAGE_MAPPING_ANON) != 0 && !isSlab(flags, _mapcount))
 | ||||
|   | ||||
|  #define PAGE_TYPE_BASE		(0xf0000000) | ||||
|   | ||||
| @@ -2259,6 +2258,7 @@ struct number_table {
 | ||||
|  	long	PAGE_BUDDY_MAPCOUNT_VALUE; | ||||
|  	long	PAGE_HUGETLB_MAPCOUNT_VALUE; | ||||
|  	long	PAGE_OFFLINE_MAPCOUNT_VALUE; | ||||
| +	long	PAGE_SLAB_MAPCOUNT_VALUE;
 | ||||
|  	long	SECTION_SIZE_BITS; | ||||
|  	long	MAX_PHYSMEM_BITS; | ||||
|  	long    HUGETLB_PAGE_DTOR; | ||||
| -- 
 | ||||
| 2.40.1 | ||||
| 
 | ||||
							
								
								
									
										232
									
								
								kexec-tools.spec
									
									
									
									
									
								
							
							
						
						
									
										232
									
								
								kexec-tools.spec
									
									
									
									
									
								
							| @ -1,9 +1,3 @@ | ||||
| %global eppic_ver e8844d3793471163ae4a56d8f95897be9e5bd554 | ||||
| %global eppic_shortver %(c=%{eppic_ver}; echo ${c:0:7}) | ||||
| %global mkdf_ver 1.7.4 | ||||
| %global kdump_utils_ver 1.0.42 | ||||
| %global mkdf_shortver %(c=%{mkdf_ver}; echo ${c:0:7}) | ||||
| 
 | ||||
| Name: kexec-tools | ||||
| Version: 2.0.28 | ||||
| Release: 14%{?dist} | ||||
| @ -13,9 +7,6 @@ Summary: The kexec/kdump userspace component | ||||
| 
 | ||||
| Source0: http://kernel.org/pub/linux/utils/kernel/kexec/%{name}-%{version}.tar.xz | ||||
| Recommends: kdump-utils | ||||
| Source1: https://github.com/rhkdump/kdump-utils/archive/v%{kdump_utils_ver}/kdump-utils-%{kdump_utils_ver}.tar.gz | ||||
| Source9: https://github.com/makedumpfile/makedumpfile/archive/%{mkdf_ver}/makedumpfile-%{mkdf_shortver}.tar.gz | ||||
| Source19: https://github.com/lucchouina/eppic/archive/%{eppic_ver}/eppic-%{eppic_shortver}.tar.gz | ||||
| 
 | ||||
| BuildRequires: automake | ||||
| BuildRequires: autoconf | ||||
| @ -54,25 +45,6 @@ Patch101: kexec-tools-2.0.28-Fix-building-on-x86_64-with-binutils-2.41.patch | ||||
| # Author: Jiri Bohac <jbohac@suse.cz> | ||||
| Patch601: kexec-tools-2.0.28-kexec-don-t-use-kexec_file_load-on-XEN.patch | ||||
| 
 | ||||
| Patch602: kexec-tools-2.0.28-makedumfpile-0001-PATCH-ppc64-get-vmalloc-start-address-from-vmcoreinf.patch | ||||
| Patch603: 0001-dracut-module-setup-Fix-missing-systemd-system.conf-.patch | ||||
| Patch604: 0002-mkdumprd-Fix-makedumpfile-parameter-check.patch | ||||
| Patch605: 0003-Try-to-install-PHY-and-MDIO-bus-drivers-explicitly.patch | ||||
| Patch606: 0004-Install-the-driver-of-physical-device-for-a-SR-IOV-v.patch | ||||
| Patch607: 0005-update-98-kexec-rules-for-crash-hotplug.patch | ||||
| Patch608: 0006-sysconfig-add-pcie_ports-compat-to-KDUMP_COMMANDLINE.patch | ||||
| Patch609: 0007-fadump-udev-do-not-re-register-fadump-if-kernel-hotp.patch | ||||
| Patch610: kexec-tools-2.0.28-makedumpfile-0002-PATCH-Fix-failure-of-hugetlb-pages-exclusion-on-Linu.patch | ||||
| Patch611: kexec-tools-2.0.28-makedumpfile-0003-PATCH-Fix-wrong-exclusion-of-Slab-pages-on-Linux-6.1.patch | ||||
| Patch612: 0001-Use-grep-q-cmd-instead-of-cmd-grep-q.patch | ||||
| Patch613: 0001-kdumpctl-Drop-default-kexec-d-option.patch | ||||
| Patch614: 0002-kdump-lib-fix-sed-expression-in-prepare_cmdline-on-a.patch | ||||
| Patch615: 0003-kdumpctl-Simplify-fadump-handling-in-reset_crashkern.patch | ||||
| Patch616: 0004-kdumpctl.8-Add-description-to-reset-crashkernel-rebo.patch | ||||
| Patch617: 0005-dracut-kdump.sh-Save-kexec-dmesg.log-after-failure_a.patch | ||||
| Patch618: 0006-Makefile-Fix-early-kdump-file-names.patch | ||||
| Patch619: 0007-kdump-lib-Drop-file-dependency-in-is_uki.patch | ||||
| 
 | ||||
| %description | ||||
| kexec-tools provides /sbin/kexec binary that facilitates a new | ||||
| kernel to boot using the kernel's kexec feature either on a | ||||
| @ -80,100 +52,13 @@ normal or a panic reboot. This package contains the /sbin/kexec | ||||
| binary and ancillary utilities that together form the userspace | ||||
| component of the kernel's kexec feature. | ||||
| 
 | ||||
| 
 | ||||
| %package -n makedumpfile | ||||
| Version: %{mkdf_ver} | ||||
| Summary: make a small dumpfile of kdump | ||||
| License: GPL-2.0-only | ||||
| URL: https://github.com/makedumpfile/makedumpfile | ||||
| 
 | ||||
| Conflicts: kexec-tools < 2.0.28-5 | ||||
| BuildRequires: make | ||||
| BuildRequires: gcc | ||||
| BuildRequires: zlib-devel | ||||
| BuildRequires: elfutils-devel | ||||
| BuildRequires: glib2-devel | ||||
| BuildRequires: bzip2-devel | ||||
| BuildRequires: ncurses-devel | ||||
| BuildRequires: bison | ||||
| BuildRequires: flex | ||||
| BuildRequires: lzo-devel | ||||
| BuildRequires: snappy-devel | ||||
| BuildRequires: libzstd-devel | ||||
| BuildRequires: pkgconfig | ||||
| BuildRequires: intltool | ||||
| BuildRequires: gettext | ||||
| 
 | ||||
| 
 | ||||
| %description -n makedumpfile | ||||
| makedumpfile is a tool to compress and filter out unneeded data from kernel | ||||
| dumps to reduce its file size. It is typically used with the kdump mechanism. | ||||
| 
 | ||||
| 
 | ||||
| %package -n kdump-utils | ||||
| Version: 1.0.42 | ||||
| License: GPL-2.0-only AND LGPL-2.1-or-later | ||||
| URL: https://github.com/rhkdump/kdump-utils | ||||
| Summary: Kernel crash dump collection utilities | ||||
| 
 | ||||
| %ifarch ppc64 ppc64le | ||||
| Requires(post): servicelog | ||||
| Recommends: keyutils | ||||
| %endif | ||||
| Requires(pre): coreutils | ||||
| Requires(pre): sed | ||||
| Requires: kexec-tools >= 2.0.28-8 | ||||
| Requires: makedumpfile | ||||
| Requires: dracut >= 058 | ||||
| Requires: dracut-network >= 058 | ||||
| Requires: dracut-squash >= 058 | ||||
| Requires: ethtool | ||||
| Requires: util-linux | ||||
| # Needed for UKI support | ||||
| Recommends: binutils | ||||
| Recommends: grubby | ||||
| Recommends: hostname | ||||
| BuildRequires: systemd-rpm-macros | ||||
| 
 | ||||
| %ifnarch s390x | ||||
| Requires: systemd-udev%{?_isa} | ||||
| %endif | ||||
| %description -n kdump-utils | ||||
| kdump-utils is responsible for collecting the crash kernel dump. It builds and | ||||
| loads the kdump initramfs so when a kernel crashes, the system will boot the | ||||
| kdump kernel and initramfs to save the collected crash kernel dump to specified | ||||
| target. | ||||
| 
 | ||||
| 
 | ||||
| %prep | ||||
| %setup -q | ||||
| 
 | ||||
| tar -z -x -v -f %{SOURCE1} | ||||
| 
 | ||||
| mkdir -p -m755 kcp | ||||
| tar -z -x -v -f %{SOURCE9} | ||||
| tar -z -x -v -f %{SOURCE19} | ||||
| 
 | ||||
| %patch 101 -p1 | ||||
| %patch 601 -p1 | ||||
| %patch 602 -p1 | ||||
| %patch 603 -p1 -d kdump-utils-%{kdump_utils_ver} | ||||
| %patch 604 -p1 -d kdump-utils-%{kdump_utils_ver} | ||||
| %patch 605 -p1 -d kdump-utils-%{kdump_utils_ver} | ||||
| %patch 606 -p1 -d kdump-utils-%{kdump_utils_ver} | ||||
| %patch 607 -p1 -d kdump-utils-%{kdump_utils_ver} | ||||
| %patch 608 -p1 -d kdump-utils-%{kdump_utils_ver} | ||||
| %patch 609 -p1 -d kdump-utils-%{kdump_utils_ver} | ||||
| %patch 610 -p1 | ||||
| %patch 611 -p1 | ||||
| %patch 612 -p1 -d kdump-utils-%{kdump_utils_ver} | ||||
| %patch 613 -p1 -d kdump-utils-%{kdump_utils_ver} | ||||
| %patch 614 -p1 -d kdump-utils-%{kdump_utils_ver} | ||||
| %patch 615 -p1 -d kdump-utils-%{kdump_utils_ver} | ||||
| %patch 616 -p1 -d kdump-utils-%{kdump_utils_ver} | ||||
| %patch 617 -p1 -d kdump-utils-%{kdump_utils_ver} | ||||
| %patch 618 -p1 -d kdump-utils-%{kdump_utils_ver} | ||||
| %patch 619 -p1 -d kdump-utils-%{kdump_utils_ver} | ||||
| 
 | ||||
| %ifarch ppc | ||||
| %define archdef ARCH=ppc | ||||
| @ -194,80 +79,10 @@ autoreconf | ||||
| rm -f kexec-tools.spec.in | ||||
| %make_build | ||||
| 
 | ||||
| # makedumpfile | ||||
| make -C eppic-%{eppic_ver}/libeppic | ||||
| make -C makedumpfile-%{mkdf_ver} LINKTYPE=dynamic USELZO=on USESNAPPY=on USEZSTD=on | ||||
| make -C makedumpfile-%{mkdf_ver} LDFLAGS="$LDFLAGS -I../eppic-%{eppic_ver}/libeppic -L../eppic-%{eppic_ver}/libeppic" eppic_makedumpfile.so | ||||
| 
 | ||||
| 
 | ||||
| %install | ||||
| %make_install | ||||
| rm -f %{buildroot}/%{_libdir}/kexec-tools/kexec_test | ||||
| 
 | ||||
| # kdump-utils | ||||
| %define kdump_utils_dir kdump-utils-%{kdump_utils_ver} | ||||
| make DESTDIR=%{buildroot} -C %kdump_utils_dir install | ||||
| 
 | ||||
| # makedumpfile | ||||
| 
 | ||||
| make DESTDIR=%{buildroot} -C makedumpfile-%{mkdf_ver} install | ||||
| install -m 644 -D makedumpfile-%{mkdf_ver}/makedumpfile.conf %{buildroot}/%{_sysconfdir}/makedumpfile.conf.sample | ||||
| rm %{buildroot}/%{_sbindir}/makedumpfile-R.pl | ||||
| 
 | ||||
| install -m 755 -D makedumpfile-%{mkdf_ver}/eppic_makedumpfile.so %{buildroot}/%{_libdir}/eppic_makedumpfile.so | ||||
| 
 | ||||
| %post -n kdump-utils | ||||
| # don't try to systemctl preset the kdump service for old kexec-tools | ||||
| # | ||||
| # when the old kexec-tools gets removed, this trigger will be excuted to | ||||
| # create a file. So later the posttrans scriptlet will know there is no need to | ||||
| # systemctl preset the kdump service. | ||||
| # This solution can be dropped in F41 when we assume no users will use old | ||||
| # version of kexec-tools. | ||||
| %define kexec_tools_no_preset %{_localstatedir}/lib/rpm-state/kexec-tools.no-preset | ||||
| %triggerun -- kexec-tools | ||||
| touch %{kexec_tools_no_preset} | ||||
| 
 | ||||
| touch /etc/kdump.conf | ||||
| 
 | ||||
| %ifarch ppc64 ppc64le | ||||
| servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh 2>/dev/null | ||||
| servicelog_notify --add --command=/usr/lib/kdump/kdump-migrate-action.sh --match='refcode="#MIGRATE" and serviceable=0' --type=EVENT --method=pairs_stdin >/dev/null | ||||
| %endif | ||||
| : | ||||
| 
 | ||||
| 
 | ||||
| %postun -n kdump-utils | ||||
| %systemd_postun_with_restart kdump.service | ||||
| 
 | ||||
| %preun -n kdump-utils | ||||
| %ifarch ppc64 ppc64le | ||||
| servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh >/dev/null | ||||
| %endif | ||||
| %systemd_preun kdump.service | ||||
| 
 | ||||
| 
 | ||||
| %posttrans -n kdump-utils | ||||
| # don't try to systemctl preset the kdump service for old kexec-tools | ||||
| if [[ -f %{kexec_tools_no_preset} ]]; then | ||||
|   # this if branch can be removed in F41 when we assume no users will use the old kexec-tools | ||||
|   rm %{kexec_tools_no_preset} | ||||
| else | ||||
|   # Initial installation | ||||
|   %systemd_post kdump.service | ||||
| fi | ||||
| # Try to reset kernel crashkernel value to new default value or set up | ||||
| # crasherkernel value for new install | ||||
| # | ||||
| # Note | ||||
| #  1. Skip ostree systems as they are not supported. | ||||
| #  2. For Fedora 36 and RHEL9, "[ $1 == 1 ]" in posttrans scriptlet means both install and upgrade; | ||||
| #     For Fedora > 36, "[ $1 == 1 ]" only means install and "[ $1 == 2 ]" means upgrade | ||||
| if [ ! -f /run/ostree-booted ] && [ $1 == 1 -o $1 == 2 ]; then | ||||
|   kdumpctl _reset-crashkernel-after-update | ||||
|   : | ||||
| fi | ||||
| 
 | ||||
| 
 | ||||
| %files | ||||
| %{_sbindir}/kexec | ||||
| @ -278,53 +93,6 @@ fi | ||||
| %license COPYING | ||||
| %doc TODO | ||||
| 
 | ||||
| %files -n kdump-utils | ||||
| %ifarch ppc64 ppc64le | ||||
| %{_sbindir}/mkfadumprd | ||||
| %{_prefix}/lib/kernel/install.d/60-fadump.install | ||||
| %endif | ||||
| %{_sbindir}/mkdumprd | ||||
| %{_bindir}/* | ||||
| %{_prefix}/lib/kdump | ||||
| %config(noreplace,missingok) %{_sysconfdir}/sysconfig/kdump | ||||
| %config(noreplace,missingok) %verify(not mtime) %{_sysconfdir}/kdump.conf | ||||
| %ifnarch s390x | ||||
| %{_udevrulesdir} | ||||
| %{_udevrulesdir}/../kdump-udev-throttler | ||||
| %endif | ||||
| %{_prefix}/lib/dracut/modules.d/* | ||||
| %dir %{_localstatedir}/crash | ||||
| %dir %{_sysconfdir}/kdump | ||||
| %dir %{_sysconfdir}/kdump/pre.d | ||||
| %dir %{_sysconfdir}/kdump/post.d | ||||
| %dir %{_sharedstatedir}/kdump | ||||
| %{_mandir}/man8/kdumpctl.8* | ||||
| %{_mandir}/man8/mkdumprd.8* | ||||
| %{_mandir}/man5/kdump.conf.5* | ||||
| %{_unitdir}/kdump.service | ||||
| %{_prefix}/lib/systemd/system-generators/kdump-dep-generator.sh | ||||
| %{_prefix}/lib/kernel/install.d/60-kdump.install | ||||
| %{_prefix}/lib/kernel/install.d/92-crashkernel.install | ||||
| %license %kdump_utils_dir/COPYING | ||||
| %doc %kdump_utils_dir/kexec-kdump-howto.txt | ||||
| %doc %kdump_utils_dir/early-kdump-howto.txt | ||||
| %doc %kdump_utils_dir/fadump-howto.txt | ||||
| %doc %kdump_utils_dir/kdump-in-cluster-environment.txt | ||||
| %doc %kdump_utils_dir/live-image-kdump-howto.txt | ||||
| %doc %kdump_utils_dir/crashkernel-howto.txt | ||||
| %doc %kdump_utils_dir/supported-kdump-targets.txt | ||||
| 
 | ||||
| 
 | ||||
| %files -n makedumpfile | ||||
| %license makedumpfile-%{mkdf_ver}/COPYING | ||||
| %{_sbindir}/makedumpfile | ||||
| %{_mandir}/man5/makedumpfile.conf.5.* | ||||
| %{_mandir}/man8/makedumpfile.8.* | ||||
| %{_sysconfdir}/makedumpfile.conf.sample | ||||
| %{_libdir}/eppic_makedumpfile.so | ||||
| %{_datadir}/makedumpfile/ | ||||
| 
 | ||||
| 
 | ||||
| %changelog | ||||
| * Fri Jul 12 2024 Lichen Liu <lichliu@redhat.com> - 2.0.28-14 | ||||
| - Various fixes. | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user