Hello community, here is the log from the commit of package kdump for openSUSE:Factory checked in at 2014-07-13 17:16:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kdump (Old) and /work/SRC/openSUSE:Factory/.kdump.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kdump" Changes: -------- --- /work/SRC/openSUSE:Factory/kdump/kdump.changes 2014-06-19 13:08:32.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.kdump.new/kdump.changes 2014-07-13 17:16:32.000000000 +0200 @@ -1,0 +2,17 @@ +Fri Jul 4 11:48:20 UTC 2014 - [email protected] + +- Switch from mkinitrd to dracut for SLES12 and openSUSE > 13.1. + +------------------------------------------------------------------- +Fri Jul 4 11:25:25 UTC 2014 - [email protected] + +- Update to 0.8.15 + o Disable memory cgroup in kdump kernel + o Limit the number of CPUs on all architectures + o Increase udevd memory requirements + o If possible, use wicked to determine network mode + o Take number of possible CPUs into account for calibrate + +- kdump-disable-memory-cgroup.patch: Dropped. + +------------------------------------------------------------------- Old: ---- kdump-0.8.14.tar.bz2 kdump-disable-memory-cgroup.patch New: ---- kdump-0.8.15.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kdump.spec ++++++ --- /var/tmp/diff_new_pack.bkPLYW/_old 2014-07-13 17:16:33.000000000 +0200 +++ /var/tmp/diff_new_pack.bkPLYW/_new 2014-07-13 17:16:33.000000000 +0200 @@ -31,7 +31,7 @@ Url: https://github.com/ptesarik/kdump Name: kdump -Version: 0.8.14 +Version: 0.8.15 Release: 0 Requires: curl Requires: makedumpfile @@ -52,14 +52,18 @@ BuildRequires: udev BuildRequires: zlib-devel #!BuildIgnore: fop -%if %suse_version > 1220 +%if 0%{?suse_version} > 1220 BuildRequires: systemd %endif -PreReq: %insserv_prereq %fillup_prereq mkinitrd +PreReq: %insserv_prereq %fillup_prereq +%if 0%{?suse_version} > 1310 +PreReq: dracut +%else +PreReq: mkinitrd +%endif Source: %{name}-%{version}.tar.bz2 Source2: %{name}-rpmlintrc Source3: kdump.service -Patch0: %{name}-disable-memory-cgroup.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build # rename "kdump-helpers" (10.3) -> "kdump" (11.0/SP2) Provides: kdump-helpers = %{version} @@ -67,7 +71,7 @@ # update should detect the split-off from kexec-tools Provides: kexec-tools:/etc/init.d/kdump Requires: kexec-tools -%if %suse_version > 1220 +%if 0%{?suse_version} > 1220 %systemd_requires %endif Recommends: nfs-client cifs-utils @@ -97,7 +101,6 @@ %prep %setup -%patch0 -p1 %build export CFLAGS="%optflags" @@ -126,13 +129,16 @@ ln -s /etc/init.d/boot.kdump $RPM_BUILD_ROOT/sbin/rckdump # empty directory mkdir $RPM_BUILD_ROOT/var/crash +%if 0%{?suse_version} > 1310 +rm -r $RPM_BUILD_ROOT/lib/mkinitrd +%endif -%if %suse_version > 1220 +%if 0%{?suse_version} > 1220 mkdir -p $RPM_BUILD_ROOT%{_unitdir} install -m644 %{S:3} $RPM_BUILD_ROOT%{_unitdir} %endif -%if %suse_version > 1220 +%if 0%{?suse_version} > 1220 %pre %service_add_pre kdump.service %endif @@ -154,14 +160,14 @@ ! test -d /var/log/dump ; then ln -snf /var/crash /var/log/dump fi -%if %suse_version > 1220 +%if 0%{?suse_version} > 1220 %service_add_post kdump.service %endif %preun echo "Stopping kdump ..." %stop_on_removal boot.kdump -%if %suse_version > 1220 +%if 0%{?suse_version} > 1220 %service_del_preun kdump.service %endif @@ -173,7 +179,7 @@ rm /var/log/dump &>/dev/null || true %restart_on_update boot.kdump %insserv_cleanup -%if %suse_version > 1220 +%if 0%{?suse_version} > 1220 %service_del_postun kdump.service %endif @@ -193,16 +199,18 @@ /sbin/rckdump %{_sysconfdir}/init.d/boot.kdump /var/adm/fillup-templates/sysconfig.kdump +%if 0%{?suse_version} <= 1310 /lib/mkinitrd/scripts/*-kdump.sh /lib/mkinitrd/scripts/setup-kdumpfs.sh /lib/mkinitrd/scripts/setup-mkdumprd.sh +%endif %dir %{dracutlibdir} %dir %{dracutlibdir}/modules.d %{dracutlibdir}/modules.d/99kdump/ %dir /lib/kdump /lib/kdump/* %{_udevrulesdir}/70-kdump.rules -%if %suse_version > 1220 +%if 0%{?suse_version} > 1220 %{_unitdir}/kdump.service %endif ++++++ kdump-0.8.14.tar.bz2 -> kdump-0.8.15.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdump-0.8.14/CMakeLists.txt new/kdump-0.8.15/CMakeLists.txt --- old/kdump-0.8.14/CMakeLists.txt 2014-06-10 14:06:49.000000000 +0200 +++ new/kdump-0.8.15/CMakeLists.txt 2014-06-23 17:47:39.000000000 +0200 @@ -26,7 +26,7 @@ cmake_minimum_required(VERSION 2.6.2) set (PACKAGE_STRING "kdump") -set (PACKAGE_VERSION "0.8.14") +set (PACKAGE_VERSION "0.8.15") include_directories("${PROJECT_BINARY_DIR}") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdump-0.8.14/NEWS new/kdump-0.8.15/NEWS --- old/kdump-0.8.14/NEWS 2014-06-10 14:06:49.000000000 +0200 +++ new/kdump-0.8.15/NEWS 2014-06-23 17:47:39.000000000 +0200 @@ -1,3 +1,11 @@ +0.8.15 +------ + * Disable memory cgroup in kdump kernel + * Limit the number of CPUs on all architectures + * Increase udevd memory requirements + * If possible, use wicked to determine network mode + * Take number of possible CPUs into account for calibrate + 0.8.14 ------ * Disable ACPI memory hotplug in kdump kernel diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdump-0.8.14/init/rc.kdump.functions new/kdump-0.8.15/init/rc.kdump.functions --- old/kdump-0.8.14/init/rc.kdump.functions 2014-06-10 14:06:49.000000000 +0200 +++ new/kdump-0.8.15/init/rc.kdump.functions 2014-06-23 17:47:39.000000000 +0200 @@ -79,6 +79,14 @@ # Linux 2.6.34+ has nr_cpus, older versions must use maxcpus function cpus_param() { + # nr_cpus does not work properly on ppc/ppc64/ppc64le + case "$(uname -m)" in + ppc*) + echo maxcpus + return 0 + ;; + esac + local version=$(get_kernel_version "$1") version="${version%%-*}" local verhex=$(IFS=. ; set -- $version ; printf "0x%02x%02x%02x" $1 $2 $3) @@ -97,25 +105,23 @@ local commandline="$KDUMP_COMMANDLINE" if [ -z "$commandline" ]; then + local nr_cpus=$(cpus_param "$kdump_kernel") commandline=$( remove_from_commandline \ - 'crashkernel|splash|mem|BOOT_IMAGE|showopts|zfcp\.allow_lun_scan|hugepages|acpi_no_memhotplug' \ + 'crashkernel|splash|mem|BOOT_IMAGE|showopts|zfcp\.allow_lun_scan|hugepages|acpi_no_memhotplug|cgroup_disable' \ < /proc/cmdline) # Use deadline for saving the memory footprint - commandline="$commandline elevator=deadline sysrq=yes reset_devices acpi_no_memhotplug" + commandline="$commandline elevator=deadline sysrq=yes reset_devices acpi_no_memhotplug cgroup_disable=memory" + commandline="$commandline irqpoll ${nr_cpus}=${KDUMP_CPUS:-1}" local arch=$(uname -i) case "$arch" in - i?86|x86_64|ia64) - local nr_cpus=$(cpus_param "$kdump_kernel") - commandline="$commandline irqpoll ${nr_cpus}=${KDUMP_CPUS:-1}" - if [ "$arch" = "x86_64" -o -z "${arch#i?86}" ]; then - local boot_apicid=$( - awk -F':[ \t]' '/^initial apicid[ \t]*:/ {print $2; exit}' \ + i?86|x86_64) + local boot_apicid=$( + awk -F':[ \t]' '/^initial apicid[ \t]*:/ {print $2; exit}' \ /proc/cpuinfo) - test -n "$boot_apicid" && - commandline="$commandline disable_cpu_apicid=$boot_apicid" - fi - ;; + test -n "$boot_apicid" && + commandline="$commandline disable_cpu_apicid=$boot_apicid" + ;; s390*) commandline="$commandline zfcp.allow_lun_scan=0" ;; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdump-0.8.14/init/setup-kdump.functions new/kdump-0.8.15/init/setup-kdump.functions --- old/kdump-0.8.14/init/setup-kdump.functions 2014-06-10 14:06:49.000000000 +0200 +++ new/kdump-0.8.15/init/setup-kdump.functions 2014-06-23 17:47:39.000000000 +0200 @@ -58,6 +58,22 @@ } # }}} # +# Get a wicked configuration value for a device +# +# Parameters: +# 1) ifname network interface name +# 2) conf configuration XPath under /interface +# Output: +# configuration value +function kdump_wicked_conf() # {{{ +{ + local ifname="$1" + local conf="$2" + + wicked show-config | wicked xpath "%{/interface[name='$ifname']/$conf}" +} # }}} + +# # Determine the default network device. # # Output: @@ -98,6 +114,19 @@ return 0 fi + # get mode using wicked if possible + if [ -n "$(type -P wicked)" -a \ + "$(kdump_wicked_conf "$ifname" name)" = "$ifname" ] + then + local dhcpv4=$(kdump_wicked_conf "$ifname" ipv4:dhcp/enabled) + local dhcpv6=$(kdump_wicked_conf "$ifname" ipv6:dhcp/enabled) + if [ "$dhcpv4" = true -o "$dhcpv6" = true ] ; then + BOOTPROTO=dhcp + else + BOOTPROTO=static + fi + fi + # get mode from config files if [ -z "$BOOTPROTO" ] ; then local cfg=/etc/sysconfig/network/ifcfg-"$ifname" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdump-0.8.14/kdumptool/calibrate.cc new/kdump-0.8.15/kdumptool/calibrate.cc --- old/kdump-0.8.14/kdumptool/calibrate.cc 2014-06-10 14:06:49.000000000 +0200 +++ new/kdump-0.8.15/kdumptool/calibrate.cc 2014-06-23 17:47:39.000000000 +0200 @@ -17,6 +17,8 @@ * 02110-1301, USA. */ #include <iostream> +#include <fstream> +#include <cerrno> #include <unistd.h> #include "subcommand.h" @@ -24,6 +26,7 @@ #include "calibrate.h" #include "configuration.h" #include "util.h" +#include "fileutil.h" // All calculations are in KiB @@ -42,70 +45,127 @@ // INIT_KB basic initramfs size (unpacked) // INIT_NET_KB initramfs size increment when network is included // SIZE_STRUCT_PAGE sizeof(struct page) +// KDUMP_PHYS_LOAD assumed physical load address of the kdump kernel; +// if pages between 0 and the load address are not +// counted into total memory, set this to ZERO +// PERCPU_KB additional kernel memory for each online CPU +// CAN_REDUCE_CPUS non-zero if the architecture can reduce kernel +// memory requirements with nr_cpus= // + #if defined(__x86_64__) # define DEF_RESERVE_KB MB(128) # define KERNEL_KB MB(16) # define INIT_KB MB(28) # define INIT_NET_KB MB(3) # define SIZE_STRUCT_PAGE 56 +# define KDUMP_PHYS_LOAD 0 +# define CAN_REDUCE_CPUS 1 +# define PERCPU_KB 108 + #elif defined(__i386__) # define DEF_RESERVE_KB MB(128) # define KERNEL_KB MB(14) # define INIT_KB MB(24) # define INIT_NET_KB MB(2) # define SIZE_STRUCT_PAGE 32 +# define KDUMP_PHYS_LOAD 0 +# define CAN_REDUCE_CPUS 1 +# define PERCPU_KB 56 + #elif defined(__powerpc64__) # define DEF_RESERVE_KB MB(256) # define KERNEL_KB MB(16) # define INIT_KB MB(48) # define INIT_NET_KB MB(4) # define SIZE_STRUCT_PAGE 64 +# define KDUMP_PHYS_LOAD MB(128) +# define CAN_REDUCE_CPUS 0 +# define PERCPU_KB 172 // FIXME: is it non-linear? + #elif defined(__powerpc__) # define DEF_RESERVE_KB MB(128) # define KERNEL_KB MB(12) # define INIT_KB MB(28) # define INIT_NET_KB MB(2) # define SIZE_STRUCT_PAGE 32 +# define KDUMP_PHYS_LOAD MB(128) +# define CAN_REDUCE_CPUS 0 +# define PERCPU_KB 0 // TODO !!! + #elif defined(__s390x__) # define DEF_RESERVE_KB MB(128) # define KERNEL_KB MB(13) # define INIT_KB MB(28) # define INIT_NET_KB MB(2) # define SIZE_STRUCT_PAGE 56 +# define KDUMP_PHYS_LOAD 0 +# define CAN_REDUCE_CPUS 1 +# define PERCPU_KB 48 + +# define align_memmap s390x_align_memmap + #elif defined(__s390__) # define DEF_RESERVE_KB MB(128) # define KERNEL_KB MB(12) # define INIT_KB MB(24) # define INIT_NET_KB MB(2) # define SIZE_STRUCT_PAGE 32 +# define KDUMP_PHYS_LOAD 0 +# define CAN_REDUCE_CPUS 1 +# define PERCPU_KB 0 // TODO !!! + +# define align_memmap s390_align_memmap + #elif defined(__ia64__) # define DEF_RESERVE_KB MB(512) # define KERNEL_KB MB(32) # define INIT_KB MB(36) # define INIT_NET_KB MB(4) # define SIZE_STRUCT_PAGE 56 +# define KDUMP_PHYS_LOAD 0 +# define CAN_REDUCE_CPUS 1 +# define PERCPU_KB 0 // TODO !!! + #elif defined(__aarch64__) # define DEF_RESERVE_KB MB(128) # define KERNEL_KB MB(10) # define INIT_KB MB(24) # define INIT_NET_KB MB(2) # define SIZE_STRUCT_PAGE 56 +# define KDUMP_PHYS_LOAD 0 +# define CAN_REDUCE_CPUS 1 +# define PERCPU_KB 0 // TODO !!! + #elif defined(__arm__) # define DEF_RESERVE_KB MB(128) # define KERNEL_KB MB(12) # define INIT_KB MB(24) # define INIT_NET_KB MB(2) # define SIZE_STRUCT_PAGE 32 +# define KDUMP_PHYS_LOAD 0 +# define CAN_REDUCE_CPUS 1 +# define PERCPU_KB 0 // TODO !!! + #else # error "No default crashkernel reservation for your architecture!" #endif -// Assume that the kdump kernel gets loaded at 128M (physical) -// The location is hard to figure out beforehand, so let's just -// make a reasonable guess here. Getting it wrong shouldn't make -// the estimate wrong by more than a few hundred KiB... -#define KDUMP_PHYS_LOAD MB(128) +#ifndef align_memmap +# define align_memmap(maxpfn) ((unsigned long) (maxpfn)) +#endif + +static inline unsigned long s390_align_memmap(unsigned long maxpfn) +{ + // SECTION_SIZE_BITS: 25, PAGE_SHIFT: 12, KiB: 10 + return ((maxpfn - 1) | ((1UL << (25 - 12 - 10)) - 1)) + 1; +} + +static inline unsigned long s390x_align_memmap(unsigned long maxpfn) +{ + // SECTION_SIZE_BITS: 28, PAGE_SHIFT: 12, KiB: 10 + return ((maxpfn - 1) | ((1UL << (28 - 12 - 10)) - 1)) + 1; +} // (Pessimistic) estimate of the initrd compression ratio (percents) #define INITRD_COMPRESS 50 @@ -134,12 +194,12 @@ // Userspace base requirements: // bash (PID 1) 3 M -// udevd 2 M +// 10 * udevd 12 M // kdumptool 4 M // makedumpfile 1 M // ------------------------- -// TOTAL: 17 M -#define USER_BASE_KB MB(17) +// TOTAL: 20 M +#define USER_BASE_KB MB(20) // Additional requirements when network is configured // dhclient 7 M @@ -153,7 +213,96 @@ using std::cout; using std::endl; +using std::ifstream; + +//{{{ SystemCPU ---------------------------------------------------------------- + +class SystemCPU { + + public: + /** + * Initialize a new SystemCPU object. + * + * @param[in] sysdir Mount point for sysfs + */ + SystemCPU(const char *sysdir = "/sys") + throw () + : m_cpudir(FilePath(sysdir).appendPath("devices/system/cpu")) + {} + + protected: + /** + * Path to the cpu system devices base directory + */ + const FilePath m_cpudir; + + /** + * Count the number of CPUs in a cpuset + * + * @param[in] name Name of the cpuset ("possible", "present", "online") + * + * @exception KError if the file cannot be opened or parsed + */ + unsigned long count(const char *name); + + public: + /** + * Count the number of online CPUs + * + * @exception KError see @c count() + */ + unsigned long numOnline(void) + { return count("online"); } + + /** + * Count the number of offline CPUs + * + * @exception KError see @c count() + */ + unsigned long numOffline(void) + { return count("offline"); } + +}; + +// ----------------------------------------------------------------------------- +unsigned long SystemCPU::count(const char *name) +{ + FilePath path(m_cpudir); + path.appendPath(name); + unsigned long ret = 0UL; + + ifstream fin(path.c_str()); + if (!fin) + throw KSystemError("Cannot open " + path, errno); + + try { + unsigned long n1, n2; + char delim; + fin.exceptions(ifstream::badbit); + while (fin >> n1) { + fin >> delim; + if (fin && delim == '-') { + if (! (fin >> n2) ) + throw KError(path + ": wrong number format"); + ret += n2 - n1; + fin >> delim; + } + if (!fin.eof() && delim != ',') + throw KError(path + ": wrong delimiter: " + delim); + ++ret; + } + if (!fin.eof()) + throw KError(path + ": wrong number format"); + fin.close(); + } catch (ifstream::failure e) { + throw KSystemError("Cannot read " + path, errno); + } + + return ret; +} + +//}}} //{{{ Calibrate ---------------------------------------------------------------- // ----------------------------------------------------------------------------- @@ -196,6 +345,20 @@ // Run-time kernel requirements required = KERNEL_KB + ramfs + KERNEL_DYNAMIC_KB; + // Add memory based on CPU count + unsigned long cpus; + if (CAN_REDUCE_CPUS) { + cpus = config->KDUMP_CPUS.value(); + } else { + 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); + // User-space requirements unsigned long user = USER_BASE_KB; if (needsnet) @@ -230,6 +393,10 @@ Debug::debug()->dbg("Dirty pagecache: %lu KiB", dirty); Debug::debug()->dbg("In-flight I/O: %lu KiB", required - prev - dirty); + // Account for memory between 0 and KDUMP_PHYS_LOAD + required += KDUMP_PHYS_LOAD; + Debug::debug()->dbg("Assumed load offset: %lu KiB", KDUMP_PHYS_LOAD); + // Account for "large hashes" prev = required; required = required * MB(1024) / (MB(1024) - KERNEL_HASH_PER_MB); @@ -238,14 +405,17 @@ // Add space for memmap prev = required; required = required * pagesize / (pagesize - SIZE_STRUCT_PAGE); - required += KDUMP_PHYS_LOAD * SIZE_STRUCT_PAGE / pagesize / 1024; + unsigned long maxpfn = (required - prev) / SIZE_STRUCT_PAGE; + required = prev + align_memmap(maxpfn) * SIZE_STRUCT_PAGE; Debug::debug()->dbg("Maximum memmap size: %lu KiB", required - prev); // Make sure there is enough space at boot + Debug::debug()->dbg("Total run-time size: %lu KiB", required); if (required < bootsize) required = bootsize; - } catch(KError) { + } catch(KError e) { + Debug::debug()->info(e.what()); required = DEF_RESERVE_KB; } -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
