SHA256
1
0
forked from pool/s390-tools
s390-tools/s390-tools-sles12sp3-dbginfo-03-dbginfo.sh-Make-use-of-sysinfo-collection-helper.patch
2017-02-21 11:14:26 +00:00

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}"