From 6df2a73b0cecde56022ad773774295f21216dec0 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Jun 09 2020 19:25:43 +0000 Subject: import dracut-049-86.git20200602.el8 --- diff --git a/SOURCES/0074.patch b/SOURCES/0074.patch index c28e6b3..2181942 100644 --- a/SOURCES/0074.patch +++ b/SOURCES/0074.patch @@ -30,3 +30,4 @@ index 8fc3114d..ad2a1534 100755 _arch=${DRACUT_ARCH:-$(uname -m)} + diff --git a/SOURCES/0075.patch b/SOURCES/0075.patch new file mode 100644 index 0000000..ba6445c --- /dev/null +++ b/SOURCES/0075.patch @@ -0,0 +1,426 @@ +From cf74193cc37f2ace1197b1e6ebacc6fe542767c8 Mon Sep 17 00:00:00 2001 +From: Kairui Song +Date: Wed, 8 Apr 2020 16:39:52 +0800 +Subject: [PATCH] Remove memtrace-ko and rd.memdebug=4 support in dracut + +This feature could be off loaded to memstrack, which have better +accurecy, better performance, and have more detailed tracing features. + +Also simplify make_trace_mem a bit. + +And currently rd.memdebug=4 is unstable, fails from time to time. + +(cherry picked from commit 49c4172f4eef6e2015615e132b199a7ec0699ffc) + +Resolves: #1829528 +--- + dracut.cmdline.7.asc | 4 +- + modules.d/98dracut-systemd/dracut-cmdline.sh | 2 +- + modules.d/98dracut-systemd/dracut-pre-mount.sh | 2 +- + modules.d/98dracut-systemd/dracut-pre-pivot.sh | 2 +- + modules.d/98dracut-systemd/dracut-pre-trigger.sh | 2 +- + modules.d/99base/dracut-lib.sh | 44 +----- + modules.d/99base/init.sh | 8 +- + modules.d/99base/memtrace-ko.sh | 191 ----------------------- + modules.d/99base/module-setup.sh | 1 - + 9 files changed, 18 insertions(+), 238 deletions(-) + +diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc +index ab9a24ad..0dc58d1a 100644 +--- a/dracut.cmdline.7.asc ++++ b/dracut.cmdline.7.asc +@@ -187,9 +187,9 @@ It should be attached to any report about dracut problems. + _/run/initramfs/init.log_. + If "quiet" is set, it also logs to the console. + +-**rd.memdebug=[0-4]**:: ++**rd.memdebug=[0-3]**:: + Print memory usage info at various points, set the verbose level from 0 to 4. +-+ +++ + Higher level means more debugging output: + + + ---- +diff --git a/modules.d/98dracut-systemd/dracut-cmdline.sh b/modules.d/98dracut-systemd/dracut-cmdline.sh +index bff9435a..6c6ee026 100755 +--- a/modules.d/98dracut-systemd/dracut-cmdline.sh ++++ b/modules.d/98dracut-systemd/dracut-cmdline.sh +@@ -42,7 +42,7 @@ export root + export rflags + export fstype + +-make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab' '4+:komem' ++make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab' + # run scriptlets to parse the command line + getarg 'rd.break=cmdline' -d 'rdbreak=cmdline' && emergency_shell -n cmdline "Break before cmdline" + source_hook cmdline +diff --git a/modules.d/98dracut-systemd/dracut-pre-mount.sh b/modules.d/98dracut-systemd/dracut-pre-mount.sh +index a3b9d291..ae511286 100755 +--- a/modules.d/98dracut-systemd/dracut-pre-mount.sh ++++ b/modules.d/98dracut-systemd/dracut-pre-mount.sh +@@ -8,7 +8,7 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh + + source_conf /etc/conf.d + +-make_trace_mem "hook pre-mount" '1:shortmem' '2+:mem' '3+:slab' '4+:komem' ++make_trace_mem "hook pre-mount" '1:shortmem' '2+:mem' '3+:slab' + # pre pivot scripts are sourced just before we doing cleanup and switch over + # to the new root. + getarg 'rd.break=pre-mount' 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break pre-mount" +diff --git a/modules.d/98dracut-systemd/dracut-pre-pivot.sh b/modules.d/98dracut-systemd/dracut-pre-pivot.sh +index dc9a2504..96e6f8ca 100755 +--- a/modules.d/98dracut-systemd/dracut-pre-pivot.sh ++++ b/modules.d/98dracut-systemd/dracut-pre-pivot.sh +@@ -8,7 +8,7 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh + + source_conf /etc/conf.d + +-make_trace_mem "hook pre-pivot" '1:shortmem' '2+:mem' '3+:slab' '4+:komem' ++make_trace_mem "hook pre-pivot" '1:shortmem' '2+:mem' '3+:slab' + # pre pivot scripts are sourced just before we doing cleanup and switch over + # to the new root. + getarg 'rd.break=pre-pivot' 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot "Break pre-pivot" +diff --git a/modules.d/98dracut-systemd/dracut-pre-trigger.sh b/modules.d/98dracut-systemd/dracut-pre-trigger.sh +index 7cd821ed..a1a33960 100755 +--- a/modules.d/98dracut-systemd/dracut-pre-trigger.sh ++++ b/modules.d/98dracut-systemd/dracut-pre-trigger.sh +@@ -8,7 +8,7 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh + + source_conf /etc/conf.d + +-make_trace_mem "hook pre-trigger" '1:shortmem' '2+:mem' '3+:slab' '4+:komem' ++make_trace_mem "hook pre-trigger" '1:shortmem' '2+:mem' '3+:slab' + + source_hook pre-trigger + +diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh +index f71e757c..502c7568 100755 +--- a/modules.d/99base/dracut-lib.sh ++++ b/modules.d/99base/dracut-lib.sh +@@ -1220,50 +1220,25 @@ are_lists_eq() { + + setmemdebug() { + if [ -z "$DEBUG_MEM_LEVEL" ]; then +- export DEBUG_MEM_LEVEL=$(getargnum 0 0 4 rd.memdebug) ++ export DEBUG_MEM_LEVEL=$(getargnum 0 0 3 rd.memdebug) + fi + } + + setmemdebug + +-cleanup_trace_mem() +-{ +- # tracekomem based on kernel trace needs cleanup after use. +- if [ "$DEBUG_MEM_LEVEL" -eq 4 ]; then +- tracekomem --cleanup +- fi +-} +- +-# parameters: msg [trace_level:trace]... +-make_trace_mem() +-{ +- local msg +- msg="$1" +- shift +- if [ -n "$DEBUG_MEM_LEVEL" ] && [ "$DEBUG_MEM_LEVEL" -gt 0 ]; then +- make_trace show_memstats $DEBUG_MEM_LEVEL "[debug_mem]" "$msg" "$@" >&2 +- fi +-} +- + # parameters: func log_level prefix msg [trace_level:trace]... +-make_trace() ++make_trace_mem() + { +- local func log_level prefix msg msg_printed ++ local log_level prefix msg msg_printed + local trace trace_level trace_in_higher_levels insert_trace + +- func=$1 +- shift +- +- log_level=$1 +- shift +- +- prefix=$1 +- shift +- + msg=$1 + shift + +- if [ -z "$log_level" ]; then ++ prefix='[debug_mem]' ++ log_level=$DEBUG_MEM_LEVEL ++ ++ if [ -z "$log_level" ] || [ "$log_level" -le 0 ]; then + return + fi + +@@ -1296,7 +1271,7 @@ make_trace() + echo "$prefix $msg" + msg_printed=1 + fi +- $func $trace ++ show_memstats $trace + fi + shift + done +@@ -1318,9 +1293,6 @@ show_memstats() + iomem) + cat /proc/iomem + ;; +- komem) +- tracekomem +- ;; + esac + } + +diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh +index e4f7cff1..2c0ccd66 100755 +--- a/modules.d/99base/init.sh ++++ b/modules.d/99base/init.sh +@@ -131,7 +131,7 @@ if ! getargbool 1 'rd.hostonly'; then + fi + + # run scriptlets to parse the command line +-make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab' '4+:komem' ++make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab' + getarg 'rd.break=cmdline' -d 'rdbreak=cmdline' && emergency_shell -n cmdline "Break before cmdline" + source_hook cmdline + +@@ -160,7 +160,7 @@ fi + + udevproperty "hookdir=$hookdir" + +-make_trace_mem "hook pre-trigger" '1:shortmem' '2+:mem' '3+:slab' '4+:komem' ++make_trace_mem "hook pre-trigger" '1:shortmem' '2+:mem' '3+:slab' + getarg 'rd.break=pre-trigger' -d 'rdbreak=pre-trigger' && emergency_shell -n pre-trigger "Break before pre-trigger" + source_hook pre-trigger + +@@ -230,7 +230,7 @@ unset RDRETRY + + # pre-mount happens before we try to mount the root filesystem, + # and happens once. +-make_trace_mem "hook pre-mount" '1:shortmem' '2+:mem' '3+:slab' '4+:komem' ++make_trace_mem "hook pre-mount" '1:shortmem' '2+:mem' '3+:slab' + getarg 'rd.break=pre-mount' -d 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break pre-mount" + source_hook pre-mount + +@@ -266,7 +266,7 @@ done + + # pre pivot scripts are sourced just before we doing cleanup and switch over + # to the new root. +-make_trace_mem "hook pre-pivot" '1:shortmem' '2+:mem' '3+:slab' '4+:komem' ++make_trace_mem "hook pre-pivot" '1:shortmem' '2+:mem' '3+:slab' + getarg 'rd.break=pre-pivot' -d 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot "Break pre-pivot" + source_hook pre-pivot + +diff --git a/modules.d/99base/memtrace-ko.sh b/modules.d/99base/memtrace-ko.sh +deleted file mode 100755 +index ee035e15..00000000 +--- a/modules.d/99base/memtrace-ko.sh ++++ /dev/null +@@ -1,191 +0,0 @@ +-#!/bin/sh +- +-# Try to find out kernel modules with large total memory allocation during loading. +-# For large slab allocation, it will fall into buddy, also not trace "mm_page_free" +-# considering large free is quite rare for module_init, thus saving tons of events +-# to avoid trace data overwritten. +-# +-# Therefore, tracing "mm_page_alloc"alone should be enough for the purpose. +- +-# "sys/kernel/tracing" has the priority if exists. +-get_trace_base() { +- # trace access through debugfs would be obsolete if "/sys/kernel/tracing" is available. +- if [ -d "/sys/kernel/tracing" ]; then +- echo "/sys/kernel" +- else +- echo "/sys/kernel/debug" +- fi +-} +- +-# We want to enable these trace events. +-get_want_events() { +- echo "module:module_put module:module_load kmem:mm_page_alloc" +-} +- +-get_event_filter() { +- echo "comm == systemd-udevd || comm == modprobe || comm == insmod" +-} +- +-is_trace_ready() { +- local trace_base want_events current_events +- +- trace_base=$(get_trace_base) +- ! [ -f "$trace_base/tracing/trace" ] && return 1 +- +- [ "$(cat $trace_base/tracing/tracing_on)" -eq 0 ] && return 1 +- +- # Also check if trace events were properly setup. +- want_events=$(get_want_events) +- current_events=$(echo $(cat $trace_base/tracing/set_event)) +- [ "$current_events" != "$want_events" ] && return 1 +- +- return 0 +-} +- +-prepare_trace() { +- local trace_base +- +- trace_base=$(get_trace_base) +- # old debugfs interface case. +- if ! [ -d "$trace_base/tracing" ]; then +- mount none -t debugfs $trace_base +- # new tracefs interface case. +- elif ! [ -f "$trace_base/tracing/trace" ]; then +- mount none -t tracefs "$trace_base/tracing" +- fi +- +- if ! [ -f "$trace_base/tracing/trace" ]; then +- echo "WARN: Mount trace failed for kernel module memory analyzing." +- return 1 +- fi +- +- # Active all the wanted trace events. +- echo "$(get_want_events)" > $trace_base/tracing/set_event +- +- # There are three kinds of known applications for module loading: +- # "systemd-udevd", "modprobe" and "insmod". +- # Set them as the global events filter. +- # NOTE: Some kernel may not support this format of filter, anyway +- # the operation will fail and it doesn't matter. +- echo "$(get_event_filter)" > $trace_base/tracing/events/kmem/filter 2>&1 +- echo "$(get_event_filter)" > $trace_base/tracing/events/module/filter 2>&1 +- +- # Set the number of comm-pid if supported. +- if [ -f "$trace_base/tracing/saved_cmdlines_size" ]; then +- # Thanks to filters, 4096 is big enough(also well supported). +- echo 4096 > $trace_base/tracing/saved_cmdlines_size +- fi +- +- # Enable and clear trace data for the first time. +- echo 1 > $trace_base/tracing/tracing_on +- echo > $trace_base/tracing/trace +- echo "Prepare trace success." +- return 0 +-} +- +-order_to_pages() +-{ +- local pages=1 +- local order=$1 +- +- while [ "$order" != 0 ]; do +- order=$((order-1)) +- pages=$(($pages*2)) +- done +- +- echo $pages +-} +- +-parse_trace_data() { +- local module_name tmp_eval pages +- +- cat "$(get_trace_base)/tracing/trace" | while read pid cpu flags ts function args +- do +- # Skip comment lines +- if [ "$pid" = "#" ]; then +- continue +- fi +- +- pid=${pid##*-} +- function=${function%:} +- if [ "$function" = "module_load" ]; then +- # One module is being loaded, save the task pid for tracking. +- # Remove the trailing after whitespace, there may be the module flags. +- module_name=${args%% *} +- # Mark current_module to track the task. +- eval current_module_$pid="$module_name" +- tmp_eval=$(eval echo '${module_loaded_'${module_name}'}') +- if [ -n "$tmp_eval" ]; then +- echo "WARN: \"$module_name\" was loaded multiple times!" +- fi +- eval unset module_loaded_$module_name +- eval nr_alloc_pages_$module_name=0 +- continue +- fi +- +- module_name=$(eval echo '${current_module_'${pid}'}') +- if [ -z "$module_name" ]; then +- continue +- fi +- +- # Once we get here, the task is being tracked(is loading a module). +- if [ "$function" = "module_put" ]; then +- # Mark the module as loaded when the first module_put event happens after module_load. +- tmp_eval=$(eval echo '${nr_alloc_pages_'${module_name}'}') +- echo "$tmp_eval pages consumed by \"$module_name\"" +- eval module_loaded_$module_name=1 +- # Module loading finished, so untrack the task. +- eval unset current_module_$pid +- eval unset nr_alloc_pages_$module_name +- continue +- fi +- +- if [ "$function" = "mm_page_alloc" ]; then +- # Get order first, then convert to actual pages. +- pages=$(echo $args | sed -e 's/.*order=\([0-9]*\) .*/\1/') +- pages=$(order_to_pages "$pages") +- tmp_eval=$(eval echo '${nr_alloc_pages_'${module_name}'}') +- eval nr_alloc_pages_$module_name="$(($tmp_eval+$pages))" +- fi +- done +-} +- +-cleanup_trace() { +- local trace_base +- +- if is_trace_ready; then +- trace_base=$(get_trace_base) +- echo 0 > $trace_base/tracing/tracing_on +- echo > $trace_base/tracing/trace +- echo > $trace_base/tracing/set_event +- echo 0 > $trace_base/tracing/events/kmem/filter +- echo 0 > $trace_base/tracing/events/module/filter +- fi +-} +- +-show_usage() { +- echo "Find out kernel modules with large memory consumption during loading based on trace." +- echo "Usage:" +- echo "1) run it first to setup trace." +- echo "2) run again to parse the trace data if any." +- echo "3) run with \"--cleanup\" option to cleanup trace after use." +-} +- +-if [ "$1" = "--help" ]; then +- show_usage +- exit 0 +-fi +- +-if [ "$1" = "--cleanup" ]; then +- cleanup_trace +- exit 0 +-fi +- +-if is_trace_ready ; then +- echo "tracekomem - Rough memory consumption by loading kernel modules (larger value with better accuracy)" +- parse_trace_data +-else +- prepare_trace +-fi +- +-exit $? +diff --git a/modules.d/99base/module-setup.sh b/modules.d/99base/module-setup.sh +index c9ead01d..3578643c 100755 +--- a/modules.d/99base/module-setup.sh ++++ b/modules.d/99base/module-setup.sh +@@ -35,7 +35,6 @@ install() { + inst_script "$moddir/initqueue.sh" "/sbin/initqueue" + inst_script "$moddir/loginit.sh" "/sbin/loginit" + inst_script "$moddir/rdsosreport.sh" "/sbin/rdsosreport" +- inst_script "$moddir/memtrace-ko.sh" "/sbin/tracekomem" + + [ -e "${initdir}/lib" ] || mkdir -m 0755 -p ${initdir}/lib + mkdir -m 0755 -p ${initdir}/lib/dracut + diff --git a/SOURCES/0076.patch b/SOURCES/0076.patch new file mode 100644 index 0000000..755c8a6 --- /dev/null +++ b/SOURCES/0076.patch @@ -0,0 +1,320 @@ +From adacd8101e7558930e4499c21006eaa14629c234 Mon Sep 17 00:00:00 2001 +From: Kairui Song +Date: Wed, 8 Apr 2020 20:09:38 +0800 +Subject: [PATCH] Add 99memstrack module + +memstrack is a new tool to track the overall memory usage and +allocation, which can help off load the improve the builtin module +memory tracing function in dracut. + +With this change, the rd.memdebug=4 behavior is similiar with before, +but the report is defered to pre-pivot, so the memory usage info +during the whole initramfs run is traced. And the ourput format is +changed a bit: + + dracut-pre-pivot[519]: ======== Report format module_summary: ======== + dracut-pre-pivot[519]: Module squashfs using 10.4MB (2658 pages), peak allocation 10.4MB (2671 pages) + dracut-pre-pivot[519]: Module qxl using 3.4MB (865 pages), peak allocation 3.4MB (880 pages) + dracut-pre-pivot[519]: Module crc32c_intel using 2.0MB (519 pages), peak allocation 3.0MB (769 pages) + dracut-pre-pivot[519]: Module serio_raw using 2.0MB (505 pages), peak allocation 3.6MB (918 pages) + dracut-pre-pivot[519]: Module virtio_console using 1.6MB (416 pages), peak allocation 1.6MB (419 pages) + ... snip ... + dracut-pre-pivot[519]: ======== Report format module_summary END ======== + +It now contains more detail and also includes the peak usage which could +be more helpful. + +And now it have a rd.memdebug=5, which will print more detail about +the stack trace of the top memory user, also printed on pri-pivot: + + dracut-pre-pivot[519]: ======== Report format module_top: ======== + dracut-pre-pivot[519]: Top stack usage of module squashfs: + dracut-pre-pivot[519]: (null) Pages: 2658 (peak: 2671) + dracut-pre-pivot[519]: (null) Pages: 2658 (peak: 2671) + dracut-pre-pivot[519]: async_page_fault (0xffffffff81a01149) Pages: 1448 (peak: 1461) + dracut-pre-pivot[519]: do_async_page_fault (0xffffffff8105c509) Pages: 1448 (peak: 1461) + dracut-pre-pivot[519]: do_page_fault (0xffffffff8106296a) Pages: 1448 (peak: 1461) + dracut-pre-pivot[519]: do_user_addr_fault (0xffffffff810626bd) Pages: 1448 (peak: 1461) + dracut-pre-pivot[519]: handle_mm_fault (0xffffffff812940c4) Pages: 1448 (peak: 1461) + dracut-pre-pivot[519]: __handle_mm_fault (0xffffffff81293627) Pages: 1195 (peak: 1208) + dracut-pre-pivot[519]: __do_fault (0xffffffff8128b07e) Pages: 1195 (peak: 1208) + dracut-pre-pivot[519]: filemap_fault (0xffffffff8124c0b9) Pages: 1195 (peak: 1208) + dracut-pre-pivot[519]: __do_page_cache_readahead (0xffffffff812585da) Pages: 1063 (peak: 1076) + dracut-pre-pivot[519]: read_pages (0xffffffff812583c2) Pages: 1063 (peak: 1076) + dracut-pre-pivot[519]: squashfs_readpage squashfs (0xffffffffc0022073) Pages: 1039 (peak: 1052) + dracut-pre-pivot[519]: squashfs_readpage_block squashfs (0xffffffffc0024334) Pages: 744 (peak: 744) + dracut-pre-pivot[519]: squashfs_copy_cache squashfs (0xffffffffc0021a3f) Pages: 744 (peak: 744) + dracut-pre-pivot[519]: pagecache_get_page (0xffffffff8124abf7) Pages: 744 (peak: 744) + dracut-pre-pivot[519]: __page_cache_alloc (0xffffffff81247df6) Pages: 744 (peak: 744) + dracut-pre-pivot[519]: alloc_pages_current (0xffffffff812cdca7) Pages: 744 (peak: 744) + dracut-pre-pivot[519]: __alloc_pages_nodemask (0xffffffff812b3107) Pages: 744 (peak: 744) + dracut-pre-pivot[519]: __alloc_pages_nodemask (0xffffffff812b3107) Pages: 1488 (peak: 1488) + dracut-pre-pivot[519]: Top stack usage of module qxl: + dracut-pre-pivot[519]: (null) Pages: 865 (peak: 880) + dracut-pre-pivot[519]: entry_SYSCALL_64_after_hwframe (0xffffffff81a0008c) Pages: 855 (peak: 858) + dracut-pre-pivot[519]: do_syscall_64 (0xffffffff81002a5a) Pages: 855 (peak: 858) + dracut-pre-pivot[519]: __x64_sys_finit_module (0xffffffff8117ccea) Pages: 811 (peak: 811) + dracut-pre-pivot[519]: __do_sys_finit_module (0xffffffff8117cc6e) Pages: 811 (peak: 811) + dracut-pre-pivot[519]: load_module (0xffffffff8117c6be) Pages: 802 (peak: 802) + dracut-pre-pivot[519]: do_init_module (0xffffffff81179e72) Pages: 802 (peak: 802) + dracut-pre-pivot[519]: do_one_initcall (0xffffffff81000d5a) Pages: 802 (peak: 802) + dracut-pre-pivot[519]: serio_raw_poll serio_raw (0xffffffffc0200054) Pages: 802 (peak: 802) + dracut-pre-pivot[519]: __pci_register_driver (0xffffffff81557804) Pages: 802 (peak: 802) + dracut-pre-pivot[519]: driver_register (0xffffffff8167ed24) Pages: 802 (peak: 802) + dracut-pre-pivot[519]: bus_add_driver (0xffffffff8167cbb2) Pages: 801 (peak: 801) + dracut-pre-pivot[519]: driver_attach (0xffffffff8167d28e) Pages: 801 (peak: 801) + dracut-pre-pivot[519]: bus_for_each_dev (0xffffffff8167b62c) Pages: 801 (peak: 801) + dracut-pre-pivot[519]: __driver_attach (0xffffffff8167e18f) Pages: 801 (peak: 801) + dracut-pre-pivot[519]: device_driver_attach (0xffffffff8167e0ed) Pages: 801 (peak: 801) + dracut-pre-pivot[519]: driver_probe_device (0xffffffff8167de6c) Pages: 801 (peak: 801) + dracut-pre-pivot[519]: really_probe (0xffffffff8167d9c9) Pages: 801 (peak: 801) + dracut-pre-pivot[519]: pci_device_probe (0xffffffff81559627) Pages: 801 (peak: 801) + dracut-pre-pivot[519]: local_pci_probe (0xffffffff81557f98) Pages: 801 (peak: 801) + dracut-pre-pivot[519]: qxl_pci_probe qxl (0xffffffffc01f0387) Pages: 773 (peak: 773) + dracut-pre-pivot[519]: drm_fbdev_generic_setup drm_kms_helper (0xffffffffc01b30c5) Pages: 773 (peak: 773) + dracut-pre-pivot[519]: drm_fbdev_client_hotplug drm_kms_helper (0xffffffffc01b2656) Pages: 773 (peak: 773) + dracut-pre-pivot[519]: __drm_fb_helper_initial_config_and_unlock drm_kms_helper (0xffffffffc01b1a28) Pages: 770 (peak: 770) + dracut-pre-pivot[519]: drm_fb_helper_generic_probe drm_kms_helper (0xffffffffc01b2fa5) Pages: 770 (peak: 770) + dracut-pre-pivot[519]: vzalloc (0xffffffff812aa39c) Pages: 770 (peak: 770) + dracut-pre-pivot[519]: __vmalloc_node_range (0xffffffff812aa200) Pages: 768 (peak: 768) + ... snip ... + ======== Report format module_top END ======== + +This could be very helpful for debuging memory usage issues. + +(cherry picked from commit 7dd8a2f4d351ce8975c0af122732a2a12697c8cc) + +Resolves: #1829528 +--- + dracut.cmdline.7.asc | 16 +++++--- + dracut.spec | 2 + + modules.d/99base/dracut-lib.sh | 2 +- + modules.d/99memstrack/memstrack-report.sh | 23 +++++++++++ + modules.d/99memstrack/memstrack-start.sh | 68 +++++++++++++++++++++++++++++++ + modules.d/99memstrack/memstrack.service | 13 ++++++ + modules.d/99memstrack/module-setup.sh | 27 ++++++++++++ + 7 files changed, 144 insertions(+), 7 deletions(-) + +diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc +index 0dc58d1a..7f31fbae 100644 +--- a/dracut.cmdline.7.asc ++++ b/dracut.cmdline.7.asc +@@ -187,8 +187,8 @@ It should be attached to any report about dracut problems. + _/run/initramfs/init.log_. + If "quiet" is set, it also logs to the console. + +-**rd.memdebug=[0-3]**:: +- Print memory usage info at various points, set the verbose level from 0 to 4. ++**rd.memdebug=[0-5]**:: ++ Print memory usage info at various points, set the verbose level from 0 to 5. + + + Higher level means more debugging output: + + +@@ -197,10 +197,14 @@ It should be attached to any report about dracut problems. + 1 - partial /proc/meminfo + 2 - /proc/meminfo + 3 - /proc/meminfo + /proc/slabinfo +- 4 - /proc/meminfo + /proc/slabinfo + tracekomem +- NOTE: tracekomem is a shell script utilizing kernel trace to track +- the rough total memory consumption of kernel modules during +- loading. It may override other trace configurations. ++ 4 - /proc/meminfo + /proc/slabinfo + memstrack summary ++ NOTE: memstrack is a memory tracing tool that tracks the total memory ++ consumption, and peak memory consumption of each kernel modules ++ and userspace progress during the whole initramfs runtime, report ++ is genereted and the end of initramsfs run. ++ 5 - /proc/meminfo + /proc/slabinfo + memstrack (with top memory stacktrace) ++ NOTE: memstrack (with top memory stacktrace) will print top memory ++ allocation stack traces during the whole initramfs runtime. + ---- + + **rd.break**:: +diff --git a/dracut.spec b/dracut.spec +index 0f7eb4bf..c82c24f6 100644 +--- a/dracut.spec ++++ b/dracut.spec +@@ -84,6 +84,7 @@ Requires: xz + Requires: gzip + + %if 0%{?fedora} || 0%{?rhel} ++Recommends: memstrack + Recommends: hardlink + Recommends: pigz + Recommends: kpartx +@@ -399,6 +400,7 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne + %{dracutlibdir}/modules.d/98syslog + %{dracutlibdir}/modules.d/98usrmount + %{dracutlibdir}/modules.d/99base ++%{dracutlibdir}/modules.d/99memstrack + %{dracutlibdir}/modules.d/99fs-lib + %{dracutlibdir}/modules.d/99shutdown + %attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log +diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh +index 502c7568..56dd63ef 100755 +--- a/modules.d/99base/dracut-lib.sh ++++ b/modules.d/99base/dracut-lib.sh +@@ -1220,7 +1220,7 @@ are_lists_eq() { + + setmemdebug() { + if [ -z "$DEBUG_MEM_LEVEL" ]; then +- export DEBUG_MEM_LEVEL=$(getargnum 0 0 3 rd.memdebug) ++ export DEBUG_MEM_LEVEL=$(getargnum 0 0 5 rd.memdebug) + fi + } + +diff --git a/modules.d/99memstrack/memstrack-report.sh b/modules.d/99memstrack/memstrack-report.sh +new file mode 100755 +index 00000000..241e8621 +--- /dev/null ++++ b/modules.d/99memstrack/memstrack-report.sh +@@ -0,0 +1,23 @@ ++#!/usr/bin/env bash ++. /lib/dracut-lib.sh ++ ++if ! [ "$DEBUG_MEM_LEVEL" -ge 4 ]; then ++ exit 0 ++fi ++ ++if type -P systemctl >/dev/null; then ++ systemctl stop memstrack.service ++else ++ get_pid_of_tracer () { ++ local _user _pid _rest ++ read _user _pid _rest <<< $(ps aux | grep [m]emstrack | head -1) ++ echo $_pid ++ } ++ ++ kill -s INT $(get_pid_of_tracer) ++ while [[ -n $(get_pid_of_tracer) ]]; do ++ sleep 1 ++ done ++fi ++ ++cat /.memstrack +diff --git a/modules.d/99memstrack/memstrack-start.sh b/modules.d/99memstrack/memstrack-start.sh +new file mode 100755 +index 00000000..5aa73efe +--- /dev/null ++++ b/modules.d/99memstrack/memstrack-start.sh +@@ -0,0 +1,68 @@ ++#!/bin/sh ++# Mount kernel debug fs so debug tools can work. ++# memdebug=4 and memdebug=5 requires debug fs to be mounted. ++# And there is no need to umount it. ++ ++type getargnum >/dev/null 2>&1 || . /lib/dracut-lib.sh ++ ++# "sys/kernel/tracing" has the priority if exists. ++get_trace_base() { ++ # trace access through debugfs would be obsolete if "/sys/kernel/tracing" is available. ++ if [ -d "/sys/kernel/tracing" ]; then ++ echo "/sys/kernel" ++ else ++ echo "/sys/kernel/debug" ++ fi ++} ++ ++is_debugfs_ready() { ++ [ -f "$(get_trace_base)/tracing/trace" ] ++} ++ ++prepare_debugfs() { ++ local trace_base ++ ++ trace_base=$(get_trace_base) ++ # old debugfs interface case. ++ if ! [ -d "$trace_base/tracing" ]; then ++ mount none -t debugfs $trace_base ++ # new tracefs interface case. ++ elif ! [ -f "$trace_base/tracing/trace" ]; then ++ mount none -t tracefs "$trace_base/tracing" ++ fi ++ ++ if ! [ -f "$trace_base/tracing/trace" ]; then ++ echo "WARN: failed to mount debugfs" ++ return 1 ++ fi ++} ++ ++if ! is_debugfs_ready ; then ++ prepare_debugfs ++fi ++ ++if [ -n "$DEBUG_MEM_LEVEL" ]; then ++ if [ "$DEBUG_MEM_LEVEL" -ge 5 ]; then ++ echo "memstrack - will report kernel module memory usage summary and top allocation stack" ++ memstrack --report module_summary,module_top --notui --throttle 80 -o /.memstrack & ++ elif [ "$DEBUG_MEM_LEVEL" -ge 4 ]; then ++ echo "memstrack - will report memory usage summary" ++ memstrack --report module_summary --notui --throttle 80 -o /.memstrack & ++ else ++ exit 0; ++ fi ++fi ++ ++PID=$! ++RET=$? ++ ++if [ $RET -ne 0 ]; then ++ echo "Failed to start memstrack, exit status: $RET" ++ exit $RET ++fi ++ ++# Wait a second for memstrack to setup everything, avoid missing any event ++sleep 1 ++ ++echo $PID > /run/memstrack.pid ++disown +diff --git a/modules.d/99memstrack/memstrack.service b/modules.d/99memstrack/memstrack.service +new file mode 100644 +index 00000000..6b47adef +--- /dev/null ++++ b/modules.d/99memstrack/memstrack.service +@@ -0,0 +1,13 @@ ++[Unit] ++Description=Memstrack Anylazing Service ++DefaultDependencies=no ++Before=dracut-cmdline.service systemd-udevd.service local-fs-pre.target ++IgnoreOnIsolate=true ++ ++[Service] ++Type=simple ++ExecStart=/bin/memstrack-start ++PIDFile=/run/memstrack.pid ++StandardInput=null ++StandardOutput=syslog+console ++StandardError=syslog+console +diff --git a/modules.d/99memstrack/module-setup.sh b/modules.d/99memstrack/module-setup.sh +new file mode 100755 +index 00000000..d5bacb4d +--- /dev/null ++++ b/modules.d/99memstrack/module-setup.sh +@@ -0,0 +1,27 @@ ++#!/usr/bin/bash ++ ++check() { ++ if type -P memstrack >/dev/null; then ++ dinfo "memstrack is available" ++ return 0 ++ fi ++ ++ dinfo "memstrack is not available" ++ dinfo "If you need to use rd.memdebug>=4, please install memstrack" ++ ++ return 1 ++} ++ ++depends() { ++ return 0 ++} ++ ++install() { ++ inst "/bin/memstrack" "/bin/memstrack" ++ ++ inst "$moddir/memstrack-start.sh" "/bin/memstrack-start" ++ inst_hook cleanup 99 "$moddir/memstrack-report.sh" ++ ++ inst "$moddir/memstrack.service" "$systemdsystemunitdir/memstrack.service" ++ systemctl -q --root "$initdir" add-wants initrd.target memstrack.service ++} + diff --git a/SOURCES/0077.patch b/SOURCES/0077.patch new file mode 100644 index 0000000..b61275e --- /dev/null +++ b/SOURCES/0077.patch @@ -0,0 +1,35 @@ +From 8b3033c92a073f9e63074ffcdb1af6e69d99105c Mon Sep 17 00:00:00 2001 +From: Attila Bruncsak +Date: Fri, 14 Dec 2018 15:57:33 +0100 +Subject: [PATCH] the strip command should avoid changing the file modification + time + +(cherry picked from commit 7e944c77c0e05f2cc28e11227b465525c5131772) + +Resolves: #1776659 +--- + dracut.sh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/dracut.sh b/dracut.sh +index f270af76..223261d6 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -1663,14 +1663,14 @@ if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then + dinfo "*** Stripping files ***" + find "$initdir" -type f \ + -executable -not -path '*/lib/modules/*.ko' -print0 \ +- | xargs -r -0 $strip_cmd -g 2>/dev/null ++ | xargs -r -0 $strip_cmd -g -p 2>/dev/null + + # strip kernel modules, but do not touch signed modules + find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \ + | while read -r -d $'\0' f || [ -n "$f" ]; do + SIG=$(tail -c 28 "$f" | tr -d '\000') + [[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; } +- done | xargs -r -0 $strip_cmd -g ++ done | xargs -r -0 $strip_cmd -g -p + + dinfo "*** Stripping files done ***" + fi + diff --git a/SOURCES/0078.patch b/SOURCES/0078.patch new file mode 100644 index 0000000..b50250b --- /dev/null +++ b/SOURCES/0078.patch @@ -0,0 +1,108 @@ +From cbebaacfd05c55fddd11b3090983a2be1d2b48d3 Mon Sep 17 00:00:00 2001 +From: Kairui Song +Date: Wed, 17 Jul 2019 17:10:36 +0800 +Subject: [PATCH] dracut.sh: Adjust squash and strip order + +Previously with squash module, some binaries will be reinstalled, but +stripping happens before that so new installed binaries is not stripped. +So adjust the squash and strip order, ensure new installed binaries are +stripped just the same way with the old binaries. + +Also split squash into two stage to make the split easier, move the +squash temp dir into initdir so stripping will cover that too, +and print more usefule message. + +Signed-off-by: Kairui Song +(cherry picked from commit 6a74c03b4a8472fb090015b32e652edfeadb5a10) + +Resolves: #1776659 +--- + dracut.sh | 43 +++++++++++++++++++++++++------------------ + 1 file changed, 25 insertions(+), 18 deletions(-) + +diff --git a/dracut.sh b/dracut.sh +index 223261d6..310646e3 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -1659,21 +1659,6 @@ for d in $(ldconfig_paths); do + rmdir -p --ignore-fail-on-non-empty "$initdir/$d" >/dev/null 2>&1 + done + +-if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then +- dinfo "*** Stripping files ***" +- find "$initdir" -type f \ +- -executable -not -path '*/lib/modules/*.ko' -print0 \ +- | xargs -r -0 $strip_cmd -g -p 2>/dev/null +- +- # strip kernel modules, but do not touch signed modules +- find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \ +- | while read -r -d $'\0' f || [ -n "$f" ]; do +- SIG=$(tail -c 28 "$f" | tr -d '\000') +- [[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; } +- done | xargs -r -0 $strip_cmd -g -p +- +- dinfo "*** Stripping files done ***" +-fi + if [[ $early_microcode = yes ]]; then + dinfo "*** Generating early-microcode cpio image ***" + ucode_dir=(amd-ucode intel-ucode) +@@ -1745,9 +1730,8 @@ if [[ $hostonly_cmdline == "yes" ]] ; then + fi + fi + +-dinfo "*** Creating image file '$outfile' ***" +- + if dracut_module_included "squash"; then ++ dinfo "*** Install squash loader ***" + if ! check_kernel_config CONFIG_SQUASHFS; then + dfatal "CONFIG_SQUASHFS have to be enabled for dracut squash module to work" + exit 1 +@@ -1761,7 +1745,7 @@ if dracut_module_included "squash"; then + exit 1 + fi + +- readonly squash_dir="${DRACUT_TMPDIR}/squashfs" ++ readonly squash_dir="$initdir/squash/root" + readonly squash_img=$initdir/squash/root.img + + # Currently only move "usr" "etc" to squashdir +@@ -1854,15 +1838,38 @@ if dracut_module_included "squash"; then + fi + done + done ++fi + ++if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then ++ dinfo "*** Stripping files ***" ++ find "$initdir" -type f \ ++ -executable -not -path '*/lib/modules/*.ko' -print0 \ ++ | xargs -r -0 $strip_cmd -g -p 2>/dev/null ++ ++ # strip kernel modules, but do not touch signed modules ++ find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \ ++ | while read -r -d $'\0' f || [ -n "$f" ]; do ++ SIG=$(tail -c 28 "$f" | tr -d '\000') ++ [[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; } ++ done | xargs -r -0 $strip_cmd -g -p ++ dinfo "*** Stripping files done ***" ++fi ++ ++if dracut_module_included "squash"; then ++ dinfo "*** Squashing the files inside the initramfs ***" + mksquashfs $squash_dir $squash_img -comp xz -b 64K -Xdict-size 100% &> /dev/null + + if [[ $? != 0 ]]; then + dfatal "dracut: Failed making squash image" + exit 1 + fi ++ ++ rm -rf $squash_dir ++ dinfo "*** Squashing the files inside the initramfs done ***" + fi + ++dinfo "*** Creating image file '$outfile' ***" ++ + if [[ $uefi = yes ]]; then + readonly uefi_outdir="$DRACUT_TMPDIR/uefi" + mkdir "$uefi_outdir" + diff --git a/SOURCES/0079.patch b/SOURCES/0079.patch new file mode 100644 index 0000000..116dc2b --- /dev/null +++ b/SOURCES/0079.patch @@ -0,0 +1,30 @@ +From b36c1ff083499c2cf1d1dbb7fe1663a2dd0683cc Mon Sep 17 00:00:00 2001 +From: Kairui Song +Date: Wed, 25 Sep 2019 13:47:40 +0800 +Subject: [PATCH] Fine tune mksquashfs options for squash module + +Drop some unneeded metadata in the squash image, and print the error +message if something went wrong. + +Signed-off-by: Kairui Song +(cherry picked from commit 89bc1aa324bcdda3723247218a697171c5a3de6f) + +Resolves: #1776659 +--- + dracut.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dracut.sh b/dracut.sh +index 310646e3..487add57 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -1857,7 +1857,7 @@ fi + + if dracut_module_included "squash"; then + dinfo "*** Squashing the files inside the initramfs ***" +- mksquashfs $squash_dir $squash_img -comp xz -b 64K -Xdict-size 100% &> /dev/null ++ mksquashfs $squash_dir $squash_img -no-xattrs -no-exports -noappend -always-use-fragments -comp xz -Xdict-size 100% -no-progress 1> /dev/null + + if [[ $? != 0 ]]; then + dfatal "dracut: Failed making squash image" + diff --git a/SOURCES/0080.patch b/SOURCES/0080.patch new file mode 100644 index 0000000..f7fd767 --- /dev/null +++ b/SOURCES/0080.patch @@ -0,0 +1,93 @@ +From 90d96c4f6a44d895f8999da8c4721a04612e6379 Mon Sep 17 00:00:00 2001 +From: Kairui Song +Date: Tue, 29 Oct 2019 16:29:14 +0800 +Subject: [PATCH] 90kernel-modules: don't install any block driver if not + needed + +If hostonly mode is in use, and there isn't any block device included +as hostonly device, then the initramfs won't need any block driver. + +Eg. for kdump built image, there could be only one nfs mount point, +or the initramfs may only execute some network operation then reboot. + +In such case, skip block driver installation to save space and time. + +Signed-off-by: Kairui Song +(cherry picked from commit f4ad2e5c8964b6c7b50420299a0096bade6a40bd) + +Resolves: #1776659 +--- + modules.d/90kernel-modules/module-setup.sh | 32 +++++++++++++++++++++++------- + 1 file changed, 25 insertions(+), 7 deletions(-) + +diff --git a/modules.d/90kernel-modules/module-setup.sh b/modules.d/90kernel-modules/module-setup.sh +index 3dfceff0..c91ba10c 100755 +--- a/modules.d/90kernel-modules/module-setup.sh ++++ b/modules.d/90kernel-modules/module-setup.sh +@@ -2,6 +2,8 @@ + + # called by dracut + installkernel() { ++ local _blockfuncs='ahci_platform_get_resources|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect|mmc_add_host|sdhci_add_host|scsi_add_host_with_dma' ++ + find_kernel_modules_external () { + local _OLDIFS + local external_pattern="^/" +@@ -16,11 +18,25 @@ installkernel() { + done < "$srcmods/modules.dep" + IFS=$_OLDIFS + } +- local _blockfuncs='ahci_platform_get_resources|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect|mmc_add_host|sdhci_add_host|scsi_add_host_with_dma' ++ ++ is_block_dev() { ++ [ -e /sys/dev/block/$1 ] && return 0 ++ return 1 ++ } ++ ++ install_block_modules () { ++ hostonly='' instmods sr_mod sd_mod scsi_dh ata_piix ++ instmods \ ++ scsi_dh_rdac scsi_dh_emc scsi_dh_alua \ ++ =ide nvme vmd nfit \ ++ virtio_blk ++ ++ dracut_instmods -o -s "${_blockfuncs}" "=drivers" ++ } + + if [[ -z $drivers ]]; then + hostonly='' instmods \ +- sr_mod sd_mod scsi_dh ata_piix hid_generic unix \ ++ hid_generic unix \ + ehci-hcd ehci-pci ehci-platform \ + ohci-hcd ohci-pci \ + uhci-hcd \ +@@ -38,10 +54,10 @@ installkernel() { + ${NULL} + + instmods \ +- yenta_socket scsi_dh_rdac scsi_dh_emc scsi_dh_alua \ ++ yenta_socket \ + atkbd i8042 usbhid firewire-ohci pcmcia hv-vmbus \ +- virtio virtio_blk virtio_ring virtio_pci virtio_scsi \ +- "=drivers/pcmcia" =ide nvme vmd nfit ++ virtio virtio_ring virtio_pci virtio_scsi \ ++ "=drivers/pcmcia" + + if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 ]]; then + # arm/aarch64 specific modules +@@ -72,10 +88,12 @@ installkernel() { + ${NULL} + fi + +- dracut_instmods -o -s "${_blockfuncs}" "=drivers" +- + find_kernel_modules_external | instmods + ++ if ! [[ $hostonly ]] || for_each_host_dev_and_slaves is_block_dev; then ++ install_block_modules ++ fi ++ + # if not on hostonly mode, install all known filesystems, + # if the required list is not set via the filesystems variable + if ! [[ $hostonly ]]; then + diff --git a/SOURCES/0081.patch b/SOURCES/0081.patch new file mode 100644 index 0000000..3d3edb1 --- /dev/null +++ b/SOURCES/0081.patch @@ -0,0 +1,63 @@ +From 9eb855e073c077966a011146484b9b9596857361 Mon Sep 17 00:00:00 2001 +From: Kairui Song +Date: Thu, 5 Mar 2020 18:44:45 +0800 +Subject: [PATCH] 95znet: Add a rd.znet_ifname= option + +qeth device may have a different IP for each boot, so the rd.ifname= +option will no longer work. So for znet device, introduce a +rd.znet_ifname= options, to subchannel id instead of MAC address as the +identifier and rename the interface. + +Signed-off-by: Kairui Song +(cherry picked from commit 872eb69936bd849eec6d1974dd6569f23a7ad3db) + +Resolves: #1811977 +--- + dracut.cmdline.7.asc | 5 +++++ + modules.d/95znet/parse-ccw.sh | 18 ++++++++++++++++++ + 2 files changed, 23 insertions(+) + +diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc +index 7f31fbae..4a7c2517 100644 +--- a/dracut.cmdline.7.asc ++++ b/dracut.cmdline.7.asc +@@ -829,6 +829,11 @@ ZNET + RHEL/Fedora with ccw_init, which is called from udev for certain + devices on z-series. + rd.znet can be specified multiple times on the kernel command line. ++ ++**rd.znet_ifname=**____:____:: ++ Assign network device name (i.e. "bootnet") to the NIC ++ corresponds to the subchannels. This is useful when dracut's default ++ "ifname=" doesn't work due to device having a changing MAC address. + + + [listing] + .Example +diff --git a/modules.d/95znet/parse-ccw.sh b/modules.d/95znet/parse-ccw.sh +index 7d40a1aa..59b588f3 100755 +--- a/modules.d/95znet/parse-ccw.sh ++++ b/modules.d/95znet/parse-ccw.sh +@@ -4,4 +4,22 @@ for ccw_arg in $(getargs rd.ccw -d 'rd_CCW=') $(getargs rd.znet -d 'rd_ZNET='); + echo $ccw_arg >> /etc/ccw.conf + done + ++for ifname in $(getargs rd.znet_ifname); do ++ IFS=: read ifname_if ifname_subchannels _rest <<< "$ifname" ++ if [ -z "$ifname_if" ] || [ -z "$ifname_subchannels" ] || [ -n "$_rest" ]; then ++ warn "Invalid arguments for rd.znet_ifname=" ++ else ++ { ++ ifname_subchannels=${ifname_subchannels//,/|} ++ ++ echo 'ACTION!="add|change", GOTO="ccw_ifname_end"' ++ echo 'ATTR{type}!="1", GOTO="ccw_ifname_end"' ++ echo 'SUBSYSTEM!="net", GOTO="ccw_ifname_end"' ++ echo "SUBSYSTEMS==\"ccwgroup\", KERNELS==\"$ifname_subchannels\", DRIVERS==\"?*\" NAME=\"$ifname_if\"" ++ echo 'LABEL="ccw_ifname_end"' ++ ++ } > /etc/udev/rules.d/81-ccw-ifname.rules ++ fi ++done ++ + znet_cio_free + diff --git a/SOURCES/0082.patch b/SOURCES/0082.patch new file mode 100644 index 0000000..57c726e --- /dev/null +++ b/SOURCES/0082.patch @@ -0,0 +1,33 @@ +From 4f43dd89a1f9c21f66d6b460c0ad1b271ee40492 Mon Sep 17 00:00:00 2001 +From: Lukas Nykryn +Date: Mon, 25 May 2020 11:59:31 +0200 +Subject: [PATCH] Revert "[RHEL] network: default to network-legacy even in + presence of nm-initrd-generator" + +This reverts commit 7843bc52777683f6a4ef953d8dde7171ff3b911c. + +This will cause that NM will be used in initrd on systems where it is installed. + +Resolves: #1839706 +--- + modules.d/40network/module-setup.sh | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/modules.d/40network/module-setup.sh b/modules.d/40network/module-setup.sh +index bf252eb7..8e2a74a3 100755 +--- a/modules.d/40network/module-setup.sh ++++ b/modules.d/40network/module-setup.sh +@@ -8,9 +8,9 @@ check() { + # called by dracut + depends() { + echo -n "kernel-network-modules " +- # RHEL 8.1: Default to network-legacy unless the user chose +- # network-manager manually +- if ! dracut_module_included "network-manager" ; then ++ if ! dracut_module_included "network-legacy" && [ -x "/usr/libexec/nm-initrd-generator" ] ; then ++ echo "network-manager" ++ else + echo "network-legacy" + fi + return 0 + diff --git a/SOURCES/0083.patch b/SOURCES/0083.patch new file mode 100644 index 0000000..d33965e --- /dev/null +++ b/SOURCES/0083.patch @@ -0,0 +1,37 @@ +From 34ef33adfbb0b44ba6143f4ced206f948d814f86 Mon Sep 17 00:00:00 2001 +From: Kairui Song +Date: Wed, 27 May 2020 22:07:37 +0800 +Subject: [PATCH] 99memstrack: hook script should not call exit + +With memstrack module, rd.break may not work because the hook scripts +are sourced, not executed, so the exit call will make pre-pivot queue +exit early. See 98dracut-systemd/dracut-pre-pivot.sh, everything after +"source_hook cleanup" will be ignored. + +Replace with return instead. + +Credits go to Lukas Nykryn who helped discover and +debug this issue. + +Signed-off-by: Kairui Song +(cherry picked from commit 424f01e2a0ac0b329e68eb63048cf0d6d9c74d37) + +Resolves: #1829528 +--- + modules.d/99memstrack/memstrack-report.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/99memstrack/memstrack-report.sh b/modules.d/99memstrack/memstrack-report.sh +index 241e8621..3de55bd1 100755 +--- a/modules.d/99memstrack/memstrack-report.sh ++++ b/modules.d/99memstrack/memstrack-report.sh +@@ -2,7 +2,7 @@ + . /lib/dracut-lib.sh + + if ! [ "$DEBUG_MEM_LEVEL" -ge 4 ]; then +- exit 0 ++ return 0 + fi + + if type -P systemctl >/dev/null; then + diff --git a/SOURCES/0084.patch b/SOURCES/0084.patch new file mode 100644 index 0000000..62e0cb1 --- /dev/null +++ b/SOURCES/0084.patch @@ -0,0 +1,42 @@ +From f47136bada397328d0a6f36a81138699c793fe92 Mon Sep 17 00:00:00 2001 +From: Kairui Song +Date: Wed, 27 May 2020 21:59:55 +0800 +Subject: [PATCH] Remove cleanup_trace_mem calls + +In commit 49c4172 all shell based memory tracing functions are removed, +there are some left over. Remove them as well. + +Signed-off-by: Kairui Song +(cherry picked from commit 2a611328652388b809a379403ceec126cb55819f) + +Resolves: #1829528 +--- + modules.d/98dracut-systemd/dracut-pre-pivot.sh | 1 - + modules.d/99base/init.sh | 1 - + 2 files changed, 2 deletions(-) + +diff --git a/modules.d/98dracut-systemd/dracut-pre-pivot.sh b/modules.d/98dracut-systemd/dracut-pre-pivot.sh +index 96e6f8ca..cc70e3c3 100755 +--- a/modules.d/98dracut-systemd/dracut-pre-pivot.sh ++++ b/modules.d/98dracut-systemd/dracut-pre-pivot.sh +@@ -14,7 +14,6 @@ make_trace_mem "hook pre-pivot" '1:shortmem' '2+:mem' '3+:slab' + getarg 'rd.break=pre-pivot' 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot "Break pre-pivot" + source_hook pre-pivot + +-cleanup_trace_mem + # pre pivot cleanup scripts are sourced just before we switch over to the new root. + getarg 'rd.break=cleanup' 'rdbreak=cleanup' && emergency_shell -n cleanup "Break cleanup" + source_hook cleanup +diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh +index 2c0ccd66..a5633936 100755 +--- a/modules.d/99base/init.sh ++++ b/modules.d/99base/init.sh +@@ -271,7 +271,6 @@ getarg 'rd.break=pre-pivot' -d 'rdbreak=pre-pivot' && emergency_shell -n pre-piv + source_hook pre-pivot + + make_trace_mem "hook cleanup" '1:shortmem' '2+:mem' '3+:slab' +-cleanup_trace_mem + # pre pivot cleanup scripts are sourced just before we switch over to the new root. + getarg 'rd.break=cleanup' -d 'rdbreak=cleanup' && emergency_shell -n cleanup "Break cleanup" + source_hook cleanup + diff --git a/SOURCES/0085.patch b/SOURCES/0085.patch new file mode 100644 index 0000000..17023c6 --- /dev/null +++ b/SOURCES/0085.patch @@ -0,0 +1,71 @@ +From 689454c727c2730b6aa89ee4c4b7676900e07f78 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Fri, 12 Apr 2019 16:26:59 +0200 +Subject: [PATCH] Do not require non-empty kernel cmdline + +When booting with Fedora-Server-dvd-x86_64-30-20190411.n.0.iso, +/proc/cmdline is empty (libvirt, qemu host with bios, not sure if that +matters), after installation to disk, anaconda would "crash" in kernel-core +%posttrans, after calling kernel-install, because dracut would fail +with +> Could not determine the kernel command line parameters. +> Please specify the kernel command line in /etc/kernel/cmdline! + +I guess it's legitimate, even if unusual, to have no cmdline parameters. +Two changes are done in this patch: +1. do not fail if the cmdline is empty. +2. if /usr/lib/kernel/cmdline or /etc/kernel/cmdline are present, but + empty, ignore /proc/cmdline. If there's explicit configuration to + have empty cmdline, don't ignore it. + +(cherry picked from commit 38b4f4b21c3c6107d7a562fcb432237464440b91) + +Resolves: #1746069 +--- + 50-dracut.install | 4 +--- + 51-dracut-rescue.install | 10 +--------- + 2 files changed, 2 insertions(+), 12 deletions(-) + +diff --git a/50-dracut.install b/50-dracut.install +index 139ff82e..b897db84 100755 +--- a/50-dracut.install ++++ b/50-dracut.install +@@ -35,9 +35,7 @@ case "$COMMAND" in + read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline + elif [[ -f /usr/lib/kernel/cmdline ]]; then + read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline +- fi +- +- if ! [[ ${BOOT_OPTIONS[*]} ]]; then ++ else + read -r -d '' -a BOOT_OPTIONS < /proc/cmdline + fi + +diff --git a/51-dracut-rescue.install b/51-dracut-rescue.install +index 0580062f..5ac34ef3 100755 +--- a/51-dracut-rescue.install ++++ b/51-dracut-rescue.install +@@ -47,9 +47,7 @@ if [[ -f /etc/kernel/cmdline ]]; then + read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline + elif [[ -f /usr/lib/kernel/cmdline ]]; then + read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline +-fi +- +-if ! [[ "${BOOT_OPTIONS[@]}" ]]; then ++else + read -r -d '' -a line < /proc/cmdline + for i in "${line[@]}"; do + [[ "${i#initrd=*}" != "$i" ]] && continue +@@ -57,12 +55,6 @@ if ! [[ "${BOOT_OPTIONS[@]}" ]]; then + done + fi + +-if ! [[ ${BOOT_OPTIONS[*]} ]]; then +- echo "Could not determine the kernel command line parameters." >&2 +- echo "Please specify the kernel command line in /etc/kernel/cmdline!" >&2 +- exit 1 +-fi +- + if [[ -d "${BOOT_DIR_ABS%/*}" ]]; then + BOOT_DIR="/${MACHINE_ID}/0-rescue" + BOOT_ROOT=${BOOT_DIR_ABS%$BOOT_DIR} diff --git a/SPECS/dracut.spec b/SPECS/dracut.spec index 5d23b67..a27d9b1 100644 --- a/SPECS/dracut.spec +++ b/SPECS/dracut.spec @@ -5,7 +5,7 @@ # strip the automatically generated dep here and instead co-own the # directory. %global __requires_exclude pkg-config -%define dist_free_release 75.git20200422 +%define dist_free_release 86.git20200602 Name: dracut Version: 049 @@ -102,6 +102,17 @@ Patch71: 0071.patch Patch72: 0072.patch Patch73: 0073.patch Patch74: 0074.patch +Patch75: 0075.patch +Patch76: 0076.patch +Patch77: 0077.patch +Patch78: 0078.patch +Patch79: 0079.patch +Patch80: 0080.patch +Patch81: 0081.patch +Patch82: 0082.patch +Patch83: 0083.patch +Patch84: 0084.patch +Patch85: 0085.patch Source1: https://www.gnu.org/licenses/lgpl-2.1.txt @@ -159,6 +170,7 @@ Requires: xz Requires: gzip %if 0%{?fedora} || 0%{?rhel} +Recommends: memstrack Recommends: hardlink Recommends: pigz Recommends: kpartx @@ -474,6 +486,7 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne %{dracutlibdir}/modules.d/98syslog %{dracutlibdir}/modules.d/98usrmount %{dracutlibdir}/modules.d/99base +%{dracutlibdir}/modules.d/99memstrack %{dracutlibdir}/modules.d/99fs-lib %{dracutlibdir}/modules.d/99shutdown %attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log @@ -555,6 +568,23 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne %endif %changelog +* Tue Jun 02 2020 Lukas Nykryn - 049-86.git20200602 +- Do not require non-empty kernel cmdline + +* Wed May 27 2020 Lukas Nykryn - 049-85.git20200527 +- 99memstrack: hook script should not call exit +- Remove cleanup_trace_mem calls + +* Mon May 25 2020 Lukas Nykryn - 049-83.git20200525 +- Remove memtrace-ko and rd.memdebug=4 support in dracut +- Add 99memstrack module +- the strip command should avoid changing the file modification +- dracut.sh: Adjust squash and strip order +- Fine tune mksquashfs options for squash module +- 90kernel-modules: don't install any block driver if not +- 95znet: Add a rd.znet_ifname= option +- Revert "[RHEL] network: default to network-legacy even in + * Wed Apr 22 2020 Lukas Nykryn - 049-75.git20200422 - network-manager: fix getting of ifname from the sysfs path - network-manager: don't run NetworkManager when there are no