forked from pool/s390-tools
Marcus Meissner
9b729e2acc
New package per "Factory first" policy. Please list me as bug owner and maintainer, if possible. OBS-URL: https://build.opensuse.org/request/show/459343 OBS-URL: https://build.opensuse.org/package/show/Base:System/s390-tools?expand=0&rev=1
73 lines
2.7 KiB
Diff
73 lines
2.7 KiB
Diff
Subject: [PATCH] [FEAT RTL1601] dbginfo.sh: Make use of sysfs collection helper
|
|
From: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
|
|
|
|
Summary: dbginfo.sh: Make use of sysfs collection helper
|
|
Description: If available, use dump2tar in dbginfo.sh for sysfs
|
|
file collection to significantly speed up dbginfo.sh
|
|
processing. Example speedup on an LPAR with ~190k
|
|
sysfs files:
|
|
|
|
Unpatched:
|
|
# time ./dbginfo.sh
|
|
real 1m19.624s
|
|
user 0m44.985s
|
|
sys 0m45.173s
|
|
|
|
Patched:
|
|
# time ./dbginfo.sh
|
|
real 0m5.822s
|
|
user 0m4.523s
|
|
sys 0m2.636s
|
|
Upstream-ID: -
|
|
Problem-ID: RTL1601
|
|
|
|
Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
|
|
---
|
|
scripts/dbginfo.sh | 33 +++++++++++++++++++++------------
|
|
1 file changed, 21 insertions(+), 12 deletions(-)
|
|
|
|
--- a/scripts/dbginfo.sh
|
|
+++ b/scripts/dbginfo.sh
|
|
@@ -620,20 +620,29 @@ collect_sysfs() {
|
|
fi
|
|
fi
|
|
|
|
- call_run_command "find /sys -print0 | sort -z | xargs -0 -n 10 ls -ld" "${OUTPUT_FILE_SYSFS}"
|
|
+ # Collect sysfs files using multiple threads (-J 1) while excluding
|
|
+ # files known to block on read (-x). Stop reading a file that takes
|
|
+ # more than 5 seconds (-T 5) such as an active ftrace buffer.
|
|
+ dump2tar /sys -z -o "${WORKPATH}/sysfs.tgz" -x '*/tracing/trace_pipe*' \
|
|
+ -x '*/tracing/per_cpu/*' --ignore-failed-read -J 1 -T 5
|
|
|
|
- find /sys -noleaf -type d 2>/dev/null | while IFS= read -r dir_name; do
|
|
- mkdir -p "${WORKPATH}${dir_name}"
|
|
- done
|
|
+ if [ $? -ne 0 ] ; then
|
|
+ echo "${SCRIPTNAME}: Warning: dump2tar failed or is unavailable - falling back to slow path"
|
|
+ call_run_command "find /sys -print0 | sort -z | xargs -0 -n 10 ls -ld" "${OUTPUT_FILE_SYSFS}"
|
|
|
|
- find /sys -noleaf -type f -perm /444\
|
|
- -a -not -name "*trace_pipe*"\
|
|
- 2>/dev/null | while IFS= read -r file_name; do
|
|
- echo " ${file_name}"
|
|
- if ! dd if="${file_name}" status=noxfer iflag=nonblock of="${WORKPATH}${file_name}" >/dev/null 2>&1; then
|
|
- echo "${SCRIPTNAME}: Warning: failed to copy \"${file_name}\""
|
|
- fi
|
|
- done
|
|
+ find /sys -noleaf -type d 2>/dev/null | while IFS= read -r dir_name; do
|
|
+ mkdir -p "${WORKPATH}${dir_name}"
|
|
+ done
|
|
+
|
|
+ find /sys -noleaf -type f -perm /444\
|
|
+ -a -not -name "*trace_pipe*"\
|
|
+ 2>/dev/null | while IFS= read -r file_name; do
|
|
+ echo " ${file_name}"
|
|
+ if ! dd if="${file_name}" status=noxfer iflag=nonblock of="${WORKPATH}${file_name}" >/dev/null 2>&1; then
|
|
+ echo "${SCRIPTNAME}: Warning: failed to copy \"${file_name}\""
|
|
+ fi
|
|
+ done
|
|
+ fi
|
|
|
|
if test ${debugfs_mounted} -eq 1; then
|
|
umount "${MOUNT_POINT_DEBUGFS}"
|