diff --git a/.gitignore b/.gitignore index 4114f43..67ccd94 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ SOURCES/eppic_050615.tar.gz -SOURCES/kdump-anaconda-addon-003-19-gda64a86.tar.gz +SOURCES/kdump-anaconda-addon-003-21-g69da0f8.tar.gz SOURCES/kexec-tools-2.0.7.tar.xz -SOURCES/makedumpfile-1.5.7.tar.gz +SOURCES/makedumpfile-1.6.0.tar.gz diff --git a/.kexec-tools.metadata b/.kexec-tools.metadata index 9edc81a..348dc3e 100644 --- a/.kexec-tools.metadata +++ b/.kexec-tools.metadata @@ -1,4 +1,4 @@ a096c8e0892b559f40b01916aae240652f75b68a SOURCES/eppic_050615.tar.gz -35161100add54ace94d0966fe45a9e3d5755114c SOURCES/kdump-anaconda-addon-003-19-gda64a86.tar.gz +303af76846ca0768503258738a43c8adf80e05ce SOURCES/kdump-anaconda-addon-003-21-g69da0f8.tar.gz 56f3c4c829d0078bb705f980e1d9ba22eb9a6246 SOURCES/kexec-tools-2.0.7.tar.xz -16427d952ce7d0426c8b4aecc92f2960cf7926d3 SOURCES/makedumpfile-1.5.7.tar.gz +c856adc0900638310b0d7d3883b5ee7489395595 SOURCES/makedumpfile-1.6.0.tar.gz diff --git a/SOURCES/dracut-kdump.sh b/SOURCES/dracut-kdump.sh index 4aab205..42ba37f 100755 --- a/SOURCES/dracut-kdump.sh +++ b/SOURCES/dracut-kdump.sh @@ -146,6 +146,10 @@ read_kdump_conf() # remove inline comments after the end of a directive. config_val=$(strip_comments $config_val) case "$config_opt" in + dracut_args) + config_val=$(get_dracut_args_target "$config_val") + [[ -n "$config_val" ]] && add_dump_code "dump_fs $config_val" + ;; ext[234]|xfs|btrfs|minix|nfs) add_dump_code "dump_fs $config_val" ;; diff --git a/SOURCES/dracut-module-setup.sh b/SOURCES/dracut-module-setup.sh index 5a11a42..fb93981 100755 --- a/SOURCES/dracut-module-setup.sh +++ b/SOURCES/dracut-module-setup.sh @@ -63,10 +63,23 @@ kdump_is_vlan() { } # $1: netdev name +source_ifcfg_file() { + local ifcfg_file + + ifcfg_file=$(get_ifcfg_filename $1) + if [ -f "${ifcfg_file}" ]; then + . ${ifcfg_file} + else + dwarning "The ifcfg file of $1 is not found!" + fi +} + +# $1: netdev name kdump_setup_dns() { local _nameserver _dns local _dnsfile=${initdir}/etc/cmdline.d/42dns.conf - . /etc/sysconfig/network-scripts/ifcfg-$1 + + source_ifcfg_file $1 [ -n "$DNS1" ] && echo "nameserver=$DNS1" > "$_dnsfile" [ -n "$DNS2" ] && echo "nameserver=$DNS2" >> "$_dnsfile" @@ -189,7 +202,9 @@ kdump_setup_bond() { done echo -n " bond=$_netdev:$(echo $_slaves | sed 's/,$//')" >> ${initdir}/etc/cmdline.d/42bond.conf # Get bond options specified in ifcfg - . /etc/sysconfig/network-scripts/ifcfg-$_netdev + + source_ifcfg_file $_netdev + bondoptions="$(echo :$BONDING_OPTS | sed 's/\s\+/,/')" echo "$bondoptions" >> ${initdir}/etc/cmdline.d/42bond.conf } @@ -244,7 +259,9 @@ kdump_setup_vlan() { # $1: netdev name kdump_setup_znet() { local _options="" - . /etc/sysconfig/network-scripts/ifcfg-$1 + + source_ifcfg_file $1 + for i in $OPTIONS; do _options=${_options},$i done @@ -336,7 +353,7 @@ kdump_install_net() { # the default gate way for network dump, eth1 in the fence kdump path will # call kdump_install_net again and we don't want eth1 to be the default # gateway. - if [ ! -f ${initdir}${initdir}/etc/cmdline.d/60kdumpnic.conf ] && + if [ ! -f ${initdir}/etc/cmdline.d/60kdumpnic.conf ] && [ ! -f ${initdir}/etc/cmdline.d/70bootdev.conf ]; then echo "kdumpnic=$(kdump_setup_ifname $_netdev)" > ${initdir}/etc/cmdline.d/60kdumpnic.conf echo "bootdev=$(kdump_setup_ifname $_netdev)" > ${initdir}/etc/cmdline.d/70bootdev.conf @@ -433,6 +450,11 @@ kdump_install_conf() { ssh|nfs) kdump_install_net "$config_val" ;; + dracut_args) + if [[ $(get_dracut_args_fstype "$config_val") = nfs* ]] ; then + kdump_install_net "$(get_dracut_args_target "$config_val")" + fi + ;; kdump_pre|kdump_post|extra_bins) dracut_install $config_val ;; @@ -494,7 +516,11 @@ kdump_get_iscsi_initiator() { return 1 } -# No ibft handling yet. +# Figure out iBFT session according to session type +is_ibft() { + [ "$(kdump_iscsi_get_rec_val $1 "node.discovery_type")" = fw ] +} + kdump_setup_iscsi_device() { local path=$1 local tgt_name; local tgt_ipaddr; @@ -517,6 +543,10 @@ kdump_setup_iscsi_device() { return 1 fi + if is_ibft ${path}; then + return + fi + tgt_name=$(kdump_iscsi_get_rec_val ${path} "node.name") tgt_ipaddr=$(kdump_iscsi_get_rec_val ${path} "node.conn\[0\].address") @@ -722,12 +752,3 @@ install() { # at some point of time. kdump_check_iscsi_targets } - -installkernel() { - wdt=$(lsmod|cut -f1 -d' '|grep "wdt$") - if [ -n "$wdt" ]; then - [ "$wdt" = "iTCO_wdt" ] && instmods lpc_ich && - echo "rd.driver.pre=lpc_ich,iTCO_wdt " >> ${initdir}/etc/cmdline.d/00-wdt.conf - instmods $wdt - fi -} diff --git a/SOURCES/kdump-lib.sh b/SOURCES/kdump-lib.sh index 89dce8d..7012dcf 100755 --- a/SOURCES/kdump-lib.sh +++ b/SOURCES/kdump-lib.sh @@ -7,6 +7,15 @@ DEFAULT_PATH="/var/crash/" FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump" FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send" +perror_exit() { + echo $@ >&2 + exit 1 +} + +perror() { + echo $@ >&2 +} + is_ssh_dump_target() { grep -q "^ssh[[:blank:]].*@" /etc/kdump.conf @@ -14,7 +23,8 @@ is_ssh_dump_target() is_nfs_dump_target() { - grep -q "^nfs" /etc/kdump.conf + grep -q "^nfs" /etc/kdump.conf || \ + [[ $(get_dracut_args_fstype "$(grep "^dracut_args .*\-\-mount" /etc/kdump.conf)") = nfs* ]] } is_raw_dump_target() @@ -36,7 +46,8 @@ is_fs_dump_target() is_user_configured_dump_target() { - return $(is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target || is_fs_dump_target) + return $(is_mount_in_dracut_args || is_ssh_dump_target || is_nfs_dump_target || \ + is_raw_dump_target || is_fs_dump_target) } strip_comments() @@ -63,6 +74,46 @@ is_generic_fence_kdump() grep -q "^fence_kdump_nodes" /etc/kdump.conf } +to_dev_name() { + local dev="${1//\"/}" + + case "$dev" in + UUID=*) + dev=`blkid -U "${dev#UUID=}"` + ;; + LABEL=*) + dev=`blkid -L "${dev#LABEL=}"` + ;; + esac + echo $dev +} + +kdump_get_persistent_dev() { + local i _tmp _dev _lookup_dirs + + _dev=$(udevadm info --query=name --name="$1" 2>/dev/null) + [ -z "$_dev" ] && { + perror_exit "Kernel dev name of $1 is not found." + } + + if [[ $2 = "raw" ]];then + _lookup_dirs="/dev/mapper/* /dev/disk/by-id/*" + else + _lookup_dirs="/dev/mapper/* /dev/disk/by-uuid/* /dev/disk/by-id/*" + fi + + for i in $_lookup_dirs; do + _tmp=$(udevadm info --query=name --name="$i" 2>/dev/null) + if [ "$_tmp" = "$_dev" ]; then + echo $i + return + fi + done + + perror "WARNING: Persistent device name of $1 not found. Using $1 as dump target name" + echo $1 +} + get_user_configured_dump_disk() { local _target @@ -230,3 +281,150 @@ is_hostname() fi echo $1 | grep -q "[a-zA-Z]" } + +# Copied from "/etc/sysconfig/network-scripts/network-functions" +get_hwaddr() +{ + if [ -f "/sys/class/net/${1}/address" ]; then + awk '{ print toupper($0) }' < /sys/class/net/${1}/address + elif [ -d "/sys/class/net/${1}" ]; then + LC_ALL= LANG= ip -o link show ${1} 2>/dev/null | \ + awk '{ print toupper(gensub(/.*link\/[^ ]* ([[:alnum:]:]*).*/, + "\\1", 1)); }' + fi +} + +get_ifcfg_by_device() +{ + grep -E -i -l "^[[:space:]]*DEVICE=\"*${1}\"*[[:space:]]*$" \ + /etc/sysconfig/network-scripts/ifcfg-* 2>/dev/null | head -1 +} + +get_ifcfg_by_hwaddr() +{ + grep -E -i -l "^[[:space:]]*HWADDR=\"*${1}\"*[[:space:]]*$" \ + /etc/sysconfig/network-scripts/ifcfg-* 2>/dev/null | head -1 +} + +get_ifcfg_by_uuid() +{ + grep -E -i -l "^[[:space:]]*UUID=\"*${1}\"*[[:space:]]*$" \ + /etc/sysconfig/network-scripts/ifcfg-* 2>/dev/null | head -1 +} + +get_ifcfg_by_name() +{ + grep -E -i -l "^[[:space:]]*NAME=\"*${1}\"*[[:space:]]*$" \ + /etc/sysconfig/network-scripts/ifcfg-* 2>/dev/null | head -1 +} + +is_nm_running() +{ + [ "$(LANG=C nmcli -t --fields running general status 2>/dev/null)" = "running" ] +} + +is_nm_handling() +{ + LANG=C nmcli -t --fields device,state dev status 2>/dev/null \ + | grep -q "^\(${1}:connected\)\|\(${1}:connecting.*\)$" +} + +# $1: netdev name +get_ifcfg_nmcli() +{ + local nm_uuid nm_name + local ifcfg_file + + # Get the active nmcli config name of $1 + if is_nm_running && is_nm_handling "${1}" ; then + # The configuration "uuid" and "name" generated by nm is wrote to + # the ifcfg file as "UUID=<nm_uuid>" and "NAME=<nm_name>". + nm_uuid=$(LANG=C nmcli -t --fields uuid,device c show --active 2>/dev/null \ + | grep "${1}" | head -1 | cut -d':' -f1) + nm_name=$(LANG=C nmcli -t --fields name,device c show --active 2>/dev/null \ + | grep "${1}" | head -1 | cut -d':' -f1) + ifcfg_file=$(get_ifcfg_by_uuid "${nm_uuid}") + [ -z "${ifcfg_file}" ] && ifcfg_file=$(get_ifcfg_by_name "${nm_name}") + fi + + echo -n "${ifcfg_file}" +} + +# $1: netdev name +get_ifcfg_legacy() +{ + local ifcfg_file + + ifcfg_file="/etc/sysconfig/network-scripts/ifcfg-${1}" + [ -f "${ifcfg_file}" ] && echo -n "${ifcfg_file}" && return + + ifcfg_file=$(get_ifcfg_by_name "${1}") + [ -f "${ifcfg_file}" ] && echo -n "${ifcfg_file}" && return + + local hwaddr=$(get_hwaddr "${1}") + if [ -n "$hwaddr" ]; then + ifcfg_file=$(get_ifcfg_by_hwaddr "${hwaddr}") + [ -f "${ifcfg_file}" ] && echo -n "${ifcfg_file}" && return + fi + + ifcfg_file=$(get_ifcfg_by_device "${1}") + + echo -n "${ifcfg_file}" +} + +# $1: netdev name +# Return the ifcfg file whole name(including the path) of $1 if any. +get_ifcfg_filename() { + local ifcfg_file + + ifcfg_file=$(get_ifcfg_nmcli "${1}") + if [ -z "${ifcfg_file}" ]; then + ifcfg_file=$(get_ifcfg_legacy "${1}") + fi + + echo -n "${ifcfg_file}" +} + +# returns 0 when omission of watchdog module is desired in dracut_args +# returns 1 otherwise +is_wdt_mod_omitted() { + local dracut_args + local ret=1 + + dracut_args=$(grep "^dracut_args" /etc/kdump.conf) + [[ -z $dracut_args ]] && return $ret + + eval set -- $dracut_args + while :; do + [[ -z $1 ]] && break + case $1 in + -o|--omit) + echo $2 | grep -qw "watchdog" + [[ $? == 0 ]] && ret=0 + break + esac + shift + done + + return $ret +} + +# If "dracut_args" contains "--mount" information, use it +# directly without any check(users are expected to ensure +# its correctness). +is_mount_in_dracut_args() +{ + grep -q "^dracut_args .*\-\-mount" /etc/kdump.conf +} + +# If $1 contains dracut_args "--mount", return <filesystem type> +get_dracut_args_fstype() +{ + echo $1 | grep "\-\-mount" | sed "s/.*--mount .\(.*\)/\1/" | cut -d' ' -f3 +} + +# If $1 contains dracut_args "--mount", return <device> +get_dracut_args_target() +{ + echo $1 | grep "\-\-mount" | sed "s/.*--mount .\(.*\)/\1/" | cut -d' ' -f1 +} diff --git a/SOURCES/kdump.conf b/SOURCES/kdump.conf index 54b581d..2865414 100644 --- a/SOURCES/kdump.conf +++ b/SOURCES/kdump.conf @@ -1,145 +1,137 @@ -# Configures where to put the kdump /proc/vmcore files -# -# This file contains a series of commands to perform (in order) when a -# kernel crash has happened and the kdump kernel has been loaded. Directives in -# this file are only applicable to the kdump initramfs, and have no effect if -# the root filesystem is mounted and the normal init scripts are processed -# -# Currently only one dump target and path may be configured at once -# if the configured dump target fails, the default action will be preformed -# the default action may be configured with the default directive below. If the -# configured dump target succedes -# -# Basics commands supported are: -# raw <partition> - Will dd /proc/vmcore into <partition>. -# Use persistent device names for partition devices, -# such as /dev/vg/<devname>. -# -# nfs <nfs mount> - Will mount fs and copy /proc/vmcore to -# <mnt>/var/crash/%HOST-%DATE/, supports DNS. -# -# ssh <user@server> - Will scp /proc/vmcore to -# <user@server>:/var/crash/%HOST-%DATE/, supports DNS -# NOTE: make sure user has necessary write -# permissions on server -# -# sshkey <path> - Will use the sshkey to do ssh dump -# Specifies the path of the ssh key you want to use -# when do ssh dump, the default value is -# /root/.ssh/kdump_id_rsa. -# -# <fs type> <partition> - Will mount -t <fs type> <partition> /mnt and copy -# /proc/vmcore to /mnt/var/crash/%DATE/. -# NOTE: <partition> can be a device node, label or uuid. -# It's recommended to use persistent device names -# such as /dev/vg/<devname>. -# Otherwise it's suggested to use label or uuid. -# -# path <path> - "path" represents the file system path in which -# vmcore will be saved. If a dump target is specified -# in kdump.conf, then "path" is relative to the -# specified dump target. Interpretation of path -# changes a bit if user has not specified a dump -# target explicitly in kdump.conf. In this case, -# "path" represents the absolute path from root. -# And dump target and adjusted path are arrived -# at automatically depending on what's mounted -# in the current system. -# Ignored for raw device dumps. If unset, will -# default to /var/crash. +# This file contains a series of commands to perform (in order) in the kdump +# kernel after a kernel crash in the crash kernel(1st kernel) has happened. +# +# Directives in this file are only applicable to the kdump initramfs, and have +# no effect once the root filesystem is mounted and the normal init scripts are +# processed. +# +# Currently, only one dump target and path can be specified. If the dumping to +# the configured target fails, the default action which can be configured via +# the "default" directive will be performed. +# +# Supported options: +# +# raw <partition> +# - Will dd /proc/vmcore into <partition>. +# Use persistent device names for partition devices, +# such as /dev/vg/<devname>. +# +# nfs <nfs mount> +# - Will mount nfs to <mnt>, and copy /proc/vmcore to +# <mnt>/<path>/%HOST-%DATE/, supports DNS. +# +# ssh <user@server> +# - Will scp /proc/vmcore to <user@server>:<path>/%HOST-%DATE/, +# supports DNS. +# NOTE: make sure the user has write permissions on the server. +# +# sshkey <path> +# - Will use the sshkey to do ssh dump. +# Specify the path of the ssh key to use when dumping +# via ssh. The default value is /root/.ssh/kdump_id_rsa. +# +# <fs type> <partition> +# - Will mount -t <fs type> <partition> <mnt>, and copy +# /proc/vmcore to <mnt>/<path>/%DATE/. +# NOTE: <partition> can be a device node, label or uuid. +# It's recommended to use persistent device names +# such as /dev/vg/<devname>. +# Otherwise it's suggested to use label or uuid. +# +# path <path> +# - "path" represents the file system path in which vmcore +# will be saved. If a dump target is specified in +# kdump.conf, then "path" is relative to the specified +# dump target. +# +# Interpretation of "path" changes a bit if the user didn't +# specify any dump target explicitly in kdump.conf. In this +# case, "path" represents the absolute path from root. The +# dump target and adjusted path are arrived at automatically +# depending on what's mounted in the current system. +# +# Ignored for raw device dumps. If unset, will use the default +# "/var/crash". # # core_collector <command> <options> -# - This allows you to specify the command to copy -# the vmcore. You could use the dump filtering -# program makedumpfile, the default one, to retrieve -# your core, which on some arches can drastically -# reduce core file size. See /sbin/makedumpfile --help -# for a list of options. Note that the -i and -g -# options are not needed here, as the initrd will -# automatically be populated with a config file -# appropriate for the running kernel. -# Default core_collector for raw/ssh dump is: -# "makedumpfile -F -l --message-level 1 -d 31". -# Default core_collector for other targets is: -# "makedumpfile -l --message-level 1 -d 31". -# For core_collector format details please refer to -# kexec-kdump-howto.txt or kdump.conf manpage. +# - This allows you to specify the command to copy +# the vmcore. The default is makedumpfile, which on +# some architectures can drastically reduce vmcore size. +# See /sbin/makedumpfile --help for a list of options. +# Note that the -i and -g options are not needed here, +# as the initrd will automatically be populated with a +# config file appropriate for the running kernel. +# The default core_collector for raw/ssh dump is: +# "makedumpfile -F -l --message-level 1 -d 31". +# The default core_collector for other targets is: +# "makedumpfile -l --message-level 1 -d 31". +# +# "makedumpfile -F" will create a flattened vmcore. +# You need to use "makedumpfile -R" to rearrange the dump data to +# a normal dumpfile readable with analysis tools. For example: +# "makedumpfile -R vmcore < vmcore.flat". +# +# For core_collector format details, you can refer to +# kexec-kdump-howto.txt or kdump.conf manpage. # # kdump_post <binary | script> -# - This directive allows you to run a specified -# executable just after the memory dump process -# terminates. The exit status from the dump process -# is fed to the kdump_post executable, which can be -# used to trigger different actions for success or -# failure. +# - This directive allows you to run a executable binary +# or script after the vmcore dump process terminates. +# The exit status of the current dump process is fed to +# the executable binary or script as its first argument. # # kdump_pre <binary | script> -# - works just like the kdump_post directive, but instead -# of running after the dump process, runs immediately -# before. Exit status of this binary is interpreted -# as follows: -# 0 - continue with dump process as usual -# non 0 - reboot the system +# - Works like the "kdump_post" directive, but instead of running +# after the dump process, runs immediately before it. +# Exit status of this binary is interpreted as follows: +# 0 - continue with dump process as usual +# non 0 - reboot the system # # extra_bins <binaries | shell scripts> -# - This directive allows you to specify additional -# binaries or shell scripts you'd like to include in -# your kdump initrd. Generally only useful in -# conjunction with a kdump_post binary or script that -# relies on other binaries or scripts. +# - This directive allows you to specify additional binaries or +# shell scripts to be included in the kdump initrd. +# Generally they are useful in conjunction with a kdump_post +# or kdump_pre binary or script which depends on these extra_bins. # # extra_modules <module(s)> -# - This directive allows you to specify extra kernel -# modules that you want to be loaded in the kdump -# initrd, typically used to set up access to -# non-boot-path dump targets that might otherwise -# not be accessible in the kdump environment. Multiple -# modules can be listed, separated by a space, and any -# dependent modules will automatically be included. +# - This directive allows you to specify extra kernel modules +# that you want to be loaded in the kdump initrd. +# Multiple modules can be listed, separated by spaces, and any +# dependent modules will automatically be included. # # default <reboot | halt | poweroff | shell | dump_to_rootfs> -# - Action to preform in case dumping to intended target -# fails. If no default action is specified, "reboot" -# is assumed default. -# reboot: If the default action is reboot simply reboot -# the system and loose the core that you are -# trying to retrieve. -# halt: If the default action is halt, then simply -# halt the system after attempting to capture -# a vmcore, regardless of success or failure. -# poweroff: The system will be powered down -# shell: If the default action is shell, then drop to -# an shell session inside the initramfs from -# where you can try to record the core manually. -# Exiting this shell reboots the system. -# Note: kdump uses bash as the default shell. -# dump_to_rootfs: If non-root dump target is specified, -# the default action can be set as dump_to_rootfs. -# That means when dump to target fails, dump vmcore -# to rootfs from initramfs context and reboot. +# - Action to perform in case dumping fails. +# reboot: Reboot the system. +# halt: Halt the system. +# poweroff: Power down the system. +# shell: Drop to a bash shell. +# Exiting the shell reboots the system. +# dump_to_rootfs: Dump vmcore to rootfs from initramfs context and +# reboot. Useful when non-root dump target is specified. +# The default option is "reboot". # # force_rebuild <0 | 1> -# - By default, kdump initrd only will be rebuilt when -# necessary. Specify 1 to force rebuilding kdump -# initrd every time when kdump service starts. +# - By default, kdump initrd will only be rebuilt whennecessary. +# Specify 1 to force rebuilding kdump initrd every time when kdump +# service starts. # -#override_resettable <0 | 1> -# - Usually a unresettable block device can't be dump target. -# Specifying 1 means though block target is unresettable, user -# understand this situation and want to try dumping. By default, -# it's set to 0, means not to try a destined failure. +# override_resettable <0 | 1> +# - Usually an unresettable block device can't be a dump target. +# Specifying 1 when you want to dump even though the block +# target is unresettable +# By default, it is 0, which will not try dumping destined to fail. # # dracut_args <arg(s)> -# - Pass extra dracut options when rebuilding kdump -# initrd. +# - Pass extra dracut options when rebuilding kdump initrd. # # fence_kdump_args <arg(s)> -# - Command line arguments for fence_kdump_send (it can contain -# all valid arguments except hosts to send notification to). +# - Command line arguments for fence_kdump_send (it can contain +# all valid arguments except hosts to send notification to). # # fence_kdump_nodes <node(s)> -# - List of cluster node(s) separated by space to send fence_kdump -# notification to (this option is mandatory to enable fence_kdump). +# - List of cluster node(s), separated by spaces, to send +# fence_kdump notifications to (this option is mandatory to +# enable fence_kdump). # #raw /dev/vg/lv_kdump diff --git a/SOURCES/kdump.conf.5 b/SOURCES/kdump.conf.5 index f1c2a2c..ca42769 100644 --- a/SOURCES/kdump.conf.5 +++ b/SOURCES/kdump.conf.5 @@ -10,14 +10,14 @@ collection service. kdump.conf provides post-kexec instructions to the kdump kernel. It is stored in the initrd file managed by the kdump service. If you change -this file and do not want to restart before it takes effect, restart -the kdump service to rebuild to initrd. +this file and do not want to reboot in order for the changes to take +effect, restart the kdump service to rebuild the initrd. For most configurations, you can simply review the examples provided in the stock /etc/kdump.conf. .B NOTE: -For filesystem dump the dump target must be mounted before building +For filesystem dumps the dump target must be mounted before building kdump initramfs. kdump.conf only affects the behavior of the initramfs. Please read the @@ -34,30 +34,30 @@ partition devices, such as /dev/vg/<devname>. .B nfs <nfs mount> .RS -Will mount fs and copy /proc/vmcore to <mnt>/var/crash/%HOST-%DATE/, +Will mount nfs to <mnt>, and copy /proc/vmcore to <mnt>/<path>/%HOST-%DATE/, supports DNS. Note that a fqdn should be used as the server name in the -mount point +mount point. .RE .B ssh <user@server> .RS -Will scp /proc/vmcore to <user@server>:/var/crash/%HOST-%DATE/, +Will scp /proc/vmcore to <user@server>:<path>/%HOST-%DATE/, supports DNS. NOTE: make sure user has necessary write permissions on -server and that a fqdn is used as the server name +server and that a fqdn is used as the server name. .RE .B sshkey <path> .RS -Specifies the path of the ssh key you want to use when do ssh dump, -the default value is /root/.ssh/kdump_id_rsa. +Specify the path of the ssh key to use when dumping via ssh. +The default value is /root/.ssh/kdump_id_rsa. .RE .B <fs type> <partition> .RS -Will mount -t <fs type> <partition> /mnt and copy /proc/vmcore to -/mnt/var/crash/%DATE/. NOTE: <partition> can be a device node, label +Will mount -t <fs type> <partition> <mnt>, and copy /proc/vmcore to +<mnt>/<path>/%DATE/. NOTE: <partition> can be a device node, label or uuid. It's recommended to use persistent device names such as -/dev/vg/<devname>. Otherwise it's suggested to use label or uuid. +/dev/vg/<devname>. Otherwise it's suggested to use label or uuid. .RE .B path <path> @@ -66,37 +66,36 @@ or uuid. It's recommended to use persistent device names such as If a dump target is specified in kdump.conf, then "path" is relative to the specified dump target. .PP -Interpretation of path changes a bit if user has not specified a dump +Interpretation of "path" changes a bit if the user didn't specify any dump target explicitly in kdump.conf. In this case, "path" represents the -absolute path from root. And dump target and adjusted path are arrived +absolute path from root. The dump target and adjusted path are arrived at automatically depending on what's mounted in the current system. .PP -Ignored for raw device dumps. If unset, will default to /var/crash. +Ignored for raw device dumps. If unset, will use the default "/var/crash". .RE .B core_collector <command> <options> .RS This allows you to specify the command to copy the vmcore. -You could use the dump filtering program makedumpfile, the default one, -to retrieve your core, which on some arches can drastically reduce -core file size. See /sbin/makedumpfile --help for a list of options. +The default is makedumpfile, which on some architectures can drastically reduce +core file size. See /sbin/makedumpfile --help for a list of options. Note that the -i and -g options are not needed here, as the initrd will automatically be populated with a config file appropriate for the running kernel. .PP Note 1: About default core collector: -Default core_collector for raw/ssh dump is: +The default core_collector for raw/ssh dump is: "makedumpfile -F -l --message-level 1 -d 31". -Default core_collector for other targets is: +The default core_collector for other targets is: "makedumpfile -l --message-level 1 -d 31". Even if core_collector option is commented out in kdump.conf, makedumpfile -is default core collector and kdump uses it internally. +is the default core collector and kdump uses it internally. If one does not want makedumpfile as default core_collector, then they need to specify one using core_collector option to change the behavior. .PP Note 2: If "makedumpfile -F" is used then you will get a flattened format vmcore.flat, you will need to use "makedumpfile -R" to rearrange the -dump data from stdard input to a normal dumpfile (readable with analysis +dump data from standard input to a normal dumpfile (readable with analysis tools). ie. "makedumpfile -R vmcore < vmcore.flat" @@ -104,20 +103,19 @@ ie. "makedumpfile -R vmcore < vmcore.flat" .B kdump_post <binary | script> .RS -This directive allows you to run a specified -executable just after the memory dump process -terminates. The exit status from the dump process -is fed to the kdump_post executable, which can be -used to trigger different actions for success or -failure. +This directive allows you to run a specified executable +just after the vmcore dump process terminates. The exit +status of the current dump process is fed to the kdump_post +executable as its first argument($1). Executable can modify +it to indicate the new exit status of succeeding dump process, .PP -Note that scripts written for use with this -directive must use the /bin/bash interpreter +Note that scripts written for use with this directive must use +the /bin/bash interpreter. .RE .B kdump_pre <binary | script> .RS -Works just like the kdump_post directive, but instead +Works just like the "kdump_post" directive, but instead of running after the dump process, runs immediately before. Exit status of this binary is interpreted as follows: @@ -127,7 +125,7 @@ as follows: non 0 - reboot the system .PP Note that scripts written for this directive must use -the /bin/bash interpreter +the /bin/bash interpreter. .RE .B extra_bins <binaries | shell scripts> @@ -146,36 +144,33 @@ modules that you want to be loaded in the kdump initrd, typically used to set up access to non-boot-path dump targets that might otherwise not be accessible in the kdump environment. Multiple -modules can be listed, separated by a space, and any +modules can be listed, separated by spaces, and any dependent modules will automatically be included. .RE .B default <reboot | halt | poweroff | shell | dump_to_rootfs> .RS -Action to preform in case dumping to intended target fails. If no default -action is specified, "reboot" is assumed default. -reboot: If the default action is reboot simply reboot the system (this is what -most people will want, as it returns the system to a nominal state). shell: If the default -action is shell, then drop to an shell session inside the initramfs from -where you can manually preform additional recovery actions. Exiting this shell -reboots the system. halt: bring the system to a halt, requiring manual reset -poweroff: The system will be powered down. dump_to_rootfs:If the default action -is dump_to_rootfs, specified root will be mounted and dump will be saved in "path" -directory. -Note: kdump uses bash as the default shell. +Action to perform in case dumping to the intended target fails. The default is "reboot". +reboot: Reboot the system (this is what most people will want, as it returns the system +to a normal state). halt: Halt the system and lose the vmcore. poweroff: The system +will be powered down. shell: Drop to a shell session inside the initramfs, from which +you can manually perform additional recovery actions. Exiting this shell reboots the +system. Note: kdump uses bash as the default shell. dump_to_rootfs: If non-root dump +target is specified, the default action can be set as dump_to_rootfs. That means when +dumping to target fails, dump vmcore to rootfs from initramfs context and reboot. .RE .B force_rebuild <0 | 1> .RS -By default, kdump initrd only will be rebuilt when necessary. +By default, kdump initrd will only be rebuilt when necessary. Specify 1 to force rebuilding kdump initrd every time when kdump service starts. .RE .B override_resettable <0 | 1> .RS -Usually a unresettable block device can't be dump target. Specifying 1 means -though block target is unresettable, user understand this situation and want -to try dumping. By default, it's set to 0, means not to try a destined failure. +Usually an unresettable block device can't be a dump target. Specifying 1 means +that even though the block target is unresettable, the user wants to try dumping anyway. +By default, it's set to 0, which will not try something destined to fail. .RE @@ -195,7 +190,7 @@ arguments except hosts to send notification to). .B fence_kdump_nodes <node(s)> .RS -List of cluster node(s) separated by space to send fence_kdump notification +List of cluster node(s), separated by spaces, to send fence_kdump notification to (this option is mandatory to enable fence_kdump). .RE @@ -210,26 +205,26 @@ directly. .B options <module> <option list> .RS -Use KDUMP_COMMANDLINE_APPEND in /etc/sysconfig/kdump to add proper -module option as kernel command line params. Such as append loop.max_loop=1 -to limit maximum loop devices to 1. +Use KDUMP_COMMANDLINE_APPEND in /etc/sysconfig/kdump to add module options as +kernel command line parameters. For example, specify 'loop.max_loop=1' to limit +maximum loop devices to 1. .RE .B link_delay <seconds> .RS -link_delay was used to wait a network device to initialize before using it. -Now dracut network module take care of this issue automaticlly. +link_delay was used to wait for a network device to initialize before using it. +Now dracut network module takes care of this issue automatically. .RE .B disk_timeout <seconds> .RS -Similar to link_delay, dracut ensures disks being ready before kdump uses them. +Similar to link_delay, dracut ensures disks are ready before kdump uses them. .RE .B debug_mem_level <0-3> .RS -This was used to turns on debug/verbose output of kdump scripts regarding -free/used memory at various points of execution. This feature has been +Turn on verbose debug output of kdump scripts regarding free/used memory at +various points of execution. This feature has been moved to dracut now. Use KDUMP_COMMANDLINE_APPEND in /etc/sysconfig/kdump and append dracut cmdline param rd.memdebug=[0-3] to enable the debug output. @@ -253,7 +248,7 @@ present in initramfs but it is not actually loaded in kernel. Hence retaining blacklist option creates more confusing behavior. It has been deprecated. .PP -Instead use rd.driver.blacklist option on second kernel to blacklist +Instead, use rd.driver.blacklist option on second kernel to blacklist a certain module. One can edit /etc/sysconfig/kdump.conf and edit KDUMP_COMMANDLINE_APPEND to pass kernel command line options. Refer to dracut.cmdline man page for more details on module blacklist option. @@ -262,7 +257,7 @@ to dracut.cmdline man page for more details on module blacklist option. .RE .SH EXAMPLES -Here is some examples for core_collector option: +Here are some examples for core_collector option: .PP Core collector command format depends on dump target type. Typically for filesystem (local/remote), core_collector should accept two arguments. diff --git a/SOURCES/kdumpctl b/SOURCES/kdumpctl index 029ded9..cedf832 100755 --- a/SOURCES/kdumpctl +++ b/SOURCES/kdumpctl @@ -14,6 +14,7 @@ FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled" FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump_registered" #kdump shall be the default dump mode DEFAULT_DUMP_MODE="kdump" +image_time=0 . /lib/kdump/kdump-lib.sh @@ -105,7 +106,7 @@ prepare_cmdline() else cmdline=${KDUMP_COMMANDLINE} fi - cmdline=`remove_cmdline_param "$cmdline" crashkernel hugepages hugepagesz panic_on_warn` + cmdline=`remove_cmdline_param "$cmdline" crashkernel hugepages hugepagesz panic_on_warn slub_debug` cmdline="${cmdline} ${KDUMP_COMMANDLINE_APPEND}" @@ -230,12 +231,18 @@ check_config() { local nr - nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE) + nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix|^dracut_args .*\-\-mount/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE) [ $nr -gt 1 ] && { echo "More than one dump targets specified." return 1 } + nr=$(grep "^dracut_args .*\-\-mount" $KDUMP_CONFIG_FILE | grep -o "\-\-mount" | wc -l) + [ $nr -gt 1 ] && { + echo "Multiple mount targets specified in one \"dracut_args\"." + return 1 + } + while read config_opt config_val; do # remove inline comments after the end of a directive. config_val=$(strip_comments $config_val) @@ -270,7 +277,6 @@ check_config() # return list of modified file for fence_kdump modified in Pacemaker cluster get_pcs_cluster_modified_files() { - local image_time=$1 local time_stamp local modified_files @@ -322,10 +328,180 @@ setup_target_initrd() fi } +check_files_modified() +{ + local modified_files="" + + #also rebuild when Pacemaker cluster conf is changed and fence kdump is enabled. + modified_files=$(get_pcs_cluster_modified_files) + + EXTRA_BINS=`grep ^kdump_post $KDUMP_CONFIG_FILE | cut -d\ -f2` + CHECK_FILES=`grep ^kdump_pre $KDUMP_CONFIG_FILE | cut -d\ -f2` + EXTRA_BINS="$EXTRA_BINS $CHECK_FILES" + CHECK_FILES=`grep ^extra_bins $KDUMP_CONFIG_FILE | cut -d\ -f2-` + EXTRA_BINS="$EXTRA_BINS $CHECK_FILES" + files="$KDUMP_CONFIG_FILE $kdump_kernel $EXTRA_BINS /etc/fstab" + + check_exist "$files" && check_executable "$EXTRA_BINS" + [ $? -ne 0 ] && return 2 + + for file in $files; do + time_stamp=`stat -c "%Y" $file` + if [ "$time_stamp" -gt "$image_time" ]; then + modified_files="$modified_files $file" + fi + done + if [ -n "$modified_files" ]; then + echo "Detected change(s) in the following file(s):" + echo -n " "; echo "$modified_files" | sed 's/\s/\n /g' + return 1 + fi + + return 0 +} + +check_dump_fs_modified() +{ + local _old_dev _old_mntpoint _old_fstype + local _new_dev _new_mntpoint _new_fstype + local _target _path _dracut_args + + # No need to check in case of mount target specified via "dracut_args". + if is_mount_in_dracut_args; then + return 0 + fi + + # No need to check in case of raw target. + # Currently we do not check also if ssh/nfs target is specified + if is_ssh_dump_target || is_nfs_dump_target || is_raw_dump_target; then + return 0 + fi + + _target=$(get_user_configured_dump_disk) + + if [[ -n "$_target" ]]; then + _target=$(to_dev_name $_target) + _new_fstype=$(blkid $_target | awk -F"TYPE=" '{print $2}' | cut -d '"' -f 2) + else + _path=$(get_save_path) + set -- $(df -T $_path 2>/dev/null | tail -1 | awk '{ print $1, $2}') + _target=$(to_dev_name $1) + _new_fstype=$2 + if [[ -z "$_target" || -z "$_new_fstype" ]];then + echo "Dump path $_path does not exist" + return 2 + fi + fi + + if [[ $(expr substr $_new_fstype 1 3) = "nfs" ]];then + _new_dev=$_target + else + _new_dev=$(kdump_get_persistent_dev $_target $_new_fstype) + if ! findmnt $_target >/dev/null; then + echo "Dump target $_target is probably not mounted." + return 2 + fi + fi + + if ! findmnt $_target >/dev/null; then + echo "Dump target $_target is probably not mounted." + return 2 + fi + _new_mntpoint="/kdumproot/$(get_mntpoint_from_target $_target)" + + _dracut_args=$(lsinitrd $TARGET_INITRD | grep "^Arguments:" | head -1) + if [[ -z "$_dracut_args" ]];then + echo "Warning: No dracut arguments found in initrd" + return 0 + fi + + # if --mount argument present then match old and new target, mount + # point and file system. If any of them mismatches then rebuild + echo $_dracut_args | grep "\-\-mount" &> /dev/null + if [[ $? -eq 0 ]];then + set -- $(echo $_dracut_args | awk -F "--mount '" '{print $2}' | cut -d' ' -f1,2,3) + _old_dev=$1 + _old_mntpoint=$2 + _old_fstype=$3 + [[ $_new_dev = $_old_dev && $_new_mntpoint = $_old_mntpoint && $_new_fstype = $_old_fstype ]] && return 0 + # otherwise rebuild if target device is not a root device + else + [[ "$_target" = "$(get_root_fs_device)" ]] && return 0 + fi + + echo "Detected change in File System" + return 1 +} + +check_wdt_modified() +{ + is_wdt_mod_omitted + [[ $? -eq 0 ]] && return 0 + [[ -d /sys/class/watchdog/ ]] || return 0 + + for dir in /sys/class/watchdog/*; do + [[ -d "$dir" ]] || continue + [[ -f "$dir/state" ]] || continue + wdtdrv=$(< "$dir/device/modalias") + wdtdrv=$(modinfo $wdtdrv | grep filename | awk -F"kernel/" '{print $2}') + active=$(< "$dir/state") + # rebuild when: + # module for this watchdog is not found and watchdog is active + # module for this watchdog is found and watchdog is inactive + lsinitrd $TARGET_INITRD | grep $wdtdrv &> /dev/null + if [ $? -ne 0 ]; then + [[ "$active" = "active" ]] && return 1 + else + [[ "$active" = "inactive" ]] && return 1 + fi + done + + # check if watchdog kernel module unloaded. + loaded_mods=$(lsinitrd $TARGET_INITRD -f etc/cmdline.d/00-watchdog.conf) + [[ -n $loaded_mods ]] && loaded_mods=$(echo $loaded_mods | awk -F"rd.driver.pre=" '{print $2}' | sed "s/,/ /g") + for mod in $loaded_mods ; do + lsmod | grep $mod &> /dev/null + [[ $? != 0 ]] && return 1 + done + + return 0 +} + +# returns 0 if system is not modified +# returns 1 if system is modified +# returns 2 if system modification is invalid +check_system_modified() +{ + local ret + + [[ -f $TARGET_INITRD ]] || return 1 + + check_files_modified + ret=$? + if [ $ret -ne 0 ]; then + return $ret + fi + + check_dump_fs_modified + ret=$? + if [ $ret -ne 0 ]; then + return $ret + fi + + check_wdt_modified + if [ $? -ne 0 ]; then + echo "Detected change in watchdog state" + return 1 + fi + + return 0 +} + check_rebuild() { - local extra_modules modified_files="" + local extra_modules local _force_rebuild force_rebuild="0" + local ret system_modified="0" local initramfs_has_fadump check_boot_dir @@ -359,8 +535,6 @@ check_rebuild() #since last build of the image file if [ -f $TARGET_INITRD ]; then image_time=`stat -c "%Y" $TARGET_INITRD 2>/dev/null` - else - image_time=0 fi #also rebuild when Pacemaker cluster conf is changed and fence kdump is enabled. @@ -383,6 +557,14 @@ check_rebuild() fi done + check_system_modified + ret=$? + if [ $ret -eq 2 ]; then + return 1 + elif [ $ret -eq 1 ];then + system_modified="1" + fi + #check if target initrd has fadump support if [ "$DEFAULT_DUMP_MODE" = "fadump" ] && [ -f "$TARGET_INITRD" ]; then initramfs_has_fadump=`lsinitrd -m $TARGET_INITRD | grep ^kdumpbase$ | wc -l` @@ -394,13 +576,17 @@ check_rebuild() echo "$TARGET_INITRD has no fadump support" elif [ "$force_rebuild" != "0" ]; then echo -n "Force rebuild $TARGET_INITRD"; echo - elif [ -n "$modified_files" ]; then - echo "Detected change(s) in the following file(s):" - echo -n " "; echo "$modified_files" | sed 's/\s/\n /g' + elif [ "$system_modified" != "0" ]; then + : else return 0 fi + if [[ ! -w "$KDUMP_BOOTDIR" ]];then + echo "$KDUMP_BOOTDIR does not have write permission. Can not rebuild $TARGET_INITRD" + return 1 + fi + echo "Rebuilding $TARGET_INITRD" rebuild_initrd return $? diff --git a/SOURCES/kexec-kdump-howto.txt b/SOURCES/kexec-kdump-howto.txt index 05b497f..f46563f 100644 --- a/SOURCES/kexec-kdump-howto.txt +++ b/SOURCES/kexec-kdump-howto.txt @@ -345,6 +345,24 @@ mount the NFS mount and copy out the vmcore to your NFS server. Restart the kdump service via '/sbin/systemctl restart kdump.service' to commit this change to your kdump initrd. +Special mount via "dracut_args" + +You can utilize "dracut_args" to pass "--mount" to kdump, see dracut manpage +about the format of "--mount" for details. If there is any "--mount" specified +via "dracut_args", kdump will build it as the mount target without doing any +validation (mounting or checking like mount options, fs size, save path, etc), +so you must test it to ensure all the correctness. You cannot use other targets +in /etc/kdump.conf if you use "--mount" in "dracut_args". You also cannot specify +mutliple "--mount" targets via "dracut_args". + +One use case of "--mount" in "dracut_args" is you do not want to mount dump target +before kdump service startup, for example, to reduce the burden of the shared nfs +server. Such as the example below: +dracut_args --mount "192.168.1.1:/share /mnt/test nfs4 defaults" + +NOTE: +- <mountpoint> must be specified as an absolute path. + Remote system via ssh/scp Dumping over ssh/scp requires setting up passwordless ssh keys for every @@ -616,6 +634,51 @@ options are copied from /proc/cmdline. In general it is best to append command line options using "KDUMP_COMMANDLINE_APPEND=" instead of replacing the original command line completely. +Notes on watchdog module handling: + +If a watchdog is active in first kernel then, we must have it's module +loaded in crash kernel, so that either watchdog is deactivated or started +being kicked in second kernel. Otherwise, we might face watchdog reboot +when vmcore is being saved. When dracut watchdog module is enabled, it +installs kernel watchdog module of active watchdog device in initrd. +kexec-tools always add "-a watchdog" to the dracut_args if there exists at +least one active watchdog and user has not added specifically "-o watchdog" +in dracut_args of kdump.conf. If a watchdog module (such as hp_wdt) has +not been written in watchdog-core framework then this option will not have +any effect and module will not be added. Please note that only systemd +watchdog daemon is supported as watchdog kick application. + +Parallel Dumping Operation +========================== +Kexec allows kdump using multiple cpus. So parallel feature can accelerate +dumping substantially, especially in executing compression and filter. +For example: + + 1."makedumpfile -c --num-threads [THREAD_NUM] /proc/vmcore dumpfile" + 2."makedumpfile -c /proc/vmcore dumpfile", + + 1 has better performance than 2, if THREAD_NUM is larger than two + and the usable cpus number is larger than THREAD_NUM. + +Notes on how to use multiple cpus on a capture kernel on x86 system: + +Make sure that you are using a kernel that supports disable_cpu_apicid +kernel option as a capture kernel, which is needed to avoid x86 specific +hardware issue (*). The disable_cpu_apicid kernel option is automatically +appended by kdumpctl script and is ignored if the kernel doesn't support it. + +You need to specify how many cpus to be used in a capture kernel by specifying +the number of cpus in nr_cpus kernel option in /etc/sysconfig/kdump. nr_cpus +is 1 at default. + +You should use necessary and sufficient number of cpus on a capture kernel. +Warning: Don't use too many cpus on a capture kernel, or the capture kernel +may lead to panic due to Out Of Memory. + +(*) Without disable_cpu_apicid kernel option, capture kernel may lead to +hang, system reset or power-off at boot, depending on your system and runtime +situation at the time of crash. + Debugging Tips -------------- - One can drop into a shell before/after saving vmcore with the help of diff --git a/SOURCES/kexec-tools-2.0.7-Add-persistent-memory-support.patch b/SOURCES/kexec-tools-2.0.7-Add-persistent-memory-support.patch new file mode 100644 index 0000000..a82c004 --- /dev/null +++ b/SOURCES/kexec-tools-2.0.7-Add-persistent-memory-support.patch @@ -0,0 +1,159 @@ +From cb9a818ff2ac437e76512ec01c0eb22d0d7456b2 Mon Sep 17 00:00:00 2001 +From: Baoquan He <bhe@redhat.com> +Date: Wed, 19 Aug 2015 17:03:49 +0800 +Subject: [PATCH] Add persistent memory support + +Kernel add E820_PRAM or E820_PMEM type for NVDIMM memory device. +Now support them in kexec too. + +Reported-by: Toshi Kani <toshi.kani@hp.com> +Tested-by: Toshi Kani <toshi.kani@hp.com> +Signed-off-by: Baoquan He <bhe@redhat.com> +Signed-off-by: Simon Horman <horms@verge.net.au> +--- + include/x86/x86-linux.h | 2 ++ + kexec/arch/i386/crashdump-x86.c | 15 ++++++++++++--- + kexec/arch/i386/kexec-x86-common.c | 10 ++++++++++ + kexec/arch/i386/x86-linux-setup.c | 6 ++++++ + kexec/firmware_memmap.c | 4 ++++ + kexec/kexec.h | 2 ++ + 6 files changed, 36 insertions(+), 3 deletions(-) + +diff --git a/include/x86/x86-linux.h b/include/x86/x86-linux.h +index 50c7324..7834751 100644 +--- a/include/x86/x86-linux.h ++++ b/include/x86/x86-linux.h +@@ -21,6 +21,8 @@ struct e820entry { + #define E820_RESERVED 2 + #define E820_ACPI 3 /* usable as RAM once ACPI tables have been read */ + #define E820_NVS 4 ++#define E820_PMEM 7 ++#define E820_PRAM 12 + } __attribute__((packed)); + #endif + +diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c +index 569c99a..63959b7 100644 +--- a/kexec/arch/i386/crashdump-x86.c ++++ b/kexec/arch/i386/crashdump-x86.c +@@ -301,6 +301,10 @@ static int get_crash_memory_ranges(struct memory_range **range, int *ranges, + type = RANGE_ACPI; + } else if(memcmp(str,"ACPI Non-volatile Storage\n",26) == 0 ) { + type = RANGE_ACPI_NVS; ++ } else if(memcmp(str,"Persistent Memory (legacy)\n",27) == 0 ) { ++ type = RANGE_PRAM; ++ } else if(memcmp(str,"Persistent Memory\n",18) == 0 ) { ++ type = RANGE_PMEM; + } else if(memcmp(str,"reserved\n",9) == 0 ) { + type = RANGE_RESERVED; + } else if (memcmp(str, "GART\n", 5) == 0) { +@@ -640,6 +644,8 @@ static void cmdline_add_memmap_internal(char *cmdline, unsigned long startk, + strcat (str_mmap, "K$"); + else if (type == RANGE_ACPI || type == RANGE_ACPI_NVS) + strcat (str_mmap, "K#"); ++ else if (type == RANGE_PRAM) ++ strcat (str_mmap, "K!"); + + ultoa(startk, str_tmp); + strcat (str_mmap, str_tmp); +@@ -674,10 +680,11 @@ static int cmdline_add_memmap(char *cmdline, struct memory_range *memmap_p) + endk = (memmap_p[i].end + 1)/1024; + type = memmap_p[i].type; + +- /* Only adding memory regions of RAM and ACPI */ ++ /* Only adding memory regions of RAM and ACPI and Persistent Mem */ + if (type != RANGE_RAM && + type != RANGE_ACPI && +- type != RANGE_ACPI_NVS) ++ type != RANGE_ACPI_NVS && ++ type != RANGE_PRAM) + continue; + + if (type == RANGE_ACPI || type == RANGE_ACPI_NVS) +@@ -997,7 +1004,9 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline, + unsigned long start, end, size, type; + if ( !( mem_range[i].type == RANGE_ACPI + || mem_range[i].type == RANGE_ACPI_NVS +- || mem_range[i].type == RANGE_RESERVED)) ++ || mem_range[i].type == RANGE_RESERVED ++ || mem_range[i].type == RANGE_PMEM ++ || mem_range[i].type == RANGE_PRAM)) + continue; + start = mem_range[i].start; + end = mem_range[i].end; +diff --git a/kexec/arch/i386/kexec-x86-common.c b/kexec/arch/i386/kexec-x86-common.c +index 91e4f94..041c8ec 100644 +--- a/kexec/arch/i386/kexec-x86-common.c ++++ b/kexec/arch/i386/kexec-x86-common.c +@@ -94,6 +94,12 @@ static int get_memory_ranges_proc_iomem(struct memory_range **range, int *ranges + else if (memcmp(str, "ACPI Non-volatile Storage\n", 26) == 0) { + type = RANGE_ACPI_NVS; + } ++ else if (memcmp(str, "Persistent Memory (legacy)\n", 27) == 0) { ++ type = RANGE_PRAM; ++ } ++ else if (memcmp(str, "Persistent Memory\n", 18) == 0) { ++ type = RANGE_PMEM; ++ } + else { + continue; + } +@@ -149,6 +155,10 @@ unsigned xen_e820_to_kexec_type(uint32_t type) + return RANGE_ACPI; + case E820_NVS: + return RANGE_ACPI_NVS; ++ case E820_PMEM: ++ return RANGE_PMEM; ++ case E820_PRAM: ++ return RANGE_PRAM; + case E820_RESERVED: + default: + return RANGE_RESERVED; +diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c +index 9271c6c..c75adaa 100644 +--- a/kexec/arch/i386/x86-linux-setup.c ++++ b/kexec/arch/i386/x86-linux-setup.c +@@ -705,6 +705,12 @@ static void add_e820_map_from_mr(struct x86_linux_param_header *real_mode, + case RANGE_ACPI_NVS: + e820[i].type = E820_NVS; + break; ++ case RANGE_PMEM: ++ e820[i].type = E820_PMEM; ++ break; ++ case RANGE_PRAM: ++ e820[i].type = E820_PRAM; ++ break; + default: + case RANGE_RESERVED: + e820[i].type = E820_RESERVED; +diff --git a/kexec/firmware_memmap.c b/kexec/firmware_memmap.c +index 6be3c7c..4d84f00 100644 +--- a/kexec/firmware_memmap.c ++++ b/kexec/firmware_memmap.c +@@ -168,6 +168,10 @@ static int parse_memmap_entry(const char *entry, struct memory_range *range) + range->type = RANGE_ACPI_NVS; + else if (strcmp(type, "Uncached RAM") == 0) + range->type = RANGE_UNCACHED; ++ else if (strcmp(type, "Persistent Memory (legacy)") == 0) ++ range->type = RANGE_PRAM; ++ else if (strcmp(type, "Persistent Memory") == 0) ++ range->type = RANGE_PMEM; + else { + fprintf(stderr, "Unknown type (%s) while parsing %s. Please " + "report this as bug. Using RANGE_RESERVED now.\n", +diff --git a/kexec/kexec.h b/kexec/kexec.h +index b129c15..0fa977f 100644 +--- a/kexec/kexec.h ++++ b/kexec/kexec.h +@@ -136,6 +136,8 @@ struct memory_range { + #define RANGE_ACPI 2 + #define RANGE_ACPI_NVS 3 + #define RANGE_UNCACHED 4 ++#define RANGE_PMEM 6 ++#define RANGE_PRAM 11 + }; + + struct memory_ranges { +-- +2.5.5 + diff --git a/SOURCES/kexec-tools-2.0.7-makedumpfile-Support-ARM64.patch b/SOURCES/kexec-tools-2.0.7-makedumpfile-Support-ARM64.patch deleted file mode 100644 index f435c89..0000000 --- a/SOURCES/kexec-tools-2.0.7-makedumpfile-Support-ARM64.patch +++ /dev/null @@ -1,371 +0,0 @@ -From 145707b5b6495467515cb6f3e0814df81cb55404 Mon Sep 17 00:00:00 2001 -Message-Id: <145707b5b6495467515cb6f3e0814df81cb55404.1431708455.git.panand@redhat.com> -From: Pratyush Anand <panand@redhat.com> -Date: Tue, 28 Apr 2015 15:15:15 +0530 -Subject: [PATCH] makedumpfile: Support ARM64 - -Patch adds support for ARM64 in makedumpfile. It takes care of vmalloc, -vmemmap, module and directly map kernel memory region's translation. - -Signed-off-by: Pratyush Anand <panand@redhat.com> ---- - Makefile | 1 + - arch/arm64.c | 259 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - makedumpfile.h | 49 +++++++++++ - 3 files changed, 309 insertions(+) - create mode 100644 arch/arm64.c - -diff --git a/makedumpfile-1.5.7/Makefile b/makedumpfile-1.5.7/Makefile -index e45c3cfe5e9d..b8d77dbad856 100644 ---- a/makedumpfile-1.5.7/Makefile -+++ b/makedumpfile-1.5.7/Makefile -@@ -49,6 +49,7 @@ SRC_BASE = makedumpfile.c makedumpfile.h diskdump_mod.h sadump_mod.h sadump_info - SRC_PART = print_info.c dwarf_info.c elf_info.c erase_info.c sadump_info.c cache.c - OBJ_PART=$(patsubst %.c,%.o,$(SRC_PART)) - SRC_ARCH = arch/arm.c arch/x86.c arch/x86_64.c arch/ia64.c arch/ppc64.c arch/s390x.c arch/ppc.c -+SRC_ARCH = arch/arm.c arch/arm64.c arch/x86.c arch/x86_64.c arch/ia64.c arch/ppc64.c arch/s390x.c arch/ppc.c - OBJ_ARCH=$(patsubst %.c,%.o,$(SRC_ARCH)) - - LIBS = -ldw -lbz2 -lebl -ldl -lelf -lz -diff --git a/makedumpfile-1.5.7/arch/arm64.c b/makedumpfile-1.5.7/arch/arm64.c -new file mode 100644 -index 000000000000..28e2adef7ae3 ---- /dev/null -+++ b/makedumpfile-1.5.7/arch/arm64.c -@@ -0,0 +1,259 @@ -+/* -+ * arch/arm64.c : Based on arch/arm.c -+ * -+ * Copyright (C) 2015 Red Hat, Pratyush Anand <panand@redhat.com> -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation (version 2 of the License). -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#ifdef __aarch64__ -+ -+#include "../elf_info.h" -+#include "../makedumpfile.h" -+#include "../print_info.h" -+ -+#if CONFIG_ARM64_PGTABLE_LEVELS == 2 -+typedef struct { -+ unsigned long pgd; -+} pgd_t; -+ -+typedef struct { -+ pgd_t pgd; -+} pud_t; -+ -+typedef struct { -+ pud_t pud; -+} pmd_t; -+ -+#define pud_offset(pgd, vaddr) ((pud_t *)pgd) -+#define pmd_offset(pud, vaddr) ((pmd_t *)pud) -+#define pgd_val(x) ((x).pgd) -+#define pud_val(x) (pgd_val((x).pgd)) -+#define pmd_val(x) (pud_val((x).pud)) -+ -+#define PUD_SHIFT PGDIR_SHIFT -+#define PUD_SIZE (1UL << PUD_SHIFT) -+ -+#endif -+ -+typedef struct { -+ unsigned long pte; -+} pte_t; -+#define pte_val(x) ((x).pte) -+ -+#define PAGE_SIZE (1UL << PAGE_SHIFT) -+#define PAGE_MASK (~(PAGE_SIZE - 1)) -+#define PGDIR_SHIFT ((PAGE_SHIFT - 3) * ARM64_PGTABLE_LEVELS + 3) -+#define PTRS_PER_PGD (1 << (VA_BITS - PGDIR_SHIFT)) -+#define PMD_SHIFT ((PAGE_SHIFT - 3) * 2 + 3) -+#define PTRS_PER_PTE (1 << (PAGE_SHIFT - 3)) -+#define PMD_SHIFT ((PAGE_SHIFT - 3) * 2 + 3) -+#define PMD_SIZE (1UL << PMD_SHIFT) -+#define PMD_MASK (~(PMD_SIZE - 1)) -+#define PTRS_PER_PMD PTRS_PER_PTE -+ -+#define PAGE_PRESENT (1 << 0) -+#define SECTIONS_SIZE_BITS 30 -+/* -+ -+* Highest possible physical address supported. -+*/ -+#define PHYS_MASK_SHIFT 48 -+#define PHYS_MASK ((1UL << PHYS_MASK_SHIFT) - 1) -+ -+#define PMD_TYPE_MASK 3 -+#define PMD_TYPE_SECT 1 -+#define PMD_TYPE_TABLE 3 -+ -+#define __va(paddr) ((paddr) - info->phys_base + PAGE_OFFSET) -+#define __pa(vaddr) ((vaddr) - PAGE_OFFSET + info->phys_base) -+ -+#define pgd_index(vaddr) (((vaddr) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1)) -+#define pgd_offset(pgdir, vaddr) ((pgd_t *)(pgdir) + pgd_index(vaddr)) -+ -+#define pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) -+#define pmd_page_vaddr(pmd) (__va(pmd_val(pmd) & PHYS_MASK & (int32_t)PAGE_MASK)) -+#define pte_offset(dir, vaddr) ((pte_t*)pmd_page_vaddr((*dir)) + pte_index(vaddr)) -+ -+/* kernel struct page size can be kernel version dependent, currently -+ * keep it constant. -+ */ -+#define KERN_STRUCT_PAGE_SIZE 64 -+#define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1)) -+#define PFN_DOWN(x) ((x) >> PAGE_SHIFT) -+#define VMEMMAP_SIZE ALIGN((1UL << (VA_BITS - PAGE_SHIFT)) * KERN_STRUCT_PAGE_SIZE, PUD_SIZE) -+#define MODULES_END PAGE_OFFSET -+#define MODULES_VADDR (MODULES_END - 0x4000000) -+ -+int is_vmalloc_addr(unsigned long vaddr) -+{ -+ return (vaddr >= VMALLOC_START && vaddr <= VMALLOC_END); -+} -+ -+static int is_vtop_from_page_table_arm64(unsigned long vaddr) -+{ -+ /* If virtual address lies in vmalloc, vmemmap or module space -+ * region then, get the physical address from page table. -+ */ -+ return ((vaddr >= VMALLOC_START && vaddr <= VMALLOC_END) -+ || (vaddr >= VMEMMAP_START && vaddr <= VMEMMAP_END) -+ || (vaddr >= MODULES_VADDR && vaddr <= MODULES_END)); -+} -+ -+int get_phys_base_arm64(void) -+{ -+ unsigned long phys_base = ULONG_MAX; -+ unsigned long long phys_start; -+ int i; -+ /* -+ * We resolve phys_base from PT_LOAD segments. LMA contains physical -+ * address of the segment, and we use the lowest start as -+ * phys_base. -+ */ -+ for (i = 0; get_pt_load(i, &phys_start, NULL, NULL, NULL); i++) { -+ if (phys_start < phys_base) -+ phys_base = phys_start; -+ } -+ -+ if (phys_base == ULONG_MAX) { -+ ERRMSG("Can't determine phys_base\n"); -+ return FALSE; -+ } -+ -+ info->phys_base = phys_base; -+ -+ DEBUG_MSG("phys_base : %lx\n", phys_base); -+ -+ return TRUE; -+} -+ -+int get_machdep_info_arm64(void) -+{ -+ info->max_physmem_bits = PHYS_MASK_SHIFT; -+ info->section_size_bits = SECTIONS_SIZE_BITS; -+ info->page_offset = KVBASE; -+ info->vmalloc_start = 0xffffffffffffffffUL << VA_BITS; -+ info->vmalloc_end = PAGE_OFFSET - PUD_SIZE - VMEMMAP_SIZE - 0x10000; -+ info->vmemmap_start = VMALLOC_END + 0x10000; -+ info->vmemmap_end = VMEMMAP_START + VMEMMAP_SIZE; -+ -+ DEBUG_MSG("max_physmem_bits : %lx\n", info->max_physmem_bits); -+ DEBUG_MSG("section_size_bits: %lx\n", info->section_size_bits); -+ DEBUG_MSG("page_offset : %lx\n", info->page_offset); -+ DEBUG_MSG("vmalloc_start : %lx\n", info->vmalloc_start); -+ DEBUG_MSG("vmalloc_end : %lx\n", info->vmalloc_end); -+ DEBUG_MSG("vmemmap_start : %lx\n", info->vmemmap_start); -+ DEBUG_MSG("vmemmap_end : %lx\n", info->vmemmap_end); -+ DEBUG_MSG("modules_start : %lx\n", MODULES_VADDR); -+ DEBUG_MSG("modules_end : %lx\n", MODULES_END); -+ -+ return TRUE; -+} -+ -+unsigned long long kvtop_xen_arm64(unsigned long kvaddr) -+{ -+ return ERROR; -+} -+ -+int get_xen_basic_info_arm64(void) -+{ -+ return ERROR; -+} -+ -+int get_xen_info_arm64(void) -+{ -+ return ERROR; -+} -+ -+int get_versiondep_info_arm64(void) -+{ -+ return TRUE; -+} -+ -+/* -+ * vtop_arm64() - translate arbitrary virtual address to physical -+ * @vaddr: virtual address to translate -+ * -+ * Function translates @vaddr into physical address using page tables. This -+ * address can be any virtual address. Returns physical address of the -+ * corresponding virtual address or %NOT_PADDR when there is no translation. -+ */ -+static unsigned long long vtop_arm64(unsigned long vaddr) -+{ -+ unsigned long long paddr = NOT_PADDR; -+ pgd_t *pgda, pgdv; -+ pud_t *puda; -+ pmd_t *pmda, pmdv; -+ pte_t *ptea, ptev; -+ -+ if (SYMBOL(swapper_pg_dir) == NOT_FOUND_SYMBOL) { -+ ERRMSG("Can't get the symbol of swapper_pg_dir.\n"); -+ return NOT_PADDR; -+ } -+ -+ pgda = pgd_offset(SYMBOL(swapper_pg_dir), vaddr); -+ if (!readmem(VADDR, (unsigned long long)pgda, &pgdv, sizeof(pgdv))) { -+ ERRMSG("Can't read pgd\n"); -+ return NOT_PADDR; -+ } -+ -+ puda = pud_offset(pgda, vaddr); -+ pmda = pmd_offset(puda, vaddr); -+ if (!readmem(VADDR, (unsigned long long)pmda, &pmdv, sizeof(pmdv))) { -+ ERRMSG("Can't read pmd\n"); -+ return NOT_PADDR; -+ } -+ -+ switch (pmd_val(pmdv) & PMD_TYPE_MASK) { -+ case PMD_TYPE_TABLE: -+ ptea = pte_offset(&pmdv, vaddr); -+ /* 64k page */ -+ if (!readmem(VADDR, (unsigned long long)ptea, &ptev, sizeof(ptev))) { -+ ERRMSG("Can't read pte\n"); -+ return NOT_PADDR; -+ } -+ -+ if (!(pte_val(ptev) & PAGE_PRESENT)) { -+ ERRMSG("Can't get a valid pte.\n"); -+ return NOT_PADDR; -+ } else { -+ -+ paddr = (PAGEBASE(pte_val(ptev)) & PHYS_MASK) -+ + (vaddr & (PAGESIZE() - 1)); -+ } -+ break; -+ case PMD_TYPE_SECT: -+ /* 1GB section */ -+ paddr = (pmd_val(pmdv) & PMD_MASK) + (vaddr & (PMD_SIZE - 1)); -+ break; -+ } -+ -+ return paddr; -+} -+ -+unsigned long long vaddr_to_paddr_arm64(unsigned long vaddr) -+{ -+ /* -+ * use translation tables when a) user has explicitly requested us to -+ * perform translation for a given address. b) virtual address lies in -+ * vmalloc, vmemmap or modules memory region. Otherwise we assume that -+ * the translation is done within the kernel direct mapped region. -+ */ -+ if ((info->vaddr_for_vtop == vaddr) || -+ is_vtop_from_page_table_arm64(vaddr)) -+ return vtop_arm64(vaddr); -+ -+ return __pa(vaddr); -+} -+#endif -diff --git a/makedumpfile-1.5.7/makedumpfile.h b/makedumpfile-1.5.7/makedumpfile.h -index 96830b071f6e..2af3a8e72e0a 100644 ---- a/makedumpfile-1.5.7/makedumpfile.h -+++ b/makedumpfile-1.5.7/makedumpfile.h -@@ -483,6 +483,33 @@ do { \ - #define VMEMMAP_START (info->vmemmap_start) - #define VMEMMAP_END (info->vmemmap_end) - -+#ifdef __aarch64__ -+#define CONFIG_ARM64_PGTABLE_LEVELS 2 -+#define CONFIG_ARM64_VA_BITS 42 -+#define CONFIG_ARM64_64K_PAGES 1 -+ -+/* Currently we only suport following defines based on above -+ * config definitions. -+ * TODOs: We need to find a way to get above defines dynamically and -+ * then to support following definitions based on that -+ */ -+ -+#if CONFIG_ARM64_PGTABLE_LEVELS == 2 -+#define ARM64_PGTABLE_LEVELS 2 -+#endif -+ -+#if CONFIG_ARM64_VA_BITS == 42 -+#define VA_BITS 42 -+#endif -+ -+#ifdef CONFIG_ARM64_64K_PAGES -+#define PAGE_SHIFT 16 -+#endif -+ -+#define KVBASE_MASK (0xffffffffffffffffUL << (VA_BITS - 1)) -+#define KVBASE (SYMBOL(_stext) & KVBASE_MASK) -+#endif /* aarch64 */ -+ - #ifdef __arm__ - #define KVBASE_MASK (0xffff) - #define KVBASE (SYMBOL(_stext) & ~KVBASE_MASK) -@@ -757,6 +784,23 @@ do { \ - /* - * The function of dependence on machine - */ -+#ifdef __aarch64__ -+int get_phys_base_arm64(void); -+int get_machdep_info_arm64(void); -+unsigned long long vaddr_to_paddr_arm64(unsigned long vaddr); -+int get_versiondep_info_arm64(void); -+int get_xen_basic_info_arm64(void); -+int get_xen_info_arm64(void); -+int is_vmalloc_addr_arm64(unsigned long vaddr); -+#define vaddr_to_paddr(X) vaddr_to_paddr_arm64(X) -+#define get_phys_base() get_phys_base_arm64() -+#define get_machdep_info() get_machdep_info_arm64() -+#define get_versiondep_info() get_versiondep_info_arm64() -+#define get_xen_basic_info_arch(X) get_xen_basic_info_arm64(X) -+#define get_xen_info_arch(X) get_xen_info_arm64(X) -+#define is_vmalloc_addr(X) is_vmalloc_addr_arm64(X) -+#endif /* aarch64 */ -+ - #ifdef __arm__ - int get_phys_base_arm(void); - int get_machdep_info_arm(void); -@@ -1581,6 +1625,11 @@ struct domain_list { - #define PAGES_PER_MAPWORD (sizeof(unsigned long) * 8) - #define MFNS_PER_FRAME (info->page_size / sizeof(unsigned long)) - -+#ifdef __aarch64__ -+unsigned long long kvtop_xen_arm64(unsigned long kvaddr); -+#define kvtop_xen(X) kvtop_xen_arm64(X) -+#endif /* aarch64 */ -+ - #ifdef __arm__ - #define kvtop_xen(X) FALSE - #define get_xen_basic_info_arch(X) FALSE --- -2.1.0 - diff --git a/SOURCES/kexec-tools-2.0.7-makedumpfile-sadump-Support-more-than-16TB-physical-memory.patch b/SOURCES/kexec-tools-2.0.7-makedumpfile-sadump-Support-more-than-16TB-physical-memory.patch deleted file mode 100644 index 41b3aed..0000000 --- a/SOURCES/kexec-tools-2.0.7-makedumpfile-sadump-Support-more-than-16TB-physical-memory.patch +++ /dev/null @@ -1,127 +0,0 @@ -From 37afcd52ac5dd276a51af51cbee9531b91911bfa Mon Sep 17 00:00:00 2001 -From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com> -Date: Fri, 20 Feb 2015 10:18:41 +0900 -Subject: [PATCH] [PATCH] sadump: Support more than 16TB physical memory space. - -This patch makes sadump format support more than 16TB physical memory -space. - -The limitation is caused by several members of dump_header structure: -max_mapnr and the others. They have 4 byte length only. In particular, -max_mapnr member gets overflow if more than 16TB physical memory space -is given. - -To support more than 16TB physical memory space, this patch adds new 4 -64-bit length members in dump_header structure: - -- max_mapnr_64 -- total_ram_blocks_64 -- device_blocks_64 -- written_blocks_64 - -Next table shows correspondence between the 32-bit version and the -64-bit version members: - - | 32-bit version | 64-bit version | - |------------------------+---------------------------| - | max_mapnr | max_mapnr_64 | - | total_ram_blocks | total_ram_blocks_64 | - | device_blocks | device_blocks_64 | - | written_blocks | written_blocks_64 | - -In addition, header_version member of dump_header structure is -increased to 1 in this extended new format. - -Old makedumpfile can access the new sadump format under 16TB -correctly. - -Current implementation treats vmcore with kernel version 2 or later as -kernel version 1, assuming backward compatibility. - -Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com> ---- - sadump_info.c | 20 +++++++++++++++++--- - sadump_mod.h | 8 ++++++++ - 2 files changed, 25 insertions(+), 3 deletions(-) - -diff --git a/makedumpfile-1.5.7/sadump_info.c b/makedumpfile-1.5.7/sadump_info.c -index 9434ff7..e2c4f03 100644 ---- a/makedumpfile-1.5.7/sadump_info.c -+++ b/makedumpfile-1.5.7/sadump_info.c -@@ -84,6 +84,7 @@ struct sadump_info { - unsigned long backup_src_size; - unsigned long long backup_offset; - int kdump_backed_up; -+ mdf_pfn_t max_mapnr; - }; - - static char *guid_to_str(efi_guid_t *guid, char *buf, size_t buflen); -@@ -625,6 +626,19 @@ restart: - offset += sh->sub_hdr_size * block_size; - } - -+ switch (sh->header_version) { -+ case 0: -+ si->max_mapnr = (mdf_pfn_t)(uint64_t)sh->max_mapnr; -+ break; -+ default: -+ ERRMSG("sadump: unsupported header version: %u\n" -+ "sadump: assuming header version: 1\n", -+ sh->header_version); -+ case 1: -+ si->max_mapnr = (mdf_pfn_t)sh->max_mapnr_64; -+ break; -+ } -+ - if (!sh->bitmap_blocks) { - DEBUG_MSG("sadump: bitmap_blocks is zero\n"); - return FALSE; -@@ -775,7 +789,7 @@ sadump_initialize_bitmap_memory(void) - memset(bmp->buf, 0, BUFSIZE_BITMAP); - bmp->offset = dumpable_bitmap_offset; - -- max_section = divideup(sh->max_mapnr, SADUMP_PF_SECTION_NUM); -+ max_section = divideup(si->max_mapnr, SADUMP_PF_SECTION_NUM); - - block_table = calloc(sizeof(unsigned long long), max_section); - if (block_table == NULL) { -@@ -906,7 +920,7 @@ sadump_set_timestamp(struct timeval *ts) - mdf_pfn_t - sadump_get_max_mapnr(void) - { -- return si->sh_memory->max_mapnr; -+ return si->max_mapnr; - } - - #ifdef __x86_64__ -@@ -964,7 +978,7 @@ readpage_sadump(unsigned long long paddr, void *bufptr) - - pfn = paddr_to_pfn(paddr); - -- if (pfn >= si->sh_memory->max_mapnr) -+ if (pfn >= si->max_mapnr) - return FALSE; - - if (!is_dumpable(info->bitmap_memory, pfn)) { -diff --git a/makedumpfile-1.5.7/sadump_mod.h b/makedumpfile-1.5.7/sadump_mod.h -index afeead8..0dd5bb5 100644 ---- a/makedumpfile-1.5.7/sadump_mod.h -+++ b/makedumpfile-1.5.7/sadump_mod.h -@@ -106,6 +106,14 @@ struct sadump_header { - uint32_t written_blocks; /* Number of written blocks */ - uint32_t current_cpu; /* CPU# which handles dump */ - uint32_t nr_cpus; /* Number of CPUs */ -+ /* -+ * The members from below are supported in header version 1 -+ * and later. -+ */ -+ uint64_t max_mapnr_64; -+ uint64_t total_ram_blocks_64; -+ uint64_t device_blocks_64; -+ uint64_t written_blocks_64; - }; - - struct sadump_apic_state { --- -1.8.5.3 - diff --git a/SOURCES/kexec-tools-2.0.7-makedumpfile-sadump-fix-segmentation-fault-on-sadump-re.patch b/SOURCES/kexec-tools-2.0.7-makedumpfile-sadump-fix-segmentation-fault-on-sadump-re.patch new file mode 100644 index 0000000..ab22420 --- /dev/null +++ b/SOURCES/kexec-tools-2.0.7-makedumpfile-sadump-fix-segmentation-fault-on-sadump-re.patch @@ -0,0 +1,114 @@ +From 8edf033f0eada8640f821ea8abd5bc2b0fa09083 Mon Sep 17 00:00:00 2001 +From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com> +Date: Mon, 20 Jun 2016 14:58:05 +0900 +Subject: [PATCH 1/2] [PATCH 1/2] sadump: fix segmentation fault on + sadump-related formats + +Currently, makedumpfile results in segmentation fault on +sadump-related formats: + + # ~/makedumpfile --message-level 31 -l -d 31 -x ./vmlinux vmcore + sadump: read dump device as single partition + sadump: single partition configuration + page_size : 4096 + Segmentation fault + +This is because although commit +5fc24bf754fa6d2c0bd0f1c6f5655de371efb9d5 started dynamically +allocating the buffer of struct dump_bitmap, the sadump source code +doesn't follow the change. + +This commit fixes this by following the change. + +Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com> +Signed-off-by: Baoquan He <bhe@redhat.com> +--- + makedumpfile.c | 5 ++++- + sadump_info.c | 28 ++++++++++++++++++++++++++-- + 2 files changed, 30 insertions(+), 3 deletions(-) + +diff --git a/makedumpfile-1.6.0/makedumpfile.c b/makedumpfile-1.6.0/makedumpfile.c +index fd884d3..ee3174f 100644 +--- a/makedumpfile-1.6.0/makedumpfile.c ++++ b/makedumpfile-1.6.0/makedumpfile.c +@@ -11245,8 +11245,11 @@ out: + free(info->kh_memory); + if (info->valid_pages) + free(info->valid_pages); +- if (info->bitmap_memory) ++ if (info->bitmap_memory) { ++ if (info->bitmap_memory->buf) ++ free(info->bitmap_memory->buf); + free(info->bitmap_memory); ++ } + if (info->fd_memory) + close(info->fd_memory); + if (info->fd_dumpfile) +diff --git a/makedumpfile-1.6.0/sadump_info.c b/makedumpfile-1.6.0/sadump_info.c +index 20376f0..8716167 100644 +--- a/makedumpfile-1.6.0/sadump_info.c ++++ b/makedumpfile-1.6.0/sadump_info.c +@@ -832,18 +832,28 @@ sadump_initialize_bitmap_memory(void) + strerror(errno)); + return FALSE; + } ++ + bmp->fd = info->fd_memory; + bmp->file_name = info->name_memory; + bmp->no_block = -1; +- memset(bmp->buf, 0, BUFSIZE_BITMAP); + bmp->offset = dumpable_bitmap_offset; + ++ bmp->buf = malloc(BUFSIZE_BITMAP); ++ if (!bmp->buf) { ++ ERRMSG("Can't allocate memory for the memory-bitmap's buffer. %s\n", ++ strerror(errno)); ++ free(bmp); ++ return FALSE; ++ } ++ memset(bmp->buf, 0, BUFSIZE_BITMAP); ++ + max_section = divideup(si->max_mapnr, SADUMP_PF_SECTION_NUM); + + block_table = calloc(sizeof(unsigned long long), max_section); + if (block_table == NULL) { + ERRMSG("Can't allocate memory for the block_table. %s\n", + strerror(errno)); ++ free(bmp->buf); + free(bmp); + return FALSE; + } +@@ -870,8 +880,17 @@ sadump_initialize_bitmap_memory(void) + bmp->fd = info->fd_memory; + bmp->file_name = info->name_memory; + bmp->no_block = -1; +- memset(bmp->buf, 0, BUFSIZE_BITMAP); + bmp->offset = si->sub_hdr_offset + sh->block_size * sh->sub_hdr_size; ++ ++ bmp->buf = malloc(BUFSIZE_BITMAP); ++ if (!bmp->buf) { ++ ERRMSG("Can't allocate memory for the memory-bitmap's buffer. %s\n", ++ strerror(errno)); ++ free(bmp); ++ return FALSE; ++ } ++ memset(bmp->buf, 0, BUFSIZE_BITMAP); ++ + si->ram_bitmap = bmp; + + /* +@@ -1904,6 +1923,11 @@ free_sadump_info(void) + fclose(si->file_elf_note); + if (si->cpu_online_mask_buf) + free(si->cpu_online_mask_buf); ++ if (si->ram_bitmap) { ++ if (si->ram_bitmap->buf) ++ free(si->ram_bitmap->buf); ++ free(si->ram_bitmap); ++ } + } + + void +-- +2.5.5 + diff --git a/SOURCES/kexec-tools-2.0.7-makedumpfile-sadump-fix-wrong-progress-report-on-sadump.patch b/SOURCES/kexec-tools-2.0.7-makedumpfile-sadump-fix-wrong-progress-report-on-sadump.patch new file mode 100644 index 0000000..99f69af --- /dev/null +++ b/SOURCES/kexec-tools-2.0.7-makedumpfile-sadump-fix-wrong-progress-report-on-sadump.patch @@ -0,0 +1,97 @@ +From 3883607bb61b265e9de259722b247075f7710994 Mon Sep 17 00:00:00 2001 +From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com> +Date: Mon, 20 Jun 2016 15:00:53 +0900 +Subject: [PATCH 2/2] [PATCH 2/2] sadump: fix wrong progress report on sadump + formats + +Currently, makedumpfile displays wrong progress report on sadump +formats and could result in "Floating point exception" in the worst +case: + + Original pages : 0x0000000000000000 + Excluded pages : 0x0000000001f2b44a + Pages filled with zero : 0x0000000000b160b5 + Non-private cache pages : 0x0000000000007a7e + Private cache pages : 0x0000000000000431 + User process data pages : 0x000000000140d4dc + Free pages : 0x0000000000000000 + Hwpoison pages : 0x000000000000000a + Remaining pages : 0xfffffffffe0d4bb6 + Floating point exception (core dumped) + +This is because on sadump-related formats, the number of memory hole +pages is not counted, the number of original pages becomes 0 and zero +division exception occurs below: + + 9409void + 9410print_report(void) + 9411{ + 9412 mdf_pfn_t pfn_original, pfn_excluded, shrinking; + 9413 + 9414 /* + 9415 * /proc/vmcore doesn't contain the memory hole area. + 9416 */ + 9417 pfn_original = info->max_mapnr - pfn_memhole; + 9418 + 9419 pfn_excluded = pfn_zero + pfn_cache + pfn_cache_private + 9420 + pfn_user + pfn_free + pfn_hwpoison; + 9421 shrinking = (pfn_original - pfn_excluded) * 100; + 9422 shrinking = shrinking / pfn_original; <-- Here. + +This commit fixes this issue by counting the number of memory hole +pages and so the number of original pages. As a result, makedumpfile +displays correct progress report on sadump formats and doesn't exit +abnormally: + + Original pages : 0x0000000001ffaa23 + Excluded pages : 0x0000000001f2b44a + Pages filled with zero : 0x0000000000b160b5 + Non-private cache pages : 0x0000000000007a7e + Private cache pages : 0x0000000000000431 + User process data pages : 0x000000000140d4dc + Free pages : 0x0000000000000000 + Hwpoison pages : 0x000000000000000a + Remaining pages : 0x00000000000cf5d9 + (The number of pages is reduced to 2%.) + Memory Hole : 0x00000000000a55dd + -------------------------------------------------- + Total pages : 0x00000000020a0000 + + Cache hit: 1570176, miss: 12997082, hit rate: 10.8% + +Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com> +Signed-off-by: Baoquan He <bhe@redhat.com> +--- + sadump_info.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/makedumpfile-1.6.0/sadump_info.c b/makedumpfile-1.6.0/sadump_info.c +index 8716167..5ff5595 100644 +--- a/makedumpfile-1.6.0/sadump_info.c ++++ b/makedumpfile-1.6.0/sadump_info.c +@@ -213,6 +213,8 @@ sadump_copy_1st_bitmap_from_memory(void) + char buf[si->sh_memory->block_size]; + off_t offset_page; + unsigned long bitmap_offset, bitmap_len; ++ mdf_pfn_t pfn, pfn_bitmap1; ++ extern mdf_pfn_t pfn_memhole; + + bitmap_offset = si->sub_hdr_offset + sh->block_size*sh->sub_hdr_size; + bitmap_len = sh->block_size * sh->bitmap_blocks; +@@ -250,6 +252,13 @@ sadump_copy_1st_bitmap_from_memory(void) + offset_page += sizeof(buf); + } + ++ pfn_bitmap1 = 0; ++ for (pfn = 0; pfn < info->max_mapnr; ++pfn) { ++ if (sadump_is_ram(pfn)) ++ pfn_bitmap1++; ++ } ++ pfn_memhole = info->max_mapnr - pfn_bitmap1; ++ + /* + * kdump uses the first 640kB on the 2nd kernel. But both + * bitmaps should reflect the 1st kernel memory situation. We +-- +2.5.5 + diff --git a/SOURCES/kexec-tools-2.0.8-arm64-prefer-reading-memory-ranges-from-iomem-over-f.patch b/SOURCES/kexec-tools-2.0.8-arm64-prefer-reading-memory-ranges-from-iomem-over-f.patch new file mode 100644 index 0000000..5aedb3c --- /dev/null +++ b/SOURCES/kexec-tools-2.0.8-arm64-prefer-reading-memory-ranges-from-iomem-over-f.patch @@ -0,0 +1,42 @@ +From edc4648e608533e05f323b5682ab98ebd37eacca Mon Sep 17 00:00:00 2001 +Message-Id: <edc4648e608533e05f323b5682ab98ebd37eacca.1469447235.git.panand@redhat.com> +From: Pratyush Anand <panand@redhat.com> +Date: Thu, 30 Jun 2016 23:16:18 +0530 +Subject: [PATCH] arm64: prefer reading memory ranges from iomem over fdt + +Some of the fdt might not have correct memory ranges defined in "memory" +nodes. For example: apm-mustang.dts expects boot loader to update "memory" +node with appropriate value. + +Now, what if boot loader /firmware does not update it. Offcourse, its an +issue in firmware. But, since we will always have more updated memory +ranges in /proc/iomem, so prefer to read it from there. + +Specifically, after kernel commit 500899c2cc3e3f06140373b587a69d30650f2d9d, +it becomes important to work kexec with such buggy firmware. + +Signed-off-by: Pratyush Anand <panand@redhat.com> +--- + kexec/arch/arm64/kexec-arm64.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c +index f936dd2de458..d1fdd64a60c2 100644 +--- a/kexec/arch/arm64/kexec-arm64.c ++++ b/kexec/arch/arm64/kexec-arm64.c +@@ -1016,10 +1016,10 @@ int get_memory_ranges(struct memory_range **range, int *ranges, + unsigned int count; + int result; + +- result = get_memory_ranges_dt(array, &count); ++ result = get_memory_ranges_iomem(array, &count); + + if (result) +- result = get_memory_ranges_iomem(array, &count); ++ result = get_memory_ranges_dt(array, &count); + + *range = result ? NULL : array; + *ranges = result ? 0 : count; +-- +2.5.5 + diff --git a/SOURCES/kexec-tools-2.0.8-fs2dt.c-move-copy-old-root-param-as-a-new-function.patch b/SOURCES/kexec-tools-2.0.8-fs2dt.c-move-copy-old-root-param-as-a-new-function.patch new file mode 100644 index 0000000..0f38093 --- /dev/null +++ b/SOURCES/kexec-tools-2.0.8-fs2dt.c-move-copy-old-root-param-as-a-new-function.patch @@ -0,0 +1,129 @@ +From a1ae68d19b6e3534ead0aab04ca84de24962def7 Mon Sep 17 00:00:00 2001 +From: "dyoung@redhat.com" <dyoung@redhat.com> +Date: Wed, 28 Oct 2015 13:41:35 +0800 +Subject: [PATCH 1/3] fs2dt.c: move copy old root param as a new function + +Split the copy old root param code to a new function dt_copy_old_root_param +Also add a global variable dt_no_old_root, do not copy root param when +dt_no_old_root == 1. It will be used in later patches. + +Signed-off-by: Dave Young <dyoung@redhat.com> +Signed-off-by: Simon Horman <horms@verge.net.au> +--- + kexec/fs2dt.c | 66 ++++++++++++++++++++++++++++++++++++----------------------- + kexec/fs2dt.h | 1 + + 2 files changed, 41 insertions(+), 26 deletions(-) + +diff --git a/kexec/fs2dt.c b/kexec/fs2dt.c +index d73e144..0ea785f 100644 +--- a/kexec/fs2dt.c ++++ b/kexec/fs2dt.c +@@ -53,6 +53,7 @@ extern unsigned char reuse_initrd; + /* Used for enabling printing message from purgatory code + * Only has implemented for PPC64 */ + int my_debug; ++int dt_no_old_root; + + /* This provides the behaviour of hte existing ppc64 implementation */ + static void pad_structure_block(size_t len) { +@@ -511,6 +512,37 @@ static int comparefunc(const struct dirent **dentry1, + return strcmp(str1, str2); + } + ++/* grab root= from the old command line */ ++static void dt_copy_old_root_param(void) ++{ ++ FILE *fp; ++ char filename[MAXPATH]; ++ char *last_cmdline = NULL; ++ char *p, *old_param; ++ size_t len = 0; ++ ++ strcpy(filename, pathname); ++ strcat(filename, "bootargs"); ++ fp = fopen(filename, "r"); ++ if (fp) { ++ if (getline(&last_cmdline, &len, fp) == -1) ++ die("unable to read %s\n", filename); ++ ++ p = strstr(last_cmdline, "root="); ++ if (p) { ++ old_param = strtok(p, " "); ++ len = strlen(local_cmdline); ++ if (len != 0) ++ strcat(local_cmdline, " "); ++ strcat(local_cmdline, old_param); ++ } ++ } ++ if (last_cmdline) ++ free(last_cmdline); ++ ++ fclose(fp); ++} ++ + /* + * put a node (directory) in the property structure. first properties + * then children. +@@ -579,8 +611,11 @@ static void putnode(void) + reserve(initrd_base, initrd_size); + } + +- /* Add cmdline to the second kernel. Check to see if the new +- * cmdline has a root=. If not, use the old root= cmdline. */ ++ /* ++ * Add cmdline to the second kernel. Use the old root= cmdline if there ++ * is no root= in the new command line and there's no --dt-no-old-root ++ * option being used. ++ */ + if (!strcmp(basename,"chosen/")) { + size_t result; + size_t cmd_len = 0; +@@ -598,30 +633,9 @@ static void putnode(void) + param = strstr(local_cmdline, "root="); + } + +- /* ... if not, grab root= from the old command line */ +- if (!param) { +- FILE *fp; +- char *last_cmdline = NULL; +- char *old_param; +- +- strcpy(filename, pathname); +- strcat(filename, "bootargs"); +- fp = fopen(filename, "r"); +- if (fp) { +- if (getline(&last_cmdline, &cmd_len, fp) == -1) +- die("unable to read %s\n", filename); +- +- param = strstr(last_cmdline, "root="); +- if (param) { +- old_param = strtok(param, " "); +- if (cmd_len != 0) +- strcat(local_cmdline, " "); +- strcat(local_cmdline, old_param); +- } +- } +- if (last_cmdline) +- free(last_cmdline); +- } ++ if (!param && !dt_no_old_root) ++ dt_copy_old_root_param(); ++ + strcat(local_cmdline, " "); + cmd_len = strlen(local_cmdline); + cmd_len = cmd_len + 1; +diff --git a/kexec/fs2dt.h b/kexec/fs2dt.h +index 6c5c3b2..7633273 100644 +--- a/kexec/fs2dt.h ++++ b/kexec/fs2dt.h +@@ -31,6 +31,7 @@ extern struct bootblock bb[1]; + /* Used for enabling printing message from purgatory code + * Only has implemented for PPC64 */ + int my_debug; ++extern int dt_no_old_root; + + void reserve(unsigned long long where, unsigned long long length); + void create_flatten_tree(char **, off_t *, const char *); +-- +2.5.0 + diff --git a/SOURCES/kexec-tools-2.0.8-makedumpfile-Add-module-of-calculating-start_pfn-and.patch b/SOURCES/kexec-tools-2.0.8-makedumpfile-Add-module-of-calculating-start_pfn-and.patch deleted file mode 100644 index c4e7676..0000000 --- a/SOURCES/kexec-tools-2.0.8-makedumpfile-Add-module-of-calculating-start_pfn-and.patch +++ /dev/null @@ -1,146 +0,0 @@ -Return-Path: yishimat@redhat.com -Received: from zmta04.collab.prod.int.phx2.redhat.com (LHLO - zmta04.collab.prod.int.phx2.redhat.com) (10.5.81.11) by - zmail24.collab.prod.int.phx2.redhat.com with LMTP; Thu, 2 Jul 2015 01:09:57 - -0400 (EDT) -Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) - by zmta04.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 29864DA114; - Thu, 2 Jul 2015 01:09:57 -0400 (EDT) -Received: from [10.3.112.13] ([10.3.112.13]) - by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6259s7J004916; - Thu, 2 Jul 2015 01:09:55 -0400 -Subject: [RHEL7.2 PATCH resend v3 4/5] Add module of calculating start_pfn and - end_pfn in each dumpfile. -To: kexec-kdump-list@redhat.com -References: <55929D94.4020500@redhat.com> <5594C62C.3030407@redhat.com> -Cc: Minfei Huang <mhuang@redhat.com>, bhe@redhat.com, yishimat@redhat.com -From: Yasuaki Ishimatsu <yishimat@redhat.com> -Message-ID: <5594C7A1.6020609@redhat.com> -Date: Thu, 2 Jul 2015 01:09:53 -0400 -User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 - Thunderbird/38.0.1 -MIME-Version: 1.0 -In-Reply-To: <5594C62C.3030407@redhat.com> -Content-Type: text/plain; charset=utf-8 -Content-Transfer-Encoding: 7bit -X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 -Content-Length: 3398 - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1182379 - -The patch is back ported directory from the following upstream commit: - -commit 2b74c02081fa0777c8cfb336adb63d9ccb2b46dd -Author: Zhou Wenjian <zhouwj-fnst@cn.fujitsu.com> -Date: Fri Nov 7 09:44:56 2014 +0900 - - [PATCH v5 4/5] Add module of calculating start_pfn and end_pfn in each - - When --split is specified in cyclic mode, start_pfn and end_pfn of each - will be calculated to make each dumpfile have the same size. - - Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com> - Signed-off-by: Zhou Wenjian <zhouwj-fnst@cn.fujitsu.com> - -Resolves: rhbz#1182379 -Signed-off-by: Yasuaki Ishimatsu <yishimat@redhat.com> - ---- - makedumpfile-1.5.7/makedumpfile.c | 73 ++++++++++++++++++++++++++++++++++--- - 1 files changed, 68 insertions(+), 5 deletions(-) - -diff --git a/makedumpfile-1.5.7/makedumpfile.c b/makedumpfile-1.5.7/makedumpfile.c -index 5ffe8e1..c4309af 100644 ---- a/makedumpfile-1.5.7/makedumpfile.c -+++ b/makedumpfile-1.5.7/makedumpfile.c -@@ -8218,6 +8218,65 @@ out: - return ret; - } - -+/* -+ * calculate end_pfn of one dumpfile. -+ * try to make every output file have the same size. -+ * splitblock_table is used to reduce calculate time. -+ */ -+ -+#define CURRENT_SPLITBLOCK_PFN_NUM (*cur_splitblock_num * splitblock->page_per_splitblock) -+mdf_pfn_t -+calculate_end_pfn_by_splitblock(mdf_pfn_t start_pfn, -+ int *cur_splitblock_num) -+{ -+ if (start_pfn >= info->max_mapnr) -+ return info->max_mapnr; -+ -+ mdf_pfn_t end_pfn; -+ long long pfn_needed, offset; -+ char *splitblock_value_offset; -+ -+ pfn_needed = info->num_dumpable / info->num_dumpfile; -+ offset = *cur_splitblock_num * splitblock->entry_size; -+ splitblock_value_offset = splitblock->table + offset; -+ end_pfn = start_pfn; -+ -+ while (*cur_splitblock_num < splitblock->num && pfn_needed > 0) { -+ pfn_needed -= read_from_splitblock_table(splitblock_value_offset); -+ splitblock_value_offset += splitblock->entry_size; -+ ++*cur_splitblock_num; -+ } -+ -+ end_pfn = CURRENT_SPLITBLOCK_PFN_NUM; -+ if (end_pfn > info->max_mapnr) -+ end_pfn = info->max_mapnr; -+ -+ return end_pfn; -+} -+ -+/* -+ * calculate start_pfn and end_pfn in each output file. -+ */ -+static int setup_splitting_cyclic(void) -+{ -+ int i; -+ mdf_pfn_t start_pfn, end_pfn; -+ int cur_splitblock_num = 0; -+ start_pfn = end_pfn = 0; -+ -+ for (i = 0; i < info->num_dumpfile - 1; i++) { -+ start_pfn = end_pfn; -+ end_pfn = calculate_end_pfn_by_splitblock(start_pfn, -+ &cur_splitblock_num); -+ SPLITTING_START_PFN(i) = start_pfn; -+ SPLITTING_END_PFN(i) = end_pfn; -+ } -+ SPLITTING_START_PFN(info->num_dumpfile - 1) = end_pfn; -+ SPLITTING_END_PFN(info->num_dumpfile - 1) = info->max_mapnr; -+ -+ return TRUE; -+} -+ - int - setup_splitting(void) - { -@@ -8231,12 +8290,16 @@ setup_splitting(void) - return FALSE; - - if (info->flag_cyclic) { -- for (i = 0; i < info->num_dumpfile; i++) { -- SPLITTING_START_PFN(i) = divideup(info->max_mapnr, info->num_dumpfile) * i; -- SPLITTING_END_PFN(i) = divideup(info->max_mapnr, info->num_dumpfile) * (i + 1); -+ int ret = FALSE; -+ -+ if (!prepare_bitmap2_buffer_cyclic()) { -+ free_bitmap_buffer(); -+ return ret; - } -- if (SPLITTING_END_PFN(i-1) > info->max_mapnr) -- SPLITTING_END_PFN(i-1) = info->max_mapnr; -+ ret = setup_splitting_cyclic(); -+ free_bitmap2_buffer_cyclic(); -+ -+ return ret; - } else { - initialize_2nd_bitmap(&bitmap2); - --- -1.7.1 - diff --git a/SOURCES/kexec-tools-2.0.8-makedumpfile-Add-module-of-generating-table.patch b/SOURCES/kexec-tools-2.0.8-makedumpfile-Add-module-of-generating-table.patch deleted file mode 100644 index f6e4115..0000000 --- a/SOURCES/kexec-tools-2.0.8-makedumpfile-Add-module-of-generating-table.patch +++ /dev/null @@ -1,219 +0,0 @@ -Return-Path: yishimat@redhat.com -Received: from zmta05.collab.prod.int.phx2.redhat.com (LHLO - zmta05.collab.prod.int.phx2.redhat.com) (10.5.81.12) by - zmail24.collab.prod.int.phx2.redhat.com with LMTP; Thu, 2 Jul 2015 01:08:58 - -0400 (EDT) -Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) - by zmta05.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 6922D17C114; - Thu, 2 Jul 2015 01:08:58 -0400 (EDT) -Received: from [10.3.112.13] ([10.3.112.13]) - by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6258t32026109; - Thu, 2 Jul 2015 01:08:56 -0400 -Subject: [RHEL7.2 PATCH resend v3 3/5] Add module of generating table. -To: kexec-kdump-list@redhat.com -References: <55929D94.4020500@redhat.com> <5594C62C.3030407@redhat.com> -Cc: Minfei Huang <mhuang@redhat.com>, bhe@redhat.com, yishimat@redhat.com -From: Yasuaki Ishimatsu <yishimat@redhat.com> -Message-ID: <5594C766.5010801@redhat.com> -Date: Thu, 2 Jul 2015 01:08:54 -0400 -User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 - Thunderbird/38.0.1 -MIME-Version: 1.0 -In-Reply-To: <5594C62C.3030407@redhat.com> -Content-Type: text/plain; charset=utf-8 -Content-Transfer-Encoding: 7bit -X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 -Content-Length: 5064 - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1182379 - -The patch is back ported directory from the following upstream commit: - -commit 28e367cb78258e5d8d89edc5435804495661d1a3 -Author: Zhou Wenjian <zhouwj-fnst@cn.fujitsu.com> -Date: Fri Nov 7 09:43:26 2014 +0900 - - [PATCH v5 3/5] Add module of generating table. - - Set block size and generate basic information of block table. - - Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com> - Signed-off-by: Zhou Wenjian <zhouwj-fnst@cn.fujitsu.com> - -Resolves: rhbz#1182379 -Signed-off-by: Yasuaki Ishimatsu <yishimat@redhat.com> - ---- - makedumpfile-1.5.7/makedumpfile.c | 109 ++++++++++++++++++++++++++++++++++++- - makedumpfile-1.5.7/makedumpfile.h | 4 ++ - 2 files changed, 112 insertions(+), 1 deletions(-) - -diff --git a/makedumpfile-1.5.7/makedumpfile.c b/makedumpfile-1.5.7/makedumpfile.c -index 4d2f077..5ffe8e1 100644 ---- a/makedumpfile-1.5.7/makedumpfile.c -+++ b/makedumpfile-1.5.7/makedumpfile.c -@@ -5208,7 +5208,14 @@ create_dump_bitmap(void) - if (info->flag_cyclic) { - if (!prepare_bitmap2_buffer_cyclic()) - goto out; -- info->num_dumpable = get_num_dumpable_cyclic(); -+ if (info->flag_split) { -+ if (!prepare_splitblock_table()) -+ goto out; -+ -+ info->num_dumpable = get_num_dumpable_cyclic_withsplit(); -+ } else { -+ info->num_dumpable = get_num_dumpable_cyclic(); -+ } - - if (!info->flag_elf_dumpfile) - free_bitmap2_buffer_cyclic(); -@@ -5745,6 +5752,61 @@ read_from_splitblock_table(char *entry) - return value; - } - -+/* -+ * The splitblock size is specified as Kbyte with --splitblock-size <size> option. -+ * If not specified, set default value. -+ */ -+int -+check_splitblock_size(void) -+{ -+ if (info->splitblock_size) { -+ info->splitblock_size <<= 10; -+ if (info->splitblock_size == 0) { -+ ERRMSG("The splitblock size could not be 0. %s.\n", -+ strerror(errno)); -+ return FALSE; -+ } -+ if (info->splitblock_size % info->page_size != 0) { -+ ERRMSG("The splitblock size must be align to page_size. %s.\n", -+ strerror(errno)); -+ return FALSE; -+ } -+ } else { -+ info->splitblock_size = DEFAULT_SPLITBLOCK_SIZE; -+ } -+ -+ return TRUE; -+} -+ -+int -+prepare_splitblock_table(void) -+{ -+ size_t table_size; -+ -+ if (!check_splitblock_size()) -+ return FALSE; -+ -+ if ((splitblock = calloc(1, sizeof(struct SplitBlock))) == NULL) { -+ ERRMSG("Can't allocate memory for the splitblock. %s.\n", -+ strerror(errno)); -+ return FALSE; -+ } -+ -+ splitblock->page_per_splitblock = info->splitblock_size / info->page_size; -+ splitblock->num = divideup(info->max_mapnr, splitblock->page_per_splitblock); -+ splitblock->entry_size = calculate_entry_size(); -+ table_size = splitblock->entry_size * splitblock->num; -+ -+ splitblock->table = (char *)calloc(sizeof(char), table_size); -+ if (!splitblock->table) { -+ ERRMSG("Can't allocate memory for the splitblock_table. %s.\n", -+ strerror(errno)); -+ return FALSE; -+ } -+ -+ return TRUE; -+} -+ - mdf_pfn_t - get_num_dumpable(void) - { -@@ -5760,6 +5822,45 @@ get_num_dumpable(void) - return num_dumpable; - } - -+/* -+ * generate splitblock_table -+ * modified from function get_num_dumpable_cyclic -+ */ -+mdf_pfn_t -+get_num_dumpable_cyclic_withsplit(void) -+{ -+ mdf_pfn_t pfn, num_dumpable = 0; -+ mdf_pfn_t dumpable_pfn_num = 0, pfn_num = 0; -+ struct cycle cycle = {0}; -+ int pos = 0; -+ -+ pfn_memhole = info->max_mapnr; -+ -+ for_each_cycle(0, info->max_mapnr, &cycle) { -+ if (!exclude_unnecessary_pages_cyclic(&cycle)) -+ return FALSE; -+ -+ if (info->flag_mem_usage) -+ exclude_zero_pages_cyclic(&cycle); -+ -+ for (pfn = cycle.start_pfn; pfn < cycle.end_pfn; pfn++) { -+ if (is_dumpable_cyclic(info->partial_bitmap2, pfn, &cycle)) { -+ num_dumpable++; -+ dumpable_pfn_num++; -+ } -+ if (++pfn_num >= splitblock->page_per_splitblock) { -+ write_into_splitblock_table(splitblock->table + pos, -+ dumpable_pfn_num); -+ pos += splitblock->entry_size; -+ pfn_num = 0; -+ dumpable_pfn_num = 0; -+ } -+ } -+ } -+ -+ return num_dumpable; -+} -+ - mdf_pfn_t - get_num_dumpable_cyclic(void) - { -@@ -9717,6 +9818,12 @@ out: - if (info->page_buf != NULL) - free(info->page_buf); - free(info); -+ -+ if (splitblock) { -+ if (splitblock->table) -+ free(splitblock->table); -+ free(splitblock); -+ } - } - free_elf_info(); - -diff --git a/makedumpfile-1.5.7/makedumpfile.h b/makedumpfile-1.5.7/makedumpfile.h -index a263631..f9d9332 100644 ---- a/makedumpfile-1.5.7/makedumpfile.h -+++ b/makedumpfile-1.5.7/makedumpfile.h -@@ -1178,6 +1178,8 @@ extern struct DumpInfo *info; - /* - * for cyclic_splitting mode,Manage memory by splitblock - */ -+#define DEFAULT_SPLITBLOCK_SIZE (1LL << 30) -+ - struct SplitBlock { - char *table; - long long num; -@@ -1888,9 +1890,11 @@ struct elf_prstatus { - * Function Prototype. - */ - mdf_pfn_t get_num_dumpable_cyclic(void); -+mdf_pfn_t get_num_dumpable_cyclic_withsplit(void); - int get_loads_dumpfile_cyclic(void); - int initial_xen(void); - unsigned long long get_free_memory_size(void); - int calculate_cyclic_buffer_size(void); -+int prepare_splitblock_table(void); - - #endif /* MAKEDUMPFILE_H */ --- -1.7.1 - diff --git a/SOURCES/kexec-tools-2.0.8-makedumpfile-Add-support-for-splitblock-size.patch b/SOURCES/kexec-tools-2.0.8-makedumpfile-Add-support-for-splitblock-size.patch deleted file mode 100644 index 31df8b8..0000000 --- a/SOURCES/kexec-tools-2.0.8-makedumpfile-Add-support-for-splitblock-size.patch +++ /dev/null @@ -1,128 +0,0 @@ -Return-Path: yishimat@redhat.com -Received: from zmta01.collab.prod.int.phx2.redhat.com (LHLO - zmta01.collab.prod.int.phx2.redhat.com) (10.5.81.8) by - zmail24.collab.prod.int.phx2.redhat.com with LMTP; Thu, 2 Jul 2015 01:10:45 - -0400 (EDT) -Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) - by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 5C0B61835A9; - Thu, 2 Jul 2015 01:10:45 -0400 (EDT) -Received: from [10.3.112.13] ([10.3.112.13]) - by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t625AhFu027595; - Thu, 2 Jul 2015 01:10:43 -0400 -Subject: [RHEL7.2 PATCH resend v3 5/5] Add support for --splitblock-size. -To: kexec-kdump-list@redhat.com -References: <55929D94.4020500@redhat.com> <5594C62C.3030407@redhat.com> -Cc: Minfei Huang <mhuang@redhat.com>, bhe@redhat.com, yishimat@redhat.com -From: Yasuaki Ishimatsu <yishimat@redhat.com> -Message-ID: <5594C7D2.8030300@redhat.com> -Date: Thu, 2 Jul 2015 01:10:42 -0400 -User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 - Thunderbird/38.0.1 -MIME-Version: 1.0 -In-Reply-To: <5594C62C.3030407@redhat.com> -Content-Type: text/plain; charset=utf-8 -Content-Transfer-Encoding: 7bit -X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 -Content-Length: 4028 - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1182379 - -The patch is back ported directory from the following upstream commit: - -commit 33521799757a52f0e97cbfb7c6a5e24de3b8cb50 -Author: Zhou Wenjian <zhouwj-fnst@cn.fujitsu.com> -Date: Fri Nov 7 09:45:04 2014 +0900 - - [PATCH v5 5/5] Add support for --splitblock-size. - - Use --splitblock-size to specify splitblock size (KB) - When --split is specified in cyclic mode,splitblock table will be - generated in create_dump_bitmap(). - - Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com> - Signed-off-by: Zhou Wenjian <zhouwj-fnst@cn.fujitsu.com> - -Resolves: rhbz#1182379 -Signed-off-by: Yasuaki Ishimatsu <yishimat@redhat.com> - ---- - makedumpfile-1.5.7/makedumpfile.8 | 10 ++++++++++ - makedumpfile-1.5.7/makedumpfile.c | 4 ++++ - makedumpfile-1.5.7/makedumpfile.h | 1 + - makedumpfile-1.5.7/print_info.c | 5 +++++ - 4 files changed, 20 insertions(+), 0 deletions(-) - -diff --git a/makedumpfile-1.5.7/makedumpfile.8 b/makedumpfile-1.5.7/makedumpfile.8 -index 9cb12c0..5e121fd 100644 ---- a/makedumpfile-1.5.7/makedumpfile.8 -+++ b/makedumpfile-1.5.7/makedumpfile.8 -@@ -386,6 +386,16 @@ size, so ordinary users don't need to specify this option. - # makedumpfile \-\-cyclic\-buffer 1024 \-d 31 \-x vmlinux /proc/vmcore dumpfile - - .TP -+\fB\-\-splitblock\-size\fR \fIsplitblock_size\fR -+Specify the splitblock size in kilo bytes for analysis in the cyclic mode with --split. -+If --splitblock N is specified, difference of each splitted dumpfile size is at most N -+kilo bytes. -+.br -+.B Example: -+.br -+# makedumpfile \-\-splitblock\-size 1024 \-d 31 \-x vmlinux \-\-split /proc/vmcore dumpfile1 dumpfile2 -+ -+.TP - \fB\-\-non\-cyclic\fR - Running in the non-cyclic mode, this mode uses the old filtering logic same as v1.4.4 or before. - If you feel the cyclic mode is too slow, please try this mode. -diff --git a/makedumpfile-1.5.7/makedumpfile.c b/makedumpfile-1.5.7/makedumpfile.c -index c4309af..f3e76c9 100644 ---- a/makedumpfile-1.5.7/makedumpfile.c -+++ b/makedumpfile-1.5.7/makedumpfile.c -@@ -9570,6 +9570,7 @@ static struct option longopts[] = { - {"eppic", required_argument, NULL, OPT_EPPIC}, - {"non-mmap", no_argument, NULL, OPT_NON_MMAP}, - {"mem-usage", no_argument, NULL, OPT_MEM_USAGE}, -+ {"splitblock-size", required_argument, NULL, OPT_SPLITBLOCK_SIZE}, - {0, 0, 0, 0} - }; - -@@ -9710,6 +9711,9 @@ main(int argc, char *argv[]) - case OPT_CYCLIC_BUFFER: - info->bufsize_cyclic = atoi(optarg); - break; -+ case OPT_SPLITBLOCK_SIZE: -+ info->splitblock_size = atoi(optarg); -+ break; - case '?': - MSG("Commandline parameter is invalid.\n"); - MSG("Try `makedumpfile --help' for more information.\n"); -diff --git a/makedumpfile-1.5.7/makedumpfile.h b/makedumpfile-1.5.7/makedumpfile.h -index f9d9332..0cb54a3 100644 ---- a/makedumpfile-1.5.7/makedumpfile.h -+++ b/makedumpfile-1.5.7/makedumpfile.h -@@ -1885,6 +1885,7 @@ struct elf_prstatus { - #define OPT_EPPIC OPT_START+12 - #define OPT_NON_MMAP OPT_START+13 - #define OPT_MEM_USAGE OPT_START+14 -+#define OPT_SPLITBLOCK_SIZE OPT_START+15 - - /* - * Function Prototype. -diff --git a/makedumpfile-1.5.7/print_info.c b/makedumpfile-1.5.7/print_info.c -index f6342d3..efdf578 100644 ---- a/makedumpfile-1.5.7/print_info.c -+++ b/makedumpfile-1.5.7/print_info.c -@@ -203,6 +203,11 @@ print_usage(void) - MSG(" By default, BUFFER_SIZE will be calculated automatically depending on\n"); - MSG(" system memory size, so ordinary users don't need to specify this option.\n"); - MSG("\n"); -+ MSG(" [--splitblock-size SPLITBLOCK_SIZE]:\n"); -+ MSG(" Specify the splitblock size in kilo bytes for analysis in the cyclic mode\n"); -+ MSG(" with --split. If --splitblock N is specified, difference of each splitted\n"); -+ MSG(" dumpfile size is at most N kilo bytes.\n"); -+ MSG("\n"); - MSG(" [--non-cyclic]:\n"); - MSG(" Running in the non-cyclic mode, this mode uses the old filtering logic\n"); - MSG(" same as v1.4.4 or before.\n"); --- -1.7.1 - diff --git a/SOURCES/kexec-tools-2.0.8-makedumpfile-Add-support-for-splitblock.patch b/SOURCES/kexec-tools-2.0.8-makedumpfile-Add-support-for-splitblock.patch deleted file mode 100644 index 12e0514..0000000 --- a/SOURCES/kexec-tools-2.0.8-makedumpfile-Add-support-for-splitblock.patch +++ /dev/null @@ -1,146 +0,0 @@ -Return-Path: yishimat@redhat.com -Received: from zmta05.collab.prod.int.phx2.redhat.com (LHLO - zmta05.collab.prod.int.phx2.redhat.com) (10.5.81.12) by - zmail24.collab.prod.int.phx2.redhat.com with LMTP; Thu, 2 Jul 2015 01:06:36 - -0400 (EDT) -Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) - by zmta05.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 9A5FA17C114; - Thu, 2 Jul 2015 01:06:36 -0400 (EDT) -Received: from [10.3.112.13] ([10.3.112.13]) - by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6256Wbm025889; - Thu, 2 Jul 2015 01:06:33 -0400 -Subject: [RHEL7.2 PATCH resend v3 1/5] Add support for splitblock. -To: kexec-kdump-list@redhat.com -References: <55929D94.4020500@redhat.com> <5594C62C.3030407@redhat.com> -Cc: Minfei Huang <mhuang@redhat.com>, bhe@redhat.com, yishimat@redhat.com -From: Yasuaki Ishimatsu <yishimat@redhat.com> -Message-ID: <5594C6D8.5060601@redhat.com> -Date: Thu, 2 Jul 2015 01:06:32 -0400 -User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 - Thunderbird/38.0.1 -MIME-Version: 1.0 -In-Reply-To: <5594C62C.3030407@redhat.com> -Content-Type: text/plain; charset=utf-8 -Content-Transfer-Encoding: 7bit -X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 -Content-Length: 3498 - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1182379 - -The patch is back ported directory from the following upstream commit: - -commit c7825d45999daf09bd89a08d08219261023dcf11 -Author: Zhou Wenjian <zhouwj-fnst@cn.fujitsu.com> -Date: Fri Nov 7 09:42:18 2014 +0900 - - [PATCH v5 1/5] Add support for splitblock. - - When --split option is specified, fair I/O workloads shoud be assigned - for each process. So the start and end pfn of each dumpfile should be - calculated with excluding unnecessary pages. However, it costs a lot of - time to execute excluding for the whole memory. That is why struct - SplitBlock exists. Struct SplitBlock is designed to manage memory, main - for recording the number of dumpable pages. We can use the number of - dumpable pages to calculate start and end pfn instead of execute exclud - for the whole memory. - - The char array *table in struct SplitBlock is used to record the number - dumpable pages. - The table entry size is calculated as - divideup(log2(splitblock_size / page_size), 8) - The table entry size is calculated, so that the - space table taken will be small enough. And the code will also have a - good performence when the number of pages in one splitblock is big enou - - Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com> - Signed-off-by: Zhou Wenjian <zhouwj-fnst@cn.fujitsu.com> - -Resolves: rhbz#1182379 -Signed-off-by: Yasuaki Ishimatsu <yishimat@redhat.com> - ---- - makedumpfile-1.5.7/makedumpfile.c | 31 +++++++++++++++++++++++++++++++ - makedumpfile-1.5.7/makedumpfile.h | 14 ++++++++++++++ - 2 files changed, 45 insertions(+), 0 deletions(-) - -diff --git a/makedumpfile-1.5.7/makedumpfile.c b/makedumpfile-1.5.7/makedumpfile.c -index b4d43d8..a4c3eee 100644 ---- a/makedumpfile-1.5.7/makedumpfile.c -+++ b/makedumpfile-1.5.7/makedumpfile.c -@@ -34,6 +34,7 @@ struct srcfile_table srcfile_table; - - struct vm_table vt = { 0 }; - struct DumpInfo *info = NULL; -+struct SplitBlock *splitblock = NULL; - - char filename_stdout[] = FILENAME_STDOUT; - -@@ -5685,6 +5686,36 @@ out: - return ret; - } - -+/* -+ * cyclic_split mode: -+ * manage memory by splitblocks, -+ * divide memory into splitblocks -+ * use splitblock_table to record numbers of dumpable pages in each -+ * splitblock -+ */ -+ -+/* -+ * calculate entry size based on the amount of pages in one splitblock -+ */ -+int -+calculate_entry_size(void) -+{ -+ int entry_num = 1; -+ int count = 1; -+ int entry_size; -+ -+ while (entry_num < splitblock->page_per_splitblock) { -+ entry_num = entry_num << 1; -+ count++; -+ } -+ -+ entry_size = count / BITPERBYTE; -+ if (count % BITPERBYTE) -+ entry_size++; -+ -+ return entry_size; -+} -+ - mdf_pfn_t - get_num_dumpable(void) - { -diff --git a/makedumpfile-1.5.7/makedumpfile.h b/makedumpfile-1.5.7/makedumpfile.h -index 96830b0..a263631 100644 ---- a/makedumpfile-1.5.7/makedumpfile.h -+++ b/makedumpfile-1.5.7/makedumpfile.h -@@ -1168,10 +1168,24 @@ struct DumpInfo { - */ - int (*page_is_buddy)(unsigned long flags, unsigned int _mapcount, - unsigned long private, unsigned int _count); -+ /* -+ * for cyclic_splitting mode, setup splitblock_size -+ */ -+ long long splitblock_size; - }; - extern struct DumpInfo *info; - - /* -+ * for cyclic_splitting mode,Manage memory by splitblock -+ */ -+struct SplitBlock { -+ char *table; -+ long long num; -+ long long page_per_splitblock; -+ int entry_size; /* counted by byte */ -+}; -+ -+/* - * kernel VM-related data - */ - struct vm_table { --- -1.7.1 - diff --git a/SOURCES/kexec-tools-2.0.8-makedumpfile-Add-tools-for-reading-and-writing-from-.patch b/SOURCES/kexec-tools-2.0.8-makedumpfile-Add-tools-for-reading-and-writing-from-.patch deleted file mode 100644 index cd5a144..0000000 --- a/SOURCES/kexec-tools-2.0.8-makedumpfile-Add-tools-for-reading-and-writing-from-.patch +++ /dev/null @@ -1,94 +0,0 @@ -Return-Path: yishimat@redhat.com -Received: from zmta05.collab.prod.int.phx2.redhat.com (LHLO - zmta05.collab.prod.int.phx2.redhat.com) (10.5.81.12) by - zmail24.collab.prod.int.phx2.redhat.com with LMTP; Thu, 2 Jul 2015 01:08:13 - -0400 (EDT) -Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) - by zmta05.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 7D03B17C114; - Thu, 2 Jul 2015 01:08:13 -0400 (EDT) -Received: from [10.3.112.13] ([10.3.112.13]) - by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6258AD6015893; - Thu, 2 Jul 2015 01:08:11 -0400 -Subject: [RHEL7.2 PATCH resend v3 2/5] Add tools for reading and writing from - splitblock table. -To: kexec-kdump-list@redhat.com -References: <55929D94.4020500@redhat.com> <5594C62C.3030407@redhat.com> -Cc: Minfei Huang <mhuang@redhat.com>, bhe@redhat.com, yishimat@redhat.com -From: Yasuaki Ishimatsu <yishimat@redhat.com> -Message-ID: <5594C73A.6080509@redhat.com> -Date: Thu, 2 Jul 2015 01:08:10 -0400 -User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 - Thunderbird/38.0.1 -MIME-Version: 1.0 -In-Reply-To: <5594C62C.3030407@redhat.com> -Content-Type: text/plain; charset=utf-8 -Content-Transfer-Encoding: 7bit -X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 -Content-Length: 1602 - -Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1182379 - -The patch is back ported directory from the following upstream commit: - -commit 11dcbfe2ebd1dec37c3a00dc8ee522504c7ed35c -Author: Zhou Wenjian <zhouwj-fnst@cn.fujitsu.com> -Date: Fri Nov 7 09:42:25 2014 +0900 - - [PATCH v5 2/5] Add tools for reading and writing from splitblock table. - - gdded in this patch, is used for writing and reading value - from the char array in struct SplitBlock. - - Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com> - Signed-off-by: Zhou Wenjian <zhouwj-fnst@cn.fujitsu.com> - -Resolves: rhbz#1182379 -Signed-off-by: Yasuaki Ishimatsu <yishimat@redhat.com> - ---- - makedumpfile-1.5.7/makedumpfile.c | 29 +++++++++++++++++++++++++++++ - 1 files changed, 29 insertions(+), 0 deletions(-) - -diff --git a/makedumpfile-1.5.7/makedumpfile.c b/makedumpfile-1.5.7/makedumpfile.c -index a4c3eee..4d2f077 100644 ---- a/makedumpfile-1.5.7/makedumpfile.c -+++ b/makedumpfile-1.5.7/makedumpfile.c -@@ -5716,6 +5716,35 @@ calculate_entry_size(void) - return entry_size; - } - -+void -+write_into_splitblock_table(char *entry, -+ unsigned long long value) -+{ -+ char temp; -+ int i = 0; -+ -+ while (i++ < splitblock->entry_size) { -+ temp = value & 0xff; -+ value = value >> BITPERBYTE; -+ *entry = temp; -+ entry++; -+ } -+} -+ -+unsigned long long -+read_from_splitblock_table(char *entry) -+{ -+ unsigned long long value = 0; -+ int i; -+ -+ for (i = splitblock->entry_size; i > 0; i--) { -+ value = value << BITPERBYTE; -+ value += *(entry + i - 1) & 0xff; -+ } -+ -+ return value; -+} -+ - mdf_pfn_t - get_num_dumpable(void) - { --- -1.7.1 - diff --git a/SOURCES/kexec-tools-2.0.8-makedumpfile-Fix-reassemble_kdump_header.patch b/SOURCES/kexec-tools-2.0.8-makedumpfile-Fix-reassemble_kdump_header.patch deleted file mode 100644 index 39c5c48..0000000 --- a/SOURCES/kexec-tools-2.0.8-makedumpfile-Fix-reassemble_kdump_header.patch +++ /dev/null @@ -1,73 +0,0 @@ -Return-Path: yishimat@redhat.com -Received: from zmta02.collab.prod.int.phx2.redhat.com (LHLO - zmta02.collab.prod.int.phx2.redhat.com) (10.5.81.9) by - zmail24.collab.prod.int.phx2.redhat.com with LMTP; Thu, 2 Jul 2015 01:16:42 - -0400 (EDT) -Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) - by zmta02.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 9997C122359; - Thu, 2 Jul 2015 01:16:42 -0400 (EDT) -Received: from [10.3.112.13] ([10.3.112.13]) - by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t625Geo3028836; - Thu, 2 Jul 2015 01:16:41 -0400 -Subject: [RHEL7.2 PATCH resend v3 4/4] Fix reassemble_kdump_header(). -To: kexec-kdump-list@redhat.com -References: <55929BD5.7050709@redhat.com> <5594C856.6050503@redhat.com> -Cc: Minfei Huang <mhuang@redhat.com>, bhe@redhat.com, yishimat@redhat.com -From: Yasuaki Ishimatsu <yishimat@redhat.com> -Message-ID: <5594C937.2060303@redhat.com> -Date: Thu, 2 Jul 2015 01:16:39 -0400 -User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 - Thunderbird/38.0.1 -MIME-Version: 1.0 -In-Reply-To: <5594C856.6050503@redhat.com> -Content-Type: text/plain; charset=utf-8 -Content-Transfer-Encoding: 7bit -X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 -Content-Length: 1349 - -https://bugzilla.redhat.com/show_bug.cgi?id=1182377 - -The patch is back ported directory from the following upstream commit: - -commit 45a1885e747c3833d5df770d0f2c5571a838f55a -Author: Zhou Wenjian <zhouwj-fnst@cn.fujitsu.com> -Date: Mon Oct 20 13:40:10 2014 +0900 - - [PATCH v4 4/4] Fix reassemble_kdump_header(). - - Fix it to take over incomplete flags of all dump file. - - Singed-of-by: Zhou Wenjian <zhouwj-fnst@cn.fujitsu.com> - -Resolves: rhbz#1182377 -Signed-off-by: Yasuaki Ishimatsu <yishimat@redhat.com> -Acked-by: Minfei Huang <mhuang@redhat.com> - ---- - makedumpfile-1.5.7/makedumpfile.c | 10 ++++++++-- - 1 files changed, 8 insertions(+), 2 deletions(-) - -diff --git a/makedumpfile-1.5.7/makedumpfile.c b/makedumpfile-1.5.7/makedumpfile.c -index 4dba83e..f072069 100644 ---- a/makedumpfile-1.5.7/makedumpfile.c -+++ b/makedumpfile-1.5.7/makedumpfile.c -@@ -8695,8 +8695,14 @@ reassemble_kdump_header(void) - /* - * Write common header. - */ -- if (!read_disk_dump_header(&dh, SPLITTING_DUMPFILE(0))) -- return FALSE; -+ int i; -+ for ( i = 0; i < info->num_dumpfile; i++){ -+ if (!read_disk_dump_header(&dh, SPLITTING_DUMPFILE(i))) -+ return FALSE; -+ int status = dh.status & DUMP_DH_COMPRESSED_INCOMPLETE; -+ if (status) -+ break; -+ } - - if (lseek(info->fd_dumpfile, 0x0, SEEK_SET) < 0) { - ERRMSG("Can't seek a file(%s). %s\n", --- -1.7.1 - diff --git a/SOURCES/kexec-tools-2.0.8-makedumpfile-Implementation-of-dealing-with-kdump-co.patch b/SOURCES/kexec-tools-2.0.8-makedumpfile-Implementation-of-dealing-with-kdump-co.patch deleted file mode 100644 index 2d56069..0000000 --- a/SOURCES/kexec-tools-2.0.8-makedumpfile-Implementation-of-dealing-with-kdump-co.patch +++ /dev/null @@ -1,184 +0,0 @@ -Return-Path: yishimat@redhat.com -Received: from zmta01.collab.prod.int.phx2.redhat.com (LHLO - zmta01.collab.prod.int.phx2.redhat.com) (10.5.81.8) by - zmail24.collab.prod.int.phx2.redhat.com with LMTP; Thu, 2 Jul 2015 01:15:32 - -0400 (EDT) -Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) - by zmta01.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id C144F1835B7; - Thu, 2 Jul 2015 01:15:32 -0400 (EDT) -Received: from [10.3.112.13] ([10.3.112.13]) - by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t625FTop028995; - Thu, 2 Jul 2015 01:15:30 -0400 -Subject: [RHEL7.2 PATCH resend v3 3/4] Implementation of dealing with - kdump-compressed dumpfile with ENOSPC error. -To: kexec-kdump-list@redhat.com -References: <55929BD5.7050709@redhat.com> <5594C856.6050503@redhat.com> -Cc: Minfei Huang <mhuang@redhat.com>, bhe@redhat.com, yishimat@redhat.com -From: Yasuaki Ishimatsu <yishimat@redhat.com> -Message-ID: <5594C8F1.3070006@redhat.com> -Date: Thu, 2 Jul 2015 01:15:29 -0400 -User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 - Thunderbird/38.0.1 -MIME-Version: 1.0 -In-Reply-To: <5594C856.6050503@redhat.com> -Content-Type: text/plain; charset=utf-8 -Content-Transfer-Encoding: 7bit -X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 -Content-Length: 4314 - -https://bugzilla.redhat.com/show_bug.cgi?id=1182377 - -The patch is back ported directory from the following upstream commit: - -commit 76025d3ca228affdd124b874b06d7a69573391e9 -Author: Wang Xiao <wangx.fnst@cn.fujitsu.com> -Date: Mon Oct 20 13:39:16 2014 +0900 - - [PATCH v4 3/4] Implementation of dealing with kdump-compressed dumpfile with ENOSPC error. - - kdump-compressed: - Dump the bitmap before any page header and page data. This format use - "status" of "disk_dump_header" to indicate that it has been modified. - - Signed-of-by: Wang Xiao <wangx.fnst@cn.fujitsu.com> - -Resolves: rhbz#1182377 -Signed-off-by: Yasuaki Ishimatsu <yishimat@redhat.com> -Acked-by: Minfei Huang <mhuang@redhat.com - ---- - makedumpfile-1.5.7/diskdump_mod.h | 2 + - makedumpfile-1.5.7/makedumpfile.c | 80 ++++++++++++++++++++++++++++++++++-- - 2 files changed, 77 insertions(+), 5 deletions(-) - -diff --git a/makedumpfile-1.5.7/diskdump_mod.h b/makedumpfile-1.5.7/diskdump_mod.h -index dd24eb2..275ed83 100644 ---- a/makedumpfile-1.5.7/diskdump_mod.h -+++ b/makedumpfile-1.5.7/diskdump_mod.h -@@ -95,6 +95,8 @@ struct kdump_sub_header { - #define DUMP_DH_COMPRESSED_LZO 0x2 /* paged is compressed with lzo */ - #define DUMP_DH_COMPRESSED_SNAPPY 0x4 - /* paged is compressed with snappy */ -+#define DUMP_DH_COMPRESSED_INCOMPLETE 0x8 -+ /* indicate an incomplete dumpfile */ - - /* descriptor of each page for vmcore */ - typedef struct page_desc { -diff --git a/makedumpfile-1.5.7/makedumpfile.c b/makedumpfile-1.5.7/makedumpfile.c -index 141d290..4dba83e 100644 ---- a/makedumpfile-1.5.7/makedumpfile.c -+++ b/makedumpfile-1.5.7/makedumpfile.c -@@ -3847,10 +3847,80 @@ out_close_file: - } - - int -+check_and_modify_kdump_headers(char *filename) { -+ int fd, ret = FALSE; -+ struct disk_dump_header dh; -+ -+ if (!read_disk_dump_header(&dh, filename)) -+ return FALSE; -+ -+ if ((fd = open(filename, O_RDWR)) < 0) { -+ ERRMSG("Can't open the dump file(%s). %s\n", -+ filename, strerror(errno)); -+ return FALSE; -+ } -+ -+ /* -+ * Set the incomplete flag to the status of disk_dump_header. -+ */ -+ dh.status |= DUMP_DH_COMPRESSED_INCOMPLETE; -+ -+ /* -+ * It's safe to overwrite the disk_dump_header. -+ */ -+ if (!write_buffer(fd, 0, &dh, sizeof(struct disk_dump_header), filename)) -+ goto out_close_file; -+ -+ ret = TRUE; -+out_close_file: -+ if (close(fd) < 0) { -+ ERRMSG("Can't close the dump file(%s). %s\n", -+ filename, strerror(errno)); -+ } -+ -+ return ret; -+} -+ -+int -+check_and_modify_multiple_kdump_headers() { -+ int i, status, ret = TRUE; -+ pid_t pid; -+ pid_t array_pid[info->num_dumpfile]; -+ -+ for (i = 0; i < info->num_dumpfile; i++) { -+ if ((pid = fork()) < 0) { -+ return FALSE; -+ -+ } else if (pid == 0) { /* Child */ -+ if (!check_and_modify_kdump_headers(SPLITTING_DUMPFILE(i))) -+ exit(1); -+ exit(0); -+ } -+ array_pid[i] = pid; -+ } -+ -+ for (i = 0; i < info->num_dumpfile; i++) { -+ waitpid(array_pid[i], &status, WUNTRACED); -+ if (!WIFEXITED(status) || WEXITSTATUS(status) == 1) { -+ ERRMSG("Check and modify the incomplete dumpfile(%s) failed.\n", -+ SPLITTING_DUMPFILE(i)); -+ ret = FALSE; -+ } -+ } -+ -+ return ret; -+} -+ -+int - check_and_modify_headers() - { - if (info->flag_elf_dumpfile) - return check_and_modify_elf_headers(info->name_dumpfile); -+ else -+ if(info->flag_split) -+ return check_and_modify_multiple_kdump_headers(); -+ else -+ return check_and_modify_kdump_headers(info->name_dumpfile); - return FALSE; - } - -@@ -7123,11 +7193,11 @@ write_kdump_pages_and_bitmap_cyclic(struct cache_data *cd_header, struct cache_d - if (!exclude_unnecessary_pages_cyclic(&cycle)) - return FALSE; - -- if (!write_kdump_pages_cyclic(cd_header, cd_page, &pd_zero, -- &offset_data, &cycle)) -+ if (!write_kdump_bitmap2_cyclic(&cycle)) - return FALSE; - -- if (!write_kdump_bitmap2_cyclic(&cycle)) -+ if (!write_kdump_pages_cyclic(cd_header, cd_page, &pd_zero, -+ &offset_data, &cycle)) - return FALSE; - } - -@@ -8127,12 +8197,12 @@ writeout_dumpfile(void) - } else { - if (!write_kdump_header()) - goto out; -+ if (!write_kdump_bitmap()) -+ goto out; - if (!write_kdump_pages(&cd_header, &cd_page)) - goto out; - if (!write_kdump_eraseinfo(&cd_page)) - goto out; -- if (!write_kdump_bitmap()) -- goto out; - } - if (info->flag_flatten) { - if (!write_end_flat_header()) --- -1.7.1 - diff --git a/SOURCES/kexec-tools-2.0.8-makedumpfile-Make-get_elf64_phdr-get_elf32_phdr-publ.patch b/SOURCES/kexec-tools-2.0.8-makedumpfile-Make-get_elf64_phdr-get_elf32_phdr-publ.patch deleted file mode 100644 index 5599dbc..0000000 --- a/SOURCES/kexec-tools-2.0.8-makedumpfile-Make-get_elf64_phdr-get_elf32_phdr-publ.patch +++ /dev/null @@ -1,160 +0,0 @@ -Return-Path: yishimat@redhat.com -Received: from zmta04.collab.prod.int.phx2.redhat.com (LHLO - zmta04.collab.prod.int.phx2.redhat.com) (10.5.81.11) by - zmail24.collab.prod.int.phx2.redhat.com with LMTP; Thu, 2 Jul 2015 01:14:06 - -0400 (EDT) -Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) - by zmta04.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 08529DA114; - Thu, 2 Jul 2015 01:14:06 -0400 (EDT) -Received: from [10.3.112.13] ([10.3.112.13]) - by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t625E1nH006506; - Thu, 2 Jul 2015 01:14:03 -0400 -Subject: [RHEL7.2 PATCH resend v3 1/4] Make get_elf64_phdr()/get_elf32_phdr() - public. -To: kexec-kdump-list@redhat.com -References: <55929BD5.7050709@redhat.com> <5594C856.6050503@redhat.com> -Cc: Minfei Huang <mhuang@redhat.com>, bhe@redhat.com, yishimat@redhat.com -From: Yasuaki Ishimatsu <yishimat@redhat.com> -Message-ID: <5594C899.1070106@redhat.com> -Date: Thu, 2 Jul 2015 01:14:01 -0400 -User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 - Thunderbird/38.0.1 -MIME-Version: 1.0 -In-Reply-To: <5594C856.6050503@redhat.com> -Content-Type: text/plain; charset=utf-8 -Content-Transfer-Encoding: 7bit -X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 -Content-Length: 3805 - -https://bugzilla.redhat.com/show_bug.cgi?id=1182377 - -The patch is back ported directory from the following upstream commit: - -commit 3182be907d27584cd04dfb03d0ec5bf7134da87f -Author: Wang Xiao <wangx.fnst@cn.fujitsu.com> -Date: Mon Oct 20 13:38:45 2014 +0900 - - [PATCH v4 1/4] Make get_elf64_phdr()/get_elf32_phdr() public. - - Move the following two functions from internal function to external - function. - - get_elf64_phdr(int fd, char *filename, int index, Elf64_Phdr *phdr) - get_elf32_phdr(int fd, char *filename, int index, Elf32_Phdr *phdr) - - Signed-of-by: Wang Xiao <wangx.fnst@cn.fujitsu.com> - -Resolves: rhbz#1182377 -Signed-off-by: Yasuaki Ishimatsu <yishimat@redhat.com> -Acked-by: Minfei Huang <mhuang@redhat.com> - ---- - makedumpfile-1.5.7/elf_info.c | 71 ++++++++++++++++++++--------------------- - makedumpfile-1.5.7/elf_info.h | 2 + - 2 files changed, 37 insertions(+), 36 deletions(-) - -diff --git a/makedumpfile-1.5.7/elf_info.c b/makedumpfile-1.5.7/elf_info.c -index 5be1990..24936d4 100644 ---- a/makedumpfile-1.5.7/elf_info.c -+++ b/makedumpfile-1.5.7/elf_info.c -@@ -95,42 +95,6 @@ static unsigned long size_xen_crash_info; - * Internal functions. - */ - static int --get_elf64_phdr(int fd, char *filename, int index, Elf64_Phdr *phdr) --{ -- off_t offset; -- -- offset = sizeof(Elf64_Ehdr) + sizeof(Elf64_Phdr) * index; -- -- if (lseek(fd, offset, SEEK_SET) < 0) { -- ERRMSG("Can't seek %s. %s\n", filename, strerror(errno)); -- return FALSE; -- } -- if (read(fd, phdr, sizeof(Elf64_Phdr)) != sizeof(Elf64_Phdr)) { -- ERRMSG("Can't read %s. %s\n", filename, strerror(errno)); -- return FALSE; -- } -- return TRUE; --} -- --static int --get_elf32_phdr(int fd, char *filename, int index, Elf32_Phdr *phdr) --{ -- off_t offset; -- -- offset = sizeof(Elf32_Ehdr) + sizeof(Elf32_Phdr) * index; -- -- if (lseek(fd, offset, SEEK_SET) < 0) { -- ERRMSG("Can't seek %s. %s\n", filename, strerror(errno)); -- return FALSE; -- } -- if (read(fd, phdr, sizeof(Elf32_Phdr)) != sizeof(Elf32_Phdr)) { -- ERRMSG("Can't read %s. %s\n", filename, strerror(errno)); -- return FALSE; -- } -- return TRUE; --} -- --static int - check_elf_format(int fd, char *filename, int *phnum, unsigned int *num_load) - { - int i; -@@ -446,6 +410,41 @@ int set_kcore_vmcoreinfo(uint64_t vmcoreinfo_addr, uint64_t vmcoreinfo_len) - /* - * External functions. - */ -+int -+get_elf64_phdr(int fd, char *filename, int index, Elf64_Phdr *phdr) -+{ -+ off_t offset; -+ -+ offset = sizeof(Elf64_Ehdr) + sizeof(Elf64_Phdr) * index; -+ -+ if (lseek(fd, offset, SEEK_SET) < 0) { -+ ERRMSG("Can't seek %s. %s\n", filename, strerror(errno)); -+ return FALSE; -+ } -+ if (read(fd, phdr, sizeof(Elf64_Phdr)) != sizeof(Elf64_Phdr)) { -+ ERRMSG("Can't read %s. %s\n", filename, strerror(errno)); -+ return FALSE; -+ } -+ return TRUE; -+} -+ -+int -+get_elf32_phdr(int fd, char *filename, int index, Elf32_Phdr *phdr) -+{ -+ off_t offset; -+ -+ offset = sizeof(Elf32_Ehdr) + sizeof(Elf32_Phdr) * index; -+ -+ if (lseek(fd, offset, SEEK_SET) < 0) { -+ ERRMSG("Can't seek %s. %s\n", filename, strerror(errno)); -+ return FALSE; -+ } -+ if (read(fd, phdr, sizeof(Elf32_Phdr)) != sizeof(Elf32_Phdr)) { -+ ERRMSG("Can't read %s. %s\n", filename, strerror(errno)); -+ return FALSE; -+ } -+ return TRUE; -+} - - /* - * Convert Physical Address to File Offset. -diff --git a/makedumpfile-1.5.7/elf_info.h b/makedumpfile-1.5.7/elf_info.h -index cbabf8a..e712253 100644 ---- a/makedumpfile-1.5.7/elf_info.h -+++ b/makedumpfile-1.5.7/elf_info.h -@@ -27,6 +27,8 @@ - - #define MAX_SIZE_NHDR MAX(sizeof(Elf64_Nhdr), sizeof(Elf32_Nhdr)) - -+int get_elf64_phdr(int fd, char *filename, int index, Elf64_Phdr *phdr); -+int get_elf32_phdr(int fd, char *filename, int index, Elf32_Phdr *phdr); - - off_t paddr_to_offset(unsigned long long paddr); - off_t paddr_to_offset2(unsigned long long paddr, off_t hint); --- -1.7.1 - diff --git a/SOURCES/kexec-tools-2.0.8-makedumpfile-Make-the-incomplete-dumpfile-generated-.patch b/SOURCES/kexec-tools-2.0.8-makedumpfile-Make-the-incomplete-dumpfile-generated-.patch deleted file mode 100644 index e53fa33..0000000 --- a/SOURCES/kexec-tools-2.0.8-makedumpfile-Make-the-incomplete-dumpfile-generated-.patch +++ /dev/null @@ -1,230 +0,0 @@ -Return-Path: yishimat@redhat.com -Received: from zmta03.collab.prod.int.phx2.redhat.com (LHLO - zmta03.collab.prod.int.phx2.redhat.com) (10.5.81.10) by - zmail24.collab.prod.int.phx2.redhat.com with LMTP; Thu, 2 Jul 2015 01:14:45 - -0400 (EDT) -Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) - by zmta03.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 4A6B242574; - Thu, 2 Jul 2015 01:14:45 -0400 (EDT) -Received: from [10.3.112.13] ([10.3.112.13]) - by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t625EgU7006706; - Thu, 2 Jul 2015 01:14:43 -0400 -Subject: [RHEL7.2 PATCH resend v3 2/4] Make the incomplete dumpfile generated - by ENOSPC error analyzable. -To: kexec-kdump-list@redhat.com -References: <55929BD5.7050709@redhat.com> <5594C856.6050503@redhat.com> -Cc: Minfei Huang <mhuang@redhat.com>, bhe@redhat.com, yishimat@redhat.com -From: Yasuaki Ishimatsu <yishimat@redhat.com> -Message-ID: <5594C8C2.8080603@redhat.com> -Date: Thu, 2 Jul 2015 01:14:42 -0400 -User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 - Thunderbird/38.0.1 -MIME-Version: 1.0 -In-Reply-To: <5594C856.6050503@redhat.com> -Content-Type: text/plain; charset=utf-8 -Content-Transfer-Encoding: 7bit -X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 -Content-Length: 5485 - -https://bugzilla.redhat.com/show_bug.cgi?id=1182377 - -The patch is back ported directory from the following upstream commit: - -commit e39216fce9f73759509ec158e39c289e6c211125 -Author: Wang Xiao <wangx.fnst@cn.fujitsu.com> -Date: Mon Oct 20 13:39:03 2014 +0900 - - [PATCH v4 2/4] Make the incomplete dumpfile generated by ENOSPC error analyzable. - - Since the incomplete dumpfile generated by ENOSPC error can't be anylyzed - by crash utility, but sometimes this file may contain important information - and the panic problem won't be reproduced, then we came up with an idea to - modify the exist data of the incomplete dumpfile to make it analyzable by - crash utility. And each of those dumpfiles has a flag to indicate that it - has been modified. As there are two formats of these dumpfiles, different - methods and flags are needed to deal with each of them, - - elf: - This format use the "e_flags" of "elf header" to indicate that it has been - modified. - - The method of dealing with "kdump-compressed" format dumpfiles is - implemented - in the next patch. - - Signed-of-by: Wang Xiao <wangx.fnst@cn.fujitsu.com> - -Resolves: rhbz#1182377 -Signed-off-by: Yasuaki Ishimatsu <yishimat@redhat.com> -Acked-by: Minfei Huang <mhuang@redhat.com> - ---- - makedumpfile-1.5.7/makedumpfile.c | 115 +++++++++++++++++++++++++++++++++++- - 1 files changed, 111 insertions(+), 4 deletions(-) - -diff --git a/makedumpfile-1.5.7/makedumpfile.c b/makedumpfile-1.5.7/makedumpfile.c -index b4d43d8..141d290 100644 ---- a/makedumpfile-1.5.7/makedumpfile.c -+++ b/makedumpfile-1.5.7/makedumpfile.c -@@ -24,6 +24,7 @@ - #include <ctype.h> - #include <sys/time.h> - #include <limits.h> -+#include <assert.h> - - struct symbol_table symbol_table; - struct size_table size_table; -@@ -3768,6 +3769,93 @@ read_flat_data_header(struct makedumpfile_data_header *fdh) - } - - int -+reserve_diskspace(int fd, off_t start_offset, off_t end_offset, char *file_name) -+{ -+ size_t buf_size; -+ char *buf = NULL; -+ -+ int ret = FALSE; -+ -+ assert(start_offset < end_offset); -+ buf_size = end_offset - start_offset; -+ -+ if ((buf = malloc(buf_size)) == NULL) { -+ ERRMSG("Can't allocate memory for the size of reserved diskspace. %s\n", -+ strerror(errno)); -+ return FALSE; -+ } -+ -+ memset(buf, 0, buf_size); -+ if (!write_buffer(fd, start_offset, buf, buf_size, file_name)) -+ goto out; -+ -+ ret = TRUE; -+out: -+ if (buf != NULL) { -+ free(buf); -+ } -+ -+ return ret; -+} -+ -+#define DUMP_ELF_INCOMPLETE 0x1 -+int -+check_and_modify_elf_headers(char *filename) -+{ -+ int fd, ret = FALSE; -+ Elf64_Ehdr ehdr64; -+ Elf32_Ehdr ehdr32; -+ -+ if ((fd = open(filename, O_RDWR)) < 0) { -+ ERRMSG("Can't open the dump file(%s). %s\n", -+ filename, strerror(errno)); -+ return FALSE; -+ } -+ -+ /* -+ * the is_elf64_memory() function still can be used. -+ */ -+ /* -+ * Set the incomplete flag to the e_flags of elf header. -+ */ -+ if (is_elf64_memory()) { /* ELF64 */ -+ if (!get_elf64_ehdr(fd, filename, &ehdr64)) { -+ ERRMSG("Can't get ehdr64.\n"); -+ goto out_close_file; -+ } -+ ehdr64.e_flags |= DUMP_ELF_INCOMPLETE; -+ if (!write_buffer(fd, 0, &ehdr64, sizeof(Elf64_Ehdr), filename)) -+ goto out_close_file; -+ -+ } else { /* ELF32 */ -+ if (!get_elf32_ehdr(fd, filename, &ehdr32)) { -+ ERRMSG("Can't get ehdr32.\n"); -+ goto out_close_file; -+ } -+ ehdr32.e_flags |= DUMP_ELF_INCOMPLETE; -+ if (!write_buffer(fd, 0, &ehdr32, sizeof(Elf32_Ehdr), filename)) -+ goto out_close_file; -+ -+ } -+ ret = TRUE; -+out_close_file: -+ if (close(fd) < 0) { -+ ERRMSG("Can't close the dump file(%s). %s\n", -+ filename, strerror(errno)); -+ } -+ return ret; -+} -+ -+int -+check_and_modify_headers() -+{ -+ if (info->flag_elf_dumpfile) -+ return check_and_modify_elf_headers(info->name_dumpfile); -+ return FALSE; -+} -+ -+ -+int - rearrange_dumpdata(void) - { - int read_size, tmp_read_size; -@@ -5498,6 +5586,13 @@ write_elf_header(struct cache_data *cd_header) - size_note = note.p_filesz; - - /* -+ * Reserve a space to store the whole program headers. -+ */ -+ if (!reserve_diskspace(cd_header->fd, cd_header->offset, -+ offset_note_dumpfile, cd_header->file_name)) -+ goto out; -+ -+ /* - * Modify the note size in PT_NOTE header to accomodate eraseinfo data. - * Eraseinfo will be written later. - */ -@@ -8015,10 +8110,10 @@ writeout_dumpfile(void) - goto out; - if (info->flag_cyclic) { - if (!write_elf_pages_cyclic(&cd_header, &cd_page)) -- goto out; -+ goto write_cache_enospc; - } else { - if (!write_elf_pages(&cd_header, &cd_page)) -- goto out; -+ goto write_cache_enospc; - } - if (!write_elf_eraseinfo(&cd_header)) - goto out; -@@ -8045,6 +8140,11 @@ writeout_dumpfile(void) - } - - ret = TRUE; -+write_cache_enospc: -+ if ((ret == FALSE) && info->flag_nospace && !info->flag_flatten) { -+ if (!write_cache_bufsz(&cd_header)) -+ ERRMSG("This dumpfile may lost some important data.\n"); -+ } - out: - free_cache_data(&cd_header); - free_cache_data(&cd_page); -@@ -8237,8 +8337,15 @@ retry: - * to create a dumpfile with it again. - */ - num_retry++; -- if ((info->dump_level = get_next_dump_level(num_retry)) < 0) -- return FALSE; -+ if ((info->dump_level = get_next_dump_level(num_retry)) < 0) { -+ if (!info->flag_flatten) { -+ if (check_and_modify_headers()) -+ MSG("This is an incomplete dumpfile," -+ " but might analyzable.\n"); -+ } -+ -+ return FALSE; -+ } - MSG("Retry to create a dumpfile by dump_level(%d).\n", - info->dump_level); - if (!delete_dumpfile()) --- -1.7.1 - diff --git a/SOURCES/kexec-tools-2.0.8-makedumpfile-sadump-Change-bit-order.patch b/SOURCES/kexec-tools-2.0.8-makedumpfile-sadump-Change-bit-order.patch deleted file mode 100644 index 1733991..0000000 --- a/SOURCES/kexec-tools-2.0.8-makedumpfile-sadump-Change-bit-order.patch +++ /dev/null @@ -1,149 +0,0 @@ -From 5f15256acab27859ececcfda1b882e8c49597697 Mon Sep 17 00:00:00 2001 -From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com> -Date: Tue, 20 Oct 2015 16:08:01 +0900 -Subject: [PATCH 1/2] [PATCH 1/2] sadump: Change bit order. - -sadump formats associate each bit in a bitmap with a physical -page in reverse order with the kdump-compressed format. - -We had not detected this bug for considerably long term because -bitmaps in sadump formats consist mostly of 0x00 and 0xff excluding a -very limited amount of memory space for firmware. - -Signed-off-by: Takao Indoh <indou.takao@jp.fujitsu.com> -Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com> ---- - makedumpfile-1.5.7/sadump_info.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 73 insertions(+), 2 deletions(-) - -diff --git a/makedumpfile-1.5.7/sadump_info.c b/makedumpfile-1.5.7/sadump_info.c -index 23275e2..4740683 100644 ---- a/makedumpfile-1.5.7/sadump_info.c -+++ b/makedumpfile-1.5.7/sadump_info.c -@@ -85,6 +85,7 @@ struct sadump_info { - unsigned long long backup_offset; - int kdump_backed_up; - mdf_pfn_t max_mapnr; -+ struct dump_bitmap *ram_bitmap; - }; - - static char *guid_to_str(efi_guid_t *guid, char *buf, size_t buflen); -@@ -127,6 +128,35 @@ static int get_registers(int cpu, struct elf_prstatus *prstatus); - static struct sadump_info sadump_info = {}; - static struct sadump_info *si = &sadump_info; - -+static inline int -+sadump_is_on(char *bitmap, mdf_pfn_t i) -+{ -+ return bitmap[i >> 3] & (1 << (7 - (i & 7))); -+} -+ -+static inline int -+sadump_is_dumpable(struct dump_bitmap *bitmap, mdf_pfn_t pfn) -+{ -+ off_t offset; -+ -+ if (pfn == 0 || bitmap->no_block != pfn/PFN_BUFBITMAP) { -+ offset = bitmap->offset + BUFSIZE_BITMAP*(pfn/PFN_BUFBITMAP); -+ lseek(bitmap->fd, offset, SEEK_SET); -+ read(bitmap->fd, bitmap->buf, BUFSIZE_BITMAP); -+ if (pfn == 0) -+ bitmap->no_block = 0; -+ else -+ bitmap->no_block = pfn / PFN_BUFBITMAP; -+ } -+ return sadump_is_on(bitmap->buf, pfn % PFN_BUFBITMAP); -+} -+ -+static inline int -+sadump_is_ram(mdf_pfn_t pfn) -+{ -+ return sadump_is_dumpable(si->ram_bitmap, pfn); -+} -+ - int - check_and_get_sadump_header_info(char *filename) - { -@@ -161,6 +191,21 @@ check_and_get_sadump_header_info(char *filename) - return TRUE; - } - -+static void -+reverse_bit(char *buf, int len) -+{ -+ int i; -+ unsigned char c; -+ -+ for (i = 0; i < len; i++) { -+ c = buf[i]; -+ c = ((c & 0x55) << 1) | ((c & 0xaa) >> 1); /* Swap 1bit */ -+ c = ((c & 0x33) << 2) | ((c & 0xcc) >> 2); /* Swap 2bit */ -+ c = (c << 4) | (c >> 4); /* Swap 4bit */ -+ buf[i] = c; -+ } -+} -+ - int - sadump_copy_1st_bitmap_from_memory(void) - { -@@ -189,6 +234,14 @@ sadump_copy_1st_bitmap_from_memory(void) - info->name_memory, strerror(errno)); - return FALSE; - } -+ /* -+ * sadump formats associate each bit in a bitmap with -+ * a physical page in reverse order with the -+ * kdump-compressed format. We need to change bit -+ * order to reuse bitmaps in sadump formats in the -+ * kdump-compressed format. -+ */ -+ reverse_bit(buf, sizeof(buf)); - if (write(info->bitmap1->fd, buf, sizeof(buf)) != sizeof(buf)) { - ERRMSG("Can't write the bitmap(%s). %s\n", - info->bitmap1->file_name, strerror(errno)); -@@ -808,6 +861,19 @@ sadump_initialize_bitmap_memory(void) - info->bitmap_memory = bmp; - si->block_table = block_table; - -+ bmp = malloc(sizeof(struct dump_bitmap)); -+ if (bmp == NULL) { -+ ERRMSG("Can't allocate memory for the memory-bitmap. %s\n", -+ strerror(errno)); -+ return FALSE; -+ } -+ bmp->fd = info->fd_memory; -+ bmp->file_name = info->name_memory; -+ bmp->no_block = -1; -+ memset(bmp->buf, 0, BUFSIZE_BITMAP); -+ bmp->offset = si->sub_hdr_offset + sh->block_size * sh->sub_hdr_size; -+ si->ram_bitmap = bmp; -+ - return TRUE; - } - -@@ -977,7 +1043,12 @@ readpage_sadump(unsigned long long paddr, void *bufptr) - if (pfn >= si->max_mapnr) - return FALSE; - -- if (!is_dumpable(info->bitmap_memory, pfn)) { -+ if (!sadump_is_ram(pfn)) { -+ ERRMSG("pfn(%llx) is not ram.\n", pfn); -+ return FALSE; -+ } -+ -+ if (!sadump_is_dumpable(info->bitmap_memory, pfn)) { - ERRMSG("pfn(%llx) is excluded from %s.\n", pfn, - info->name_memory); - return FALSE; -@@ -1142,7 +1213,7 @@ pfn_to_block(mdf_pfn_t pfn) - block = 0; - - for (p = section * SADUMP_PF_SECTION_NUM; p < pfn; ++p) -- if (is_dumpable(info->bitmap_memory, p)) -+ if (sadump_is_dumpable(info->bitmap_memory, p)) - block++; - - return block; --- -2.1.0 - diff --git a/SOURCES/kexec-tools-2.0.8-makedumpfile-sadump-Perform-explicit-zero-page-filterin.patch b/SOURCES/kexec-tools-2.0.8-makedumpfile-sadump-Perform-explicit-zero-page-filterin.patch deleted file mode 100644 index ee4d0e8..0000000 --- a/SOURCES/kexec-tools-2.0.8-makedumpfile-sadump-Perform-explicit-zero-page-filterin.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 19b3a91646958089f8ce90ca518c8262bfc8ca88 Mon Sep 17 00:00:00 2001 -From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com> -Date: Tue, 20 Oct 2015 16:12:01 +0900 -Subject: [PATCH 2/2] [PATCH 2/2] sadump: Perform explicit zero page filtering. - -Currently, crash utility faces different behaviors on reading zero -pages that are filtered out on the kdump-compressed format originating -from kdump ELF and from sadump formats: the former succeeds in reading -zero pages but the latter fails. This is a design bug. To fix this -issue, perform zero pages filtering explicitly if some pages are -filtered out. - -Signed-off-by: Takao Indoh <indou.takao@jp.fujitsu.com> -Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com> ---- - makedumpfile-1.5.7/sadump_info.c | 20 +++++++++++++++++--- - 1 file changed, 17 insertions(+), 3 deletions(-) - -diff --git a/makedumpfile-1.5.7/sadump_info.c b/makedumpfile-1.5.7/sadump_info.c -index 4740683..20376f0 100644 ---- a/makedumpfile-1.5.7/sadump_info.c -+++ b/makedumpfile-1.5.7/sadump_info.c -@@ -874,6 +874,21 @@ sadump_initialize_bitmap_memory(void) - bmp->offset = si->sub_hdr_offset + sh->block_size * sh->sub_hdr_size; - si->ram_bitmap = bmp; - -+ /* -+ * Perform explicitly zero filtering. Without this processing -+ * crash utility faces different behaviors on reading zero -+ * pages that are filtered out on the kdump-compressed format -+ * originating from kdump ELF and from sadump formats: the -+ * former succeeds in reading zero pages but the latter fails. -+ */ -+ for (pfn = 0; pfn < si->max_mapnr; pfn++) { -+ if (sadump_is_ram(pfn) && -+ !sadump_is_dumpable(info->bitmap_memory, pfn)) { -+ info->dump_level |= DL_EXCLUDE_ZERO; -+ break; -+ } -+ } -+ - return TRUE; - } - -@@ -1049,9 +1064,8 @@ readpage_sadump(unsigned long long paddr, void *bufptr) - } - - if (!sadump_is_dumpable(info->bitmap_memory, pfn)) { -- ERRMSG("pfn(%llx) is excluded from %s.\n", pfn, -- info->name_memory); -- return FALSE; -+ memset(bufptr, 0, info->page_size); -+ return TRUE; - } - - block = pfn_to_block(pfn); --- -2.1.0 - diff --git a/SOURCES/kexec-tools-2.0.8-ppc64-add-arch-option-dt-no-old-root.patch b/SOURCES/kexec-tools-2.0.8-ppc64-add-arch-option-dt-no-old-root.patch new file mode 100644 index 0000000..0a8e532 --- /dev/null +++ b/SOURCES/kexec-tools-2.0.8-ppc64-add-arch-option-dt-no-old-root.patch @@ -0,0 +1,69 @@ +From 83a65e2e13af2041b2816712475e3fec6fdc9e68 Mon Sep 17 00:00:00 2001 +From: "dyoung@redhat.com" <dyoung@redhat.com> +Date: Wed, 28 Oct 2015 13:41:37 +0800 +Subject: [PATCH 3/3] ppc64: add arch option --dt-no-old-root + +When createing fdt from /proc/device-tree, if there's local --command-line +option provided but there's no root= specified, kexec-tools will copy the root= +param from 1st kernel cmdline by default. In case one want kexec boot without +root= it will be impossible. + +Thus add the new option so that one can provide --dt-no-old-root for above +mentioned case. + +Reported-by: Jan Stodola <jstodola@redhat.com> +Signed-off-by: Dave Young <dyoung@redhat.com> +Signed-off-by: Simon Horman <horms@verge.net.au> +--- + kexec/arch/ppc64/include/arch/options.h | 4 +++- + kexec/arch/ppc64/kexec-ppc64.c | 5 +++++ + 2 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/kexec/arch/ppc64/include/arch/options.h b/kexec/arch/ppc64/include/arch/options.h +index 4ad9b75..71632ec 100644 +--- a/kexec/arch/ppc64/include/arch/options.h ++++ b/kexec/arch/ppc64/include/arch/options.h +@@ -2,7 +2,8 @@ + #define KEXEC_ARCH_PPC64_OPTIONS_H + + #define OPT_ELF64_CORE (OPT_MAX+0) +-#define OPT_ARCH_MAX (OPT_MAX+1) ++#define OPT_DT_NO_OLD_ROOT (OPT_MAX+1) ++#define OPT_ARCH_MAX (OPT_MAX+2) + + /* All 'local' loader options: */ + #define OPT_APPEND (OPT_ARCH_MAX+0) +@@ -14,6 +15,7 @@ + #define KEXEC_ARCH_OPTIONS \ + KEXEC_OPTIONS \ + { "elf64-core-headers", 0, 0, OPT_ELF64_CORE }, \ ++ { "dt-no-old-root", 0, 0, OPT_DT_NO_OLD_ROOT }, \ + + #define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR "" + +diff --git a/kexec/arch/ppc64/kexec-ppc64.c b/kexec/arch/ppc64/kexec-ppc64.c +index 6e79f52..09ee025 100644 +--- a/kexec/arch/ppc64/kexec-ppc64.c ++++ b/kexec/arch/ppc64/kexec-ppc64.c +@@ -869,6 +869,8 @@ int file_types = sizeof(file_type) / sizeof(file_type[0]); + void arch_usage(void) + { + fprintf(stderr, " --elf64-core-headers Prepare core headers in ELF64 format\n"); ++ fprintf(stderr, " --dt-no-old-root Do not reuse old kernel root= param.\n" \ ++ " while creating flatten device tree.\n"); + } + + struct arch_options_t arch_options = { +@@ -895,6 +897,9 @@ int arch_process_options(int argc, char **argv) + case OPT_ELF64_CORE: + arch_options.core_header_type = CORE_TYPE_ELF64; + break; ++ case OPT_DT_NO_OLD_ROOT: ++ dt_no_old_root = 1; ++ break; + } + } + /* Reset getopt for the next pass; called in other source modules */ +-- +2.5.0 + diff --git a/SOURCES/mkdumprd b/SOURCES/mkdumprd index dd6ce8a..1865079 100644 --- a/SOURCES/mkdumprd +++ b/SOURCES/mkdumprd @@ -16,38 +16,27 @@ SAVE_PATH=$(grep ^path $conf_file| cut -d' ' -f2) # strip the duplicated "/" SAVE_PATH=$(echo $SAVE_PATH | tr -s /) -extra_modules="" -dracut_args=("--hostonly" "--hostonly-cmdline" "--hostonly-i18n" "-o" "plymouth dash resume ifcfg") -OVERRIDE_RESETTABLE=0 - -perror_exit() { - echo $@ >&2 - exit 1 +is_wdt_addition_needed() { + local active + + is_wdt_mod_omitted + [[ $? -eq 0 ]] && return 1 + [[ -d /sys/class/watchdog/ ]] || return 1 + for dir in /sys/class/watchdog/*; do + [[ -f "$dir/state" ]] || continue + active=$(< "$dir/state") + [[ "$active" = "active" ]] && return 0 + done + return 1 } -perror() { - echo $@ >&2 -} - -get_persistent_dev() { - local i _tmp _dev +WDTCFG="" +is_wdt_addition_needed +[[ $? -eq 0 ]] && WDTCFG="-a watchdog" - _dev=$(udevadm info --query=name --name="$1" 2>/dev/null) - [ -z "$_dev" ] && { - perror_exit "Kernel dev name of $1 is not found." - } - - for i in /dev/mapper/* /dev/disk/by-uuid/* /dev/disk/by-id/*; do - _tmp=$(udevadm info --query=name --name="$i" 2>/dev/null) - if [ "$_tmp" = "$_dev" ]; then - echo $i - return - fi - done - - perror "WARNING: Persistent device name of $1 not found. Using $1 as dump target name" - echo $1 -} +extra_modules="" +dracut_args=("--hostonly" "--hostonly-cmdline" "--hostonly-i18n" "-o" "plymouth dash resume ifcfg" $WDTCFG) +OVERRIDE_RESETTABLE=0 add_dracut_arg() { local arg qarg is_quoted=0 @@ -138,7 +127,7 @@ to_mount() { _mntopts="$_target $_fstype $_options" #for non-nfs _dev converting to use udev persistent name if [ -b "$_source" ]; then - _pdev="$(get_persistent_dev $_source)" + _pdev="$(kdump_get_persistent_dev $_source $_fstype)" if [ $? -ne 0 ]; then return 1 fi @@ -325,20 +314,6 @@ check_block_and_slaves() { return 1 } -to_dev_name() { - local dev="${1//\"/}" - - case "$dev" in - UUID=*) - dev=`blkid -U "${dev#UUID=}"` - ;; - LABEL=*) - dev=`blkid -L "${dev#LABEL=}"` - ;; - esac - echo $dev -} - get_block_dump_target() { local _target @@ -380,10 +355,6 @@ handle_default_dump_target() SAVE_PATH=${SAVE_PATH##"$_mntpoint"} _fstype=$(get_fs_type_from_target $_target) - if $(is_fs_type_nfs $_fstype); then - add_dracut_module "nfs" - fi - add_mount "$_target" check_size fs $_target fi @@ -544,10 +515,6 @@ do perror_exit "Dump target $config_val is probably not mounted." fi - if [ "$config_opt" = "nfs" ]; then - add_dracut_module "nfs" - fi - _absolute_save_path=$(make_absolute_save_path $config_val) _mntpoint=$(get_mntpoint_from_path $_absolute_save_path) if is_atomic && is_bind_mount $_mntpoint; then @@ -565,7 +532,7 @@ do dd if=$config_val count=1 of=/dev/null > /dev/null 2>&1 || { perror_exit "Bad raw disk $config_val" } - _praw=$(get_persistent_dev $config_val) + _praw=$(kdump_get_persistent_dev $config_val "raw") if [ $? -ne 0 ]; then exit 1 fi diff --git a/SOURCES/supported-kdump-targets.txt b/SOURCES/supported-kdump-targets.txt index 65c95fc..b5fd08c 100644 --- a/SOURCES/supported-kdump-targets.txt +++ b/SOURCES/supported-kdump-targets.txt @@ -41,6 +41,7 @@ storage: software RAID (mdraid) hardware RAID (cciss, hpsa, megaraid_sas, mpt2sas, aacraid) SCSI/SATA disks + iSCSI HBA (all offload) network: Hardware using kernel modules: (tg3, igb, ixgbe, sfc, e1000e, bna, @@ -62,6 +63,7 @@ filesystem: ext[234] btrfs xfs + nfs firmware: BIOS @@ -76,7 +78,8 @@ Unsupported Dump targets storage: BIOS RAID Thin provisioning volume - hardware iSCSI + Software iSCSI with iBFT (bnx2i, cxgb3i, cxgb4i) + Software iSCSI with hybrid (be2iscsi) FCoE legacy IDE glusterfs diff --git a/SPECS/kexec-tools.spec b/SPECS/kexec-tools.spec index db8393a..4288482 100644 --- a/SPECS/kexec-tools.spec +++ b/SPECS/kexec-tools.spec @@ -1,6 +1,6 @@ Name: kexec-tools Version: 2.0.7 -Release: 38%{?dist}.1 +Release: 50%{?dist} License: GPLv2 Group: Applications/System Summary: The kexec/kdump userspace component. @@ -13,7 +13,7 @@ Source5: kdump.sysconfig.ppc64 Source6: kdump.sysconfig.ia64 Source7: mkdumprd Source8: kdump.conf -Source9: http://downloads.sourceforge.net/project/makedumpfile/makedumpfile/1.5.7/makedumpfile-1.5.7.tar.gz +Source9: http://downloads.sourceforge.net/project/makedumpfile/makedumpfile/1.6.0/makedumpfile-1.6.0.tar.gz Source10: kexec-kdump-howto.txt Source12: mkdumprd.8 Source14: 98-kexec.rules @@ -26,7 +26,7 @@ Source21: kdump-in-cluster-environment.txt Source22: supported-kdump-targets.txt Source23: kdump-dep-generator.sh Source24: kdump-lib-initramfs.sh -Source25: kdump-anaconda-addon-003-19-gda64a86.tar.gz +Source25: kdump-anaconda-addon-003-21-g69da0f8.tar.gz Source26: kdump.sysconfig.ppc64le Source27: kdump.sysconfig.aarch64 Source28: kdumpctl.8 @@ -47,8 +47,9 @@ Requires(post): systemd-units Requires(preun): systemd-units Requires(postun): systemd-units Requires(pre): coreutils sed zlib -Requires: dracut >= 033-346 -Requires: dracut-network, ethtool +Requires: dracut >= 033-449 +Requires: dracut-network >= 033-449 +Requires: ethtool BuildRequires: zlib-devel zlib zlib-static elfutils-devel-static glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel BuildRequires: pkgconfig intltool gettext BuildRequires: systemd-units @@ -62,11 +63,14 @@ Obsoletes: diskdumputils netdump # # Patches 0 through 100 are meant for x86 kexec-tools enablement # +Patch0: kexec-tools-2.0.7-Add-persistent-memory-support.patch # # Patches 101 through 200 are meant for x86_64 kexec-tools enablement # Patch101: kexec-tools-2.0.7-Provide-an-option-to-use-new-kexec-system-call.patch +Patch102: kexec-tools-2.0.7-makedumpfile-sadump-fix-segmentation-fault-on-sadump-re.patch +Patch103: kexec-tools-2.0.7-makedumpfile-sadump-fix-wrong-progress-report-on-sadump.patch # # Patches 201 through 300 are meant for ia64 kexec-tools enablement @@ -79,6 +83,9 @@ Patch301: kexec-tools-2.0.7-kexec-ppc64-disabling-exception-handling-when-buildi Patch302: kexec-tools-2.0.7-kexec-ppc64-move-to-device-tree-version-17.patch Patch303: kexec-tools-2.0.7-ppc64-kdump-Fix-ELF-header-endianess.patch Patch304: kexec-tools-2.0.8-ppc64-erase-unnecessary-segment-info-printing.patch +# patch305 depends on generic patch patch680 thus patch 680 should be applied +# before patch305 +Patch305: kexec-tools-2.0.8-ppc64-add-arch-option-dt-no-old-root.patch # # Patches 401 through 500 are meant for s390 kexec-tools enablement @@ -91,8 +98,6 @@ Patch304: kexec-tools-2.0.8-ppc64-erase-unnecessary-segment-info-printing.patch # Patches 601 onward are generic patches # Patch601: kexec-tools-2.0.3-disable-kexec-test.patch -Patch602: kexec-tools-2.0.7-makedumpfile-sadump-Support-more-than-16TB-physical-memory.patch -Patch603: kexec-tools-2.0.7-makedumpfile-Support-ARM64.patch Patch650: kexec-tools-2.0.8-add-aarch64-to-configure.patch Patch651: kexec-tools-2.0.8-kexec-Add-common-device-tree-routines.patch @@ -114,20 +119,10 @@ Patch667: kexec-tools-2.0.8-Don-t-bail-out-if-check_cpu_nodes-fails.patch Patch668: kexec-tools-2.0.8-arm64-Add-enable-disable-d-cache-support-for-purgato.patch Patch669: kexec-tools-2.0.8-arm64-Pass-RAM-boundary-to-purgatory.patch Patch670: kexec-tools-2.0.8-arm64-Enable-disable-D-cache-before-after-sha-verifi.patch +Patch671: kexec-tools-2.0.8-arm64-prefer-reading-memory-ranges-from-iomem-over-f.patch -Patch671: kexec-tools-2.0.8-makedumpfile-Make-get_elf64_phdr-get_elf32_phdr-publ.patch -Patch672: kexec-tools-2.0.8-makedumpfile-Make-the-incomplete-dumpfile-generated-.patch -Patch673: kexec-tools-2.0.8-makedumpfile-Implementation-of-dealing-with-kdump-co.patch -Patch674: kexec-tools-2.0.8-makedumpfile-Fix-reassemble_kdump_header.patch - -Patch675: kexec-tools-2.0.8-makedumpfile-Add-support-for-splitblock.patch -Patch676: kexec-tools-2.0.8-makedumpfile-Add-tools-for-reading-and-writing-from-.patch -Patch677: kexec-tools-2.0.8-makedumpfile-Add-module-of-generating-table.patch -Patch678: kexec-tools-2.0.8-makedumpfile-Add-module-of-calculating-start_pfn-and.patch -Patch679: kexec-tools-2.0.8-makedumpfile-Add-support-for-splitblock-size.patch -Patch680: kexec-tools-2.0.8-makedumpfile-sadump-Change-bit-order.patch -Patch681: kexec-tools-2.0.8-makedumpfile-sadump-Perform-explicit-zero-page-filterin.patch +Patch680: kexec-tools-2.0.8-fs2dt.c-move-copy-old-root-param-as-a-new-function.patch # # Patch 701 through 800 are meant for kdump anaconda addon # @@ -166,14 +161,15 @@ tar -z -x -v -f %{SOURCE19} tar -z -x -v -f %{SOURCE25} +%patch0 -p1 %patch101 -p1 +%patch102 -p1 +%patch103 -p1 %patch301 -p1 %patch302 -p1 %patch303 -p1 %patch304 -p1 %patch601 -p1 -%patch602 -p1 -%patch603 -p1 %patch650 -p1 %patch651 -p1 %patch652 -p1 @@ -195,16 +191,8 @@ tar -z -x -v -f %{SOURCE25} %patch669 -p1 %patch670 -p1 %patch671 -p1 -%patch672 -p1 -%patch673 -p1 -%patch674 -p1 -%patch675 -p1 -%patch676 -p1 -%patch677 -p1 -%patch678 -p1 -%patch679 -p1 %patch680 -p1 -%patch681 -p1 +%patch305 -p1 %ifarch ppc @@ -241,8 +229,8 @@ cp %{SOURCE22} . make %ifarch %{ix86} x86_64 ia64 ppc64 s390x ppc64le aarch64 make -C eppic/libeppic -make -C makedumpfile-1.5.7 LINKTYPE=dynamic USELZO=on USESNAPPY=on -make -C makedumpfile-1.5.7 LDFLAGS="-I../eppic/libeppic -L../eppic/libeppic" eppic_makedumpfile.so +make -C makedumpfile-1.6.0 LINKTYPE=dynamic USELZO=on USESNAPPY=on +make -C makedumpfile-1.6.0 LDFLAGS="-I../eppic/libeppic -L../eppic/libeppic" eppic_makedumpfile.so %endif make -C kdump-anaconda-addon/po @@ -283,13 +271,13 @@ install -m 644 %{SOURCE16} $RPM_BUILD_ROOT%{_unitdir}/kdump.service install -m 755 -D %{SOURCE23} $RPM_BUILD_ROOT%{_prefix}/lib/systemd/system-generators/kdump-dep-generator.sh %ifarch %{ix86} x86_64 ia64 ppc64 s390x ppc64le aarch64 -install -m 755 makedumpfile-1.5.7/makedumpfile $RPM_BUILD_ROOT/sbin/makedumpfile -install -m 644 makedumpfile-1.5.7/makedumpfile.8.gz $RPM_BUILD_ROOT/%{_mandir}/man8/makedumpfile.8.gz -install -m 644 makedumpfile-1.5.7/makedumpfile.conf.5.gz $RPM_BUILD_ROOT/%{_mandir}/man5/makedumpfile.conf.5.gz -install -m 644 makedumpfile-1.5.7/makedumpfile.conf $RPM_BUILD_ROOT/%{_sysconfdir}/makedumpfile.conf.sample -install -m 755 makedumpfile-1.5.7/eppic_makedumpfile.so $RPM_BUILD_ROOT/%{_libdir}/eppic_makedumpfile.so +install -m 755 makedumpfile-1.6.0/makedumpfile $RPM_BUILD_ROOT/sbin/makedumpfile +install -m 644 makedumpfile-1.6.0/makedumpfile.8.gz $RPM_BUILD_ROOT/%{_mandir}/man8/makedumpfile.8.gz +install -m 644 makedumpfile-1.6.0/makedumpfile.conf.5.gz $RPM_BUILD_ROOT/%{_mandir}/man5/makedumpfile.conf.5.gz +install -m 644 makedumpfile-1.6.0/makedumpfile.conf $RPM_BUILD_ROOT/%{_sysconfdir}/makedumpfile.conf.sample +install -m 755 makedumpfile-1.6.0/eppic_makedumpfile.so $RPM_BUILD_ROOT/%{_libdir}/eppic_makedumpfile.so mkdir -p $RPM_BUILD_ROOT/usr/share/makedumpfile/eppic_scripts/ -install -m 644 makedumpfile-1.5.7/eppic_scripts/* $RPM_BUILD_ROOT/usr/share/makedumpfile/eppic_scripts/ +install -m 644 makedumpfile-1.6.0/eppic_scripts/* $RPM_BUILD_ROOT/usr/share/makedumpfile/eppic_scripts/ %endif make -C kdump-anaconda-addon install DESTDIR=$RPM_BUILD_ROOT %find_lang kdump-anaconda-addon @@ -427,8 +415,67 @@ done %doc %changelog -* Fri Jan 15 2016 Minfei Huang <mhuang@redhat.com> - 2.0.7-38.1 -- Makedumpfile: Fix to copy some parts of memory in sadump vmcore formats +* Mon Sep 05 2016 Baoquan He <bhe@redhat.com> - 2.0.7-50 +- spec: Update to add dependency on dracut-network version >= 033-449 +- mkdumprd: Do not add "nfs" dracut module explicitly +- kexec-kdump-howto: Add doc about the special mount information via "dracut_args" +- Support special mount information via "dracut_args" + +* Wed Aug 17 2016 Baoquan He <bhe@redhat.com> - 2.0.7-49 +- fa9c082 kexec: Remedy the incomplete fix about persistent memory back porting + +* Wed Jul 27 2016 Baoquan He <bhe@redhat.com> - 2.0.7-48 +- arm64: prefer reading memory ranges from iomem over fdt + +* Mon Jul 25 2016 Baoquan He <bhe@redhat.com> - 2.0.7-47 +- spec: Update to add dependency on dracut version >= 033-449 +- watchdog: do not add watchdog module in rd.driver.pre now +- howto: Notes on watchdog module handling +- kdumpctl: force rebuild in case of watchdog state change +- mkdumprd: Add dracut watchdog module as default option + + +* Mon Jul 25 2016 Baoquan He <bhe@redhat.com> - 2.0.7-46 +- kexec-kdump-howto:Add introduction of parallel dumping + +* Wed Jul 20 2016 Baoquan He <bhe@redhat.com> - 2.0.7-45 +- kdump.conf man page fixes +- kdump.conf comments fixes +- Add persistent memory support +- module-setup: Don't handle iBFT in kdump + +* Fri Jul 08 2016 Baoquan He <bhe@redhat.com> - 2.0.7-44 +- Update kdump anaconda addon +- kdumpctl: Do not rebuild initramfs when $KDUMP_BOOTDIR is read only +- get_persistent_dev(): fix name contention with dracut's similar function + +* Mon Jul 04 2016 Baoquan He <bhe@redhat.com> - 2.0.7-43 +- kexec/sadump: Back port two patches to fix regression bug of makedumpfile 1.6.0 +- Makedumpfile: Rebase to 1.6.0 + +* Fri Jun 17 2016 Baoquan He <bhe@redhat.com> - 2.0.7-42 +- module-setup: Use get_ifcfg_filename() to get the proper ifcfg file +- kdump-lib: Add get_ifcfg_filename() to get the proper ifcfg file +- doc: add nfs to supported filesystems list + +* Sun Jun 12 2016 Baoquan He <bhe@redhat.com> - 2.0.7-41 +- Update kdump anaconda addon + +* Mon Jun 06 2016 Baoquan He <bhe@redhat.com> - 2.0.7-40 +- kdumpctl: force rebuild in case of file system is modified +- mkdumprd: move to_dev_name() & get_persistent_dev() to kdump-lib.sh +- kdumpctl: Move file modification check logic in check_system_modified() +- kdumpctl: force rebuild in case of dynamic system modification +- mkdumprd: do not lookup in by-uuid dirs for raw device's persistent name + +* Thu May 19 2016 Baoquan He <bhe@redhat.com> - 2.0.7-39 +- Remove duplicate prefix path ${initdir} +- Document declaration to support iSCSI HBA (ALL OFFLOAD) +- kdump.init: fix a typo +- rpm spec: add two patches to fix ppc64 kexec boot issue +- kexec-tools ppc64: add arch option --dt-no-old-root +- kexec-tools fs2dt.c: move copy old root param as a new function +- kdumpctl: Remove slub_debug from cmdline * Wed Oct 21 2015 Minfei Huang <mhuang@redhat.com> - 2.0.7-38 - pc64/ppc64le: drop cpu online rule in 40-redhat.rules in kdump initramfs