File s390-tools-sles15sp3-dbginfo.sh-add-remove-commands.patch of Package s390-tools.24639

Subject: [PATCH] [BZ 192022] dbginfo: Added and removed commands
From: Mario Held <mario.held@de.ibm.com>

Description:   dbginfo.sh: Collect /proc/kallsyms, issue additional commands
Symptom:       - Required data gets not collected during run of dbginfo.sh  
               - vmcp q cache command always fails
Problem:       - some commands yet missing in dbginfo.sh script
               - command vmcp q cache is missing a mandatory parameter
Solution:      Stop to issue a vmcp q cache command (fails always) and add 
               - collect /proc/kallsyms as a tgz file (because of huge size)
               - lscpu -ye
               - vmcp q memassist
               - vmcp q pcifunction
               - vmcp q vmrelocate
Reproduction:  Run the dbginfo.sh and check for results in DBGINFOxxx.tgz file 
               - /proc/kallsyms
               - zvm_runtime.out
               - runtime.out
Upstream-ID:   eb1fd47a85c93ec247d89a4d02b0a5a2c5a8d444
Problem-ID:    192022

Upstream-Description:

              dbginfo: Added and removed commands

              Added kallsyms and lscpu -ye, added vmcp commands
              q memassist, q pcifunction, q vmrelocate and removed q cache

              Signed-off-by: Mario Held <mario.held@de.ibm.com>
              Signed-off-by: Jan Hoeppner <hoeppner@linux.ibm.com>


Signed-off-by: Mario Held <mario.held@de.ibm.com>
--- s390-tools-service.orig/scripts/dbginfo.sh
+++ s390-tools-service/scripts/dbginfo.sh
@@ -37,8 +37,8 @@ print_usage()
 
 Usage: ${SCRIPTNAME} [OPTIONS]
 
-This script collects runtime, configuration and trace information about
-your Linux on System z installation for debugging purposes.
+This script collects runtime, configuration and trace information on
+a Linux on IBM Z installation for debugging purposes.
 
 It also traces information about z/VM if the Linux runs under z/VM.
 
@@ -253,6 +253,7 @@ PROCFILES="\
   /proc/driver/z90crypt\
   /proc/interrupts\
   /proc/iomem\
+  /proc/kallsyms\
   /proc/mdstat\
   /proc/meminfo\
   /proc/misc\
@@ -435,6 +436,7 @@ CMDS="uname -a\
   :lschp\
   :lscss\
   :lscpu -ae\
+  :lscpu -ye\
   :lsmem\
   :lsdasd\
   :lsdasd -u\
@@ -532,7 +534,7 @@ VM_CMDS="q userid\
   :q lan\
   :q lan all details\
   :q lan all access\
-  :q cache\
+  :q memassist\
   :q nic\
   :q pav\
   :q proc\
@@ -549,6 +551,8 @@ VM_CMDS="q userid\
   :q dumpdev\
   :q reorder VMUSERID\
   :q quickdsp VMUSERID\
+  :q pcifunction\
+  :q vmrelocate\
   :ind load\
   :ind sp\
   :ind user\
@@ -1008,6 +1012,22 @@ post_processing() {
         touch --time=mtime -t "${file_mtime}" "${file_name}"
     done
 
+    find "${WORKPATH}proc/" -name "kallsyms" 2>/dev/null | while IFS= read -r file_name; do
+        tmp_file=${file_name}-`uname -r`.tgz
+        ch_dir="${WORKPATH}proc/"
+        orig_file="kallsyms"
+
+
+        echo " ${file_name}"
+        if ! test -e "${file_name}"; then
+            echo "${SCRIPTNAME}: Warning: Postprocessing failed on ${file_name}"
+            echo
+        fi
+
+        tar -cvzf "${tmp_file}" -C "${ch_dir}" "${orig_file}"
+        rm -f  "${file_name}"
+
+    done
 
     pr_log_stdout " "
 }
@@ -1124,6 +1144,8 @@ create_package()
     pr_stdout "Finalizing: Creating archive with collected data"
     cd "${WORKDIR_BASE}"
 
+    touch "${WORKARCHIVE}"
+    chmod 0600 "${WORKARCHIVE}"
     tar -czf "${WORKARCHIVE}" "${WORKDIR_CURRENT}"
     rc_tar=$?
     if [ $rc_tar -eq 0 ]; then
--- s390-tools-service.orig/scripts/dbginfo.sh.1
+++ s390-tools-service/scripts/dbginfo.sh.1
@@ -2,7 +2,7 @@
 
 .SH NAME
 dbginfo.sh \- collect runtime, configuration and trace information
-for debugging Linux on System z
+for debugging Linux on IBM Z
 
 .SH SYNOPSIS
 .br
@@ -12,7 +12,7 @@ for debugging Linux on System z
 
 .SH DESCRIPTION
 This script collects runtime, configuration and trace information that can
-be used to debug a Linux on System z instance.
+be used to debug a Linux on IBM Z instance.
 For Linux on z/VM, the script also traces information about the z/VM system.
 The debug information is written to a file
 /tmp/DBGINFO\-<date>\-<time>\-<hostname>\-<processorid>.tgz
@@ -52,7 +52,7 @@ Sample invocation:
 .br
 dbginfo.sh: Debug information script version %S390_TOOLS_VERSION%
 .br
-Copyright IBM Corp. 2002, 2019
+Copyright IBM Corp. 2002, 2021
 .PP
 Hardware platform     = s390x
 .br
@@ -104,4 +104,4 @@ Run the script with root authority.
 For Linux on z/VM, only z/VM guest virtual machines with class B privileges
 yield the complete debug information.
 .SH AUTHOR
-Linux on System z development <linux390@de.ibm.com>
+Linux on IBM Z development <linux390@de.ibm.com>
openSUSE Build Service is sponsored by