[PATCH] powerpc/do_estimate: fix fadump reserved area size handling
by Sourabh Jain
In fadump mode, the crashkernel reserved area size cannot be
obtained from /sys/kernel/kexec_crash_size sysfs node.
The do_estimate function has been modified to use
/sys/kernel/fadump/mem_reserved to get the reserved area size
for fadump mode.
Signed-off-by: Sourabh Jain <sourabhjain(a)linux.ibm.com>
Reported-by: Sachin P Bappalige <sachinpb(a)linux.vnet.ibm.com>
---
kdumpctl | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl
index 7e561fd..7580ab0 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -1270,7 +1270,12 @@ do_estimate()
# The default pre-reserved crashkernel value
baseline_size=$((baseline * size_mb))
# Current reserved crashkernel size
- reserved_size=$(< /sys/kernel/kexec_crash_size)
+ if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then
+ reserved_size=$(< /sys/kernel/fadump/mem_reserved)
+ else
+ reserved_size=$(< /sys/kernel/kexec_crash_size)
+ fi
+
# A pre-estimated value for userspace usage and kernel
# runtime allocation, 64M should good for most cases
runtime_size=$((64 * size_mb))
--
2.41.0
4 months, 1 week
[RFC v2 00/23] kdumpctl: Introduce new CLI
by Philipp Rudo
Hi everybody,
here is the second try on the series. Since the first version I've concentrated
on
1) splitting out the preparation/cleanup patches into their own series so
they can be applied ahead of the rest.
2) refining the new 'crashkernel' command which now has four subcommands
'add', 'estimate', 'show' and, 'set'.
3) reworking the man pages and adding the new CLI to them. This includes
bumping their date to today's date for the last non-trivial change.
The series depends on the cleanup series I've posted earlier. To simplify
review I've also pushed the series to branch cli_rework on
https://src.fedoraproject.org/forks/prudo/rpms/kexec-tools.git.
Thanks
Philipp
rfc v1 -> rfv v2:
- Rebased to latest rawhide
- Moved former patches 1-5 & 8-10 to separate series
- Added new patches 1-3, that overhaul the man pages and convert them to RST.
- Update the man pages when changing the CLI
- Small changes to --help so the wording matches the man pages
- Fixed bug with --verbose when no KDUMP_STDLOGLVL was defined.
- Former patches 25 & 26 by new patches 20-23, to refine the new 'crashkernel'
command
Philipp Rudo (23):
man: Convert to RST
man/kdump.conf.5: Improve the man page
man/kdumpctl.8: Improve the man page
kdumpctl: make all subcommands execute exactly one function
kdumpctl: Restructure subcommand handling and add usage
kdumpctl: Simplify fadump handling in reset_crashkernel
kdumpctl: Use getopt for option parsing in reset_crashkernel
kdumpctl: Add simple bash-completion for kdumpctl
kdumpctl: Make --kernel a global option
kdumpctl: Add global -h/--help option
kdumpctl: Add --kver option
kdumpctl: Reduce dependencies from grubby for --kernel
kdumpctl: merge reset_crashkernel_{after_update,for_installed_kernel}
kdumpctl: Allow --kernel with 'start' and 'rebuild'
kdumpctl: Add --quiet/--verbose option
kdumpctl: Rework the 'status' subcommand
kdumpctl: Merge _upgrade_crashkernel into the upgrade hook
kdumpctl: Drop special handling for CoreOS in reset_crashkernel
kdumpctl: Determine "old" value within _update_kernel_cmdline
kdumpctl: Replace 'get-default-crashkernel' by 'crashkernel show'
kdumpctl: Replace 'reset-crashkernel' with 'crashkernel set'
kdumpctl: Make 'estimate' a subcommand of 'crashkernel'
kdumpctl: Add 'crashkernel add' subcommand
92-crashkernel.install | 2 +-
kdump-lib.sh | 6 +
kdump.conf.5 | 378 ---------------
kdump.conf.5.rst | 325 +++++++++++++
kdumpctl | 988 +++++++++++++++++++++++++++------------
kdumpctl.8 | 72 ---
kdumpctl.8.rst | 158 +++++++
kdumpctl.bash-completion | 125 +++++
kexec-tools.spec | 29 +-
mkdumprd.8 | 39 --
mkdumprd.8.rst | 54 +++
11 files changed, 1387 insertions(+), 789 deletions(-)
delete mode 100644 kdump.conf.5
create mode 100644 kdump.conf.5.rst
delete mode 100644 kdumpctl.8
create mode 100644 kdumpctl.8.rst
create mode 100755 kdumpctl.bash-completion
delete mode 100644 mkdumprd.8
create mode 100644 mkdumprd.8.rst
--
2.40.0
4 months, 1 week
[PATCH 00/12] Various small cleanups and improvements
by Philipp Rudo
Hi everybody,
this series got spit from the CLI rework series as they are independent and can
be merged earlier to reduce the overall series size. While most of the patches
were part of the rfc v1 of the CLI rework series patches 9-12 are new.
@Pingfan: I've dropped your Reviewed-by from patch 1 as I've added two more
fixes to the patch. But I've kept it for patch 2&4 where I've updated
the commit message and patch 3 where I've dropped the definition of
_is_valid_kver as after the rebase an identical function already
existed. Hope that is ok with you.
To simplify review I've also pushed the series to branch cleanup on
https://src.fedoraproject.org/forks/prudo/rpms/kexec-tools.git.
Thanks
Philipp
rfc -> v1:
- Rebased to latest rawhide
- Patch 1 added two more fixes.
- Patch 2,4&8 improved the commit message
- Patch 3 dropped definition of _is_valid_kver as it was already present on
latest rawhide
- Added new patches 9-12
Philipp Rudo (12):
Fix various shellcheck findings
kdump-lib: make is_zstd_command_available more generic
kdump-lib: simplify _get_kdump_kernel_version
kdumpctl: drop _get_current_running_kernel_path
kdumpctl: drop condrestart subcommand
kdumpctl: simplify _update_kernel_cmdline
kdumpctl: Prevent option --fadump on non-PPC in reset_crashkernel
kdumpctl: Stop updating grub config in reset_crashkernel
kdump.conf: Remove option override_resettable
spec: Clean up handling of dracut files
spec: Silence unversioned Obsolete warning
kdump-lib: Harden _crashkernel_add
gen-kdump-conf.sh | 6 --
kdump-lib.sh | 175 ++++++++++++++++++++----------
kdump.conf.5 | 8 --
kdumpctl | 236 +++++++++++++----------------------------
kexec-tools.spec | 50 ++++-----
mkdumprd | 57 +---------
mkfadumprd | 2 +-
spec/kdump-lib_spec.sh | 38 ++++---
8 files changed, 235 insertions(+), 337 deletions(-)
--
2.40.0
4 months, 2 weeks
[RFC PATCH v2 0/5] Add reboot estimation support
by Lichen Liu
I recently organized the outstanding work Kairui had done previously on reboot
estimate support[1].
This series add an more accurate kdump crashkernel estimation helper.
Compared to Kairui's version, I only modified parts of the code to adapt to the
new changes in kexec-tools over the last two years. The core part written by
Kairui has only been slightly modified by me.
The original Patch4 has been removed.
In Patch3 v2, I moved most of the code used only in estimate to
kdump-estimate.sh. I exported some variables defined in kdumpctl in order to
use them in estimate.
In Patch4 v2, I found that creating files by using cat or echo and redirecting
output would be blocked by selinux, so I switched to the cp command.
The current version is not perfect, and has only been tested on x86_64-fedora.
It even includes some known issues:
When a large amount of memory is reserved, if crash_base is greater than 4G, it
will reserve 256M of low memory, which causes problems when calculating
reserved_size. This is because we subtract the memtotal given in memdebug from
the set crashkernel value. However, the extra reserved 256M memory causes
memtotal to be greater than crashkernel.
I'm now posting this patchset for everyone to help review and provide feedback.
Thanks.
[1] https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.o...
Kairui Song & Lichen Liu (5):
kdumpctl: only acquire the single instance lock when necessary
kdumpctl: allow passing in extra cmdline using env variable
kdump-estiamte.sh: introduce a seperate file
kdump-estimate.sh: add reboot estimation support
Upate crashkernel-howto.txt
.editorconfig | 2 +-
crashkernel-howto.txt | 100 ++++-
dracut-kdump.sh | 15 +
kdump-estimate-cleanup.service | 8 +
kdump-estimate.service | 11 +
kdump-estimate.sh | 776 +++++++++++++++++++++++++++++++++
kdump-lib.sh | 9 +-
kdump.shutdown | 13 +
kdumpctl | 213 ++-------
kexec-tools.spec | 19 +
10 files changed, 956 insertions(+), 210 deletions(-)
create mode 100644 kdump-estimate-cleanup.service
create mode 100644 kdump-estimate.service
create mode 100755 kdump-estimate.sh
create mode 100644 kdump.shutdown
--
2.40.1
4 months, 4 weeks
[RFC PATCH 00/26] kdumpctl: Introduce new CLI
by Philipp Rudo
Hi everybody,
The series far from being complete. But it finally passes the first simple
tests so I think it's time to get the first feedback.
The series started out with the request to be able to rebuild the initramfs for
all installed kernels. As 'reset-crashkernel' already had a --kernel=ALL option
I didn't want to introduce a second way to do the same thing. My problem was
the way --kernel=ALL was implemented, especially its hard dependency on grubby
which might not be installed on all systems. This lead to basically a rewrite
of the crashkernel handling with now (hopefully) simpler, better to understand
code.
An other problem I had with the former implementation of --kernel=ALL was that
the command line parser was self-written. This made the UI much more rigid than
it had to be. So I changed it to use getopt instead. In order to prevent
unnecessary duplicate code I also wrote a framework around it (which might be a
little bit over engineered for what we need but once I started I refused to
give up plus it gives bash-completion almost for free, which is nice ;-)).
While at it I also added some basic options most users expect, like --help.
Finally I've merged multiple commands to make the UI (hopefully) a little bit
cleaner and more intuitive. For example I've never understood why 'status' only
retuned a simple yes/no but not other important information about the current
state like 'git status' does.
As stated in the beginning there is still a lot to do. In particular:
* Test cases still need to be adjusted (and new ones added).
* The documentation needs to be reviewed and adjusted.
* The patches don't consider Pingfans 64k work, yet. So they will need some
adjustments (they are currently based on
29fe563 ("kdump.conf: redirect unknown architecture warning to stderr"))
* I've noticed a bug in the bash completion where subsubcommands aren't
completed correctly.
* And of course the series need a lot more testing. For the moment I've only
made some very simple sanity checks. So I would be surprised if the code
isn't still riddled with bugs...
Anyway, this is quite a big change and opinions on what a good UI is are very
subjective. That's why I want to get feedback early before I waste too much
time on something which isn't wanted.
Happy to hear your opinion (good and bad).
Thanks
Philipp
Philipp Rudo (26):
kdumpctl: Fix various shellcheck findings
kdump-lib: make is_zstd_command_available more generic
kdump-lib: simplify _get_kdump_kernel_version
kdumpctl: drop _get_current_running_kernel_path
kdumpctl: drop condrestart subcommand
kdumpctl: make all subcommands execute exactly one function
kdumpctl: Restructure subcommand handling and and usage
kdumpctl: simplify _update_kernel_cmdline
kdumpctl: Prevent option --fadump on non-PPC in reset_crashkernel
kdumpctl: Stop updating grub config in reset_crashkernel
kdumpctl: Simplify fadump handling in reset_crashkernel
kdumpctl: Use getopt for option parsing in reset_crashkernel
kdumpctl: Add simple bash-completion for kdumpctl
kdumpctl: Make --kernel a global option
kdumpctl: Add global -h/--help option
kdumpctl: Add --kver option
kdumpctl: Reduce dependencies from grubby for --kernel
kdumpctl: merge reset_crashkernel_{after_update,for_installed_kernel}
kdumpctl: Allow --kernel with 'start' and 'rebuild'
kdumpctl: Add --quiet/--verbose option
kdumpctl: Rework the 'status' subcommand
kdumpctl: Merge _upgrade_crashkernel into the upgrade hook
kdumpctl: Drop special handling for CoreOS in reset_crashkernel
kdumpctl: Determine "old" value within _update_kernel_cmdline
kdumpctl: Introduce new crashkernel subcommand
REMOVEME: add test subsubcommands
92-crashkernel.install | 2 +-
kdump-lib.sh | 27 +-
kdumpctl | 1094 ++++++++++++++++++++++++--------------
kdumpctl.bash-completion | 125 +++++
kexec-tools.spec | 16 +-
mkdumprd | 2 +-
mkfadumprd | 2 +-
7 files changed, 865 insertions(+), 403 deletions(-)
create mode 100755 kdumpctl.bash-completion
--
2.40.1
5 months
[RFC] Split kexec-tools into two sub-packages kexec-tools and kdump-tools
by Coiby Xu
Related: https://bugzilla.redhat.com/show_bug.cgi?id=2121912
Now there is a growing user base to use the kexec reboot and it's
desirable to make the kexec-tools package more modular.
This patch splits current kexec-tools into two sub-packages kexec-tools
and kdump-tools. Now kexec-tools merely provides /usr/sbin/kexec and the
remaining features go into kdump-tools.
"dnf repoquery --whatrequires kexec-tools" shows the following packages
requires kexec-tools,
- abrt-addon-vmcore
- anaconda-install-env-deps
- cockpit-kdump
- dracut-kiwi-oem-dump
- realtime-setup
- retrace-server
For those packages that need kdump, the dependency needs to point to
the new kdump-tools package instead.
Cc: fedora-devel(a)lists.fedorahosted.org
Cc: Dusty Mabe <dustymabe(a)redhat.com>
Cc: crash-catcher-owner(a)lists.fedorahosted.org
CC: anaconda-devel(a)lists.fedoraproject.org
Cc: Martin Pitt <mpitt(a)redhat.com>
Cc: kiwi-images(a)googlegroups.com
Cc: Clark Williams <williams(a)redhat.com>
Cc: Matěj Grabovský <mgrabovs(a)redhat.com>
Suggested-by: Zbigniew Jędrzejewski-Szmek <zbyszek(a)in.waw.pl>
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
kexec-tools.spec | 80 +++++++++++++++++++++++++++++-------------------
1 file changed, 48 insertions(+), 32 deletions(-)
diff --git a/kexec-tools.spec b/kexec-tools.spec
index 360b6c5d..6e78f6d3 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -5,9 +5,10 @@
Name: kexec-tools
Version: 2.0.26
-Release: 7%{?dist}
+Release: 8%{?dist}
License: GPLv2
Summary: The kexec/kdump userspace component
+Obsoletes: kexec-tools < 2.0.26-8
Source0: http://kernel.org/pub/linux/utils/kernel/kexec/%{name}-%{version}.tar.xz
Source1: kdumpctl
@@ -56,33 +57,6 @@ Source109: dracut-early-kdump-module-setup.sh
Source200: dracut-fadump-init-fadump.sh
Source201: dracut-fadump-module-setup.sh
-%ifarch ppc64 ppc64le
-Requires(post): servicelog
-Recommends: keyutils
-%endif
-Requires(pre): coreutils sed zlib
-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: make
-BuildRequires: zlib-devel elfutils-devel glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel libzstd-devel
-BuildRequires: pkgconfig intltool gettext
-BuildRequires: systemd-rpm-macros
-BuildRequires: automake autoconf libtool
-%ifarch %{ix86} x86_64 ppc64 ppc s390x ppc64le
-Obsoletes: diskdumputils netdump kexec-tools-eppic
-%endif
-
-%ifnarch s390x
-Requires: systemd-udev%{?_isa}
-%endif
-
#START INSERT
#
@@ -117,6 +91,42 @@ 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 kdump-tools
+Summary: Kernel crash dump collection tools
+Obsoletes: kexec-tools < 2.0.26-8
+%ifarch ppc64 ppc64le
+Requires(post): servicelog
+Recommends: keyutils
+%endif
+Requires(pre): coreutils sed zlib
+Requires: kexec-tools >= 2.0.26-8
+Requires: dracut >= 058
+Requires: dracut-network >= 058
+Requires: dracut-squash >= 058
+Requires: ethtool
+Requires: util-linux
+Requires: binutils
+Obsoletes: kexec-tools = 2.0.26-8
+Recommends: grubby
+Recommends: hostname
+BuildRequires: make
+BuildRequires: zlib-devel elfutils-devel glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel libzstd-devel
+BuildRequires: pkgconfig intltool gettext
+BuildRequires: systemd-rpm-macros
+BuildRequires: automake autoconf libtool
+%ifarch %{ix86} x86_64 ppc64 ppc s390x ppc64le
+Obsoletes: diskdumputils netdump kexec-tools-eppic
+%endif
+
+%ifnarch s390x
+Requires: systemd-udev%{?_isa}
+%endif
+%description -n kdump-tools
+kdump-tools is reponsible for collecting the crash kernel dump. It builds and
+load the kdump initramfs so when a kernel crashes, the system will boot the
+kdump kernel and initramfs to save the colletecd crash kernel dump to specified
+target.
+
%prep
%setup -q
@@ -261,7 +271,7 @@ chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99zz-fadumpini
mkdir -p $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/
mv $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/* $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/
-%post
+%post -n kdump-tools
# Initial installation
%systemd_post kdump.service
@@ -295,10 +305,10 @@ then
fi
-%postun
+%postun -n kdump-tools
%systemd_postun_with_restart kdump.service
-%preun
+%preun -n kdump-tools
%ifarch ppc64 ppc64le
servicelog_notify --remove --command=/usr/lib/kdump/kdump-migrate-action.sh
%endif
@@ -326,7 +336,7 @@ do
fi
done
-%posttrans
+%posttrans -n kdump-tools
# Try to reset kernel crashkernel value to new default value or set up
# crasherkernel value for new install
#
@@ -342,6 +352,9 @@ fi
%files
/usr/sbin/kexec
+%{_mandir}/man8/kexec.8.gz
+
+%files -n kdump-tools
%ifarch %{ix86} x86_64 ppc64 s390x ppc64le aarch64
/usr/sbin/makedumpfile
%endif
@@ -396,6 +409,9 @@ fi
%endif
%changelog
+* Wed Jun 14 2023 Coiby <coxu(a)redhat.com> - 2.0.26-8
+- split kexec-tools into kexec-tools and kdump-tools
+
* Wed Jun 14 2023 Coiby <coxu(a)redhat.com> - 2.0.26-7
- kdumpctl: Fix the matching of plus symbol by grep's EREs
- kdump-lib: Evaluate the memory consumption by smmu and mlx5 separately
--
2.41.0
5 months, 1 week
[PATCH] Exclude the extra memory requirement when comparing the estimated value with the baseline value
by Coiby Xu
The current estimated crashkernel is too small and leads to OOM for the
LUKS case forboth aarch64 4k and 64k kernels. Since the baseline value
doesn't take special cases like LUKS into consideration, the extra
memory requirement should be included when comparing the estimated value
with the baseline value.
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
kdumpctl | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl
index 58c18d21..12401042 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -1314,13 +1314,15 @@ do_estimate()
echo -e "Encrypted kdump target requires extra memory, assuming using the keyslot with maximum memory requirement\n"
fi
- estimated_size=$((kernel_size + mod_size + initrd_size + runtime_size + crypt_size))
+ estimated_size=$((kernel_size + mod_size + initrd_size + runtime_size))
if [[ $baseline_size -gt $estimated_size ]]; then
recommended_size=$baseline_size
else
recommended_size=$estimated_size
fi
+ recommended_size=$((recommended_size + crypt_size))
+
echo "Reserved crashkernel: $((reserved_size / size_mb))M"
echo "Recommended crashkernel: $((recommended_size / size_mb))M"
echo
--
2.40.1
5 months, 1 week