Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package kdump for openSUSE:Factory checked in at 2022-02-03 23:15:46 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kdump (Old) and /work/SRC/openSUSE:Factory/.kdump.new.1898 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kdump" Thu Feb 3 23:15:46 2022 rev:121 rq:950701 version:1.0.2 Changes: -------- --- /work/SRC/openSUSE:Factory/kdump/kdump.changes 2022-01-23 12:16:45.504038693 +0100 +++ /work/SRC/openSUSE:Factory/.kdump.new.1898/kdump.changes 2022-02-03 23:15:58.720820743 +0100 @@ -1,0 +2,20 @@ +Tue Feb 1 22:16:36 UTC 2022 - Petr Tesa????k <ptesa...@suse.com> + +- kdump-calibrate.conf-depends-on-kdumptool.patch: calibrate.conf: + Add dependency on kdumptool. +- kdump-calibrate-fix-nic-naming.patch: calibrate: Fix network + interface naming. +- kdump-calibrate-include-af_packet.patch: calibrate: Explicitly + include af_packet in the test initrd. + +------------------------------------------------------------------- +Tue Feb 1 12:52:56 UTC 2022 - Petr Tesa????k <ptesa...@suse.com> + +- Update to 1.0.2 + * Adjust crash kernel reservation at boot time (jsc#SLE-18441). +- All remaining patches have been upstreamed: + * kdump-fillupdir-fixes.patch + * kdump-use-pbl.patch + * kdump-calibrate-Ignore-malformed-VMCOREINFO.patch + +------------------------------------------------------------------- Old: ---- kdump-1.0.tar.bz2 kdump-calibrate-Ignore-malformed-VMCOREINFO.patch kdump-fillupdir-fixes.patch kdump-use-pbl.patch New: ---- kdump-1.0.2.tar.bz2 kdump-calibrate-fix-nic-naming.patch kdump-calibrate-include-af_packet.patch kdump-calibrate.conf-depends-on-kdumptool.patch kdump-calibrate.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kdump.spec ++++++ --- /var/tmp/diff_new_pack.JbvINw/_old 2022-02-03 23:15:59.416815993 +0100 +++ /var/tmp/diff_new_pack.JbvINw/_new 2022-02-03 23:15:59.420815965 +0100 @@ -16,9 +16,16 @@ # -#Compat macro for new _fillupdir macro introduced in Nov 2017 -%if ! %{defined _fillupdir} - %define _fillupdir %{_localstatedir}/adm/fillup-templates +%bcond_with calibrate + +%if 0%{?is_opensuse} +%if 0%{suse_version} > 1500 +%define distro_suffix tumbleweed.%{_arch} +%else +%define distro_suffix leap%{sle_version}.%{_arch} +%endif +%else +%define distro_suffix sle%{sle_version}.%{_arch} %endif %ifarch aarch64 @@ -42,37 +49,28 @@ %define dracutlibdir %{_prefix}/lib/dracut Name: kdump -Version: 1.0 +Version: 1.0.2 Release: 0 Summary: Script for kdump License: GPL-2.0-or-later Group: System/Kernel URL: https://github.com/openSUSE/kdump Source: %{name}-%{version}.tar.bz2 +Source1: %{name}-calibrate.tar.bz2 Source2: %{name}-rpmlintrc -Patch1: %{name}-fillupdir-fixes.patch -Patch9: %{name}-use-pbl.patch -Patch10: %{name}-calibrate-Ignore-malformed-VMCOREINFO.patch -BuildRequires: %qemu +Patch1: %{name}-calibrate-include-af_packet.patch +Patch2: %{name}-calibrate-fix-nic-naming.patch +Patch3: %{name}-calibrate.conf-depends-on-kdumptool.patch BuildRequires: asciidoc BuildRequires: cmake >= 3.7 -BuildRequires: dhcp-client -BuildRequires: dracut BuildRequires: gcc-c++ -BuildRequires: iputils -BuildRequires: kernel-default BuildRequires: libblkid-devel BuildRequires: libcurl-devel BuildRequires: libelf-devel BuildRequires: libesmtp-devel BuildRequires: libmount-devel BuildRequires: libxslt -BuildRequires: makedumpfile BuildRequires: pkgconfig -BuildRequires: procps -BuildRequires: python3 -BuildRequires: qemu-ipxe -BuildRequires: qemu-vgabios BuildRequires: systemd-sysvinit BuildRequires: util-linux-systemd BuildRequires: wicked @@ -80,9 +78,24 @@ BuildRequires: pkgconfig(systemd) BuildRequires: pkgconfig(udev) #!BuildIgnore: fop +%if %{with calibrate} +BuildRequires: %qemu +BuildRequires: dhcp-client +BuildRequires: dracut >= 047 +BuildRequires: iputils +BuildRequires: kernel-default +BuildRequires: makedumpfile +BuildRequires: procps +BuildRequires: python3 +BuildRequires: qemu-ipxe +BuildRequires: qemu-vgabios +BuildRequires: systemd-sysvinit +BuildRequires: util-linux-systemd +BuildRequires: wicked +%endif Requires: /usr/bin/sed Requires: curl -Requires: dracut +Requires: dracut >= 047 Requires: kexec-tools Requires: makedumpfile Requires: openssh @@ -117,21 +130,18 @@ %prep %setup -q -%if 0%{?suse_version} >= 1330 %patch1 -p1 -%endif -%patch9 -p1 -%patch10 -p1 +%patch2 -p1 +%patch3 -p1 +%setup -q -D -T -a 1 %build export CXXFLAGS="%{optflags} -std=c++11" -%cmake - -# for SLE_15 -%if %{undefined cmake_build} -%define cmake_build make %{?_smp_mflags} -%define ctest cd build; ctest --output-on-failure --force-new-ctest-process %{?_smp_mflags} -%define cmake_install DESTDIR=%{buildroot} make -C build %{?_smp_mflags} install +%cmake \ +%if %{with calibrate} + -DCALIBRATE=ON +%else + -DCALIBRATE=OFF %endif %cmake_build @@ -144,6 +154,11 @@ # empty directory mkdir -p %{buildroot}%{_localstatedir}/crash +# Install pre-built calibrate.conf +%if !%{with calibrate} +cp calibrate/calibrate.conf.%{distro_suffix} %{buildroot}/usr/lib/kdump/calibrate.conf +%endif + # symlink for init script rm %{buildroot}%{_initddir}/boot.kdump ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rckdump ++++++ kdump-1.0.tar.bz2 -> kdump-1.0.2.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdump-1.0/CMakeLists.txt new/kdump-1.0.2/CMakeLists.txt --- old/kdump-1.0/CMakeLists.txt 2022-01-21 13:47:25.000000000 +0100 +++ new/kdump-1.0.2/CMakeLists.txt 2022-02-01 12:54:09.000000000 +0100 @@ -27,10 +27,11 @@ cmake_minimum_required(VERSION 3.7) set (PACKAGE_STRING "kdump") -set (PACKAGE_VERSION "1.0") +set (PACKAGE_VERSION "1.0.2") include_directories("${PROJECT_BINARY_DIR}") +option(CALIBRATE "Run QEMU to calibrate the build host" ON) # # Defines @@ -174,7 +175,7 @@ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/sysconfig.kdump DESTINATION - /var/adm/fillup-templates/ + /usr/share/fillup-templates/ ) ADD_CUSTOM_COMMAND( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdump-1.0/NEWS new/kdump-1.0.2/NEWS --- old/kdump-1.0/NEWS 2022-01-21 13:47:25.000000000 +0100 +++ new/kdump-1.0.2/NEWS 2022-02-01 12:54:09.000000000 +0100 @@ -1,3 +1,13 @@ +1.0.2 +----- + * Accept cmake option -DCALIBRATE=OFF to skip calibration at build time + * Improved estimate of the largest possible crash kernel reservation + +1.0.1 +----- + * KDUMP_AUTO_RESIZE: Automatically shrink the reservation at boot + * Use the pbl script to udpate the bootloader + 1.0 --- * Provide scripts to measure actual kernel and user space memory diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdump-1.0/calibrate/CMakeLists.txt new/kdump-1.0.2/calibrate/CMakeLists.txt --- old/kdump-1.0/calibrate/CMakeLists.txt 2022-01-21 13:47:25.000000000 +0100 +++ new/kdump-1.0.2/calibrate/CMakeLists.txt 2022-02-01 12:54:09.000000000 +0100 @@ -46,14 +46,19 @@ maxrss.py run-qemu.py ) -ADD_CUSTOM_TARGET(calibrate-conf - ALL - DEPENDS - calibrate.conf -) -INSTALL( - FILES - ${CMAKE_CURRENT_BINARY_DIR}/calibrate.conf - DESTINATION - /usr/lib/kdump -) + +IF(CALIBRATE) + + ADD_CUSTOM_TARGET(calibrate-conf + ALL + DEPENDS + calibrate.conf + ) + INSTALL( + FILES + ${CMAKE_CURRENT_BINARY_DIR}/calibrate.conf + DESTINATION + /usr/lib/kdump + ) + +ENDIF() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdump-1.0/calibrate/compare.py new/kdump-1.0.2/calibrate/compare.py --- old/kdump-1.0/calibrate/compare.py 1970-01-01 01:00:00.000000000 +0100 +++ new/kdump-1.0.2/calibrate/compare.py 2022-02-01 12:54:09.000000000 +0100 @@ -0,0 +1,39 @@ +#! /usr/bin/python3 + +import sys +import argparse + +def read_config(path): + ret = dict() + with open(path, 'r') as f: + for line in f: + (key, val) = line.split('=', 1) + ret[key] = int(val) + return ret + +if __name__ == '__main__': + parser = argparse.ArgumentParser() + parser.add_argument('-t', '--tolerance', type=int, default=0, + help='tolerance in percents') + parser.add_argument('refname', metavar="REFERENCE", + help='reference file') + parser.add_argument('newname', metavar="NEW", + help='new file') + args = parser.parse_args() + + err = 0 + refcfg = read_config(args.refname) + newcfg = read_config(args.newname) + for key in refcfg: + ref = refcfg[key] + new = newcfg[key] + if new < ref * (100 - args.tolerance) / 100: + print('{} value {} is {:.1f} % below reference'.format( + key, new, 100 - 100 * new / ref)) + err = 1 + elif new > ref * (100 + args.tolerance) / 100: + print('{} value {} is {:.1f} % above reference'.format( + key, new, 100 * new / ref - 100)) + err = 1 + + exit(err) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdump-1.0/calibrate/dummy-net.conf new/kdump-1.0.2/calibrate/dummy-net.conf --- old/kdump-1.0/calibrate/dummy-net.conf 2022-01-21 13:47:25.000000000 +0100 +++ new/kdump-1.0.2/calibrate/dummy-net.conf 2022-02-01 12:54:09.000000000 +0100 @@ -1,5 +1,5 @@ KDUMP_SAVEDIR="ftp://unused:dummy@host/" KDUMP_COPY_KERNEL="no" KDUMP_POSTSCRIPT="poweroff" -KDUMP_NETCONFIG="auto:force" +KDUMP_COMMANDLINE_APPEND="ip=eth0:dhcp" KDUMP_NET_TIMEOUT=1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdump-1.0/calibrate/maxrss.py new/kdump-1.0.2/calibrate/maxrss.py --- old/kdump-1.0/calibrate/maxrss.py 2022-01-21 13:47:25.000000000 +0100 +++ new/kdump-1.0.2/calibrate/maxrss.py 2022-02-01 12:54:09.000000000 +0100 @@ -61,11 +61,14 @@ percpu = int(value.split()[0]) elif category == 'vmcoreinfo': - (key, value) = data.split('=') - if key == 'PAGESIZE': - pagesize = int(value) - elif key == 'SIZE(page)': - sizeofpage = int(value) + try: + (key, value) = data.split('=') + if key == 'PAGESIZE': + pagesize = int(value) + elif key == 'SIZE(page)': + sizeofpage = int(value) + except ValueError: + pass else: if cmdline.debug: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdump-1.0/calibrate/run-qemu.py new/kdump-1.0.2/calibrate/run-qemu.py --- old/kdump-1.0/calibrate/run-qemu.py 2022-01-21 13:47:25.000000000 +0100 +++ new/kdump-1.0.2/calibrate/run-qemu.py 2022-02-01 12:54:09.000000000 +0100 @@ -93,6 +93,7 @@ os.path.abspath('dracut'), '--local', '--hostonly', + '--no-hostonly-default-device', # Standard kdump initrd options: '--omit', 'plymouth resume usrmount', @@ -108,7 +109,7 @@ path, params['KERNELVER'], ) - subprocess.call(args, env=env) + subprocess.call(args, env=env, stdout=sys.stderr) # Replace /init with trackrss: trackrss = os.path.join(bindir, 'trackrss') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdump-1.0/calibrate/trackrss.c new/kdump-1.0.2/calibrate/trackrss.c --- old/kdump-1.0/calibrate/trackrss.c 2022-01-21 13:47:25.000000000 +0100 +++ new/kdump-1.0.2/calibrate/trackrss.c 2022-02-01 12:54:09.000000000 +0100 @@ -526,7 +526,8 @@ { int fd; - if (mknod(RANDOM_PATH, S_IFCHR | 0666, RANDOM_DEV) < 0) { + if (mknod(RANDOM_PATH, S_IFCHR | 0666, RANDOM_DEV) < 0 && + errno != EEXIST) { perror("create random"); return 1; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdump-1.0/doc/man/kdump.5.txt.in new/kdump-1.0.2/doc/man/kdump.5.txt.in --- old/kdump-1.0/doc/man/kdump.5.txt.in 2022-01-21 13:47:25.000000000 +0100 +++ new/kdump-1.0.2/doc/man/kdump.5.txt.in 2022-02-01 12:54:09.000000000 +0100 @@ -184,6 +184,27 @@ Default is "". +KDUMP_AUTO_RESIZE +~~~~~~~~~~~~~~~~~ + +Memory for the crash kernel is reserved at boot time. It is a large +block that must be continuous in physical address space, and such +allocations must be early because of memory fragmentation. However, +the Linux kernel allows to shrink this reserved area later, and this +is what kdump does before loading the panic kernel when this option +is turned on. + +The intention is that the _crashkernel_ boot option is set to the +maximum possible value (e.g. half of available RAM), which should be +enough for the worst case. When the system boots, it checks the +actual requirements and reduces the reservation accordingly. + +Note that this option is ignored if the reservation is not done by +the Linux kernel, i.e. under the Xen hypervisor, or when using +FADUMP on IBM POWER. + +Default is "no". + ifeval::['@HAVE_FADUMP@'=='TRUE'] KDUMP_FADUMP diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdump-1.0/dracut/kdump-save.service.in new/kdump-1.0.2/dracut/kdump-save.service.in --- old/kdump-1.0/dracut/kdump-save.service.in 2022-01-21 13:47:25.000000000 +0100 +++ new/kdump-1.0.2/dracut/kdump-save.service.in 2022-02-01 12:54:09.000000000 +0100 @@ -11,6 +11,7 @@ Description=save kernel crash dump Documentation=man:kdump(7) RequiresMountsFor=@KDUMP_MOUNTPOINTS@ +After=dracut-initqueue.service Before=initrd-parse-etc.service ConditionPathExists=/etc/initrd-release ConditionPathExists=/proc/vmcore diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdump-1.0/init/CMakeLists.txt new/kdump-1.0.2/init/CMakeLists.txt --- old/kdump-1.0/init/CMakeLists.txt 2022-01-21 13:47:25.000000000 +0100 +++ new/kdump-1.0.2/init/CMakeLists.txt 2022-02-01 12:54:09.000000000 +0100 @@ -41,7 +41,6 @@ INSTALL( FILES ${CMAKE_CURRENT_SOURCE_DIR}/mkdumprd - ${CMAKE_CURRENT_SOURCE_DIR}/kdump-bootloader.pl DESTINATION /usr/sbin PERMISSIONS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdump-1.0/init/kdump-bootloader.pl new/kdump-1.0.2/init/kdump-bootloader.pl --- old/kdump-1.0/init/kdump-bootloader.pl 2022-01-21 13:47:25.000000000 +0100 +++ new/kdump-1.0.2/init/kdump-bootloader.pl 1970-01-01 01:00:00.000000000 +0100 @@ -1,48 +0,0 @@ -#! /usr/bin/perl - -use Bootloader::Tools; - -Bootloader::Tools::InitLibrary(); - -my $grub2; -my $section; -if (Bootloader::Tools::GetBootloader() =~ /^(grub2|grub2-efi)$/) { - $grub2 = true; - $section = Bootloader::Tools::GetGlobals(); -} else { - $grub2 = false; - $section = Bootloader::Tools::GetDefaultSection(); -} - -if ($ARGV[0] eq "--get") { - print $section->{"append"}; -} elsif ($ARGV[0] eq "--update") { - my $input = $section->{"append"}; - my $result; - while (length($input)) { - $input =~ s/^[[:space:]]+//; - if ($input =~ s/^("[^"]*"?|[^"[:space:]]+)+//) { - my $rawparam = $&; - my $param = $rawparam; - $param =~ s/"//g; - $param =~ s/=(.*)//; - if (! ($param =~ /^fadump$/)) { - $result .= " " if length($result); - $result .= $rawparam; - } - } - } - - shift @ARGV; - $result .= " " if length($result); - $result .= join(" ", @ARGV); - if ($grub2) { - Bootloader::Tools::SetGlobals("append" => $result); - } else { - $section->{"append"} = $result; - $section->{"__modified"} = 1; - Bootloader::Tools::SetGlobals(); - } -} else { - die "Need an action (--get or --update)"; -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdump-1.0/init/kdump-early.service new/kdump-1.0.2/init/kdump-early.service --- old/kdump-1.0/init/kdump-early.service 2022-01-21 13:47:25.000000000 +0100 +++ new/kdump-1.0.2/init/kdump-early.service 2022-02-01 12:54:09.000000000 +0100 @@ -4,7 +4,7 @@ [Service] Type=oneshot -ExecStart=/usr/lib/kdump/load.sh +ExecStart=/usr/lib/kdump/load.sh --shrink ExecStop=/usr/lib/kdump/unload.sh RemainAfterExit=true # It is OK if the initrd is missing in this early attempt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdump-1.0/init/load.sh new/kdump-1.0.2/init/load.sh --- old/kdump-1.0/init/load.sh 2022-01-21 13:47:25.000000000 +0100 +++ new/kdump-1.0.2/init/load.sh 2022-02-01 12:54:09.000000000 +0100 @@ -255,14 +255,13 @@ local newstate="$1" # check if the old configuration is still valid - boot_opts=$(kdump-bootloader.pl --get) - nofadump_opts=$(echo "$boot_opts" | remove_from_commandline 'fadump') + local boot_opts=$(pbl --get-option fadump) if [ "$newstate" = on ] ; then - if [ "$boot_opts" = "$nofadump_opts" ] ; then - kdump-bootloader.pl --update fadump=on - fi - elif [ "$boot_opts" != "$nofadump_opts" ] ; then - kdump-bootloader.pl --update + if [ "$boot_opts" != "fadump=on" ] ; then + pbl --add-option fadump=on --config + fi + elif [ -n "$boot_opts" ] ; then + pbl --del-option fadump --config fi } @@ -368,11 +367,34 @@ KDUMPTOOL="$KDUMPTOOL -D" fi +update= +shrink= +while [ $# -gt 0 ] ; do + case "$1" in + --update) + update=yes + ;; + --shrink) + shrink="$KDUMP_AUTO_RESIZE" + ;; + *) + echo "Unknown option: $1" >&2 + exit 1 + ;; + esac + shift +done + find_kernel || exit 6 -if [ "$1" = "--update" ] ; then + +if [ "$update" = yes ] ; then rebuild_kdumprd || exit 1 fi +if [ "$shrink" = yes ] ; then + $KDUMPTOOL calibrate --shrink > /dev/null +fi + if [ "$KDUMP_FADUMP" = "yes" ] ; then load_kdump_fadump else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdump-1.0/init/mkdumprd new/kdump-1.0.2/init/mkdumprd --- old/kdump-1.0/init/mkdumprd 2022-01-21 13:47:25.000000000 +0100 +++ new/kdump-1.0.2/init/mkdumprd 2022-02-01 12:54:09.000000000 +0100 @@ -55,7 +55,7 @@ # Create a new initrd using dracut {{{ function run_dracut() { - DRACUT_ARGS="--force --hostonly --omit 'plymouth resume usrmount' $@" + DRACUT_ARGS="--force --hostonly --no-hostonly-default-device --omit 'plymouth resume usrmount' $@" if [ -z "$KERNELVERSION" ] then diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdump-1.0/kdumptool/calibrate.cc new/kdump-1.0.2/kdumptool/calibrate.cc --- old/kdump-1.0/kdumptool/calibrate.cc 2022-01-21 13:47:25.000000000 +0100 +++ new/kdump-1.0.2/kdumptool/calibrate.cc 2022-02-01 12:54:09.000000000 +0100 @@ -22,8 +22,12 @@ #include <cstring> #include <cstdlib> #include <limits> -#include <unistd.h> + #include <dirent.h> +#include <fcntl.h> +#include <unistd.h> +#include <sys/stat.h> +#include <sys/types.h> #include "subcommand.h" #include "debug.h" @@ -151,9 +155,11 @@ // for overflow, DMA buffers, etc. #define MINLOW_KB MB(64 + 8) +using std::cerr; using std::cout; using std::endl; using std::ifstream; +using std::string; //{{{ SizeConstants ------------------------------------------------------------ @@ -793,17 +799,14 @@ public: - typedef std::list<const MemRange*> List; + typedef std::list<MemRange> List; /** * Initialize a new MemMap object. * * @param[in] procdir Mount point for procfs */ - MemMap(const char *procdir = "/proc"); - - ~MemMap() - { destroyRanges(); } + MemMap(const SizeConstants &sizes, const char *procdir = "/proc"); /** * Get the total System RAM (in bytes). @@ -831,15 +834,13 @@ private: + const SizeConstants& m_sizes; List m_ranges; - - /** - * Destroy MemRange objects in m_ranges. - */ - void destroyRanges(void); + MemRange::Addr m_kstart, m_kend; }; -MemMap::MemMap(const char *procdir) +MemMap::MemMap(const SizeConstants &sizes, const char *procdir) + : m_sizes(sizes), m_kstart(0), m_kend(0) { FilePath path(procdir); @@ -850,7 +851,8 @@ f.setf(std::ios::hex, std::ios::basefield); while (f) { - if (f.peek() != ' ' && !f.eof()) { + int firstc = f.peek(); + if (!f.eof()) { MemRange::Addr start, end; if (!(f >> start)) @@ -867,34 +869,28 @@ while ((c = f.get()) == ' '); f.unget(); - std::string name; + KString name; std::getline(f, name); - if (name == "System RAM") - m_ranges.push_back(new MemRange(start, end)); - } else - f.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); + if (firstc != ' ' && name == "System RAM") { + m_ranges.emplace_back(start, end); + } else if (firstc == ' ' && name.startsWith("Kernel ")) { + if (!m_kstart) + m_kstart = start; + m_kend = end; + } + } } f.close(); } // ----------------------------------------------------------------------------- -void MemMap::destroyRanges(void) -{ - List::iterator it; - for (it = m_ranges.begin(); it != m_ranges.end(); ++it) - delete *it; - m_ranges.clear(); -} - -// ----------------------------------------------------------------------------- unsigned long long MemMap::total(void) const { - List::const_iterator it; unsigned long long ret = 0; - for (it = m_ranges.begin(); it != m_ranges.end(); ++it) - ret += (*it)->length(); + for (const auto& range : m_ranges) + ret += range.length(); return ret; } @@ -902,18 +898,26 @@ // ----------------------------------------------------------------------------- unsigned long long MemMap::largest(unsigned long long limit) const { - List::const_iterator it; unsigned long long ret = 0; - for (it = m_ranges.begin(); it != m_ranges.end(); ++it) { + for (const auto& range : m_ranges) { MemRange::Addr start, end, length; - start = (*it)->start(); + start = range.start(); if (start > limit) continue; - end = (*it)->end(); - length = (end <= limit ? end : limit) - start + 1; + end = range.end(); + if (end > limit) + end = limit; + length = end - start + 1; + if (start <= m_kstart && m_kstart <= end) { + // Worst case is if the kernel and initrd are spread evenly + // across this RAM region + MemRange::Addr ksize = + (end < m_kend ? end : m_kend) - m_kstart + 1; + length = (length - ksize - m_sizes.kernel_init_kb()) / 3; + } if (length > ret) ret = length; } @@ -927,14 +931,14 @@ List::const_reverse_iterator it; for (it = m_ranges.rbegin(); it != m_ranges.rend(); ++it) { - MemRange::Addr base = (*it)->end() + 1; + MemRange::Addr base = it->end() + 1; if (base < size) continue; base -= size; base -= base % align; - if (base >= (*it)->start()) + if (base >= it->start()) return base; } @@ -1009,7 +1013,13 @@ // ----------------------------------------------------------------------------- Calibrate::Calibrate() -{} + : m_shrink(false) +{ + Debug::debug()->trace("Calibrate::Calibrate()"); + + m_options.push_back(new FlagOption("shrink", 's', &m_shrink, + "Shrink the crash kernel reservation")); +} // ----------------------------------------------------------------------------- const char *Calibrate::getName() const @@ -1018,246 +1028,243 @@ } // ----------------------------------------------------------------------------- -void Calibrate::execute() +static unsigned long runtimeSize(SizeConstants const &sizes, + unsigned long memtotal) { - Debug::debug()->trace("Calibrate::execute()"); - - HyperInfo hyper; - Debug::debug()->dbg("Hypervisor type: %s", hyper.type().c_str()); - Debug::debug()->dbg("Guest type: %s", hyper.guest_type().c_str()); - Debug::debug()->dbg("Guest variant: %s", hyper.guest_variant().c_str()); - if (hyper.type() == "xen" && hyper.guest_type() == "PV" && - hyper.guest_variant() == "DomU") { - cout << "Total: 0" << endl; - cout << "Low: 0" << endl; - cout << "High: 0" << endl; - cout << "MinLow: 0" << endl; - cout << "MaxLow: 0" << endl; - cout << "MinHigh: 0 " << endl; - cout << "MaxHigh: 0 " << endl; - return; - } - - SizeConstants sizes; - MemMap mm; + Configuration *config = Configuration::config(); unsigned long required, prev; - unsigned long minlow = MINLOW_KB; - unsigned long memtotal = shr_round_up(mm.total(), 10); - // Default (pessimistic) boot-time requirements. - unsigned long bootsize = sizes.kernel_base_kb() + - sizes.kernel_init_kb() + sizes.kernel_init_net_kb() + - sizes.initramfs_kb() + sizes.initramfs_net_kb(); - try { - Configuration *config = Configuration::config(); - bool needsnet = config->needsNetwork(); + // Run-time kernel requirements + required = sizes.kernel_base_kb() + sizes.initramfs_kb(); - // Get total RAM size - Debug::debug()->dbg("Expected total RAM: %lu KiB", memtotal); + // Double the size, because fbcon allocates its own framebuffer, + // and many DRM drivers allocate the hw framebuffer in system RAM + try { + Framebuffers fb; + required += 2 * fb.size() / 1024UL; + } catch(KError &e) { + Debug::debug()->dbg("Cannot get framebuffer size: %s", e.what()); + required += 2 * DEF_FRAMEBUFFER_KB; + } - // Calculate boot requirements - if (!needsnet) - bootsize -= sizes.kernel_init_net_kb() + sizes.initramfs_net_kb(); - Debug::debug()->dbg("Memory needed at boot: %lu KiB", bootsize); - - // Run-time kernel requirements - required = sizes.kernel_base_kb() + sizes.initramfs_kb(); - - // Double the size, because fbcon allocates its own - // framebuffer, and many DRM drivers allocate the hw - // framebuffer in system RAM - try { - Framebuffers fb; - required += 2 * fb.size() / 1024UL; - } catch(KError &e) { - Debug::debug()->dbg("Cannot get framebuffer size: %s", e.what()); - required += 2 * DEF_FRAMEBUFFER_KB; - } + // LUKS Argon2 hash requires a lot of memory + try { + FilesystemTypeMap map; - // LUKS Argon2 hash requires a lot of memory - try { - FilesystemTypeMap map; + if (config->KDUMP_COPY_KERNEL.value()) { + try { + map.addPath("/boot"); + } catch (KError&) { + // ignore device resolution failures + } + } - if (config->KDUMP_COPY_KERNEL.value()) { + std::istringstream iss(config->KDUMP_SAVEDIR.value()); + std::string elem; + while (iss >> elem) { + RootDirURL url(elem, std::string()); + if (url.getProtocol() == RootDirURL::PROT_FILE) { try { - map.addPath("/boot"); + map.addPath(url.getRealPath()); } catch (KError&) { // ignore device resolution failures } } + } - std::istringstream iss(config->KDUMP_SAVEDIR.value()); - std::string elem; - while (iss >> elem) { - RootDirURL url(elem, std::string()); - if (url.getProtocol() == RootDirURL::PROT_FILE) { - try { - map.addPath(url.getRealPath()); - } catch (KError&) { - // ignore device resolution failures - } - } - } - - unsigned long crypto_mem = 0; - StringStringMap devices = map.devices(); - for (StringStringMap::iterator it = devices.begin(); - it != devices.end(); - ++it) { - if (it->second == "crypto_LUKS") { - CryptInfo info(it->first); - if (crypto_mem < info.memory()) - crypto_mem = info.memory(); - } + unsigned long crypto_mem = 0; + for (const auto& devmap : map.devices()) { + if (devmap.second == "crypto_LUKS") { + CryptInfo info(devmap.first); + if (crypto_mem < info.memory()) + crypto_mem = info.memory(); } - required += crypto_mem; - - Debug::debug()->dbg("Adding %lu KiB for crypto devices", - crypto_mem); - } catch (KError &e) { - Debug::debug()->dbg("Cannot check encrypted volumes: %s", e.what()); - // Fall back to no allocation } + required += crypto_mem; - // Add space for constant slabs - try { - SlabInfos slab; - SlabInfos::Map info = slab.getInfo(); - SlabInfos::Map::iterator it; - for (it = info.begin(); it != info.end(); ++it) { - if (it->first.startsWith("Acpi-")) { - unsigned long slabsize = it->second->numSlabs() * - it->second->pagesPerSlab() * sizes.pagesize() / 1024; - required += slabsize; + Debug::debug()->dbg("Adding %lu KiB for crypto devices", crypto_mem); + } catch (KError &e) { + Debug::debug()->dbg("Cannot check encrypted volumes: %s", e.what()); + // Fall back to no allocation + } - Debug::debug()->dbg("Adding %ld KiB for %s slab cache", - slabsize, it->second->name().c_str()); - } - } - } catch (KError &e) { - Debug::debug()->dbg("Cannot get slab sizes: %s", e.what()); - } + // Add space for constant slabs + try { + SlabInfos slab; + for (const auto& elem : slab.getInfo()) { + if (elem.first.startsWith("Acpi-")) { + unsigned long slabsize = elem.second->numSlabs() * + elem.second->pagesPerSlab() * sizes.pagesize() / 1024; + required += slabsize; - // Add memory based on CPU count - unsigned long cpus = 0; - if (CAN_REDUCE_CPUS) - cpus = config->KDUMP_CPUS.value(); - if (!cpus) { - SystemCPU syscpu; - unsigned long online = syscpu.numOnline(); - unsigned long offline = syscpu.numOffline(); - Debug::debug()->dbg("CPUs online: %lu, offline: %lu", - online, offline); - cpus = online + offline; - } - Debug::debug()->dbg("Total assumed CPUs: %lu", cpus); - cpus *= sizes.percpu_kb(); - Debug::debug()->dbg("Total per-cpu requirements: %lu KiB", cpus); - required += cpus; - - // User-space requirements - unsigned long user = sizes.user_base_kb(); - if (needsnet) - user += sizes.user_net_kb(); - - if (config->needsMakedumpfile()) { - // Estimate bitmap size (1 bit for every RAM page) - unsigned long bitmapsz = shr_round_up(memtotal / sizes.pagesize(), 2); - if (bitmapsz > MAX_BITMAP_KB) - bitmapsz = MAX_BITMAP_KB; - Debug::debug()->dbg("Estimated bitmap size: %lu KiB", bitmapsz); - user += bitmapsz; + Debug::debug()->dbg("Adding %ld KiB for %s slab cache", + slabsize, elem.second->name().c_str()); + } + } + } catch (KError &e) { + Debug::debug()->dbg("Cannot get slab sizes: %s", e.what()); + } - // Makedumpfile needs additional 96 B for every 128 MiB of RAM - user += 96 * shr_round_up(memtotal, 20 + 7); - } - Debug::debug()->dbg("Total userspace: %lu KiB", user); - required += user; + // Add memory based on CPU count + unsigned long cpus = 0; + if (CAN_REDUCE_CPUS) + cpus = config->KDUMP_CPUS.value(); + if (!cpus) { + SystemCPU syscpu; + unsigned long online = syscpu.numOnline(); + unsigned long offline = syscpu.numOffline(); + Debug::debug()->dbg("CPUs online: %lu, offline: %lu", + online, offline); + cpus = online + offline; + } + Debug::debug()->dbg("Total assumed CPUs: %lu", cpus); + cpus *= sizes.percpu_kb(); + Debug::debug()->dbg("Total per-cpu requirements: %lu KiB", cpus); + required += cpus; + + // User-space requirements + unsigned long user = sizes.user_base_kb(); + if (config->needsNetwork()) + user += sizes.user_net_kb(); + + if (config->needsMakedumpfile()) { + // Estimate bitmap size (1 bit for every RAM page) + unsigned long bitmapsz = shr_round_up(memtotal / sizes.pagesize(), 2); + if (bitmapsz > MAX_BITMAP_KB) + bitmapsz = MAX_BITMAP_KB; + Debug::debug()->dbg("Estimated bitmap size: %lu KiB", bitmapsz); + user += bitmapsz; + + // Makedumpfile needs additional 96 B for every 128 MiB of RAM + user += 96 * shr_round_up(memtotal, 20 + 7); + } + Debug::debug()->dbg("Total userspace: %lu KiB", user); + required += user; - // Make room for dirty pages and in-flight I/O: - // - // required = prev + dirty + io - // dirty = total * (DIRTY_RATIO / 100) - // io = dirty * (BUF_PER_DIRTY_MB / 1024) - // - // solve the above using integer math: - unsigned long dirty; - prev = required; - required = required * MB(100) / - (MB(100) - MB(DIRTY_RATIO) - DIRTY_RATIO * BUF_PER_DIRTY_MB); - dirty = (required - prev) * MB(1) / (MB(1) + BUF_PER_DIRTY_MB); - Debug::debug()->dbg("Dirty pagecache: %lu KiB", dirty); - Debug::debug()->dbg("In-flight I/O: %lu KiB", required - prev - dirty); - - // Account for "large hashes" - prev = required; - required = required * MB(1024) / (MB(1024) - KERNEL_HASH_PER_MB); - Debug::debug()->dbg("Large kernel hashes: %lu KiB", required - prev); + // Make room for dirty pages and in-flight I/O: + // + // required = prev + dirty + io + // dirty = total * (DIRTY_RATIO / 100) + // io = dirty * (BUF_PER_DIRTY_MB / 1024) + // + // solve the above using integer math: + unsigned long dirty; + prev = required; + required = required * MB(100) / + (MB(100) - MB(DIRTY_RATIO) - DIRTY_RATIO * BUF_PER_DIRTY_MB); + dirty = (required - prev) * MB(1) / (MB(1) + BUF_PER_DIRTY_MB); + Debug::debug()->dbg("Dirty pagecache: %lu KiB", dirty); + Debug::debug()->dbg("In-flight I/O: %lu KiB", required - prev - dirty); + + // Account for "large hashes" + prev = required; + required = required * MB(1024) / (MB(1024) - KERNEL_HASH_PER_MB); + Debug::debug()->dbg("Large kernel hashes: %lu KiB", required - prev); - // Add space for memmap - prev = required; + // Add space for memmap + prev = required; #if HAVE_FADUMP - if (config->KDUMP_FADUMP.value()) { - // FADUMP will map all memory - unsigned long maxpfn = memtotal / (sizes.pagesize() / 1024); - required += shr_round_up(maxpfn * sizes.sizeof_page(), 10); - } else { + if (config->KDUMP_FADUMP.value()) { + // FADUMP will map all memory + unsigned long maxpfn = memtotal / (sizes.pagesize() / 1024); + required += shr_round_up(maxpfn * sizes.sizeof_page(), 10); + } else { #endif - required = required * sizes.pagesize() / (sizes.pagesize() - sizes.sizeof_page()); - unsigned long maxpfn = (required - prev) / sizes.sizeof_page(); - required = prev + align_memmap(maxpfn) * sizes.sizeof_page(); + required = required * sizes.pagesize() / (sizes.pagesize() - sizes.sizeof_page()); + unsigned long maxpfn = (required - prev) / sizes.sizeof_page(); + required = prev + align_memmap(maxpfn) * sizes.sizeof_page(); #if HAVE_FADUMP - } + } #endif - Debug::debug()->dbg("Maximum memmap size: %lu KiB", required - prev); + Debug::debug()->dbg("Maximum memmap size: %lu KiB", required - prev); + + Debug::debug()->dbg("Total run-time size: %lu KiB", required); + return required; +} + +// ----------------------------------------------------------------------------- +static void shrink_crash_size(unsigned long size) +{ + static const char crash_size_fname[] = "/sys/kernel/kexec_crash_size"; + + std::ostringstream ss; + ss << size; + const string &numstr = ss.str(); + + int fd = open(crash_size_fname, O_WRONLY); + if (fd < 0) + throw KSystemError(string("Cannot open ") + crash_size_fname, + errno); + if (write(fd, numstr.c_str(), numstr.length()) < 0) { + if (errno == EINVAL) + Debug::debug()->dbg("New crash kernel size is bigger"); + else if (errno == ENOENT) + throw KError("Crash kernel is currently loaded"); + else + throw KSystemError(string("Cannot write to ") + crash_size_fname, + errno); + } + close(fd); +} + +// ----------------------------------------------------------------------------- +void Calibrate::execute() +{ + Debug::debug()->trace("Calibrate::execute()"); + + HyperInfo hyper; + Debug::debug()->dbg("Hypervisor type: %s", hyper.type().c_str()); + Debug::debug()->dbg("Guest type: %s", hyper.guest_type().c_str()); + Debug::debug()->dbg("Guest variant: %s", hyper.guest_variant().c_str()); + if (hyper.type() == "xen" && hyper.guest_type() == "PV" && + hyper.guest_variant() == "DomU") { + cout << "Total: 0" << endl; + cout << "Low: 0" << endl; + cout << "High: 0" << endl; + cout << "MinLow: 0" << endl; + cout << "MaxLow: 0" << endl; + cout << "MinHigh: 0 " << endl; + cout << "MaxHigh: 0 " << endl; + return; + } + + Configuration *config = Configuration::config(); + SizeConstants sizes; + MemMap mm(sizes); + unsigned long required; + unsigned long memtotal = shr_round_up(mm.total(), 10); + + // Get total RAM size + Debug::debug()->dbg("Expected total RAM: %lu KiB", memtotal); + + // Calculate boot requirements + unsigned long bootsize = sizes.kernel_base_kb() + + sizes.kernel_init_kb() + sizes.initramfs_kb(); + if (config->needsNetwork()) + bootsize += sizes.kernel_init_net_kb() + sizes.initramfs_net_kb(); + Debug::debug()->dbg("Memory needed at boot: %lu KiB", bootsize); + + try { + required = runtimeSize(sizes, memtotal); // Make sure there is enough space at boot - Debug::debug()->dbg("Total run-time size: %lu KiB", required); if (required < bootsize) required = bootsize; // Reserve a fixed percentage on top of the calculation required = (required * (100 + ADD_RESERVE)) / 100; -#if HAVE_FADUMP - // The kernel enforces minimum reservation size for FADUMP - if (config->KDUMP_FADUMP.value()) { - static const char rtas_fname[] = - "/proc/device-tree/rtas/ibm,configure-kernel-dump"; - static const char opal_fname[] = - "/proc/device-tree/ibm,opal/dump"; - - unsigned long fadump_min = 0; - if (FilePath(rtas_fname).exists()) { - // RTAS_FADUMP_MIN_BOOT_MEM - // see arch/powerpc/platforms/pseries/rtas-fadump.h - fadump_min = MB(320); - } else if (FilePath(opal_fname).exists()) { - // OPAL_FADUMP_MIN_BOOT_MEM - // see arch/powerpc/platforms/powernv/opal-fadump.h - fadump_min = MB(768); - } else { - Debug::debug()->info("Unknown FADUMP implementation!"); - } - - if (fadump_min) - Debug::debug()->dbg("Minimum FADUMP size: %lu KiB", fadump_min); - if (minlow < fadump_min) - minlow = fadump_min; - if (required < minlow) - required = minlow; - } -#endif } catch(KError &e) { Debug::debug()->info(e.what()); required = DEF_RESERVE_KB; } - cout << "Total: " << (memtotal >> 10) << endl; + unsigned long low, minlow, maxlow; + unsigned long high, minhigh, maxhigh; #if defined(__x86_64__) + unsigned long long base = mm.find(required << 10, 16UL << 20); - unsigned long low, high; Debug::debug()->dbg("Estimated crash area base: 0x%llx", base); @@ -1268,32 +1275,77 @@ } if (base < (1ULL<<32)) { - low = 0; - high = required; + low = minlow = 0; } else { - low = minlow; - high = (required > low ? required - low : 0); - if (high < bootsize) - high = bootsize; + low = minlow = MINLOW_KB; + required = (required > low ? required - low : 0); + if (required < bootsize) + required = bootsize; + } + high = required; + + maxlow = mm.largest(1ULL<<32) >> 10; + minhigh = 0; + maxhigh = mm.largest() >> 10; + +#else // __x86_64__ + + minlow = MINLOW_KB; + +#if HAVE_FADUMP + // The kernel enforces minimum reservation size for FADUMP + if (config->KDUMP_FADUMP.value()) { + static const char rtas_fname[] = + "/proc/device-tree/rtas/ibm,configure-kernel-dump"; + static const char opal_fname[] = + "/proc/device-tree/ibm,opal/dump"; + + unsigned long fadump_min = 0; + if (FilePath(rtas_fname).exists()) { + // RTAS_FADUMP_MIN_BOOT_MEM + // see arch/powerpc/platforms/pseries/rtas-fadump.h + fadump_min = MB(320); + } else if (FilePath(opal_fname).exists()) { + // OPAL_FADUMP_MIN_BOOT_MEM + // see arch/powerpc/platforms/powernv/opal-fadump.h + fadump_min = MB(768); + } else { + Debug::debug()->info("Unknown FADUMP implementation!"); + } + + if (fadump_min) + Debug::debug()->dbg("Minimum FADUMP size: %lu KiB", fadump_min); + if (minlow < fadump_min) + minlow = fadump_min; + if (required < minlow) + required = minlow; } +#endif + + low = required; + +# if defined(__i386__) + maxlow = mm.largest(512ULL<<20) >> 10; +# else + maxlow = mm.largest() >> 10; +# endif // __i386__ + + high = 0; + minhigh = 0; + maxhigh = 0; + +#endif // __x86_64__ + + cout << "Total: " << (memtotal >> 10) << endl; cout << "Low: " << shr_round_up(low, 10) << endl; cout << "High: " << shr_round_up(high, 10) << endl; - cout << "MinLow: " << shr_round_up(low, 10) << endl; - cout << "MaxLow: " << (mm.largest(1ULL<<32) >> 20) << endl; - cout << "MinHigh: 0" << endl; - cout << "MaxHigh: " << (mm.largest() >> 20) << endl; -#else - cout << "Low: " << shr_round_up(required, 10) << endl; - cout << "High: 0" << endl; cout << "MinLow: " << shr_round_up(minlow, 10) << endl; -# if defined(__i386__) - cout << "MaxLow: " << (mm.largest(512ULL<<20) >> 20) << endl; -# else - cout << "MaxLow: " << (mm.largest() >> 20) << endl; -# endif - cout << "MinHigh: 0 " << endl; - cout << "MaxHigh: 0 " << endl; -#endif + cout << "MaxLow: " << (maxlow >> 10) << endl; + cout << "MinHigh: " << shr_round_up(minhigh, 10) << endl; + cout << "MaxHigh: " << (maxhigh >> 10) << endl; + + if (m_shrink) + shrink_crash_size(required << 10); } //}}} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdump-1.0/kdumptool/calibrate.h new/kdump-1.0.2/kdumptool/calibrate.h --- old/kdump-1.0/kdumptool/calibrate.h 2022-01-21 13:47:25.000000000 +0100 +++ new/kdump-1.0.2/kdumptool/calibrate.h 2022-02-01 12:54:09.000000000 +0100 @@ -28,6 +28,8 @@ * Subcommand to calibrate reserved memory */ class Calibrate : public Subcommand { + protected: + bool m_shrink; public: /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdump-1.0/kdumptool/define_opt.h new/kdump-1.0.2/kdumptool/define_opt.h --- old/kdump-1.0/kdumptool/define_opt.h 2022-01-21 13:47:25.000000000 +0100 +++ new/kdump-1.0.2/kdumptool/define_opt.h 2022-02-01 12:54:09.000000000 +0100 @@ -13,6 +13,7 @@ DEFINE_OPT(KDUMP_CPUS, Int, 1, KEXEC | DUMP) DEFINE_OPT(KDUMP_COMMANDLINE, String, "", KEXEC) DEFINE_OPT(KDUMP_COMMANDLINE_APPEND, String, "", KEXEC) +DEFINE_OPT(KDUMP_AUTO_RESIZE, Bool, false, KEXEC) #if HAVE_FADUMP DEFINE_OPT(KDUMP_FADUMP, Bool, false, MKINITRD) DEFINE_OPT(KDUMP_FADUMP_SHELL, Bool, false, MKINITRD | DUMP) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdump-1.0/sysconfig.kdump.in new/kdump-1.0.2/sysconfig.kdump.in --- old/kdump-1.0/sysconfig.kdump.in 2022-01-21 13:47:25.000000000 +0100 +++ new/kdump-1.0.2/sysconfig.kdump.in 2022-02-01 12:54:09.000000000 +0100 @@ -54,6 +54,16 @@ # KDUMP_COMMANDLINE_APPEND="" +## Type: yesno +## Default: "no" +# +# When this option is set to yes, kdump tries to shrink the crash +# kernel reservation at boot. +# +# See also: kdump(6). +# +KDUMP_AUTO_RESIZE="no" + @if @HAVE_FADUMP@ TRUE ## Type: yesno ## Default: "no" ++++++ kdump-calibrate-fix-nic-naming.patch ++++++ From: Petr Tesarik <ptesa...@suse.com> Date: Tue Feb 1 22:25:59 2022 +0100 Subject: calibrate: Fix network interface naming Upstream: merged Git-commit: 75a44901b54ba853497d63c01bef77b251436e0a The init scripts may rename the network interface unless it is given an explicit name by MAC address. If that happens, network initialization fails, because the "eth0" interface is missing. Signed-off-by: Petr Tesarik <ptesa...@suse.com> --- calibrate/run-qemu.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) --- a/calibrate/run-qemu.py +++ b/calibrate/run-qemu.py @@ -217,8 +217,15 @@ def run_qemu(bindir, params, initrd, elf model = 'virtio' else: model = 'e1000e' - extra_qemu_args.extend(('-nic', 'user,model={}'.format(model))) - extra_kernel_args.extend(('bootdev=eth0', 'ip=eth0:dhcp')) + mac = '12:34:56:78:9A:BC' + extra_qemu_args.extend(( + '-nic', 'user,mac={},model={}'.format(mac, model) + )) + extra_kernel_args.extend(( + 'ifname=kdump0:{}'.format(mac), + 'bootdev=kdump0', + 'ip=kdump0:dhcp' + )) # Other arch-specific arguments if arch == 'aarch64': ++++++ kdump-calibrate-include-af_packet.patch ++++++ From: Petr Tesarik <ptesa...@suse.com> Date: Tue Feb 1 18:47:25 2022 +0100 Subject: calibrate: Explicitly include af_packet in the test initrd Upstream: merged Git-commit: 00edd1457aa19eebe78c8c36ef013f72af262584 DHCP clients need protocol family PF_PACKET. If it is built as a module, then the dependency is not automatically added by dracut's kernel-network-modules unless af_packet is loaded in the host. This breaks OBS build, because that is done inside a VM with no network. Signed-off-by: Petr Tesarik <ptesa...@suse.com> --- calibrate/run-qemu.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/calibrate/run-qemu.py +++ b/calibrate/run-qemu.py @@ -82,11 +82,12 @@ class build_initrd(object): '/usr/bin')) if params['NET']: + netdrivers = [ 'af_packet' ] if params['ARCH'].startswith('s390'): - net_driver = 'virtio-net' + netdrivers.append('virtio-net') else: - net_driver = 'e1000e' - extra_args = ('--add-drivers', net_driver) + netdrivers.append('e1000e') + extra_args = ('--add-drivers', ' '.join(netdrivers)) else: extra_args = () args = ( ++++++ kdump-calibrate.conf-depends-on-kdumptool.patch ++++++ From: Petr Tesarik <ptesa...@suse.com> Date: Tue Feb 1 23:14:01 2022 +0100 Subject: calibrate.conf: Add dependency on kdumptool Upstream: merged Git-commit: 4641d2bc0468fe733c18b6f9c81f1bb6402c520e The run-qemu.py script invokes kdumptool to find a suitable kernel, so kdumptool must be built before this script runs. Signed-off-by: Petr Tesarik <ptesa...@suse.com> diff --git a/calibrate/CMakeLists.txt b/calibrate/CMakeLists.txt index 7d8b4fc..57344ae 100644 --- a/calibrate/CMakeLists.txt +++ b/calibrate/CMakeLists.txt @@ -38,6 +38,7 @@ ADD_CUSTOM_COMMAND( VERBATIM DEPENDS ${dracut_targets} + kdumptool dummy.conf dummy-net.conf trackrss