diff -Nru s390-tools-2.20.0/debian/changelog s390-tools-2.20.0/debian/changelog --- s390-tools-2.20.0/debian/changelog 2022-04-13 10:32:45.000000000 +0000 +++ s390-tools-2.20.0/debian/changelog 2022-05-20 11:48:34.000000000 +0000 @@ -1,3 +1,42 @@ +s390-tools (2.20.0-0ubuntu3.1) jammy; urgency=medium + + * Fix chreipl-fcp-mpath (LP: #1971993) + - Move chreipl-fcp-mpath* from /lib/udev/rules.d to /lib/udev. + - d/control: + + Build-Depend on bsdextrautils for hexdump + + Add multiple explicit Depends on udev + + s390-tools-chreipl-fcp-mpath: drop unnecessary Depends on lvm2 + - No longer change attributes of chreipl-fcp-mpath-common.sh to 755, + since only the input script '.in' has a she-bang, but not the '.sh' + anymore (was done with commit c2f8988). + - Add d/p/0d15a07-chreipl-fcp-mpath-bundle-a-pre-cooked-man-page.patch + to bundle a pre-cooked version of the man page for chreipl-fcp-mpath + Required minor context adjustment for CHANGELOG.md hunk + and changes in d/rules. + - Add missing README.md to s390-tools-chreipl-fcp-mpath.doc + (and with that also the README.md for genprotimg to s390-tools.docs). + * Add new CPU-MF Counters for new IBM Z hardware (LP: #1960119) by: + - d/p/2515832-util_arch-Add-IBM-z16-as-known-machine.patch and + - d/p/cce5f51-cpumf-lscpumf-Add-IBM-z16-extended-counter-set-def.patch + * Add exploitation support of new IBM Z crypto hardware (LP: #1959548) with: + - d/p/b16a6d4f-lszcrypt-add-CEX8S-support.patch + - d/p/bcbb6fca-zcryptstats-add-CEX8-support.patch + - d/p/4382901d-lszcrypt-show-AP-bus-msg-size-limit-capability.patch + - d/p/27dce331-lszcrypt-add-support-for-checkstop-state.patch + - d/p/a29b3c89-lszcrypt-new-options-to-show-only-accel-cca-or-ep11-.patch + - d/p/a8b0d7ac-lszcrypt-new-options-to-filter-cards-queues-only.patch + - d/p/46fd42af-lszcrypt-new-option-to-show-the-serial-numbers-of-CC.patch + * Stabilization of data collection in dbginfo.sh script (LP: #1971959) + by adding several upstream patches: + - d/p/*-dbginfo.sh-*.patch + - whereas one needed minor context adjutment for the CHANGELOG.md hunk: + d/p/50a4740-dbginfo.sh-replace-which-by-builtin-command-type-for.patch + * Fix cmsfs-fuse mount failure due to unknown option '-o hard_remove' + (LP: #1978323) with: + d/p/0981df6-cmsfs-fuse-fix-enabling-of-hard_remove-option.patch + + -- Frank Heimes Fri, 20 May 2022 13:48:34 +0200 + s390-tools (2.20.0-0ubuntu3) jammy; urgency=medium * No-change rebuild to match s390-tools-signed version diff -Nru s390-tools-2.20.0/debian/control s390-tools-2.20.0/debian/control --- s390-tools-2.20.0/debian/control 2022-02-06 10:27:24.000000000 +0000 +++ s390-tools-2.20.0/debian/control 2022-05-20 11:48:34.000000000 +0000 @@ -4,14 +4,14 @@ Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Debian S/390 Team Uploaders: Bastian Blank -Build-Depends: debhelper-compat (= 13), libz-dev, quilt, gcc-multilib, libfuse3-dev, libncurses-dev, libpfm4-dev, libssl-dev, libcurl4-openssl-dev, libcryptsetup-dev, libjson-c-dev, libsnmp-dev, libglib2.0-dev, libxml2-dev +Build-Depends: debhelper-compat (= 13), libz-dev, quilt, gcc-multilib, libfuse3-dev, libncurses-dev, libpfm4-dev, libssl-dev, libcurl4-openssl-dev, libcryptsetup-dev, libjson-c-dev, libsnmp-dev, libglib2.0-dev, libxml2-dev, bsdextrautils Standards-Version: 3.9.7 Homepage: https://github.com/ibm-s390-linux/s390-tools Package: s390-tools Architecture: s390 s390x Priority: important -Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, ${signing:Depends}, gawk +Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, ${signing:Depends}, gawk, udev Recommends: sg3-utils Suggests: s390-tools-cpuplugd, s390-tools-osasnmpd, s390-tools-statd, s390-tools-chreipl-fcp-mpath, multipath-tools, lsscsi, rsync, blktrace Description: fundamental utilities for Linux on z Systems @@ -49,7 +49,7 @@ Package: s390-tools-osasnmpd Architecture: s390 s390x -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: ${shlibs:Depends}, ${misc:Depends}, udev Description: osasnmpd utility for Linux on z Systems The package contains osasnmpd monitoring daemon from the s390-tools collection of utilities. @@ -105,7 +105,7 @@ Package: s390-tools-chreipl-fcp-mpath Architecture: s390 s390x -Depends: ${misc:Depends}, multipath-tools-boot, lvm2 +Depends: ${misc:Depends}, multipath-tools, multipath-tools-boot, udev Description: chreipl-fcp-mpath utility for Linux on z Systems The package contains chreipl-fcp-mpath toolset from the s390-tools collection of utilities, that uses multipath information to change the configured FCP diff -Nru s390-tools-2.20.0/debian/patches/02a0d12-dbginfo.sh-re-group-commands-by-block-scsi.patch s390-tools-2.20.0/debian/patches/02a0d12-dbginfo.sh-re-group-commands-by-block-scsi.patch --- s390-tools-2.20.0/debian/patches/02a0d12-dbginfo.sh-re-group-commands-by-block-scsi.patch 1970-01-01 00:00:00.000000000 +0000 +++ s390-tools-2.20.0/debian/patches/02a0d12-dbginfo.sh-re-group-commands-by-block-scsi.patch 2022-05-20 11:48:34.000000000 +0000 @@ -0,0 +1,75 @@ +From 02a0d12988c43886943a26d3617b8f9422e6171a Mon Sep 17 00:00:00 2001 +From: Joern Siglen +Date: Wed, 16 Feb 2022 11:55:55 +0100 +Subject: [PATCH] dbginfo.sh: (re)group commands by block/scsi +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This change will group the commands executed for block and scsi devices +into a section with a comment. +By grouping, we intend to enhance the handling in our runtime.out file +and help to understand the purpose of command groups. + +In addition we did get feedback for promoting some commands to the top. + +Signed-off-by: Joern Siglen +Reviewed-by: Sa Liu +Reviewed-by: Mario Held +Reviewed-by: Steffen Maier +Signed-off-by: Jan Höppner + +Origin: upstream, https://github.com/ibm-s390-tools/s390-tools/commit/02a0d12988c43886943a26d3617b8f9422e6171a +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1971959 +Last-Update: 2022-05-25 + +--- + scripts/dbginfo.sh | 18 ++++++++++-------- + 1 file changed, 10 insertions(+), 8 deletions(-) + +diff --git a/scripts/dbginfo.sh b/scripts/dbginfo.sh +index e1b2ba04..4e458b3c 100755 +--- a/scripts/dbginfo.sh ++++ b/scripts/dbginfo.sh +@@ -447,18 +447,18 @@ CMDS="${CMDS}\ + :smc_dbg\ + " + ++# block device and other scsi device commands (in non alphabetical order) ++# command groups itself have an intentional topical grouping and order + CMDS="${CMDS}\ ++ :lsdasd\ ++ :lsdasd -u\ ++ :lvdisplay\ ++ :pvpath -qa\ + :dmsetup ls\ + :dmsetup ls --tree\ + :dmsetup table\ + :dmsetup table --target multipath\ + :dmsetup status\ +- :lsdasd\ +- :lsdasd -u\ +- :lsscsi\ +- :lszfcp\ +- :lszfcp -D\ +- :lszfcp -V\ + :multipathd -k'show config'\ + :multipathd -k'show maps'\ + :multipathd -k'show topo'\ +@@ -472,9 +472,11 @@ CMDS="${CMDS}\ + :multipath -v6 -ll\ + :multipath -d\ + :multipath -t\ +- :pvpath -qa\ +- :lvdisplay\ ++ :lszfcp\ ++ :lszfcp -D\ ++ :lszfcp -V\ + :ziorep_config -ADM\ ++ :lsscsi\ + " + + # crypto specific commands +-- +2.25.1 + diff -Nru s390-tools-2.20.0/debian/patches/0981df6-cmsfs-fuse-fix-enabling-of-hard_remove-option.patch s390-tools-2.20.0/debian/patches/0981df6-cmsfs-fuse-fix-enabling-of-hard_remove-option.patch --- s390-tools-2.20.0/debian/patches/0981df6-cmsfs-fuse-fix-enabling-of-hard_remove-option.patch 1970-01-01 00:00:00.000000000 +0000 +++ s390-tools-2.20.0/debian/patches/0981df6-cmsfs-fuse-fix-enabling-of-hard_remove-option.patch 2022-05-20 11:48:34.000000000 +0000 @@ -0,0 +1,67 @@ +From 0981df62c05e71123bc14483bba347f17aafa59a Mon Sep 17 00:00:00 2001 +From: Sven Schnelle +Date: Fri, 6 May 2022 16:16:12 +0200 +Subject: [PATCH] cmsfs-fuse: fix enabling of hard_remove option +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Since the switch to fuse3 setting the hard_remove option with the +FUSE_LIB_OPT() macro is no longer supported. See libfuse commit +8ee553dac029 ("fuse_new(): don't accept options that don't make sense +for end-users") for details. To fix this, add an appropriate init +function which sets this option. + +Fixes: https://github.com/ibm-s390-linux/s390-tools/issues/131 +Fixes: e679a88d8816 ("Switch from fuse2 to fuse3") +Signed-off-by: Sven Schnelle +Signed-off-by: Jan Höppner + +Origin: upstream, https://github.com/ibm-s390-tools/s390-tools/commit/0981df62c05e71123bc14483bba347f17aafa59a +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1978323 +Last-Update: 2022-06-10 + +--- + cmsfs-fuse/cmsfs-fuse.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/cmsfs-fuse/cmsfs-fuse.c b/cmsfs-fuse/cmsfs-fuse.c +index 4e0095fc..cfc30606 100644 +--- a/cmsfs-fuse/cmsfs-fuse.c ++++ b/cmsfs-fuse/cmsfs-fuse.c +@@ -4492,6 +4492,15 @@ static void destroy_file_object(struct file *f) + free(f); + } + ++static void *cmsfs_oper_init(struct fuse_conn_info *conn, struct fuse_config *cfg) ++{ ++ (void)conn; ++ ++ /* force immediate file removal */ ++ cfg->hard_remove = 1; ++ return NULL; ++} ++ + static struct file_operations fops_fixed = { + .cache_data = cache_file_fixed, + .write_data = extend_block_fixed, +@@ -4507,6 +4516,7 @@ static struct file_operations fops_variable = { + }; + + static struct fuse_operations cmsfs_oper = { ++ .init = cmsfs_oper_init, + .getattr = cmsfs_getattr, + .statfs = cmsfs_statfs, + .readdir = cmsfs_readdir, +@@ -4683,8 +4693,6 @@ int main(int argc, char *argv[]) + fuse_opt_add_arg(&args, "-oro"); + /* force single threaded mode which requires no locking */ + fuse_opt_add_arg(&args, "-s"); +- /* force immediate file removal */ +- fuse_opt_add_arg(&args, "-ohard_remove"); + + if (cmsfs.mode == BINARY_MODE && + (cmsfs.codepage_from != NULL || cmsfs.codepage_to != NULL)) +-- +2.25.1 + diff -Nru s390-tools-2.20.0/debian/patches/0d15a07-chreipl-fcp-mpath-bundle-a-pre-cooked-man-page.patch s390-tools-2.20.0/debian/patches/0d15a07-chreipl-fcp-mpath-bundle-a-pre-cooked-man-page.patch --- s390-tools-2.20.0/debian/patches/0d15a07-chreipl-fcp-mpath-bundle-a-pre-cooked-man-page.patch 1970-01-01 00:00:00.000000000 +0000 +++ s390-tools-2.20.0/debian/patches/0d15a07-chreipl-fcp-mpath-bundle-a-pre-cooked-man-page.patch 2022-05-20 11:48:34.000000000 +0000 @@ -0,0 +1,408 @@ +From 0d15a07c0a5842a359554b6fb5f8cba3d11fd5cc Mon Sep 17 00:00:00 2001 +From: Benjamin Block +Date: Tue, 30 Nov 2021 18:54:35 +0100 +Subject: [PATCH] chreipl-fcp-mpath: bundle a pre-cooked version of the man page +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +On several distributions `pandoc` is not available via the default +repositories, and thus not available in the build environments for the +distribution packages. That means, the man page can't be bundled along +with the packages generated for those distributions. + +But since this is a valuable asset for some users, instead of requiring +`pandoc` in order to have a man page be generated during the build, so it +can be installed, bundle a pre-cooked version that corresponds to the +current version of the `README.md` file. This way, the man page can always +be packaged, and is now always installed, even if `ENABLE_DOC` is set to +`0` (the default). + +This also means, whenever the `README.md` file is changed, the bundled +man page needs to be regenerated, so it stays in sync. As a safeguard +we also add a checksum of the `README.md` file that is regenerated along +with the man page. This checksum is tested even when `pandoc` is not +available, and the user is notified whenever it runs out of sync (with a +hint as to how to remedy it). + +Nothing changes for the compile/installation workflow, if `ENABLE_DOC` is +set to `1`. + +Suggested-by: Jens Remus +Reviewed-by: Steffen Maier +Signed-off-by: Benjamin Block +Signed-off-by: Jan Höppner + +Origin: upstream, https://github.com/ibm-s390-linux/s390-tools/commit/0d15a07c0a5842a359554b6fb5f8cba3d11fd5cc +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1971993 +Last-Update: 2022-05-22 + +--- + CHANGELOG.md | 2 + + README.md | 5 +- + chreipl-fcp-mpath/.chreipl-fcp-mpath.7.cksum | 1 + + chreipl-fcp-mpath/.gitignore | 1 - + chreipl-fcp-mpath/Makefile | 29 ++- + chreipl-fcp-mpath/README.md | 14 +- + chreipl-fcp-mpath/chreipl-fcp-mpath.7 | 183 +++++++++++++++++++ + 7 files changed, 221 insertions(+), 14 deletions(-) + create mode 100644 chreipl-fcp-mpath/.chreipl-fcp-mpath.7.cksum + create mode 100644 chreipl-fcp-mpath/chreipl-fcp-mpath.7 + +diff --git a/CHANGELOG.md b/CHANGELOG.md +index eda87f46..0f9c68fe 100644 +--- a/CHANGELOG.md ++++ b/CHANGELOG.md +@@ -1,5 +1,9 @@ Release history for s390-tools (MIT version) + Release history for s390-tools (MIT version) + -------------------------------------------- ++ ++ - chreipl-fcp-mpath: bundle a pre-cooked version of the manpage for ++ build environments without access to `pandoc` ++ + * __v2.20.0 (2021-02-04)__ + + For Linux kernel version: 5.16 +diff --git a/README.md b/README.md +index 21ad2d8b..069c6a53 100644 +--- a/README.md ++++ b/README.md +@@ -478,5 +478,6 @@ the different tools are provided: + Summarized: chreipl-fcp-mpath requires GNU Bash, GNU Core Utilities, + util-linux, udev, and multipath-tools. When using `HAVE_DRACUT=1` with the + make invocation, it also requires dracut. When using `ENABLE_DOC=1` with the +- make invocation to build a man page and render the README.md as HTML, make +- further requires pandoc and GNU awk for the build process. ++ make invocation to build a fresh man page (instead of using the pre-cooked ++ version) and render the README.md as HTML, make further requires pandoc and ++ GNU awk for the build process. +diff --git a/chreipl-fcp-mpath/.chreipl-fcp-mpath.7.cksum b/chreipl-fcp-mpath/.chreipl-fcp-mpath.7.cksum +new file mode 100644 +index 00000000..56e76090 +--- /dev/null ++++ b/chreipl-fcp-mpath/.chreipl-fcp-mpath.7.cksum +@@ -0,0 +1 @@ ++8e604dab39577678bc9f24bfe5e2ee35354b2f4b1759edd16093157b1ecce9d3 README.md +diff --git a/chreipl-fcp-mpath/.gitignore b/chreipl-fcp-mpath/.gitignore +index ecd49eee..53c41de9 100644 +--- a/chreipl-fcp-mpath/.gitignore ++++ b/chreipl-fcp-mpath/.gitignore +@@ -9,4 +9,3 @@ + /README.html + /README.pdf + /chreipl-fcp-mpath.md +-/chreipl-fcp-mpath.7 +diff --git a/chreipl-fcp-mpath/Makefile b/chreipl-fcp-mpath/Makefile +index 6cf65a3f..e7fb920d 100644 +--- a/chreipl-fcp-mpath/Makefile ++++ b/chreipl-fcp-mpath/Makefile +@@ -11,6 +11,8 @@ + # - chreipl-fcp-mpath.mak + # bash: + # - bash ++# GNU coreutils: ++# - sha256sum + # If $(ENABLE_DOC) is `1`: + # GNU awk: + # - gawk +@@ -100,20 +102,41 @@ chreiplzfcpmp-doc-man-meta = \ + -V footer="s390-tools $(S390_TOOLS_RELEASE)" + + chreipl-fcp-mpath.7: PANDOCFLAGS += $(chreiplzfcpmp-doc-man-meta) ++chreipl-fcp-mpath.7: .chreipl-fcp-mpath.7.cksum + + .INTERMEDIATE: chreipl-fcp-mpath.md + chreipl-fcp-mpath.md: README.md + gawk -- '/NOT-IN-MAN \{/,/NOT-IN-MAN \}/ { next } { print }' $(<) > $(@) + ++.chreipl-fcp-mpath.7.cksum: README.md ++ sha256sum $(<) > $(@) ++ + .PHONY: chreipl-fcp-mpath-doc-clean + chreipl-fcp-mpath-doc-clean: +- rm -f README.html README.pdf chreipl-fcp-mpath.md chreipl-fcp-mpath.7 ++ rm -f README.html README.pdf chreipl-fcp-mpath.md + + chreipl-fcp-mpath: chreipl-fcp-mpath-doc + chreipl-fcp-mpath-clean: chreipl-fcp-mpath-doc-clean + ++else # $(ENABLE_DOC) != 1 ++ ++# We bundle a pre-cooked man page with the source-code so that distributions ++# don't need `pandoc` in order to be able to ship the man page. As of this ++# writing multiple distributions don't have a packaged version of it. ++# ++# In order to remember to regenerate this pre-cooked version whenever the ++# README.md is changed, we also generate a checksum of the README.md, bundle ++# that as well, and compare that whenever `make` is called. This way, the ++# freshness of the man page can be checked, even if `pandoc` is not available, ++# or ENABLE_DOC disabled. ++ ++MANPAGE_FRESH := $(shell sha256sum --check .chreipl-fcp-mpath.7.cksum >/dev/null && echo 1 || echo 0) ++ifeq ($(MANPAGE_FRESH),0) ++$(warning chreipl-fcp-mpath.7 is outdated, please regenerate it by calling `make ENABLE_DOC=1`) + endif + ++endif # $(ENABLE_DOC) == 1 ++ + # + ## Install + # +@@ -180,8 +203,6 @@ chreipl-fcp-mpath-install: chreipl-fcp-mpath-install-dracut-config + + endif + +-ifeq ($(ENABLE_DOC),1) +- + # chreipl-fcp-mpath: install man page + INSTDIRS += $(MANDIR) + $(DESTDIR)$(MANDIR)/man7: install_dirs +@@ -194,8 +215,6 @@ chreipl-fcp-mpath-install-man-page: chreipl-fcp-mpath.7 + + chreipl-fcp-mpath-install: chreipl-fcp-mpath-install-man-page + +-endif +- + # + ## Utility + # +diff --git a/chreipl-fcp-mpath/README.md b/chreipl-fcp-mpath/README.md +index d58ccd2c..3d69ad54 100644 +--- a/chreipl-fcp-mpath/README.md ++++ b/chreipl-fcp-mpath/README.md +@@ -120,18 +120,20 @@ in place, but the toolset has some software dependencies besides the + requirements in section [Requirements](#requirements): + + - GNU Bash; +- - GNU Core Utilities (mktemp, readlink, sync, truncate); ++ - GNU Core Utilities (mktemp, readlink, sync, truncate, sha256sum); + - util-linux (flock, hexdump, logger); + - udev / systemd-udev; + - multipath-tools. + + To make use of the optional dracut configuration you need: dracut. + +-To build and install the documentation (man page) you need: ++To build a fresh version of the documentation (man page) you need: + + - pandoc; + - GNU Core Utilities (date); +- - GNU awk. ++ - GNU awk; ++ ++otherwise the pre-cooked version shipped with the source will be used. + + INSTALLATION + ============ +@@ -160,7 +162,7 @@ steps and copies the resulting components to their final destination. + | Option | Values | Default | Effect + | :----- | :----: | :-----: | :----- + | HAVE_DRACUT | 0, 1 | 0 | Install a dracut configuration file that includes **chreipl-fcp-mpath** in the initial ramdisks built with **dracut**. +-| ENABLE_DOC | 0, 1 | 0 | Build and install a man page for **chreipl-fcp-mpath**. ++| ENABLE_DOC | 0, 1 | 0 | Build a fresh version of the man page for **chreipl-fcp-mpath**. + + Specify any options as arguments for both the **make** and **make install** + command as shown in the following example: +@@ -195,8 +197,8 @@ the boot record to find the new initial ramdisk. + + ~ # zipl + +-With dracut and documentation enabled, **make install** deploys the following +-files to these default locations: ++With dracut enabled, **make install** deploys the following files to these ++default locations: + + /usr/lib/chreipl-fcp-mpath/chreipl-fcp-mpath-common.sh + /usr/lib/dracut/dracut.conf.d/70-chreipl-fcp-mpath.conf +diff --git a/chreipl-fcp-mpath/chreipl-fcp-mpath.7 b/chreipl-fcp-mpath/chreipl-fcp-mpath.7 +new file mode 100644 +index 00000000..1b8eda87 +--- /dev/null ++++ b/chreipl-fcp-mpath/chreipl-fcp-mpath.7 +@@ -0,0 +1,183 @@ ++.\" Automatically generated by Pandoc 2.16.1 ++.\" ++.TH "CHREIPL-FCP-MPATH" "7" "2022-02-24" "s390-tools 2.20.0-build-20220224" "Administrator Manual" ++.hy ++.SH NAME ++.PP ++chreipl-fcp-mpath - use multipath information for re-IPL path failover ++on a running Linux instance ++.SH DESCRIPTION ++.PP ++The IPL process of Linux on Z or LinuxONE from an FCP-attached SCSI ++volume uses exactly one path to the volume. ++If this path is unavailable, the IPL fails. ++.PP ++The \f[B]chreipl-fcp-mpath\f[R] toolset monitors \f[B]udev\f[R] events ++about paths to the re-IPL volume. ++If the currently configured re-IPL path becomes unavailable, the toolset ++checks for operational paths to the same volume. ++If available, it reconfigures the re-IPL settings to use an operational ++path. ++.PP ++Thus, re-IPL from an FCP-attached SCSI volume can be successful despite ++path failures on a running Linux instance if at least one path to the ++re-IPL volume remains operational. ++.PP ++\f[B]Chreipl-fcp-mpath\f[R] requires \f[B]udev\f[R], ++\f[B]multipathd\f[R] and \f[B]dm-multipath\f[R]. ++Once installed, the toolset runs automatically and autonomously. ++No user intervention is possible or required. ++.PP ++Other than installing the toolset, there is no user interface for ++\f[B]chreipl-fcp-mpath\f[R]. ++.SS Requirements ++.PP ++The \f[B]chreipl-fcp-mpath\f[R] tool has the following requirements on ++the Linux instance that is being monitored: ++.IP \[bu] 2 ++The Linux instance must have started successfully, during IPL. ++.IP \[bu] 2 ++The running Linux instance must use \f[B]dm-multipath\f[R] and ++\f[B]multipathd\f[R] for the configured re-IPL volume - a volume that ++contains a zipl boot record and has one of its paths used in the re-IPL ++configuration. ++.IP \[bu] 2 ++\f[B]udev\f[R] must run. ++.IP \[bu] 2 ++The toolset must observe at least one event about the configured re-IPL ++path. ++Examples for such events are: the SCSI disk comes online, or a path of ++the corresponding multipath device goes down or comes back online. ++.RS 2 ++.IP \[bu] 2 ++The WWID of the re-IPL volume must not change while the Linux instance ++is running. ++.RE ++.IP \[bu] 2 ++When the configured re-IPL path becomes unavailable while the Linux ++instance is running, at least one operational path to the re-IPL volume ++must be available, or must become available. ++If no such path is available when the Linux instance is rebooted, the ++re-IPL path is not changed. ++.IP \[bu] 2 ++The tool assumes that any manually reconfigured re-IPL device is valid ++and operational. ++.RS 2 ++.PP ++The tool treats a newly configured re-IPL device like the initially ++configured re-IPL device. ++In particular, if the newly configured re-IPL device fulfills the ++requirements of the tool, re-IPL path failover takes place if the ++configured re-IPL path becomes unavailable. ++.RE ++.SS Caution with Manual Changes to the Configured re-IPL Target ++.PP ++\f[B]chreipl-fcp-mpath\f[R] is designed to accept operator-inititated ++changes of the re-IPL device. ++However, concurrent changes by the operator and tool driven changes can ++result in the operator change being overwritten. ++.PP ++To avoid this problem, change the re-IPL device only during steady-state ++operations, when no path events happen. ++Alternatively, make sure that no events are processed while you change ++the device. ++See EXAMPLES for one way to suspend event processing. ++.SH MESSAGES ++.PP ++During monitoring and event processing, \f[B]chreipl-fcp-mpath\f[R] ++writes messages to the syslog. ++.PP ++When the configured re-IPL path is changed to a different path to the ++same volume (priority \f[I]daemon.notice\f[R]): ++.RS ++.PP ++Changed re-IPL path to: ::. ++.RE ++.PP ++When a path event indicates that the last available path has become ++non-operational (priority \f[I]daemon.alert\f[R]): ++.RS ++.PP ++The re-IPL device cannot be changed because no operational path to the ++re-IPL volume remains. ++The next re-IPL might fail unless you re-attach or enable at least one ++valid path to the re-IPL volume. ++.RE ++.PP ++When changing the configured re-IPL device failed because of an error ++with the used Linux kernel interface (priority \f[I]daemon.crit\f[R]): ++.RS ++.PP ++Changing the re-IPL device failed. ++The current re-IPL settings might be inconsistent. ++Check and correct the settings (see the README.md of chreipl-fcp-mpath) ++to make sure that the current re-IPL device is valid. ++.RE ++.PP ++A failure to change the re-IPL device can indicate an inconsistent ++setting that cannot be corrected automatically by ++\f[B]chreipl-fcp-mpath\f[R]. ++As a result, the next re-IPL might fail or might not use the intended ++re-IPL device. ++.PP ++You can use the following tools to check and correct the current ++settings: ++.IP \[bu] 2 ++\f[B]lsreipl\f[R] to confirm that the intended re-IPL device is ++configured; ++.IP \[bu] 2 ++\f[B]chreipl\f[R] to change the re-IPL device; ++.IP \[bu] 2 ++\f[B]lszfcp\f[R] to inspect the state of available paths to the re-IPL ++device. ++.SH EXAMPLES ++.SS Manual Changes to the Configured re-IPL Device ++.PP ++As outlined in DESCRIPTION, be cautious when manually changing the ++configured re-IPL device. ++Assure that your reconfiguration actions do not collide with concurrent ++automatic event processing by \f[B]chreipl-fcp-mpath\f[R]. ++You can avoid such collisions, by stopping event processing, making your ++changes, and then re-enabling event processing. ++You need \f[I]root\f[R] privileges for running the commands in the ++following example: ++.IP ++.nf ++\f[C] ++\[ti] # udevadm settle ++\[ti] # udevadm control --stop-exec-queue ++\[ti] # chreipl ... ++\[ti] # udevadm control --start-exec-queue ++\f[R] ++.fi ++.SS Listing messages with journalctl ++.PP ++If your Linux instance includes \f[B]journalctl\f[R], use the following ++command to list all messages that are issued by ++\f[B]chreipl-fcp-mpath\f[R]: ++.IP ++.nf ++\f[C] ++\[ti] # journalctl -t chreipl-fcp-mpath ++\f[R] ++.fi ++.PP ++To list only messages that were issued since the last IPL, use this ++command: ++.IP ++.nf ++\f[C] ++\[ti] # journalctl -t chreipl-fcp-mpath -b ++\f[R] ++.fi ++.SH REPORTING BUGS ++.PP ++Use the \f[B]Issues\f[R] functionality on GitHub to report any bugs in ++\f[B]chreipl-fcp-mpath\f[R]: s390-tools ++Issues (https://github.com/ibm-s390-linux/s390-tools/issues). ++.SH SEE ALSO ++.PP ++\f[B]chreipl\f[R](8), \f[B]dracut\f[R](8), \f[B]journalctl\f[R](1), ++\f[B]lsreipl(8)\f[R], \f[B]lszfcp\f[R](8), \f[B]multipath\f[R](8), ++\f[B]multipathd\f[R](8), \f[B]udev\f[R](7), \f[B]udevadm\f[R](8), ++\f[B]zipl\f[R](8) +-- +2.25.1 + diff -Nru s390-tools-2.20.0/debian/patches/164d481-dbginfo.sh-check-existence-of-dump2tar-before-execut.patch s390-tools-2.20.0/debian/patches/164d481-dbginfo.sh-check-existence-of-dump2tar-before-execut.patch --- s390-tools-2.20.0/debian/patches/164d481-dbginfo.sh-check-existence-of-dump2tar-before-execut.patch 1970-01-01 00:00:00.000000000 +0000 +++ s390-tools-2.20.0/debian/patches/164d481-dbginfo.sh-check-existence-of-dump2tar-before-execut.patch 2022-05-20 11:48:34.000000000 +0000 @@ -0,0 +1,81 @@ +From 164d4817ecca5deadaff2b268876bbf330a0f985 Mon Sep 17 00:00:00 2001 +From: Joern Siglen +Date: Fri, 4 Feb 2022 13:35:19 +0100 +Subject: [PATCH] dbginfo.sh: check existence of dump2tar before executing +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +a missing dump2tar command did show misleading error messages +now check it and give clear messages + +Signed-off-by: Joern Siglen +Reviewed-by: Mario Held +Signed-off-by: Jan Höppner + +Origin: upstream, https://github.com/ibm-s390-tools/s390-tools/commit/164d4817ecca5deadaff2b268876bbf330a0f985 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1971959 +Last-Update: 2022-05-25 + +--- + scripts/dbginfo.sh | 30 ++++++++++++++++++++---------- + 1 file changed, 20 insertions(+), 10 deletions(-) + +diff --git a/scripts/dbginfo.sh b/scripts/dbginfo.sh +index b35883b0..cf5f953c 100755 +--- a/scripts/dbginfo.sh ++++ b/scripts/dbginfo.sh +@@ -726,6 +726,7 @@ collect_sysfs() { + local debugfs_mounted=0 + local dir_name + local file_name ++ local rc=0 + + pr_collect "sysfs" + if ! grep -qE "${MOUNT_POINT_DEBUGFS}.*debugfs" /proc/mounts 2>/dev/null; then +@@ -742,14 +743,25 @@ collect_sysfs() { + # 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. + # error messages are not written to the log +- dump2tar /sys -z -o "${OUTPUT_FILE_SYSFS}.tgz" \ +- -x '*/tracing/trace_pipe*' \ +- -x '*/page_idle/bitmap*' \ +- -x '*/tracing/per_cpu/*' \ +- --ignore-failed-read -J 1 -T 5 2>>${OUTPUT_FILE_SYSFS}.err +- +- if [ $? -ne 0 ] ; then +- echo "${SCRIPTNAME}: Warning: dump2tar failed or is unavailable" ++ if type -t dump2tar >/dev/null; then ++ dump2tar /sys -z -o "${OUTPUT_FILE_SYSFS}.tgz" \ ++ -x '*/tracing/trace_pipe*' \ ++ -x '*/page_idle/bitmap*' \ ++ -x '*/tracing/per_cpu/*' \ ++ --ignore-failed-read -J 1 -T 5 2>>${OUTPUT_FILE_SYSFS}.err ++ rc=$? ++ else ++ echo "${SCRIPTNAME}: Warning: dump2tar is unavailable" ++ rc=255 ++ fi ++ ++ ++ if [ ${rc} -eq 0 ] ; then ++ echo " all failed entries are logged to ${OUTPUT_FILE_SYSFS}.err" ++ else ++ if [ $rc -ne 255 ]; then ++ echo "${SCRIPTNAME}: Warning: dump2tar failed with $rc" ++ fi + pr_log_stdout " Warning: falling back to slow path" + call_run_command "find /sys -print0 | sort -z \ + | xargs -0 -n 10 ls -ld" "${OUTPUT_FILE_SYSFS}.out" +@@ -769,8 +781,6 @@ collect_sysfs() { + echo "${SCRIPTNAME}: Warning: failed to copy \"${file_name}\"" + fi + done +- else +- echo " all failed entries are logged to ${OUTPUT_FILE_SYSFS}.err" + fi + + if test ${debugfs_mounted} -eq 1; then +-- +2.25.1 + diff -Nru s390-tools-2.20.0/debian/patches/2515832-util_arch-Add-IBM-z16-as-known-machine.patch s390-tools-2.20.0/debian/patches/2515832-util_arch-Add-IBM-z16-as-known-machine.patch --- s390-tools-2.20.0/debian/patches/2515832-util_arch-Add-IBM-z16-as-known-machine.patch 1970-01-01 00:00:00.000000000 +0000 +++ s390-tools-2.20.0/debian/patches/2515832-util_arch-Add-IBM-z16-as-known-machine.patch 2022-05-20 11:48:34.000000000 +0000 @@ -0,0 +1,51 @@ +From 2515832469f65a0dd0f4c6bfc2a6a530a6c1833c Mon Sep 17 00:00:00 2001 +From: Thomas Richter +Date: Fri, 13 May 2022 13:02:33 +0200 +Subject: [PATCH] util_arch: Add IBM z16 as known machine +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add IBM z16 as known machine to the architecture definitions. + +Signed-off-by: Thomas Richter +Reviewed-by: Jan Höppner +Signed-off-by: Jan Höppner + +Origin: upstream, https://github.com/ibm-s390-tools/s390-tools/commit/2515832469f65a0dd0f4c6bfc2a6a530a6c1833c +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1960119 +Last-Update: 2022-05-24 + +--- + include/lib/util_arch.h | 1 + + libutil/util_arch.c | 2 ++ + 2 files changed, 3 insertions(+) + +diff --git a/include/lib/util_arch.h b/include/lib/util_arch.h +index 72a1b386..86029115 100644 +--- a/include/lib/util_arch.h ++++ b/include/lib/util_arch.h +@@ -26,6 +26,7 @@ enum util_arch_machine_type { + UTIL_ARCH_MACHINE_TYPE_Z14_ZR1 = 3907, + UTIL_ARCH_MACHINE_TYPE_Z15 = 8561, + UTIL_ARCH_MACHINE_TYPE_Z15_T02 = 8562, ++ UTIL_ARCH_MACHINE_TYPE_Z16 = 3931, + }; + + int util_arch_machine_type(void); +diff --git a/libutil/util_arch.c b/libutil/util_arch.c +index c64c1d8b..0b9208e1 100644 +--- a/libutil/util_arch.c ++++ b/libutil/util_arch.c +@@ -93,6 +93,8 @@ const char *util_arch_machine_type_to_str(int type) + return "IBM z15"; + case UTIL_ARCH_MACHINE_TYPE_Z15_T02: + return "IBM z15 Model T02"; ++ case UTIL_ARCH_MACHINE_TYPE_Z16: ++ return "IBM z16"; + default: + return "Unknown machine type"; + } +-- +2.25.1 + diff -Nru s390-tools-2.20.0/debian/patches/2677a41-dbginfo.sh-re-group-commands-by-system-state.patch s390-tools-2.20.0/debian/patches/2677a41-dbginfo.sh-re-group-commands-by-system-state.patch --- s390-tools-2.20.0/debian/patches/2677a41-dbginfo.sh-re-group-commands-by-system-state.patch 1970-01-01 00:00:00.000000000 +0000 +++ s390-tools-2.20.0/debian/patches/2677a41-dbginfo.sh-re-group-commands-by-system-state.patch 2022-05-20 11:48:34.000000000 +0000 @@ -0,0 +1,107 @@ +From 2677a4182db0303ae6c90b727b09fafb52f8a46d Mon Sep 17 00:00:00 2001 +From: Joern Siglen +Date: Mon, 14 Feb 2022 13:39:22 +0100 +Subject: [PATCH] dbginfo.sh: (re)group commands by system state +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This change will group the commands executed for overall state into a +first section with a comment. +By grouping, we intend to enhance the handling in our runtime.out file +and help to understand the purpose of command groups. + +In addition we did get feedback for promoting some commands to the top. + +Signed-off-by: Joern Siglen +Reviewed-by: Sa Liu +Reviewed-by: Mario Held +Signed-off-by: Jan Höppner + +Origin: upstream, https://github.com/ibm-s390-tools/s390-tools/commit/2677a4182db0303ae6c90b727b09fafb52f8a46d +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1971959 +Last-Update: 2022-05-25 + +--- + scripts/dbginfo.sh | 32 ++++++++++++++++++-------------- + 1 file changed, 18 insertions(+), 14 deletions(-) + +diff --git a/scripts/dbginfo.sh b/scripts/dbginfo.sh +index fa357ae3..98e8a3ed 100755 +--- a/scripts/dbginfo.sh ++++ b/scripts/dbginfo.sh +@@ -410,37 +410,48 @@ CONFIGFILES="\ + " + + ######################################## ++# system state commands (non alphabetical order here) + CMDS="uname -a\ + :uptime\ + :timedatectl\ ++ :last\ ++ :lscpu -ae\ ++ :lscpu -ye\ ++ :lsmem\ ++ :lsmod\ ++ :lsshut\ + :runlevel\ ++ :sysctl -a\ ++ :systemctl --all --no-pager show\ ++ :systemctl --all --no-pager list-units\ ++ :systemctl --all --no-pager list-unit-files\ ++ :systemd-delta\ + :ulimit -a\ + :env\ ++ :find /boot -print0 | sort -z | xargs -0 -n 10 ls -ld\ ++ :find /var/crash -print0 | sort -z | xargs -0 -n 10 ls -ld\ + :df -h\ + :df -i\ ++ :mount\ ++ " ++ ++CMDS="${CMDS}\ + :dmsetup ls\ + :dmsetup ls --tree\ + :dmsetup table\ + :dmsetup table --target multipath\ + :dmsetup status\ +- :last\ + :lschp\ +- :lscpu -ae\ +- :lscpu -ye\ + :lscss\ +- :lsmem\ + :lsdasd\ + :lsdasd -u\ +- :lsmod\ + :lspci -vv\ + :lsscsi\ +- :lsshut\ + :lstape\ + :lszdev\ + :lszfcp\ + :lszfcp -D\ + :lszfcp -V\ +- :mount\ + :multipathd -k'show config'\ + :multipathd -k'show maps'\ + :multipathd -k'show topo'\ +@@ -455,15 +466,8 @@ CMDS="uname -a\ + :multipath -d\ + :multipath -t\ + :pvpath -qa\ +- :find /boot -print0 | sort -z | xargs -0 -n 10 ls -ld\ + :find /dev -print0 | sort -z | xargs -0 -n 10 ls -ld\ +- :find /var/crash -print0 | sort -z | xargs -0 -n 10 ls -ld\ + :smc_dbg\ +- :sysctl -a\ +- :systemctl --all --no-pager show\ +- :systemctl --all --no-pager list-units\ +- :systemctl --all --no-pager list-unit-files\ +- :systemd-delta\ + :lvdisplay\ + :ziorep_config -ADM\ + " +-- +2.25.1 + diff -Nru s390-tools-2.20.0/debian/patches/27dce331-lszcrypt-add-support-for-checkstop-state.patch s390-tools-2.20.0/debian/patches/27dce331-lszcrypt-add-support-for-checkstop-state.patch --- s390-tools-2.20.0/debian/patches/27dce331-lszcrypt-add-support-for-checkstop-state.patch 1970-01-01 00:00:00.000000000 +0000 +++ s390-tools-2.20.0/debian/patches/27dce331-lszcrypt-add-support-for-checkstop-state.patch 2022-05-20 11:48:34.000000000 +0000 @@ -0,0 +1,101 @@ +From 27dce3317a99c3f22f6bcc9a5e68f581cd470164 Mon Sep 17 00:00:00 2001 +From: Harald Freudenberger +Date: Wed, 17 Nov 2021 15:02:01 +0100 +Subject: [PATCH] lszcrypt: add support for checkstop state +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Newer kernel show a sysfs attribute chkstop which displays +the checkstop state of a crypto card. This patch enables +support for lszcrypt to display the checkstop state. + +Signed-off-by: Harald Freudenberger +Signed-off-by: Jan Höppner + +Origin: upstream, https://github.com/ibm-s390-tools/s390-tools/commit/27dce3317a99c3f22f6bcc9a5e68f581cd470164 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1959548 +Last-Update: 2022-05-25 + +--- + zconf/zcrypt/lszcrypt.8 | 3 +++ + zconf/zcrypt/lszcrypt.c | 16 ++++++++++++---- + 2 files changed, 15 insertions(+), 4 deletions(-) + +diff --git a/zconf/zcrypt/lszcrypt.8 b/zconf/zcrypt/lszcrypt.8 +index 351ce3e6..7a822fc4 100644 +--- a/zconf/zcrypt/lszcrypt.8 ++++ b/zconf/zcrypt/lszcrypt.8 +@@ -154,6 +154,9 @@ cryptographic operations. 'offline' is displayed when a card or queue + is switched to (software) offline. If a card is 'deconfigured' via + HMC, SE or chzcrypt the field shows 'deconfig'. + .br ++A crypto card may also reach a 'checkstopped' state. lszcrypt shows ++this as 'chkstop'. ++.br + If a queue is not bound to a device driver there is no detailed + information available and thus the status shows only '-'. + .br +diff --git a/zconf/zcrypt/lszcrypt.c b/zconf/zcrypt/lszcrypt.c +index cb06325d..b180d1e3 100644 +--- a/zconf/zcrypt/lszcrypt.c ++++ b/zconf/zcrypt/lszcrypt.c +@@ -381,7 +381,7 @@ static int read_driver(const char *dir, const char *subdir, char *buf, size_t bu + static void read_subdev_rec_default(struct util_rec *rec, const char *grp_dev, + const char *sub_dev) + { +- long config = -1, online = -1; ++ long config = -1, online = -1, chkstop = -1; + char buf[256]; + unsigned long facility; + +@@ -392,6 +392,8 @@ static void read_subdev_rec_default(struct util_rec *rec, const char *grp_dev, + + if (util_path_is_readable("%s/%s/config", grp_dev, sub_dev)) + util_file_read_l(&config, 10, "%s/%s/config", grp_dev, sub_dev); ++ if (util_path_is_readable("%s/%s/chkstop", grp_dev, sub_dev)) ++ util_file_read_l(&chkstop, 10, "%s/%s/chkstop", grp_dev, sub_dev); + if (util_path_is_readable("%s/%s/online", grp_dev, sub_dev)) + util_file_read_l(&online, 10, "%s/%s/online", grp_dev, sub_dev); + +@@ -399,7 +401,9 @@ static void read_subdev_rec_default(struct util_rec *rec, const char *grp_dev, + if (config == 0) { + util_rec_set(rec, "status", "deconfig"); + } else { +- if (online > 0) ++ if (chkstop > 0) ++ util_rec_set(rec, "status", "chkstop"); ++ else if (online > 0) + util_rec_set(rec, "status", "online"); + else if (online == 0) + util_rec_set(rec, "status", "offline"); +@@ -522,7 +526,7 @@ static void show_subdevices(struct util_rec *rec, const char *grp_dev) + */ + static void read_rec_default(struct util_rec *rec, const char *grp_dev) + { +- long config = -1, online = -1; ++ long config = -1, online = -1, chkstop = -1; + char buf[256]; + unsigned long facility; + +@@ -543,12 +547,16 @@ static void read_rec_default(struct util_rec *rec, const char *grp_dev) + + if (util_path_is_readable("%s/config", grp_dev)) + util_file_read_l(&config, 10, "%s/config", grp_dev); ++ if (util_path_is_readable("%s/chkstop", grp_dev)) ++ util_file_read_l(&chkstop, 10, "%s/chkstop", grp_dev); + if (util_path_is_readable("%s/online", grp_dev)) + util_file_read_l(&online, 10, "%s/online", grp_dev); + if (config == 0) { + util_rec_set(rec, "status", "deconfig"); + } else { +- if (online > 0) ++ if (chkstop > 0) ++ util_rec_set(rec, "status", "chkstop"); ++ else if (online > 0) + util_rec_set(rec, "status", "online"); + else if (online == 0) + util_rec_set(rec, "status", "offline"); +-- +2.25.1 + diff -Nru s390-tools-2.20.0/debian/patches/2ab27bd-dbginfo.sh-update-copyright-date.patch s390-tools-2.20.0/debian/patches/2ab27bd-dbginfo.sh-update-copyright-date.patch --- s390-tools-2.20.0/debian/patches/2ab27bd-dbginfo.sh-update-copyright-date.patch 1970-01-01 00:00:00.000000000 +0000 +++ s390-tools-2.20.0/debian/patches/2ab27bd-dbginfo.sh-update-copyright-date.patch 2022-05-20 11:48:34.000000000 +0000 @@ -0,0 +1,46 @@ +From 2ab27bdaf2f00868ea54847d2dec360508c427f5 Mon Sep 17 00:00:00 2001 +From: Joern Siglen +Date: Thu, 10 Feb 2022 06:05:50 +0100 +Subject: [PATCH] dbginfo.sh: update copyright date +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +adjust second year field on recent updates + +Signed-off-by: Joern Siglen +Signed-off-by: Jan Höppner + +Origin: upstream, https://github.com/ibm-s390-tools/s390-tools/commit/2ab27bdaf2f00868ea54847d2dec360508c427f5 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1971959 +Last-Update: 2022-05-25 + +--- + scripts/dbginfo.sh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/scripts/dbginfo.sh b/scripts/dbginfo.sh +index 924c6de0..bab1738c 100755 +--- a/scripts/dbginfo.sh ++++ b/scripts/dbginfo.sh +@@ -2,7 +2,7 @@ + # + # dbginfo.sh - Tool to collect runtime, configuration, and trace information + # +-# Copyright IBM Corp. 2002, 2021 ++# Copyright IBM Corp. 2002, 2022 + # + # s390-tools is free software; you can redistribute it and/or modify + # it under the terms of the MIT license. See LICENSE for details. +@@ -62,7 +62,7 @@ paramWORKDIR_BASE="/tmp" # initial default path + print_version() { + cat < +Date: Mon, 7 Feb 2022 11:30:22 +0100 +Subject: [PATCH] dbginfo.sh: unify indents - prettify code +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +adopt all indents to have the same setting overall - NO logic changes ! +tooling: vim used with setting "shiftwidth=8",expandtab,autoindent + commands "gg=G",":retab" + some additional line brakes to stay below 100 chars + and one line added manual before "collect_procfs" + +Signed-off-by: Joern Siglen +Reviewed-by: Mario Held +Signed-off-by: Jan Höppner + +Origin: upstream, https://github.com/ibm-s390-tools/s390-tools/commit/2eea614bbff9e4e1755ca933d849c1f4964f4827 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1971959 +Last-Update: 2022-05-25 + +--- + scripts/dbginfo.sh | 1240 ++++++++++++++++++++++---------------------- + 1 file changed, 630 insertions(+), 610 deletions(-) + +diff --git a/scripts/dbginfo.sh b/scripts/dbginfo.sh +index d1806375..59f040f2 100755 +--- a/scripts/dbginfo.sh ++++ b/scripts/dbginfo.sh +@@ -14,7 +14,7 @@ export LC_ALL + + ######################################## + # Global used variables +-readonly SCRIPTNAME="${0##*/}" # general name of this script ++readonly SCRIPTNAME="${0##*/}" # general name of this script + # + readonly DATETIME="$(date +%Y-%m-%d-%H-%M-%S 2>/dev/null)" + readonly DOCKER=$(if which docker >/dev/null 2>&1; then echo "YES"; else echo "NO"; fi) +@@ -38,14 +38,14 @@ readonly OSPRETTY="$(cat /etc/os* 2>/dev/null | grep -m1 PRETTY_NAME | sed 's/\" + readonly OS_NAME="${OSPRETTY##*=}" + # The processor ID for the first processor + readonly PROCESSORID="$(grep -E ".*processor 0:.*" /proc/cpuinfo | \ +- sed 's/.*identification[[:space:]]*\=[[:space:]]*\([[:alnum:]]*\).*/\1/g')" ++ sed 's/.*identification[[:space:]]*\=[[:space:]]*\([[:alnum:]]*\).*/\1/g')" + readonly PROCESSORVERSION="$(grep -E ".*processor 0:.*" /proc/cpuinfo | \ +- sed 's/.*version[[:space:]]*\=[[:space:]]*\([[:alnum:]]*\).*/\1/g')" ++ sed 's/.*version[[:space:]]*\=[[:space:]]*\([[:alnum:]]*\).*/\1/g')" + if test "x${PROCESSORVERSION}" = "xFF" || test "x${PROCESSORVERSION}" = "xff"; then +- RUNTIME_ENVIRONMENT=$(grep -E "VM00.*Control Program.*" /proc/sysinfo | \ +- sed 's/.*:[[:space:]]*\([[:graph:]]*\).*/\1/g') ++ RUNTIME_ENVIRONMENT=$(grep -E "VM00.*Control Program.*" /proc/sysinfo | \ ++ sed 's/.*:[[:space:]]*\([[:graph:]]*\).*/\1/g') + else +- RUNTIME_ENVIRONMENT="LPAR" ++ RUNTIME_ENVIRONMENT="LPAR" + fi + readonly SYSTEMHOSTNAME="$(hostname -s 2>/dev/null)" # hostname of system being analysed + readonly TERMINAL="$(tty 2>/dev/null)" +@@ -60,7 +60,7 @@ paramWORKDIR_BASE="/tmp" # initial default path + ######################################## + # print dbginfo.sh version info + print_version() { +- cat </dev/null | wc -l) +- if [ ${counter} -eq 1 ]; then +- echo " CHECK - ${logfile} may miss a rotation" +- else +- echo " OK - ${logfile}* may have a rotation in place: ${counter} files" +- fi +- done +- fi ++ local counter ++ local logfile ++ local logfiles ++ ++ # find files bigger than recommended ++ counter=$(find $1 -maxdepth 1 -type f -mtime -${LOG_FILE_AGE_CHECK} \ ++ -size ${LOG_FILE_SIZE_CHECK}M | wc -l) ++ ++ echo " ${counter} logfiles over ${LOG_FILE_SIZE_CHECK} MB" ++ # maybe check for rotation of base names ++ if [ ${counter} -ne 0 ]; then ++ for logfile in $(find $1 -maxdepth 1 -type f -mtime -${LOG_FILE_AGE_CHECK} \ ++ -size ${LOG_FILE_SIZE_CHECK}M -print); do ++ # use a neutral separtor ':' as concat is different in some bash ++ # insert the 'blank' for later use in for loop ++ # add the base name before '.' or '-' only for checks ++ logfiles="${logfiles}: ${logfile%%[.-]*}" ++ done ++ # change separator to new line for sorting ++ logfiles=$(echo "${logfiles}" | sed s'/:/\n/g' | sort -u) ++ for logfile in ${logfiles}; do ++ counter=$(ls ${logfile}* 2>/dev/null | wc -l) ++ if [ ${counter} -eq 1 ]; then ++ echo " CHECK - ${logfile} may miss a rotation" ++ else ++ echo " OK - ${logfile}* may have a rotation "\ ++ "in place: ${counter} files" ++ fi ++ done ++ fi + } + + ######################################## + # print basic info and online checks + print_check() { +- print_version +- cat </dev/null)" -ne 0; then +- echo "${SCRIPTNAME}: Error: You must be user root to run \"${SCRIPTNAME}\"!" +- exit 1 ++ echo "${SCRIPTNAME}: Error: You must be user root to run \"${SCRIPTNAME}\"!" ++ exit 1 + fi + + ######################################### +@@ -221,9 +222,9 @@ fi + readonly WORKDIR_BASE="$(echo "${paramWORKDIR_BASE}" | sed -e 's#/$##')/" + # The current working directory for the actual script execution + if test -z "${PROCESSORID}"; then +- readonly WORKDIR_CURRENT="DBGINFO-${DATETIME}-${SYSTEMHOSTNAME:-localhost}" ++ readonly WORKDIR_CURRENT="DBGINFO-${DATETIME}-${SYSTEMHOSTNAME:-localhost}" + else +- readonly WORKDIR_CURRENT="DBGINFO-${DATETIME}-${SYSTEMHOSTNAME:-localhost}-${PROCESSORID}" ++ readonly WORKDIR_CURRENT="DBGINFO-${DATETIME}-${SYSTEMHOSTNAME:-localhost}-${PROCESSORID}" + fi + # The current path where the collected information is put together + readonly WORKPATH="${WORKDIR_BASE}${WORKDIR_CURRENT}/" +@@ -254,26 +255,26 @@ readonly OUTPUT_FILE_SYSFS="${WORKPATH}sysfs" + # define order of collection steps + # - state/debug files are collected first, to avoid overwriting by command execution + ALL_STEPS="\ +- collect_sysfs\ +- collect_procfs\ +- collect_configfiles\ +- collect_cmdsout\ +- collect_hyptop\ +- collect_vmcmdsout\ +- collect_network\ +- collect_osaoat\ +- collect_ethtool\ +- collect_tc\ +- collect_bridge\ +- collect_ovs\ +- collect_kvm\ +- collect_docker\ +- collect_nvme\ +- collect_logfiles\ +- post_processing\ +- create_package\ +- environment_cleanup\ +- " ++ collect_sysfs\ ++ collect_procfs\ ++ collect_configfiles\ ++ collect_cmdsout\ ++ collect_hyptop\ ++ collect_vmcmdsout\ ++ collect_network\ ++ collect_osaoat\ ++ collect_ethtool\ ++ collect_tc\ ++ collect_bridge\ ++ collect_ovs\ ++ collect_kvm\ ++ collect_docker\ ++ collect_nvme\ ++ collect_logfiles\ ++ post_processing\ ++ create_package\ ++ environment_cleanup\ ++ " + # The amount of steps running the whole collections, without last cleanup + readonly COLLECTION_COUNT=`expr $(echo ${ALL_STEPS} | wc -w) - 1` + +@@ -320,9 +321,9 @@ PROCFILES="\ + + # Adding files to PROCFILES in case scsi devices are available + if test -e /proc/scsi; then +- PROCFILES="${PROCFILES}\ +- $(find /proc/scsi -type f -perm /444 2>/dev/null)\ +- " ++ PROCFILES="${PROCFILES}\ ++ $(find /proc/scsi -type f -perm /444 2>/dev/null)\ ++ " + fi + + ######################################## +@@ -603,520 +604,538 @@ KVM_CMDS="virsh version\ + + ######################################## + collect_cmdsout() { +- local cmd +- local ifs_orig="${IFS}" ++ local cmd ++ local ifs_orig="${IFS}" + +- pr_collect_output "command" ++ pr_collect_output "command" + +- IFS=: +- for cmd in ${CMDS}; do +- IFS=${ifs_orig} call_run_command "${cmd}" "${OUTPUT_FILE_CMD}" +- done +- IFS="${ifs_orig}" ++ IFS=: ++ for cmd in ${CMDS}; do ++ IFS=${ifs_orig} call_run_command "${cmd}" "${OUTPUT_FILE_CMD}" ++ done ++ IFS="${ifs_orig}" + } + + ######################################## + collect_network() { +- local cmd +- local ifs_orig="${IFS}" ++ local cmd ++ local ifs_orig="${IFS}" + +- pr_collect_output "network" ++ pr_collect_output "network" + +- IFS=: +- for cmd in ${NETWORK_CMDS}; do +- IFS=${ifs_orig} call_run_command "${cmd}" "${OUTPUT_FILE_NETWORK}" +- done +- IFS="${ifs_orig}" ++ IFS=: ++ for cmd in ${NETWORK_CMDS}; do ++ IFS=${ifs_orig} call_run_command "${cmd}" "${OUTPUT_FILE_NETWORK}" ++ done ++ IFS="${ifs_orig}" + } + + ######################################## + collect_vmcmdsout() { +- local vm_command +- local cp_command +- local vm_cmds +- local vm_userid +- local module_loaded=1 +- local ifs_orig="${IFS}" +- local cp_buffer_size=2 +- local rc_buffer_size=2 +- +- if echo "${RUNTIME_ENVIRONMENT}" | grep -qi "z/VM" >/dev/null 2>&1; then +- pr_collect_output "z/VM" +- +- if which vmcp >/dev/null 2>&1; then +- cp_command="vmcp" +- if ! lsmod 2>/dev/null | grep -q vmcp && modinfo vmcp >/dev/null 2>&1; then +- modprobe vmcp && module_loaded=0 && sleep 2 +- fi +- elif which hcp >/dev/null 2>&1; then +- cp_command="hcp" +- if ! lsmod 2>/dev/null | grep -q cpint; then +- modprobe cpint && module_loaded=0 && sleep 2 +- fi +- else +- pr_log_stdout "${SCRIPTNAME}: Warning: No program found to communicate to z/VM CP" +- pr_skip "z/VM: vmcp not available" +- return 1 +- fi +- vm_userid=$(${cp_command} q userid 2>/dev/null | sed -ne 's/^\([^[:space:]]*\).*$/\1/p') +- vm_cmds=$(echo "${VM_CMDS}" | sed "s/VMUSERID/${vm_userid}/g") +- +- IFS=: +- for vm_command in ${vm_cmds}; do +- IFS="${ifs_orig}" +- while test ${rc_buffer_size} -eq 2 && test ${cp_buffer_size} -lt 1024; do +- cp_buffer_size=$(( cp_buffer_size * 2 )) +- +- eval ${cp_command} -b ${cp_buffer_size}k "${vm_command}" >/dev/null 2>&1 +- rc_buffer_size=$? +- done +- call_run_command "${cp_command} -b ${cp_buffer_size}k ${vm_command}" "${OUTPUT_FILE_VMCMD}" +- IFS=: +- done +- IFS="${ifs_orig}" +- +- if test ${module_loaded} -eq 0 && test "x${cp_command}" = "xhcp"; then +- rmmod cpint +- elif test ${module_loaded} -eq 0 && test "x${cp_command}" = "xvmcp"; then +- rmmod vmcp +- fi +- else +- pr_skip "z/VM: no z/VM environment" +- fi ++ local vm_command ++ local cp_command ++ local vm_cmds ++ local vm_userid ++ local module_loaded=1 ++ local ifs_orig="${IFS}" ++ local cp_buffer_size=2 ++ local rc_buffer_size=2 ++ ++ if echo "${RUNTIME_ENVIRONMENT}" | grep -qi "z/VM" >/dev/null 2>&1; then ++ pr_collect_output "z/VM" ++ ++ if which vmcp >/dev/null 2>&1; then ++ cp_command="vmcp" ++ if ! lsmod 2>/dev/null | grep -q vmcp && modinfo vmcp >/dev/null 2>&1; then ++ modprobe vmcp && module_loaded=0 && sleep 2 ++ fi ++ elif which hcp >/dev/null 2>&1; then ++ cp_command="hcp" ++ if ! lsmod 2>/dev/null | grep -q cpint; then ++ modprobe cpint && module_loaded=0 && sleep 2 ++ fi ++ else ++ pr_log_stdout "${SCRIPTNAME}: Warning: No program to communicate to z/VM CP" ++ pr_skip "z/VM: vmcp not available" ++ return 1 ++ fi ++ vm_userid=$(${cp_command} q userid 2>/dev/null | sed -ne 's/^\([^[:space:]]*\).*$/\1/p') ++ vm_cmds=$(echo "${VM_CMDS}" | sed "s/VMUSERID/${vm_userid}/g") ++ ++ IFS=: ++ for vm_command in ${vm_cmds}; do ++ IFS="${ifs_orig}" ++ while test ${rc_buffer_size} -eq 2 && test ${cp_buffer_size} -lt 1024; do ++ cp_buffer_size=$(( cp_buffer_size * 2 )) ++ eval ${cp_command} -b ${cp_buffer_size}k "${vm_command}" \ ++ >/dev/null 2>&1 ++ rc_buffer_size=$? ++ done ++ call_run_command "${cp_command} -b ${cp_buffer_size}k ${vm_command}" \ ++ "${OUTPUT_FILE_VMCMD}" ++ IFS=: ++ done ++ IFS="${ifs_orig}" ++ ++ if test ${module_loaded} -eq 0 && test "x${cp_command}" = "xhcp"; then ++ rmmod cpint ++ elif test ${module_loaded} -eq 0 && test "x${cp_command}" = "xvmcp"; then ++ rmmod vmcp ++ fi ++ else ++ pr_skip "z/VM: no z/VM environment" ++ fi + } + + ######################################## + collect_hyptop() { +- local param +- local delay=1 # seconds +- local iter=5 +- local sec=`expr ${delay} \\* ${iter}` +- +- case ${RUNTIME_ENVIRONMENT} in +- "z/VM") +- param="\#,c,m,C:s,M:s,o" # z/VM guest fields +- ;; +- "LPAR") +- param="\#,T,c,e,m,C:s,E:s,M:s,o" # all LPAR fields +- ;; +- *) # KVM guest +- pr_skip "hyptop: not available for ${RUNTIME_ENVIRONMENT}" +- return 1 +- ;; +- esac +- pr_collect_output "hyptop for ${RUNTIME_ENVIRONMENT} - ${sec}s" +- call_run_command "hyptop -b -d ${delay} -n ${iter} -f ${param} -S c" "${OUTPUT_FILE_HYPTOP}" ++ local param ++ local delay=1 # seconds ++ local iter=5 ++ local sec=`expr ${delay} \\* ${iter}` ++ ++ case ${RUNTIME_ENVIRONMENT} in ++ "z/VM") ++ param="\#,c,m,C:s,M:s,o" # z/VM guest fields ++ ;; ++ "LPAR") ++ param="\#,T,c,e,m,C:s,E:s,M:s,o" # all LPAR fields ++ ;; ++ *) # KVM guest ++ pr_skip "hyptop: not available for ${RUNTIME_ENVIRONMENT}" ++ return 1 ++ ;; ++ esac ++ pr_collect_output "hyptop for ${RUNTIME_ENVIRONMENT} - ${sec}s" ++ call_run_command "hyptop -b -d ${delay} -n ${iter} -f ${param} -S c" "${OUTPUT_FILE_HYPTOP}" + } ++ + ######################################## + collect_procfs() { +- local file_name ++ local file_name + +- pr_collect "procfs" ++ pr_collect "procfs" + +- for file_name in ${PROCFILES}; do +- call_collect_file "${file_name}" +- done ++ for file_name in ${PROCFILES}; do ++ call_collect_file "${file_name}" ++ done + } + + ######################################## + collect_sysfs() { +- local debugfs_mounted=0 +- local dir_name +- local file_name +- +- pr_collect "sysfs" +- if ! grep -qE "${MOUNT_POINT_DEBUGFS}.*debugfs" /proc/mounts 2>/dev/null; then +- if mount -t debugfs debugfs "${MOUNT_POINT_DEBUGFS}" >/dev/null 2>&1; then +- sleep 2 +- debugfs_mounted=1 +- else +- pr_log_stdout "${SCRIPTNAME}: Warning: Unable to mount debugfs at \"${MOUNT_POINT_DEBUGFS}\"" +- fi +- fi +- +- # 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. +- # error messages are not written to the log +- dump2tar /sys -z -o "${OUTPUT_FILE_SYSFS}.tgz" -x '*/tracing/trace_pipe*' -x '*/page_idle/bitmap*' \ +- -x '*/tracing/per_cpu/*' --ignore-failed-read -J 1 -T 5 2>>${OUTPUT_FILE_SYSFS}.err +- +- if [ $? -ne 0 ] ; then +- echo "${SCRIPTNAME}: Warning: dump2tar failed or is unavailable" +- pr_log_stdout " Warning: falling back to slow path" +- call_run_command "find /sys -print0 | sort -z \ +- | xargs -0 -n 10 ls -ld" "${OUTPUT_FILE_SYSFS}.out" +- +- find /sys -noleaf -type d 2>/dev/null | while IFS= read -r dir_name; do +- mkdir -p "${WORKPATH}${dir_name}" +- done ++ local debugfs_mounted=0 ++ local dir_name ++ local file_name ++ ++ pr_collect "sysfs" ++ if ! grep -qE "${MOUNT_POINT_DEBUGFS}.*debugfs" /proc/mounts 2>/dev/null; then ++ if mount -t debugfs debugfs "${MOUNT_POINT_DEBUGFS}" >/dev/null 2>&1; then ++ sleep 2 ++ debugfs_mounted=1 ++ else ++ pr_log_stdout "${SCRIPTNAME}: Warning: Unable to mount debugfs \ ++ at \"${MOUNT_POINT_DEBUGFS}\"" ++ fi ++ fi + +- 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 +- else +- echo " all failed entries are logged to ${OUTPUT_FILE_SYSFS}.err" +- fi ++ # 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. ++ # error messages are not written to the log ++ dump2tar /sys -z -o "${OUTPUT_FILE_SYSFS}.tgz" \ ++ -x '*/tracing/trace_pipe*' -x '*/page_idle/bitmap*' \ ++ -x '*/tracing/per_cpu/*' --ignore-failed-read -J 1 -T 5 2>>${OUTPUT_FILE_SYSFS}.err ++ ++ if [ $? -ne 0 ] ; then ++ echo "${SCRIPTNAME}: Warning: dump2tar failed or is unavailable" ++ pr_log_stdout " Warning: falling back to slow path" ++ call_run_command "find /sys -print0 | sort -z \ ++ | xargs -0 -n 10 ls -ld" "${OUTPUT_FILE_SYSFS}.out" ++ ++ 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 ++ else ++ echo " all failed entries are logged to ${OUTPUT_FILE_SYSFS}.err" ++ fi + +- if test ${debugfs_mounted} -eq 1; then +- umount "${MOUNT_POINT_DEBUGFS}" +- fi ++ if test ${debugfs_mounted} -eq 1; then ++ umount "${MOUNT_POINT_DEBUGFS}" ++ fi + } + + ######################################## + collect_logfiles() { +- local file_name ++ local file_name + +- pr_collect "log files" ++ pr_collect "log files" + +- for file_name in ${LOGFILES}; do +- call_collect_file "${file_name}" +- done ++ for file_name in ${LOGFILES}; do ++ call_collect_file "${file_name}" ++ done + +- pr_log_stdout "$(logfile_checker "/var/log*")" ++ pr_log_stdout "$(logfile_checker "/var/log*")" + } + + ######################################## + collect_configfiles() { +- local file_name ++ local file_name + +- pr_collect "config files" ++ pr_collect "config files" + +- for file_name in ${CONFIGFILES}; do +- call_collect_file "${file_name}" +- done ++ for file_name in ${CONFIGFILES}; do ++ call_collect_file "${file_name}" ++ done + } + + ######################################## + collect_osaoat() { +- local network_devices +- local network_device ++ local network_devices ++ local network_device + +- network_devices=$(lsqeth 2>/dev/null | grep "Device name" \ ++ network_devices=$(lsqeth 2>/dev/null | grep "Device name" \ + | sed 's/D.*:[[:space:]]*\([^[:space:]]*\)[[:space:]]\+/\1/g') +- if which qethqoat >/dev/null 2>&1; then +- if test -n "${network_devices}"; then +- pr_collect_output "osa oat" +- for network_device in ${network_devices}; do +- call_run_command "qethqoat ${network_device}" "${OUTPUT_FILE_OSAOAT}.out" && +- call_run_command "qethqoat -r ${network_device}" "${OUTPUT_FILE_OSAOAT}_${network_device}.raw" +- done +- else +- pr_skip "osa oat: no devices" +- fi +- else +- pr_skip "osa oat: qethqoat not available" +- fi ++ if which qethqoat >/dev/null 2>&1; then ++ if test -n "${network_devices}"; then ++ pr_collect_output "osa oat" ++ for network_device in ${network_devices}; do ++ call_run_command "qethqoat ${network_device}" \ ++ "${OUTPUT_FILE_OSAOAT}.out" && ++ call_run_command "qethqoat -r ${network_device}" \ ++ "${OUTPUT_FILE_OSAOAT}_${network_device}.raw" ++ done ++ else ++ pr_skip "osa oat: no devices" ++ fi ++ else ++ pr_skip "osa oat: qethqoat not available" ++ fi + } + + ######################################## + collect_ethtool() { +- local network_devices +- local network_device +- +- network_devices=$(ls /sys/class/net 2>/dev/null) +- if which ethtool >/dev/null 2>&1; then +- if test -n "${network_devices}"; then +- pr_collect_output "ethtool" +- for network_device in ${network_devices}; do +- call_run_command "ethtool ${network_device}" "${OUTPUT_FILE_ETHTOOL}" +- call_run_command "ethtool -k ${network_device}" "${OUTPUT_FILE_ETHTOOL}" +- call_run_command "ethtool -a ${network_device}" "${OUTPUT_FILE_ETHTOOL}" +- call_run_command "ethtool -c ${network_device}" "${OUTPUT_FILE_ETHTOOL}" +- call_run_command "ethtool --per-queue ${network_device} --show-coalesce" "${OUTPUT_FILE_ETHTOOL}" +- call_run_command "ethtool -g ${network_device}" "${OUTPUT_FILE_ETHTOOL}" +- call_run_command "ethtool -i ${network_device}" "${OUTPUT_FILE_ETHTOOL}" +- call_run_command "ethtool -l ${network_device}" "${OUTPUT_FILE_ETHTOOL}" +- call_run_command "ethtool -P ${network_device}" "${OUTPUT_FILE_ETHTOOL}" +- call_run_command "ethtool -S ${network_device}" "${OUTPUT_FILE_ETHTOOL}" +- call_run_command "ethtool -T ${network_device}" "${OUTPUT_FILE_ETHTOOL}" +- done +- else +- pr_skip "ethtool: no devices" +- fi +- else +- pr_skip "ethtool: not available" +- fi ++ local network_devices ++ local network_device ++ ++ network_devices=$(ls /sys/class/net 2>/dev/null) ++ if which ethtool >/dev/null 2>&1; then ++ if test -n "${network_devices}"; then ++ pr_collect_output "ethtool" ++ for network_device in ${network_devices}; do ++ call_run_command "ethtool ${network_device}" \ ++ "${OUTPUT_FILE_ETHTOOL}" ++ call_run_command "ethtool -k ${network_device}" \ ++ "${OUTPUT_FILE_ETHTOOL}" ++ call_run_command "ethtool -a ${network_device}" \ ++ "${OUTPUT_FILE_ETHTOOL}" ++ call_run_command "ethtool -c ${network_device}" \ ++ "${OUTPUT_FILE_ETHTOOL}" ++ call_run_command "ethtool --per-queue ${network_device} \ ++ --show-coalesce" "${OUTPUT_FILE_ETHTOOL}" ++ call_run_command "ethtool -g ${network_device}" \ ++ "${OUTPUT_FILE_ETHTOOL}" ++ call_run_command "ethtool -i ${network_device}" \ ++ "${OUTPUT_FILE_ETHTOOL}" ++ call_run_command "ethtool -l ${network_device}" \ ++ "${OUTPUT_FILE_ETHTOOL}" ++ call_run_command "ethtool -P ${network_device}" \ ++ "${OUTPUT_FILE_ETHTOOL}" ++ call_run_command "ethtool -S ${network_device}" \ ++ "${OUTPUT_FILE_ETHTOOL}" ++ call_run_command "ethtool -T ${network_device}" \ ++ "${OUTPUT_FILE_ETHTOOL}" ++ done ++ else ++ pr_skip "ethtool: no devices" ++ fi ++ else ++ pr_skip "ethtool: not available" ++ fi + } + + ######################################## + collect_tc() { +- local network_devices +- local network_device +- +- network_devices=$(ls /sys/class/net 2>/dev/null) +- if which tc >/dev/null 2>&1; then +- if test -n "${network_devices}"; then +- pr_collect_output "Trafic Control" +- for network_device in ${network_devices}; do +- call_run_command "tc -s qdisc show dev ${network_device}" "${OUTPUT_FILE_TC}" +- done +- else +- pr_skip "Trafic Control: no devices" +- fi +- else +- pr_skip "Trafic Control: tc not available" +- fi ++ local network_devices ++ local network_device ++ ++ network_devices=$(ls /sys/class/net 2>/dev/null) ++ if which tc >/dev/null 2>&1; then ++ if test -n "${network_devices}"; then ++ pr_collect_output "Trafic Control" ++ for network_device in ${network_devices}; do ++ call_run_command "tc -s qdisc show dev ${network_device}" \ ++ "${OUTPUT_FILE_TC}" ++ done ++ else ++ pr_skip "Trafic Control: no devices" ++ fi ++ else ++ pr_skip "Trafic Control: tc not available" ++ fi + } + + ######################################## + collect_bridge() { +- local network_devices +- local network_device +- +- network_devices=$(ls /sys/class/net 2>/dev/null) +- if which bridge >/dev/null 2>&1; then +- if test -n "${network_devices}"; then +- pr_collect_output "bridge" +- for network_device in ${network_devices}; do +- call_run_command "bridge -d link show dev ${network_device}" "${OUTPUT_FILE_BRIDGE}" +- call_run_command "bridge -s fdb show dev ${network_device}" "${OUTPUT_FILE_BRIDGE}" +- call_run_command "bridge -d mdb show dev ${network_device}" "${OUTPUT_FILE_BRIDGE}" +- done +- else +- pr_skip "bridge: no devices" +- fi +- else +- pr_skip "bridge: not available" +- fi ++ local network_devices ++ local network_device ++ ++ network_devices=$(ls /sys/class/net 2>/dev/null) ++ if which bridge >/dev/null 2>&1; then ++ if test -n "${network_devices}"; then ++ pr_collect_output "bridge" ++ for network_device in ${network_devices}; do ++ call_run_command "bridge -d link show dev ${network_device}" \ ++ "${OUTPUT_FILE_BRIDGE}" ++ call_run_command "bridge -s fdb show dev ${network_device}" \ ++ "${OUTPUT_FILE_BRIDGE}" ++ call_run_command "bridge -d mdb show dev ${network_device}" \ ++ "${OUTPUT_FILE_BRIDGE}" ++ done ++ else ++ pr_skip "bridge: no devices" ++ fi ++ else ++ pr_skip "bridge: not available" ++ fi + } + + ######################################## + # OpenVSwitch + collect_ovs() { +- local ovscmd +- local bridge +- local ovscmds +- local ovsbrcmd +- local ovsbrcmds +- +- ovscmds="ovs-dpctl -s show\ +- :ovs-vsctl -t 5 show\ +- :ovsdb-client dump\ +- " +- if which ovs-vsctl >/dev/null 2>&1; +- then +- pr_collect_output "OpenVSwitch" +- IFS=: +- for ovscmd in ${ovscmds}; do +- IFS=${ifs_orig} call_run_command "${ovscmd}" "${OUTPUT_FILE_OVS}" +- done +- IFS="${ifs_orig}" +- +- for bridge in ${ovs-vsctl list-br}; do +- ovsbrcmds="ovs-ofctl show ${bridge}\ +- :ovs-ofctl dump-flows ${bridge}\ +- :ovs-appctl fdb/show ${bridge}\ +- " +- IFS=: +- for ovsbrcmd in ${ovsbrcmds}; do +- IFS=${ifs_orig} call_run_command "${ovsbrcmd}" "${OUTPUT_FILE_OVS}" +- done +- IFS="${ifs_orig}" +- done +- else +- pr_skip "OpenVSwitch: ovs-vsctl not available" +- fi ++ local ovscmd ++ local bridge ++ local ovscmds ++ local ovsbrcmd ++ local ovsbrcmds ++ ++ ovscmds="ovs-dpctl -s show\ ++ :ovs-vsctl -t 5 show\ ++ :ovsdb-client dump\ ++ " ++ if which ovs-vsctl >/dev/null 2>&1; then ++ pr_collect_output "OpenVSwitch" ++ IFS=: ++ for ovscmd in ${ovscmds}; do ++ IFS=${ifs_orig} call_run_command "${ovscmd}" "${OUTPUT_FILE_OVS}" ++ done ++ IFS="${ifs_orig}" ++ ++ for bridge in ${ovs-vsctl list-br}; do ++ ovsbrcmds="ovs-ofctl show ${bridge}\ ++ :ovs-ofctl dump-flows ${bridge}\ ++ :ovs-appctl fdb/show ${bridge}\ ++ " ++ IFS=: ++ for ovsbrcmd in ${ovsbrcmds}; do ++ IFS=${ifs_orig} call_run_command "${ovsbrcmd}" "${OUTPUT_FILE_OVS}" ++ done ++ IFS="${ifs_orig}" ++ done ++ else ++ pr_skip "OpenVSwitch: ovs-vsctl not available" ++ fi + } + + ######################################## + collect_docker() { +- local container_list +- local network_list +- local item +- +- # check if docker command exists +- if [ "x${DOCKER}" = "xYES" ]; +- then +- pr_collect_output "docker" +- container_list=$(docker ps -qa) +- network_list=$(docker network ls -q) +- ifs_orig="${IFS}" +- IFS=: +- for item in ${DOCKER_CMDS}; do +- IFS=${ifs_orig} call_run_command "${item}" "${OUTPUT_FILE_DOCKER}" +- done +- IFS="${ifs_orig}" +- +- if test -n "${container_list}"; then +- for item in ${container_list}; do +- call_run_command "docker inspect ${item}" "${OUTPUT_FILE_DOCKER}" +- done +- fi +- +- if test -n "${network_list}"; then +- for item in ${network_list}; do +- call_run_command "docker network inspect ${item}" "${OUTPUT_FILE_DOCKER}" +- done +- fi +- else +- pr_skip "docker: not available" +- fi ++ local container_list ++ local network_list ++ local item ++ ++ # check if docker command exists ++ if [ "x${DOCKER}" = "xYES" ]; then ++ pr_collect_output "docker" ++ container_list=$(docker ps -qa) ++ network_list=$(docker network ls -q) ++ ifs_orig="${IFS}" ++ IFS=: ++ for item in ${DOCKER_CMDS}; do ++ IFS=${ifs_orig} call_run_command "${item}" "${OUTPUT_FILE_DOCKER}" ++ done ++ IFS="${ifs_orig}" ++ ++ if test -n "${container_list}"; then ++ for item in ${container_list}; do ++ call_run_command "docker inspect ${item}" "${OUTPUT_FILE_DOCKER}" ++ done ++ fi ++ ++ if test -n "${network_list}"; then ++ for item in ${network_list}; do ++ call_run_command "docker network inspect ${item}" \ ++ "${OUTPUT_FILE_DOCKER}" ++ done ++ fi ++ else ++ pr_skip "docker: not available" ++ fi + } + + ######################################## + collect_nvme() { +- local device +- +- if which nvme >/dev/null 2>&1; then +- pr_collect_output "NVME storage" +- call_run_command "nvme list" "${OUTPUT_FILE_NVME}" +- for device in /dev/nvme[0-9]*; do +- if [ -c $device ]; then +- call_run_command "smartctl -x $device" "${OUTPUT_FILE_NVME}" +- call_run_command "nvme fw-log $device" "${OUTPUT_FILE_NVME}" +- call_run_command "nvme smart-log $device" "${OUTPUT_FILE_NVME}" +- call_run_command "nvme error-log $device" "${OUTPUT_FILE_NVME}" +- fi +- done +- else +- pr_skip "nvme: not available" +- fi ++ local device ++ ++ if which nvme >/dev/null 2>&1; then ++ pr_collect_output "NVME storage" ++ call_run_command "nvme list" "${OUTPUT_FILE_NVME}" ++ for device in /dev/nvme[0-9]*; do ++ if [ -c $device ]; then ++ call_run_command "smartctl -x $device" "${OUTPUT_FILE_NVME}" ++ call_run_command "nvme fw-log $device" "${OUTPUT_FILE_NVME}" ++ call_run_command "nvme smart-log $device" "${OUTPUT_FILE_NVME}" ++ call_run_command "nvme error-log $device" "${OUTPUT_FILE_NVME}" ++ fi ++ done ++ else ++ pr_skip "nvme: not available" ++ fi + } + + ######################################## + collect_kvm() { +- local cmd +- local ifs_orig="${IFS}" +- local domain_list +- local domain +- +- # check if KVM virsh command exists +- if [ "x${KVM}" = "xYES" ]; +- then +- pr_collect_output "KVM" +- IFS=: +- for cmd in ${KVM_CMDS}; do +- IFS=${ifs_orig} call_run_command "${cmd}" "${OUTPUT_FILE_KVM}" +- done +- IFS="${ifs_orig}" +- +- # domain/guest specific commands +- domain_list=$(virsh list --all --name) +- if test -n "${domain_list}"; then +- for domain in ${domain_list}; do +- call_run_command "virsh dominfo ${domain}" "${OUTPUT_FILE_KVM}" +- call_run_command "virsh domblklist ${domain}" "${OUTPUT_FILE_KVM}" +- call_run_command "virsh domstats ${domain}" "${OUTPUT_FILE_KVM}" +- done +- else +- echo "no KVM doamins found" | tee -a ${OUTPUT_FILE_KVM} ++ local cmd ++ local ifs_orig="${IFS}" ++ local domain_list ++ local domain ++ ++ # check if KVM virsh command exists ++ if [ "x${KVM}" = "xYES" ]; then ++ pr_collect_output "KVM" ++ IFS=: ++ for cmd in ${KVM_CMDS}; do ++ IFS=${ifs_orig} call_run_command "${cmd}" "${OUTPUT_FILE_KVM}" ++ done ++ IFS="${ifs_orig}" ++ ++ # domain/guest specific commands ++ domain_list=$(virsh list --all --name) ++ if test -n "${domain_list}"; then ++ for domain in ${domain_list}; do ++ call_run_command "virsh dominfo ${domain}" "${OUTPUT_FILE_KVM}" ++ call_run_command "virsh domblklist ${domain}" "${OUTPUT_FILE_KVM}" ++ call_run_command "virsh domstats ${domain}" "${OUTPUT_FILE_KVM}" ++ done ++ else ++ echo "no KVM doamins found" | tee -a ${OUTPUT_FILE_KVM} ++ fi ++ else ++ pr_skip "KVM: no virsh command" + fi +- else +- pr_skip "KVM: no virsh command" +- fi + } + + ######################################## + post_processing() { +- local file_mtime +- local file_mtime_epoche +- local tmp_file +- local file_name +- local base_dir +- local dir_list +- +- pr_syslog_stdout ${step_num} "Postprocessing" +- +- # wipe possible passwords +- dir_list="${WORKPATH} \ +- ${WORKPATH}etc/ssl/ \ +- ${WORKPATH}etc/libvirt/" +- for base_dir in ${dir_list}; do +- find "${base_dir}" -maxdepth 2 -name "*xml" -o -name "*conf" -o -name "*cnf" 2>/dev/null | \ +- while read -r file_name; do +- file_mtime_epoche=$(stat --format=%Y "${file_name}") +- file_mtime=$(date +%Y%m%d%H%M.%S --date="@${file_mtime_epoche}") +- tmp_file=${file_name}.$$ +- echo " clean pw: ${file_name}" +- if ! sed "s/\(.*[Pp]assw.*=\).*/\1********/g" "${file_name}" > "${tmp_file}"; then +- echo "${SCRIPTNAME}: Warning: Postprocessing failed on ${file_name}" +- fi +- mv "${tmp_file}" "${file_name}" +- touch --time=mtime -t "${file_mtime}" "${file_name}" +- done +- done +- +- # compressing data folder to avoid full unpack for any DBGINFO +- base_dir="${WORKPATH}proc/" +- search4="kallsyms" +- find "${base_dir}" -name ${search4} 2>/dev/null | while read -r file_name; do +- tmp_file=${file_name}-${KERNEL_BASE}.tgz +- echo " compress: ${file_name}" +- if ! tar -czf "${tmp_file}" -C "${base_dir}" "${search4}"; then +- echo "${SCRIPTNAME}: Warning: Postprocessing failed on ${file_name}" +- echo +- else +- rm -f "${file_name}" +- fi +- done ++ local file_mtime ++ local file_mtime_epoche ++ local tmp_file ++ local file_name ++ local base_dir ++ local dir_list ++ ++ pr_syslog_stdout ${step_num} "Postprocessing" ++ ++ # wipe possible passwords ++ dir_list="${WORKPATH} \ ++ ${WORKPATH}etc/ssl/ \ ++ ${WORKPATH}etc/libvirt/" ++ for base_dir in ${dir_list}; do ++ find "${base_dir}" -maxdepth 2 -name "*xml" -o -name "*conf" -o -name "*cnf" \ ++ 2>/dev/null | while read -r file_name; do ++ file_mtime_epoche=$(stat --format=%Y "${file_name}") ++ file_mtime=$(date +%Y%m%d%H%M.%S --date="@${file_mtime_epoche}") ++ tmp_file=${file_name}.$$ ++ echo " clean pw: ${file_name}" ++ if ! sed "s/\(.*[Pp]assw.*=\).*/\1********/g" "${file_name}" > "${tmp_file}"; then ++ echo "${SCRIPTNAME}: Warning: Postprocessing failed on ${file_name}" ++ fi ++ mv "${tmp_file}" "${file_name}" ++ touch --time=mtime -t "${file_mtime}" "${file_name}" ++ done ++ done ++ ++ # compressing data folder to avoid full unpack for any DBGINFO ++ base_dir="${WORKPATH}proc/" ++ search4="kallsyms" ++ find "${base_dir}" -name ${search4} 2>/dev/null | while read -r file_name; do ++ tmp_file=${file_name}-${KERNEL_BASE}.tgz ++ echo " compress: ${file_name}" ++ if ! tar -czf "${tmp_file}" -C "${base_dir}" "${search4}"; then ++ echo "${SCRIPTNAME}: Warning: Postprocessing failed on ${file_name}" ++ echo ++ else ++ rm -f "${file_name}" ++ fi ++ done + } + + ######################################## + # Be aware that this output must be + # redirected into a separate logfile + call_run_command() { +- local rc +- local cmd="${1}" +- local logfile="${2}" +- local raw_cmd=$(echo "${cmd}" | sed -ne 's/^\([^[:space:]]*\).*$/\1/p') +- +- echo "#######################################################" >> "${logfile}" +- echo "${USER}@${SYSTEMHOSTNAME:-localhost}> ${cmd}" >> "${logfile}" +- +- # check if calling command and timeout exist +- if which "${raw_cmd}" >/dev/null 2>&1 && which timeout >/dev/null 2>&1; then +- eval timeout -k ${TOS} ${TOS} "${cmd}" >> ${logfile} 2>&1 +- rc=$? +- # check if command is a builtin (no use of timeout possible) +- elif command -v "${raw_cmd}" >/dev/null 2>&1; then +- eval "${cmd}" >> ${logfile} 2>&1 +- rc=$? +- else +- echo "${SCRIPTNAME}: Warning: Command \"${raw_cmd}\" not available" >> "${logfile}" +- echo >> "${logfile}" +- return 1 +- fi +- +- # log a warning on rc not 0 and define return +- if [ ${rc} ]; then +- echo >> "${logfile}" +- return 0 +- else +- echo "${SCRIPTNAME}: Warning: Command \"${cmd}\" failed" >> "${logfile}" +- echo >> "${logfile}" +- return 1 +- fi ++ local rc ++ local cmd="${1}" ++ local logfile="${2}" ++ local raw_cmd=$(echo "${cmd}" | sed -ne 's/^\([^[:space:]]*\).*$/\1/p') ++ ++ echo "#######################################################" >> "${logfile}" ++ echo "${USER}@${SYSTEMHOSTNAME:-localhost}> ${cmd}" >> "${logfile}" ++ ++ # check if calling command and timeout exist ++ if which "${raw_cmd}" >/dev/null 2>&1 && which timeout >/dev/null 2>&1; then ++ eval timeout -k ${TOS} ${TOS} "${cmd}" >> ${logfile} 2>&1 ++ rc=$? ++ # check if command is a builtin (no use of timeout possible) ++ elif command -v "${raw_cmd}" >/dev/null 2>&1; then ++ eval "${cmd}" >> ${logfile} 2>&1 ++ rc=$? ++ else ++ echo "${SCRIPTNAME}: Warning: Command \"${raw_cmd}\" not available" >> "${logfile}" ++ echo >> "${logfile}" ++ return 1 ++ fi ++ ++ # log a warning on rc not 0 and define return ++ if [ ${rc} ]; then ++ echo >> "${logfile}" ++ return 0 ++ else ++ echo "${SCRIPTNAME}: Warning: Command \"${cmd}\" failed" >> "${logfile}" ++ echo >> "${logfile}" ++ return 1 ++ fi + } + + ######################################## + call_collect_file() { +- local file_name="${1}" +- local directory_name=$(dirname "${file_name}" 2>/dev/null) +- echo " ${file_name}" +- +- if test ! -e "${WORKPATH}${directory_name}"; then +- mkdir -p "${WORKPATH}${directory_name}" 2>&1 +- fi +- if ! cp -r --preserve=mode,timestamps -d -L --parents "${file_name}" "${WORKPATH}" 2>&1; then +- return 1 +- else +- return 0 +- fi ++ local file_name="${1}" ++ local directory_name=$(dirname "${file_name}" 2>/dev/null) ++ echo " ${file_name}" ++ ++ if test ! -e "${WORKPATH}${directory_name}"; then ++ mkdir -p "${WORKPATH}${directory_name}" 2>&1 ++ fi ++ if ! cp -r --preserve=mode,timestamps -dL --parents "${file_name}" "${WORKPATH}" 2>&1; then ++ return 1 ++ else ++ return 0 ++ fi + } + + ######################################## + # print that an instance is already running + print_alreadyrunning() { +- print_version ++ print_version + +- cat < "${LOCKFILE}" +- fi +- if ! mkdir "${WORKPATH}" 2>/dev/null; then +- echo "${SCRIPTNAME}: Error: Target directory \"${WORKPATH}\" already exists or" +- echo " \"${WORKDIR_BASE}\" does not exist!" +- exit 1 +- fi +- chmod 0700 "${WORKPATH}" ++ if test ! -e "${WORKDIR_BASE}"; then ++ mkdir -p "${WORKDIR_BASE}" ++ elif test ! -d "${WORKDIR_BASE}"; then ++ echo "${SCRIPTNAME}: Error: \"${WORKDIR_BASE}\" exists but this is a file!" ++ echo " Please make sure \"${WORKDIR_BASE}\" is a directory." ++ exit 1 ++ fi ++ if test -e "${LOCKFILE}"; then ++ print_alreadyrunning ++ exit 1 ++ else ++ touch "${LOCKFILE}" ++ echo "${DATETIME}" > "${LOCKFILE}" ++ fi ++ if ! mkdir "${WORKPATH}" 2>/dev/null; then ++ echo "${SCRIPTNAME}: Error: Target directory \"${WORKPATH}\" already exists or" ++ echo " \"${WORKDIR_BASE}\" does not exist!" ++ exit 1 ++ fi ++ chmod 0700 "${WORKPATH}" + } + + ######################################## + # create gzip-ped tar file + create_package() { +- local rc_tar +- pr_syslog_stdout ${step_num} "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 ++ local rc_tar ++ pr_syslog_stdout ${step_num} "Finalizing: Creating archive with collected data" ++ cd "${WORKDIR_BASE}" ++ ++ touch "${WORKARCHIVE}" + chmod 0600 "${WORKARCHIVE}" +- pr_stdout " " +- pr_stdout "Collected data was saved to:" +- pr_stdout " >> ${WORKARCHIVE} <<" +- pr_stdout " " +- pr_stdout "Please review all collected data before sending to your service organization. " +- pr_stdout " " +- elif [ $rc_tar -eq 127 ]; then +- pr_stdout " " +- pr_stdout "${SCRIPTNAME}: Error: tar command is not available!" +- pr_stdout " Please install the corresponding package!" +- else +- pr_stdout " " +- pr_stdout "${SCRIPTNAME}: Error: Collection of data failed!" +- pr_stdout " The creation of \"${WORKARCHIVE}\" was not successful." +- pr_stdout " Please check the directory \"${WORKDIR_BASE}\"" +- pr_stdout " to provide enough free available space." +- fi ++ tar -czf "${WORKARCHIVE}" "${WORKDIR_CURRENT}" ++ rc_tar=$? ++ if [ $rc_tar -eq 0 ]; then ++ chmod 0600 "${WORKARCHIVE}" ++ pr_stdout " " ++ pr_stdout "Collected data was saved to:" ++ pr_stdout " >> ${WORKARCHIVE} <<" ++ pr_stdout " " ++ pr_stdout "Please review all collected data before sending to your" \ ++ "service organization." ++ pr_stdout " " ++ elif [ $rc_tar -eq 127 ]; then ++ pr_stdout " " ++ pr_stdout "${SCRIPTNAME}: Error: tar command is not available!" ++ pr_stdout " Please install the corresponding package!" ++ else ++ pr_stdout " " ++ pr_stdout "${SCRIPTNAME}: Error: Collection of data failed!" ++ pr_stdout " The creation of \"${WORKARCHIVE}\" was not successful." ++ pr_stdout " Please check the directory \"${WORKDIR_BASE}\"" ++ pr_stdout " to provide enough free available space." ++ fi + } + + ######################################## + # Cleaning up the prepared/collected information + environment_cleanup() { +- if ! rm -rf "${WORKPATH}" 2>/dev/null; then +- pr_stdout " " +- pr_stdout "${SCRIPTNAME}: Warning: Deletion of \"${WORKPATH}\" failed" +- pr_stdout " Please remove the directory manually" +- pr_stdout " " +- fi +- if ! rm -f "${LOCKFILE}" 2>/dev/null; then +- pr_stdout " " +- pr_stdout "${SCRIPTNAME}: Warning: Deletion of \"${LOCKFILE}\" failed" +- pr_stdout " Please remove the file manually" +- pr_stdout " " +- fi ++ if ! rm -rf "${WORKPATH}" 2>/dev/null; then ++ pr_stdout " " ++ pr_stdout "${SCRIPTNAME}: Warning: Deletion of \"${WORKPATH}\" failed" ++ pr_stdout " Please remove the directory manually" ++ pr_stdout " " ++ fi ++ if ! rm -f "${LOCKFILE}" 2>/dev/null; then ++ pr_stdout " " ++ pr_stdout "${SCRIPTNAME}: Warning: Deletion of \"${LOCKFILE}\" failed" ++ pr_stdout " Please remove the file manually" ++ pr_stdout " " ++ fi + } + + ######################################## + # Function to perform a cleanup in case of a received signal + emergency_exit() { +- pr_stdout " " +- pr_stdout "${SCRIPTNAME}: Info: Data collection has been interrupted" +- pr_stdout " Cleanup of temporary collected data" +- environment_cleanup +- pr_stdout "${SCRIPTNAME}: Info: Emergency exit processed" +- +- pr_stdout " " +- logger -t "${SCRIPTNAME}" "Data collection interrupted" +- exit ++ pr_stdout " " ++ pr_stdout "${SCRIPTNAME}: Info: Data collection has been interrupted" ++ pr_stdout " Cleanup of temporary collected data" ++ environment_cleanup ++ pr_stdout "${SCRIPTNAME}: Info: Emergency exit processed" ++ ++ pr_stdout " " ++ logger -t "${SCRIPTNAME}" "Data collection interrupted" ++ exit + } + + ######################################## + # Function to print to stdout when rediretion is active + pr_stdout() { +- echo "${@}" >&8 ++ echo "${@}" >&8 + } + + ######################################## + # Function to print to stdout and into log file when rediretion is active + pr_log_stdout() { +- echo "$@" +- echo "$@" >&8 ++ echo "$@" ++ echo "$@" >&8 + } + + ######################################## + # Function to print to stdout and into log file when rediretion is active + pr_syslog_stdout() { +- echo "$@" >&8 +- echo +- echo "$(date +%H:%M:%S.%N) - $@" +- logger -t "${SCRIPTNAME}" "$@" ++ echo "$@" >&8 ++ echo ++ echo "$(date +%H:%M:%S.%N) - $@" ++ logger -t "${SCRIPTNAME}" "$@" + } + + ######################################## + # print "Collecting ... output" + pr_collect_output() { +- pr_syslog_stdout ${step_num} "Collecting" $1 "output" ++ pr_syslog_stdout ${step_num} "Collecting" $1 "output" + } + + ######################################## + # print "Collecting ..." like fs + pr_collect() { +- pr_syslog_stdout ${step_num} "Collecting" $@ ++ pr_syslog_stdout ${step_num} "Collecting" $@ + } + + ######################################## + # print "Skipping ..." info with reason + pr_skip() { +- pr_syslog_stdout ${step_num} "Skip" $@ ++ pr_syslog_stdout ${step_num} "Skip" $@ + } + + ############################################################################### +@@ -1279,11 +1299,11 @@ logger -t "${SCRIPTNAME}" "Starting data collection" + current_step=1 + # run all collection steps + for step in ${ALL_STEPS}; do +- # generate step numbering +- step_num="${current_step} of ${COLLECTION_COUNT}: " +- # calling step procedure +- ${step} +- current_step=`expr ${current_step} + 1` ++ # generate step numbering ++ step_num="${current_step} of ${COLLECTION_COUNT}: " ++ # calling step procedure ++ ${step} ++ current_step=`expr ${current_step} + 1` + done + + logger -t "${SCRIPTNAME}" "Data collection completed" +-- +2.25.1 + diff -Nru s390-tools-2.20.0/debian/patches/3a13cb4-dbginfo.sh-unify-console-output.patch s390-tools-2.20.0/debian/patches/3a13cb4-dbginfo.sh-unify-console-output.patch --- s390-tools-2.20.0/debian/patches/3a13cb4-dbginfo.sh-unify-console-output.patch 1970-01-01 00:00:00.000000000 +0000 +++ s390-tools-2.20.0/debian/patches/3a13cb4-dbginfo.sh-unify-console-output.patch 2022-05-20 11:48:34.000000000 +0000 @@ -0,0 +1,56 @@ +From 3a13cb43f211d997e3c5ea83cfc7ff71b964dca8 Mon Sep 17 00:00:00 2001 +From: Joern Siglen +Date: Tue, 1 Feb 2022 10:39:10 +0100 +Subject: [PATCH] dbginfo.sh: unify console output +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +use same look over all output + +Signed-off-by: Joern Siglen +Reviewed-by: Mario Held +Signed-off-by: Jan Höppner + +Origin: upstream, https://github.com/ibm-s390-tools/s390-tools/commit/3a13cb43f211d997e3c5ea83cfc7ff71b964dca8 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1971959 +Last-Update: 2022-05-25 + +--- + scripts/dbginfo.sh | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/scripts/dbginfo.sh b/scripts/dbginfo.sh +index 909e99b4..d1806375 100755 +--- a/scripts/dbginfo.sh ++++ b/scripts/dbginfo.sh +@@ -160,7 +160,7 @@ Log file check =$(logfile_checker "/var/log*") + + Working directory = $(ls -d ${paramWORKDIR_BASE} 2>&1 && df -k ${paramWORKDIR_BASE}) + $(ls -ltr ${paramWORKDIR_BASE}/DBGINFO*tgz 2>/dev/null | tail -2) +-$(ls ${LOCKFILE} 2>/dev/null && echo " WARNING: dbginfo running since: $(cat ${LOCKFILE})") ++$(ls ${LOCKFILE} 2>/dev/null && echo " Warning: dbginfo running since: $(cat ${LOCKFILE})") + + This is a console output only - no data was saved using option -c ! + +@@ -1022,7 +1022,7 @@ post_processing() { + local base_dir + local dir_list + +- pr_syslog_stdout "${step_num} Postprocessing" ++ pr_syslog_stdout ${step_num} "Postprocessing" + + # wipe possible passwords + dir_list="${WORKPATH} \ +@@ -1154,7 +1154,7 @@ environment_setup() { + # create gzip-ped tar file + create_package() { + local rc_tar +- pr_syslog_stdout "${step_num} Finalizing: Creating archive with collected data" ++ pr_syslog_stdout ${step_num} "Finalizing: Creating archive with collected data" + cd "${WORKDIR_BASE}" + + touch "${WORKARCHIVE}" +-- +2.25.1 + diff -Nru s390-tools-2.20.0/debian/patches/4382901d-lszcrypt-show-AP-bus-msg-size-limit-capability.patch s390-tools-2.20.0/debian/patches/4382901d-lszcrypt-show-AP-bus-msg-size-limit-capability.patch --- s390-tools-2.20.0/debian/patches/4382901d-lszcrypt-show-AP-bus-msg-size-limit-capability.patch 1970-01-01 00:00:00.000000000 +0000 +++ s390-tools-2.20.0/debian/patches/4382901d-lszcrypt-show-AP-bus-msg-size-limit-capability.patch 2022-05-20 11:48:34.000000000 +0000 @@ -0,0 +1,117 @@ +From 4382901daa4f9ad96576100159cbe910a4e8f52d Mon Sep 17 00:00:00 2001 +From: Harald Freudenberger +Date: Tue, 8 Feb 2022 17:32:28 +0100 +Subject: [PATCH] lszcrypt: show AP bus msg size limit capability +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +If there is a max_msg_size attribute for the card +the lszcrypt -c option will show this limit as + AP bus max message size limit xx Kb + +Signed-off-by: Harald Freudenberger +Signed-off-by: Jan Höppner + +Origin: upstream, https://github.com/ibm-s390-tools/s390-tools/commit/4382901daa4f9ad96576100159cbe910a4e8f52d +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1959548 +Last-Update: 2022-05-25 + +--- + zconf/zcrypt/lszcrypt.c | 29 +++++++++++++++++------------ + 1 file changed, 17 insertions(+), 12 deletions(-) + +diff --git a/zconf/zcrypt/lszcrypt.c b/zconf/zcrypt/lszcrypt.c +index 57d6c236..cb06325d 100644 +--- a/zconf/zcrypt/lszcrypt.c ++++ b/zconf/zcrypt/lszcrypt.c +@@ -39,6 +39,7 @@ static struct lszcrypt_l { + #define CAP_CCA "CCA Secure Key" + #define CAP_RNG "Long RNG" + #define CAP_EP11 "EP11 Secure Key" ++#define CAP_APMMS "AP bus max message size limit %ld Kb" + + /* + * Card types +@@ -253,7 +254,7 @@ static void show_domains(void) + static void show_capability(const char *id_str) + { + unsigned long func_val; +- long hwtype, id; ++ long hwtype, id, max_msg_size; + char *p, *ap, *dev, card[16], cbuf[256]; + + /* check if ap driver is available */ +@@ -272,6 +273,9 @@ static void show_capability(const char *id_str) + /* If sysfs attribute is missing, set functions to 0 */ + if (util_file_read_ul(&func_val, 16, "%s/ap_functions", dev)) + func_val = 0x00000000; ++ /* try to read the ap bus max message size for this card */ ++ if (util_file_read_l(&max_msg_size, 10, "%s/max_msg_size", dev)) ++ max_msg_size = 0; + /* Skip devices, which are not supported by zcrypt layer */ + if (!util_path_is_readable("%s/type", dev) || + !util_path_is_readable("%s/online", dev)) { +@@ -289,9 +293,9 @@ static void show_capability(const char *id_str) + case 6: + case 8: + if (func_val & MASK_RSA4K) +- printf("%s", CAP_RSA4K); ++ printf("%s\n", CAP_RSA4K); + else +- printf("%s", CAP_RSA2K); ++ printf("%s\n", CAP_RSA2K); + break; + case 7: + case 9: +@@ -300,7 +304,7 @@ static void show_capability(const char *id_str) + printf("%s (%s)\n", CAP_CCA, cbuf); + else + printf("%s\n", CAP_CCA); +- printf("%s", CAP_RNG); ++ printf("%s\n", CAP_RNG); + break; + case 10: /* CEX4S */ + case 11: /* CEX5S */ +@@ -309,29 +313,30 @@ static void show_capability(const char *id_str) + case 14: /* CEX8S */ + if (func_val & MASK_ACCEL) { + if (func_val & MASK_RSA4K) +- printf("%s", CAP_RSA4K); ++ printf("%s\n", CAP_RSA4K); + else +- printf("%s", CAP_RSA2K); ++ printf("%s\n", CAP_RSA2K); + } else if (func_val & MASK_COPRO) { + printf("%s\n", CAP_RSA4K); + if (cbuf[0]) + printf("%s (%s)\n", CAP_CCA, cbuf); + else + printf("%s\n", CAP_CCA); +- printf("%s", CAP_RNG); ++ printf("%s\n", CAP_RNG); + } else if (func_val & MASK_EP11) { +- printf("%s", CAP_EP11); ++ printf("%s\n", CAP_EP11); + } else { +- printf("Detailed capability information for %s (hardware type %ld) is not available.", ++ printf("Detailed capability information for %s (hardware type %ld) is not available.\n", + card, hwtype); + } ++ if (max_msg_size > 0) ++ printf(CAP_APMMS "\n", max_msg_size / 1024); + break; + default: +- printf("Detailed capability information for %s (hardware type %ld) is not available.", +- card, hwtype); ++ printf("Detailed capability information for %s (hardware type %ld) is not available.\n", ++ card, hwtype); + break; + } +- printf("\n"); + } + + /* +-- +2.25.1 + diff -Nru s390-tools-2.20.0/debian/patches/46fd42af-lszcrypt-new-option-to-show-the-serial-numbers-of-CC.patch s390-tools-2.20.0/debian/patches/46fd42af-lszcrypt-new-option-to-show-the-serial-numbers-of-CC.patch --- s390-tools-2.20.0/debian/patches/46fd42af-lszcrypt-new-option-to-show-the-serial-numbers-of-CC.patch 1970-01-01 00:00:00.000000000 +0000 +++ s390-tools-2.20.0/debian/patches/46fd42af-lszcrypt-new-option-to-show-the-serial-numbers-of-CC.patch 2022-05-20 11:48:34.000000000 +0000 @@ -0,0 +1,163 @@ +From 46fd42af0c569972ced135cbf28c2402ae6d18f3 Mon Sep 17 00:00:00 2001 +From: Harald Freudenberger +Date: Fri, 18 Feb 2022 16:26:14 +0100 +Subject: [PATCH] lszcrypt: new option to show the serial numbers of CCA and + EP11 cards +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The new option -s, long --serial shows the serial numbers of +CCA and EP11 cards. + +Signed-off-by: Harald Freudenberger +Signed-off-by: Jan Höppner + +Origin: upstream, https://github.com/ibm-s390-tools/s390-tools/commit/46fd42af0c569972ced135cbf28c2402ae6d18f3 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1959548 +Last-Update: 2022-05-25 + +--- + zconf/zcrypt/lszcrypt.8 | 5 +++ + zconf/zcrypt/lszcrypt.c | 88 +++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 93 insertions(+) + +diff --git a/zconf/zcrypt/lszcrypt.8 b/zconf/zcrypt/lszcrypt.8 +index 1c53a80e..20354d23 100644 +--- a/zconf/zcrypt/lszcrypt.8 ++++ b/zconf/zcrypt/lszcrypt.8 +@@ -32,6 +32,8 @@ lszcrypt \- display zcrypt device and configuration information + .TP + .B lszcrypt -h + .TP ++.B lszcrypt -s ++.TP + .B lszcrypt -v + . TP + .B +@@ -113,6 +115,9 @@ B - indicate both (control and usage domain) + .B -h, --help + Displays help text and exits. + .TP 8 ++.B -s, --serial ++Shows the serial numbers for CCA and EP11 crypto cards. ++.TP 8 + .B -v, --version + Displays version information and exits. + .TP 8 +diff --git a/zconf/zcrypt/lszcrypt.c b/zconf/zcrypt/lszcrypt.c +index a0884417..c0eadce8 100644 +--- a/zconf/zcrypt/lszcrypt.c ++++ b/zconf/zcrypt/lszcrypt.c +@@ -151,6 +151,10 @@ static struct util_opt opt_vec[] = { + .flags = UTIL_OPT_FLAG_NOSHORT, + .desc = "Show only information from queues but no card info", + }, ++ { ++ .option = {"serial", 0, NULL, 's'}, ++ .desc = "Show the serial numbers for CCA and EP11 crypto cards", ++ }, + UTIL_OPT_HELP, + UTIL_OPT_VERSION, + UTIL_OPT_END +@@ -285,6 +289,87 @@ static void show_domains(void) + show_domains_util_rec(domain_array); + } + ++/* ++ * Show serialnumbers ++ */ ++static void show_serialnumbers(void) ++{ ++ struct util_rec *rec = util_rec_new_wide("-"); ++ struct dirent **dev_vec; ++ int i, count; ++ char *ap, *path, *device, *grp_dev, card[16], buf[256]; ++ long config = -1, online = -1, chkstop = -1; ++ unsigned long facility; ++ ++ /* check if ap driver is available */ ++ ap = util_path_sysfs("bus/ap"); ++ if (!util_path_is_dir(ap)) ++ errx(EXIT_FAILURE, "Crypto device driver not available."); ++ ++ /* define the record */ ++ util_rec_def(rec, "card", UTIL_REC_ALIGN_LEFT, 8, "CARD.DOM"); ++ util_rec_def(rec, "type", UTIL_REC_ALIGN_LEFT, 5, "TYPE"); ++ util_rec_def(rec, "mode", UTIL_REC_ALIGN_LEFT, 11, "MODE"); ++ util_rec_def(rec, "status", UTIL_REC_ALIGN_LEFT, 10, "STATUS"); ++ util_rec_def(rec, "serialnr", UTIL_REC_ALIGN_LEFT, 8, "SERIALNR"); ++ ++ /* scan the devices */ ++ path = util_path_sysfs("devices/ap/"); ++ count = util_scandir(&dev_vec, alphasort, path, "card[0-9a-fA-F]+"); ++ if (count < 1) ++ errx(EXIT_FAILURE, "No crypto card devices found."); ++ util_rec_print_hdr(rec); ++ for (i = 0; i < count; i++) { ++ device = dev_vec[i]->d_name; ++ grp_dev = util_path_sysfs("devices/ap/%s", device); ++ if (!util_path_is_dir(grp_dev)) ++ errx(EXIT_FAILURE, "Error - cryptographic device %s does not exist.", device); ++ if (!util_path_is_readable("%s/type", grp_dev) || ++ !util_path_is_readable("%s/online", grp_dev)) ++ goto next; ++ strcpy(card, device + 4); ++ util_rec_set(rec, "card", card); ++ util_file_read_line(buf, sizeof(buf), "%s/type", grp_dev); ++ util_rec_set(rec, "type", buf); ++ util_file_read_ul(&facility, 16, "%s/ap_functions", grp_dev); ++ if (facility & MASK_COPRO) ++ util_rec_set(rec, "mode", "CCA-Coproc"); ++ else if (facility & MASK_EP11) ++ util_rec_set(rec, "mode", "EP11-Coproc"); ++ else ++ goto next; ++ if (util_path_is_readable("%s/config", grp_dev)) ++ util_file_read_l(&config, 10, "%s/config", grp_dev); ++ if (util_path_is_readable("%s/chkstop", grp_dev)) ++ util_file_read_l(&chkstop, 10, "%s/chkstop", grp_dev); ++ if (util_path_is_readable("%s/online", grp_dev)) ++ util_file_read_l(&online, 10, "%s/online", grp_dev); ++ if (config == 0) { ++ util_rec_set(rec, "status", "deconfig"); ++ } else { ++ if (chkstop > 0) ++ util_rec_set(rec, "status", "chkstop"); ++ else if (online > 0) ++ util_rec_set(rec, "status", "online"); ++ else if (online == 0) ++ util_rec_set(rec, "status", "offline"); ++ else ++ util_rec_set(rec, "status", "-"); ++ } ++ if (util_file_read_line(buf, sizeof(buf), "%s/serialnr", grp_dev)) ++ util_rec_set(rec, "serialnr", "-"); ++ else { ++ buf[8] = '\0'; ++ util_rec_set(rec, "serialnr", buf); ++ } ++ util_rec_print(rec); ++next: ++ free(grp_dev); ++ } ++ ++ free(path); ++} ++ + /* + * Show capability + */ +@@ -863,6 +948,9 @@ int main(int argc, char **argv) + case 'd': + show_domains(); + return EXIT_SUCCESS; ++ case 's': ++ show_serialnumbers(); ++ return EXIT_SUCCESS; + case 'V': + l.verbose++; + break; +-- +2.25.1 + diff -Nru s390-tools-2.20.0/debian/patches/50a4740-dbginfo.sh-replace-which-by-builtin-command-type-for.patch s390-tools-2.20.0/debian/patches/50a4740-dbginfo.sh-replace-which-by-builtin-command-type-for.patch --- s390-tools-2.20.0/debian/patches/50a4740-dbginfo.sh-replace-which-by-builtin-command-type-for.patch 1970-01-01 00:00:00.000000000 +0000 +++ s390-tools-2.20.0/debian/patches/50a4740-dbginfo.sh-replace-which-by-builtin-command-type-for.patch 2022-05-20 11:48:34.000000000 +0000 @@ -0,0 +1,178 @@ +From 50a4740443673737df7c2b4e81ad2f2db448d43f Mon Sep 17 00:00:00 2001 +From: Joern Siglen +Date: Fri, 4 Feb 2022 14:11:11 +0100 +Subject: [PATCH] dbginfo.sh: replace "which" by builtin command "type" for cmd + checks +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +'which' tool is packaged separately from other core tools and there will +likely be scenarios where this check will fail because 'which' is +unavailable. +The "type" is builtin itself and should solve this problem. +For a built in command, we will not suppress error out -> removing 2>&1. +On this replace - in call_run_command - get cmd_type as variable only once + +Reported by: Peter Oberparleiter +Signed-off-by: Joern Siglen +Reviewed-by: Mario Held +Signed-off-by: Jan Höppner + +Origin: upstream, https://github.com/ibm-s390-tools/s390-tools/commit/50a4740443673737df7c2b4e81ad2f2db448d43f +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1971959 +Last-Update: 2022-05-25 + +--- + CHANGELOG.md | 3 +++ + scripts/dbginfo.sh | 44 +++++++++++++++++++++++++++----------------- + 2 files changed, 30 insertions(+), 17 deletions(-) + +diff --git a/CHANGELOG.md b/CHANGELOG.md +index 65bfa3bf..eda87f46 100644 +--- a/CHANGELOG.md ++++ b/CHANGELOG.md +@@ -12,6 +12,9 @@ Release history for s390-tools (MIT version) + - Add EditorConfig configuration + + Changes of existing tools: ++ - dbginfo.sh: rework script formatting (indents, order) ++ - dbginfo.sh: update sysfs collection (excludes, messages) ++ - dbginfo.sh: replace "which" by builtin command "type" + - s390-tools switches to Fuse 3 as Fuse 2 is deprecated. + Affected tools: cmsfs, hmcdrvfs, hsavmcore, zdsfs, zdump + - chreipl-fcp-mpath: don't compress the manpage before installing it +diff --git a/scripts/dbginfo.sh b/scripts/dbginfo.sh +index cf5f953c..924c6de0 100755 +--- a/scripts/dbginfo.sh ++++ b/scripts/dbginfo.sh +@@ -17,7 +17,7 @@ export LC_ALL + readonly SCRIPTNAME="${0##*/}" # general name of this script + # + readonly DATETIME="$(date +%Y-%m-%d-%H-%M-%S 2>/dev/null)" +-readonly DOCKER=$(if which docker >/dev/null 2>&1; then echo "YES"; else echo "NO"; fi) ++readonly DOCKER=$(if type -t docker >/dev/null; then echo "YES"; else echo "NO"; fi) + readonly HW="$(uname -i 2>/dev/null)" + # retrieve and split kernel version + readonly KERNEL_BASE="$(uname -r 2>/dev/null)" +@@ -25,7 +25,7 @@ readonly KERNEL_VERSION=$(echo ${KERNEL_BASE} | cut -d'.' -f1 ) + readonly KERNEL_MAJOR_REVISION=$(echo ${KERNEL_BASE} | cut -d'.' -f2 ) + readonly KERNEL_MINOR_REVISION=$(echo ${KERNEL_BASE} | cut -d'.' -f3 | sed 's/[^0-9].*//g') + readonly KERNEL_INFO=${KERNEL_VERSION}.${KERNEL_MAJOR_REVISION}.${KERNEL_MINOR_REVISION} +-readonly KVM=$(if which virsh >/dev/null 2>&1; then echo "YES"; else echo "NO"; fi) ++readonly KVM=$(if type -t virsh >/dev/null; then echo "YES"; else echo "NO"; fi) + # The file to indicate that another instance of the script is already running + readonly LOCKFILE="/tmp/${SCRIPTNAME}.lock" + # check limits for logfiles like /var/log/messages +@@ -644,12 +644,12 @@ collect_vmcmdsout() { + if echo "${RUNTIME_ENVIRONMENT}" | grep -qi "z/VM" >/dev/null 2>&1; then + pr_collect_output "z/VM" + +- if which vmcp >/dev/null 2>&1; then ++ if type -t vmcp >/dev/null; then + cp_command="vmcp" + if ! lsmod 2>/dev/null | grep -q vmcp && modinfo vmcp >/dev/null 2>&1; then + modprobe vmcp && module_loaded=0 && sleep 2 + fi +- elif which hcp >/dev/null 2>&1; then ++ elif type -t hcp >/dev/null; then + cp_command="hcp" + if ! lsmod 2>/dev/null | grep -q cpint; then + modprobe cpint && module_loaded=0 && sleep 2 +@@ -819,7 +819,7 @@ collect_osaoat() { + + network_devices=$(lsqeth 2>/dev/null | grep "Device name" \ + | sed 's/D.*:[[:space:]]*\([^[:space:]]*\)[[:space:]]\+/\1/g') +- if which qethqoat >/dev/null 2>&1; then ++ if type -t qethqoat >/dev/null; then + if test -n "${network_devices}"; then + pr_collect_output "osa oat" + for network_device in ${network_devices}; do +@@ -842,7 +842,7 @@ collect_ethtool() { + local network_device + + network_devices=$(ls /sys/class/net 2>/dev/null) +- if which ethtool >/dev/null 2>&1; then ++ if type -t ethtool >/dev/null; then + if test -n "${network_devices}"; then + pr_collect_output "ethtool" + for network_device in ${network_devices}; do +@@ -883,7 +883,7 @@ collect_tc() { + local network_device + + network_devices=$(ls /sys/class/net 2>/dev/null) +- if which tc >/dev/null 2>&1; then ++ if type -t tc >/dev/null; then + if test -n "${network_devices}"; then + pr_collect_output "Trafic Control" + for network_device in ${network_devices}; do +@@ -904,7 +904,7 @@ collect_bridge() { + local network_device + + network_devices=$(ls /sys/class/net 2>/dev/null) +- if which bridge >/dev/null 2>&1; then ++ if type -t bridge >/dev/null; then + if test -n "${network_devices}"; then + pr_collect_output "bridge" + for network_device in ${network_devices}; do +@@ -936,7 +936,7 @@ collect_ovs() { + :ovs-vsctl -t 5 show\ + :ovsdb-client dump\ + " +- if which ovs-vsctl >/dev/null 2>&1; then ++ if type -t ovs-vsctl >/dev/null; then + pr_collect_output "OpenVSwitch" + IFS=: + for ovscmd in ${ovscmds}; do +@@ -999,7 +999,7 @@ collect_docker() { + collect_nvme() { + local device + +- if which nvme >/dev/null 2>&1; then ++ if type -t nvme >/dev/null; then + pr_collect_output "NVME storage" + call_run_command "nvme list" "${OUTPUT_FILE_NVME}" + for device in /dev/nvme[0-9]*; do +@@ -1096,22 +1096,32 @@ post_processing() { + # Be aware that this output must be + # redirected into a separate logfile + call_run_command() { +- local rc ++ local rc=0 + local cmd="${1}" + local logfile="${2}" ++ # extract the raw_command and set cmd_type + local raw_cmd=$(echo "${cmd}" | sed -ne 's/^\([^[:space:]]*\).*$/\1/p') ++ local cmd_type=$(type -t ${raw_cmd}) ++ # timeout_ok - like a boolean - is not empty if command exists ++ local timeout_ok=$(type -t timeout) + + echo "#######################################################" >> "${logfile}" + echo "${USER}@${SYSTEMHOSTNAME:-localhost}> ${cmd}" >> "${logfile}" + +- # check if calling command and timeout exist +- if which "${raw_cmd}" >/dev/null 2>&1 && which timeout >/dev/null 2>&1; then +- eval timeout -k ${TOS} ${TOS} "${cmd}" >> ${logfile} 2>&1 +- rc=$? +- # check if command is a builtin (no use of timeout possible) +- elif command -v "${raw_cmd}" >/dev/null 2>&1; then ++ # check calling command type ++ if [ "X${cmd_type}" = "Xbuiltin" ]; then ++ # command is a builtin (no use of timeout possible) + eval "${cmd}" >> ${logfile} 2>&1 + rc=$? ++ elif [ "X${cmd_type}" != "X" ]; then ++ if [ "X${timeout_ok}" = "Xfile" ]; then ++ eval timeout -k ${TOS} ${TOS} "${cmd}" >> ${logfile} 2>&1 ++ rc=$? ++ else ++ # fall back - call all existing commands without timeout ++ eval "${cmd}" >> ${logfile} 2>&1 ++ rc=$? ++ fi + else + echo "${SCRIPTNAME}: Warning: Command \"${raw_cmd}\" not available" >> "${logfile}" + echo >> "${logfile}" +-- +2.25.1 + diff -Nru s390-tools-2.20.0/debian/patches/812df79-dbginfo.sh-re-group-commands-by-topic.patch s390-tools-2.20.0/debian/patches/812df79-dbginfo.sh-re-group-commands-by-topic.patch --- s390-tools-2.20.0/debian/patches/812df79-dbginfo.sh-re-group-commands-by-topic.patch 1970-01-01 00:00:00.000000000 +0000 +++ s390-tools-2.20.0/debian/patches/812df79-dbginfo.sh-re-group-commands-by-topic.patch 2022-05-20 11:48:34.000000000 +0000 @@ -0,0 +1,88 @@ +From 812df795c346c39002fb2cd60740866b2960c8c6 Mon Sep 17 00:00:00 2001 +From: Joern Siglen +Date: Mon, 14 Feb 2022 13:24:13 +0100 +Subject: [PATCH] dbginfo.sh: (re)group commands by topic +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This change will group the commands executed for crypto, special SW or +specific for a distro into sections with a comment. +By grouping, we intend to enhance the handling in our runtime.out file +and help to understand the purpose of command groups. + +Signed-off-by: Joern Siglen +Reviewed-by: Sa Liu +Reviewed-by: Mario Held +Signed-off-by: Jan Höppner + +Origin: upstream, https://github.com/ibm-s390-tools/s390-tools/commit/812df795c346c39002fb2cd60740866b2960c8c6 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1971959 +Last-Update: 2022-05-25 + +--- + scripts/dbginfo.sh | 26 +++++++++++++++++--------- + 1 file changed, 17 insertions(+), 9 deletions(-) + +diff --git a/scripts/dbginfo.sh b/scripts/dbginfo.sh +index 521e364d..fa357ae3 100755 +--- a/scripts/dbginfo.sh ++++ b/scripts/dbginfo.sh +@@ -423,10 +423,6 @@ CMDS="uname -a\ + :dmsetup table\ + :dmsetup table --target multipath\ + :dmsetup status\ +- :icainfo\ +- :icastats\ +- :ivp.e # IBM CCA package install check\ +- :java -version\ + :last\ + :lschp\ + :lscpu -ae\ +@@ -440,7 +436,6 @@ CMDS="uname -a\ + :lsscsi\ + :lsshut\ + :lstape\ +- :lszcrypt -VV\ + :lszdev\ + :lszfcp\ + :lszfcp -D\ +@@ -459,11 +454,7 @@ CMDS="uname -a\ + :multipath -v6 -ll\ + :multipath -d\ + :multipath -t\ +- :pkcsconf -mlist\ + :pvpath -qa\ +- :SPident # SLES service package\ +- :cat /var/lib/opencryptoki/pk_config_data\ +- :ls -al /usr/lib64/opencryptoki/stdll\ + :find /boot -print0 | sort -z | xargs -0 -n 10 ls -ld\ + :find /dev -print0 | sort -z | xargs -0 -n 10 ls -ld\ + :find /var/crash -print0 | sort -z | xargs -0 -n 10 ls -ld\ +@@ -477,6 +468,23 @@ CMDS="uname -a\ + :ziorep_config -ADM\ + " + ++# crypto specific commands ++CMDS="${CMDS}\ ++ :cat /var/lib/opencryptoki/pk_config_data\ ++ :icainfo\ ++ :icastats\ ++ :ivp.e # IBM CCA package install check\ ++ :ls -al /usr/lib64/opencryptoki/stdll\ ++ :lszcrypt -VV\ ++ :pkcsconf -mlist\ ++ " ++ ++# product / distro specific commands ++CMDS="${CMDS}\ ++ :java -version\ ++ :SPident # SLES service package\ ++ " ++ + # commands with long output at the end + CMDS="${CMDS}\ + :cat /root/.bash_history\ +-- +2.25.1 + diff -Nru s390-tools-2.20.0/debian/patches/81920f7-dbginfo.sh-re-group-commands-for-network.patch s390-tools-2.20.0/debian/patches/81920f7-dbginfo.sh-re-group-commands-for-network.patch --- s390-tools-2.20.0/debian/patches/81920f7-dbginfo.sh-re-group-commands-for-network.patch 1970-01-01 00:00:00.000000000 +0000 +++ s390-tools-2.20.0/debian/patches/81920f7-dbginfo.sh-re-group-commands-for-network.patch 2022-05-20 11:48:34.000000000 +0000 @@ -0,0 +1,72 @@ +From 81920f7cfd964f8133406848c5cee2b1d40cf7c8 Mon Sep 17 00:00:00 2001 +From: Joern Siglen +Date: Mon, 14 Feb 2022 11:42:23 +0100 +Subject: [PATCH] dbginfo.sh: (re)group commands for network +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This change will regroup & reorder the commands executed for network. +By grouping, we intend to enhance the handling in our runtime.out file +and help to understand the purpose of command groups. + +In addition we did get feedback for promoting some commands to the top. +"ip -br a" was added on request of SMEs during the discussions + +Signed-off-by: Joern Siglen +Reviewed-by: Sa Liu +Reviewed-by: Mario Held +Acked-by: Sandy Winter +Acked-by: Stefan Raspl +Signed-off-by: Jan Höppner + +Origin: upstream, https://github.com/ibm-s390-tools/s390-tools/commit/81920f7cfd964f8133406848c5cee2b1d40cf7c8 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1971959 +Last-Update: 2022-05-25 + +--- + scripts/dbginfo.sh | 18 ++++++++++-------- + 1 file changed, 10 insertions(+), 8 deletions(-) + +diff --git a/scripts/dbginfo.sh b/scripts/dbginfo.sh +index 939ac275..7a3728e8 100755 +--- a/scripts/dbginfo.sh ++++ b/scripts/dbginfo.sh +@@ -426,7 +426,6 @@ CMDS="uname -a\ + :dmsetup status\ + :icainfo\ + :icastats\ +- :ipcs -a\ + :ivp.e # IBM CCA package install check\ + :java -version\ + :last\ +@@ -490,16 +489,19 @@ CMDS="uname -a\ + " + + ######################################## +-NETWORK_CMDS="ip a sh\ ++# network comamnds for separate output file with ip -br a as header command ++NETWORK_CMDS="ip -br a\ ++ :firewall-cmd --list-all\ ++ :ifconfig -a\ ++ :ip a sh\ ++ :ip -s -s link\ ++ :ip link show\ ++ :ip neigh list\ ++ :ip ntable\ + :ip route list\ + :ip route list table all\ + :ip rule list\ +- :ip neigh list\ +- :ip link show\ +- :ip ntable\ +- :ip -s -s link\ +- :firewall-cmd --list-all\ +- :ifconfig -a\ ++ :ipcs -a\ + :iptables -L\ + :lsqeth\ + :netstat -pantu\ +-- +2.25.1 + diff -Nru s390-tools-2.20.0/debian/patches/a0d6edf-dbginfo.sh-re-group-commands-by-long-output.patch s390-tools-2.20.0/debian/patches/a0d6edf-dbginfo.sh-re-group-commands-by-long-output.patch --- s390-tools-2.20.0/debian/patches/a0d6edf-dbginfo.sh-re-group-commands-by-long-output.patch 1970-01-01 00:00:00.000000000 +0000 +++ s390-tools-2.20.0/debian/patches/a0d6edf-dbginfo.sh-re-group-commands-by-long-output.patch 2022-05-20 11:48:34.000000000 +0000 @@ -0,0 +1,99 @@ +From a0d6edf03c255ca2f906c4eb98398e8fcf03f0b8 Mon Sep 17 00:00:00 2001 +From: Joern Siglen +Date: Mon, 14 Feb 2022 12:06:33 +0100 +Subject: [PATCH] dbginfo.sh: (re)group commands by long output +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This change will group the commands with long output into two +sections with a comment. +By grouping, we intend to enhance the handling in our runtime.out file +and help to understand the purpose of command groups. + +We did get feedback for moveing some independent long output files to +the end for speed up the scrolling in the upper parts. +Files which already have a separate output file are bundled in a +separate group at the end. + +Signed-off-by: Joern Siglen +Reviewed-by: Sa Liu +Reviewed-by: Mario Held +Signed-off-by: Jan Höppner + +Origin: upstream, https://github.com/ibm-s390-tools/s390-tools/commit/a0d6edf03c255ca2f906c4eb98398e8fcf03f0b8 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1971959 +Last-Update: 2022-05-25 + +--- + scripts/dbginfo.sh | 30 +++++++++++++++++++----------- + 1 file changed, 19 insertions(+), 11 deletions(-) + +diff --git a/scripts/dbginfo.sh b/scripts/dbginfo.sh +index 7a3728e8..521e364d 100755 +--- a/scripts/dbginfo.sh ++++ b/scripts/dbginfo.sh +@@ -418,7 +418,6 @@ CMDS="uname -a\ + :env\ + :df -h\ + :df -i\ +- :dmesg -s 1048576\ + :dmsetup ls\ + :dmsetup ls --tree\ + :dmsetup table\ +@@ -461,22 +460,13 @@ CMDS="uname -a\ + :multipath -d\ + :multipath -t\ + :pkcsconf -mlist\ +- :ps -emo pid,tid,nlwp,policy,user,tname,ni,pri,psr,sgi_p,stat,wchan,start_time,time,pcpu,pmem,vsize,size,rss,share,command\ +- :ps -eHo pid,tid,nlwp,policy,user,tname,ni,pri,psr,sgi_p,stat,wchan,start_time,time,pcpu,pmem,vsize,size,rss,share,command\ +- :ps axX\ + :pvpath -qa\ + :SPident # SLES service package\ + :cat /var/lib/opencryptoki/pk_config_data\ + :ls -al /usr/lib64/opencryptoki/stdll\ +- :rpm -qa | sort >> '${OUTPUT_FILE_ISW}'\ +- :apt list >> '${OUTPUT_FILE_ISW}'\ +- :lsof >> '${OUTPUT_FILE_LSOF}'\ + :find /boot -print0 | sort -z | xargs -0 -n 10 ls -ld\ + :find /dev -print0 | sort -z | xargs -0 -n 10 ls -ld\ + :find /var/crash -print0 | sort -z | xargs -0 -n 10 ls -ld\ +- :cat /root/.bash_history\ +- :journalctl --all --no-pager --lines=100000 --output=short-precise\ +- >> '${OUTPUT_FILE_JOURNALCTL}'\ + :smc_dbg\ + :sysctl -a\ + :systemctl --all --no-pager show\ +@@ -484,10 +474,28 @@ CMDS="uname -a\ + :systemctl --all --no-pager list-unit-files\ + :systemd-delta\ + :lvdisplay\ +- :coredumpctl && coredumpctl info -o ${OUTPUT_FILE_COREDUMPCTL}\ + :ziorep_config -ADM\ + " + ++# commands with long output at the end ++CMDS="${CMDS}\ ++ :cat /root/.bash_history\ ++ :dmesg -s 1048576\ ++ :ps -emo pid,tid,nlwp,policy,user,tname,ni,pri,psr,sgi_p,stat,wchan,start_time,time,pcpu,pmem,vsize,size,rss,share,command\ ++ :ps -eHo pid,tid,nlwp,policy,user,tname,ni,pri,psr,sgi_p,stat,wchan,start_time,time,pcpu,pmem,vsize,size,rss,share,command\ ++ :ps axX\ ++ " ++ ++# commands with separate output file ++CMDS="${CMDS}\ ++ :apt list >> '${OUTPUT_FILE_ISW}'\ ++ :coredumpctl && coredumpctl info -o ${OUTPUT_FILE_COREDUMPCTL}\ ++ :journalctl --all --no-pager --lines=100000 --output=short-precise\ ++ >> '${OUTPUT_FILE_JOURNALCTL}'\ ++ :lsof >> '${OUTPUT_FILE_LSOF}'\ ++ :rpm -qa | sort >> '${OUTPUT_FILE_ISW}'\ ++ " ++ + ######################################## + # network comamnds for separate output file with ip -br a as header command + NETWORK_CMDS="ip -br a\ +-- +2.25.1 + diff -Nru s390-tools-2.20.0/debian/patches/a29b3c89-lszcrypt-new-options-to-show-only-accel-cca-or-ep11-.patch s390-tools-2.20.0/debian/patches/a29b3c89-lszcrypt-new-options-to-show-only-accel-cca-or-ep11-.patch --- s390-tools-2.20.0/debian/patches/a29b3c89-lszcrypt-new-options-to-show-only-accel-cca-or-ep11-.patch 1970-01-01 00:00:00.000000000 +0000 +++ s390-tools-2.20.0/debian/patches/a29b3c89-lszcrypt-new-options-to-show-only-accel-cca-or-ep11-.patch 2022-05-20 11:48:34.000000000 +0000 @@ -0,0 +1,167 @@ +From a29b3c8997b8a5aa818005bb060fb7770c07e5b5 Mon Sep 17 00:00:00 2001 +From: Harald Freudenberger +Date: Fri, 18 Feb 2022 15:42:36 +0100 +Subject: [PATCH] lszcrypt: new options to show only accel, cca or ep11 + cards/queues +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +New options: + --accelonly + --ccaonly + --ep11only +which restrict the output to only cards/queues with the given mode. + +Signed-off-by: Harald Freudenberger +Signed-off-by: Jan Höppner + +Origin: upstream, https://github.com/ibm-s390-tools/s390-tools/commit/a29b3c8997b8a5aa818005bb060fb7770c07e5b5 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1959548 +Last-Update: 2022-05-25 + +--- + zconf/zcrypt/lszcrypt.8 | 12 ++++++++- + zconf/zcrypt/lszcrypt.c | 54 ++++++++++++++++++++++++++++++++++++++++- + 2 files changed, 64 insertions(+), 2 deletions(-) + +diff --git a/zconf/zcrypt/lszcrypt.8 b/zconf/zcrypt/lszcrypt.8 +index 7a822fc4..4e3c3e93 100644 +--- a/zconf/zcrypt/lszcrypt.8 ++++ b/zconf/zcrypt/lszcrypt.8 +@@ -16,7 +16,8 @@ lszcrypt \- display zcrypt device and configuration information + .SH SYNOPSIS + .TP 9 + .B lszcrypt +-.RB "[ " -V " ] " ++.RB "[" --accelonly | --ccaonly | --ep11only "]" ++.RB "[" -V "]" + [ + .I + [...]] +@@ -111,6 +112,15 @@ Displays help text and exits. + .TP 8 + .B -v, --version + Displays version information and exits. ++.TP 8 ++.B --accelonly ++Show only information for cards/queues in Accelerator mode. ++.TP 8 ++.B --ccaonly ++Show only information for cards/queues in CCA-Coprocessor mode. ++.TP 8 ++.B --ep11only ++Show only information for cards/queues in EP11-Coprocessor mode. + .SH LISTING DETAILS + Here is an explanation of the columns displayed. Please note that some + of the columns show up in verbose mode only. +diff --git a/zconf/zcrypt/lszcrypt.c b/zconf/zcrypt/lszcrypt.c +index b180d1e3..dc807759 100644 +--- a/zconf/zcrypt/lszcrypt.c ++++ b/zconf/zcrypt/lszcrypt.c +@@ -29,6 +29,9 @@ + */ + static struct lszcrypt_l { + int verbose; ++ int showaccel; ++ int showcca; ++ int showep11; + } l; + + /* +@@ -96,6 +99,11 @@ static const struct util_prg prg = { + /* + * Configuration of command line options + */ ++ ++#define OPT_ACCELONLY 0x81 ++#define OPT_CCAONLY 0x82 ++#define OPT_EP11ONLY 0x83 ++ + static struct util_opt opt_vec[] = { + { + .option = {"bus", 0, NULL, 'b'}, +@@ -114,6 +122,21 @@ static struct util_opt opt_vec[] = { + .option = {"verbose", 0, NULL, 'V'}, + .desc = "Print verbose messages", + }, ++ { ++ .option = {"accelonly", 0, NULL, OPT_ACCELONLY}, ++ .flags = UTIL_OPT_FLAG_NOSHORT, ++ .desc = "Show only information from cards/queues in Accelerator mode", ++ }, ++ { ++ .option = {"ccaonly", 0, NULL, OPT_CCAONLY}, ++ .flags = UTIL_OPT_FLAG_NOSHORT, ++ .desc = "Show only information from cards/queues in CCA-Coprocessor mode", ++ }, ++ { ++ .option = {"ep11only", 0, NULL, OPT_EP11ONLY}, ++ .flags = UTIL_OPT_FLAG_NOSHORT, ++ .desc = "Show only information from cards/queues in EP11-Coprocessor mode", ++ }, + UTIL_OPT_HELP, + UTIL_OPT_VERSION, + UTIL_OPT_END +@@ -617,7 +640,7 @@ static void read_rec_verbose(struct util_rec *rec, const char *grp_dev) + */ + static void show_device(struct util_rec *rec, const char *device) + { +- char *grp_dev, card[16]; ++ char *grp_dev, card[16], type[16], t = '\0'; + + strcpy(card, &device[4]); + grp_dev = util_path_sysfs("devices/ap/%s", device); +@@ -635,6 +658,14 @@ static void show_device(struct util_rec *rec, const char *device) + } + util_rec_set(rec, "card", card); + ++ if (util_file_read_line(type, sizeof(type), "%s/type", grp_dev) == 0) ++ t = type[strlen(type) - 1]; ++ ++ if ((t == 'A' && !l.showaccel) || ++ (t == 'C' && !l.showcca) || ++ (t == 'P' && !l.showep11)) ++ goto out_free; ++ + read_rec_default(rec, grp_dev); + read_rec_verbose(rec, grp_dev); + +@@ -816,6 +847,15 @@ int main(int argc, char **argv) + case 'V': + l.verbose++; + break; ++ case OPT_ACCELONLY: ++ l.showaccel = 1; ++ break; ++ case OPT_CCAONLY: ++ l.showcca = 1; ++ break; ++ case OPT_EP11ONLY: ++ l.showep11 = 1; ++ break; + case 'h': + util_prg_print_help(); + util_opt_print_help(); +@@ -829,6 +869,18 @@ int main(int argc, char **argv) + return EXIT_FAILURE; + } + } ++ ++ switch (l.showaccel + l.showcca + l.showep11) { ++ case 0: ++ l.showaccel = l.showcca = l.showep11 = 1; ++ break; ++ case 1: ++ break; ++ default: ++ warnx("Only one of --accelonly or --ccaonly or --ep11only can be specified"); ++ return EXIT_FAILURE; ++ } ++ + if (optind == argc) + show_devices_all(); + else +-- +2.25.1 + diff -Nru s390-tools-2.20.0/debian/patches/a8579a0-dbginfo.sh-replace-indents-with-8char-tab.patch s390-tools-2.20.0/debian/patches/a8579a0-dbginfo.sh-replace-indents-with-8char-tab.patch --- s390-tools-2.20.0/debian/patches/a8579a0-dbginfo.sh-replace-indents-with-8char-tab.patch 1970-01-01 00:00:00.000000000 +0000 +++ s390-tools-2.20.0/debian/patches/a8579a0-dbginfo.sh-replace-indents-with-8char-tab.patch 2022-05-20 11:48:34.000000000 +0000 @@ -0,0 +1,1519 @@ +From a8579a072757ddd3d973dcd90ac73921a8dc55ce Mon Sep 17 00:00:00 2001 +From: Joern Siglen +Date: Fri, 11 Feb 2022 14:59:19 +0100 +Subject: [PATCH] dbginfo.sh: replace indents with 8char tab +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +cleanup of indents according to the guidlines +this patch has no logic changes + +Signed-off-by: Joern Siglen +Reviewed-by: Sa Liu +Signed-off-by: Jan Höppner + +Origin: upstream, https://github.com/ibm-s390-tools/s390-tools/commit/a8579a072757ddd3d973dcd90ac73921a8dc55ce +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1971959 +Last-Update: 2022-05-25 + +--- + scripts/dbginfo.sh | 1268 ++++++++++++++++++++++---------------------- + 1 file changed, 634 insertions(+), 634 deletions(-) + +diff --git a/scripts/dbginfo.sh b/scripts/dbginfo.sh +index bab1738c..939ac275 100755 +--- a/scripts/dbginfo.sh ++++ b/scripts/dbginfo.sh +@@ -38,14 +38,14 @@ readonly OSPRETTY="$(cat /etc/os* 2>/dev/null | grep -m1 PRETTY_NAME | sed 's/\" + readonly OS_NAME="${OSPRETTY##*=}" + # The processor ID for the first processor + readonly PROCESSORID="$(grep -E ".*processor 0:.*" /proc/cpuinfo | \ +- sed 's/.*identification[[:space:]]*\=[[:space:]]*\([[:alnum:]]*\).*/\1/g')" ++ sed 's/.*identification[[:space:]]*\=[[:space:]]*\([[:alnum:]]*\).*/\1/g')" + readonly PROCESSORVERSION="$(grep -E ".*processor 0:.*" /proc/cpuinfo | \ +- sed 's/.*version[[:space:]]*\=[[:space:]]*\([[:alnum:]]*\).*/\1/g')" ++ sed 's/.*version[[:space:]]*\=[[:space:]]*\([[:alnum:]]*\).*/\1/g')" + if test "x${PROCESSORVERSION}" = "xFF" || test "x${PROCESSORVERSION}" = "xff"; then +- RUNTIME_ENVIRONMENT=$(grep -E "VM00.*Control Program.*" /proc/sysinfo | \ +- sed 's/.*:[[:space:]]*\([[:graph:]]*\).*/\1/g') ++ RUNTIME_ENVIRONMENT=$(grep -E "VM00.*Control Program.*" /proc/sysinfo | \ ++ sed 's/.*:[[:space:]]*\([[:graph:]]*\).*/\1/g') + else +- RUNTIME_ENVIRONMENT="LPAR" ++ RUNTIME_ENVIRONMENT="LPAR" + fi + readonly SYSTEMHOSTNAME="$(hostname -s 2>/dev/null)" # hostname of system being analysed + readonly TERMINAL="$(tty 2>/dev/null)" +@@ -60,7 +60,7 @@ paramWORKDIR_BASE="/tmp" # initial default path + ######################################## + # print dbginfo.sh version info + print_version() { +- cat </dev/null | wc -l) +- if [ ${counter} -eq 1 ]; then +- echo " CHECK - ${logfile} may miss a rotation" +- else +- echo " OK - ${logfile}* may have a rotation "\ +- "in place: ${counter} files" +- fi +- done +- fi ++ local counter ++ local logfile ++ local logfiles ++ ++ # find files bigger than recommended ++ counter=$(find $1 -maxdepth 1 -type f -mtime -${LOG_FILE_AGE_CHECK} \ ++ -size ${LOG_FILE_SIZE_CHECK}M | wc -l) ++ ++ echo " ${counter} logfiles over ${LOG_FILE_SIZE_CHECK} MB" ++ # maybe check for rotation of base names ++ if [ ${counter} -ne 0 ]; then ++ for logfile in $(find $1 -maxdepth 1 -type f -mtime -${LOG_FILE_AGE_CHECK} \ ++ -size ${LOG_FILE_SIZE_CHECK}M -print); do ++ # use a neutral separtor ':' as concat is different in some bash ++ # insert the 'blank' for later use in for loop ++ # add the base name before '.' or '-' only for checks ++ logfiles="${logfiles}: ${logfile%%[.-]*}" ++ done ++ # change separator to new line for sorting ++ logfiles=$(echo "${logfiles}" | sed s'/:/\n/g' | sort -u) ++ for logfile in ${logfiles}; do ++ counter=$(ls ${logfile}* 2>/dev/null | wc -l) ++ if [ ${counter} -eq 1 ]; then ++ echo " CHECK - ${logfile} may miss a rotation" ++ else ++ echo " OK - ${logfile}* may have a rotation "\ ++ "in place: ${counter} files" ++ fi ++ done ++ fi + } + + ######################################## + # print basic info and online checks + print_check() { +- print_version +- cat </dev/null)" -ne 0; then +- echo "${SCRIPTNAME}: Error: You must be user root to run \"${SCRIPTNAME}\"!" +- exit 1 ++ echo "${SCRIPTNAME}: Error: You must be user root to run \"${SCRIPTNAME}\"!" ++ exit 1 + fi + + ######################################### +@@ -222,9 +222,9 @@ fi + readonly WORKDIR_BASE="$(echo "${paramWORKDIR_BASE}" | sed -e 's#/$##')/" + # The current working directory for the actual script execution + if test -z "${PROCESSORID}"; then +- readonly WORKDIR_CURRENT="DBGINFO-${DATETIME}-${SYSTEMHOSTNAME:-localhost}" ++ readonly WORKDIR_CURRENT="DBGINFO-${DATETIME}-${SYSTEMHOSTNAME:-localhost}" + else +- readonly WORKDIR_CURRENT="DBGINFO-${DATETIME}-${SYSTEMHOSTNAME:-localhost}-${PROCESSORID}" ++ readonly WORKDIR_CURRENT="DBGINFO-${DATETIME}-${SYSTEMHOSTNAME:-localhost}-${PROCESSORID}" + fi + # The current path where the collected information is put together + readonly WORKPATH="${WORKDIR_BASE}${WORKDIR_CURRENT}/" +@@ -321,9 +321,9 @@ PROCFILES="\ + + # Adding files to PROCFILES in case scsi devices are available + if test -e /proc/scsi; then +- PROCFILES="${PROCFILES}\ +- $(find /proc/scsi -type f -perm /444 2>/dev/null)\ +- " ++ PROCFILES="${PROCFILES}\ ++ $(find /proc/scsi -type f -perm /444 2>/dev/null)\ ++ " + fi + + ######################################## +@@ -604,563 +604,563 @@ KVM_CMDS="virsh version\ + + ######################################## + collect_cmdsout() { +- local cmd +- local ifs_orig="${IFS}" ++ local cmd ++ local ifs_orig="${IFS}" + +- pr_collect_output "command" ++ pr_collect_output "command" + +- IFS=: +- for cmd in ${CMDS}; do +- IFS=${ifs_orig} call_run_command "${cmd}" "${OUTPUT_FILE_CMD}" +- done +- IFS="${ifs_orig}" ++ IFS=: ++ for cmd in ${CMDS}; do ++ IFS=${ifs_orig} call_run_command "${cmd}" "${OUTPUT_FILE_CMD}" ++ done ++ IFS="${ifs_orig}" + } + + ######################################## + collect_network() { +- local cmd +- local ifs_orig="${IFS}" ++ local cmd ++ local ifs_orig="${IFS}" + +- pr_collect_output "network" ++ pr_collect_output "network" + +- IFS=: +- for cmd in ${NETWORK_CMDS}; do +- IFS=${ifs_orig} call_run_command "${cmd}" "${OUTPUT_FILE_NETWORK}" +- done +- IFS="${ifs_orig}" ++ IFS=: ++ for cmd in ${NETWORK_CMDS}; do ++ IFS=${ifs_orig} call_run_command "${cmd}" "${OUTPUT_FILE_NETWORK}" ++ done ++ IFS="${ifs_orig}" + } + + ######################################## + collect_vmcmdsout() { +- local vm_command +- local cp_command +- local vm_cmds +- local vm_userid +- local module_loaded=1 +- local ifs_orig="${IFS}" +- local cp_buffer_size=2 +- local rc_buffer_size=2 +- +- if echo "${RUNTIME_ENVIRONMENT}" | grep -qi "z/VM" >/dev/null 2>&1; then +- pr_collect_output "z/VM" +- +- if type -t vmcp >/dev/null; then +- cp_command="vmcp" +- if ! lsmod 2>/dev/null | grep -q vmcp && modinfo vmcp >/dev/null 2>&1; then +- modprobe vmcp && module_loaded=0 && sleep 2 +- fi +- elif type -t hcp >/dev/null; then +- cp_command="hcp" +- if ! lsmod 2>/dev/null | grep -q cpint; then +- modprobe cpint && module_loaded=0 && sleep 2 +- fi +- else +- pr_log_stdout "${SCRIPTNAME}: Warning: No program to communicate to z/VM CP" +- pr_skip "z/VM: vmcp not available" +- return 1 +- fi +- vm_userid=$(${cp_command} q userid 2>/dev/null | sed -ne 's/^\([^[:space:]]*\).*$/\1/p') +- vm_cmds=$(echo "${VM_CMDS}" | sed "s/VMUSERID/${vm_userid}/g") +- +- IFS=: +- for vm_command in ${vm_cmds}; do +- IFS="${ifs_orig}" +- while test ${rc_buffer_size} -eq 2 && test ${cp_buffer_size} -lt 1024; do +- cp_buffer_size=$(( cp_buffer_size * 2 )) +- eval ${cp_command} -b ${cp_buffer_size}k "${vm_command}" \ +- >/dev/null 2>&1 +- rc_buffer_size=$? +- done +- call_run_command "${cp_command} -b ${cp_buffer_size}k ${vm_command}" \ +- "${OUTPUT_FILE_VMCMD}" +- IFS=: +- done +- IFS="${ifs_orig}" +- +- if test ${module_loaded} -eq 0 && test "x${cp_command}" = "xhcp"; then +- rmmod cpint +- elif test ${module_loaded} -eq 0 && test "x${cp_command}" = "xvmcp"; then +- rmmod vmcp +- fi +- else +- pr_skip "z/VM: no z/VM environment" +- fi ++ local vm_command ++ local cp_command ++ local vm_cmds ++ local vm_userid ++ local module_loaded=1 ++ local ifs_orig="${IFS}" ++ local cp_buffer_size=2 ++ local rc_buffer_size=2 ++ ++ if echo "${RUNTIME_ENVIRONMENT}" | grep -qi "z/VM" >/dev/null 2>&1; then ++ pr_collect_output "z/VM" ++ ++ if type -t vmcp >/dev/null; then ++ cp_command="vmcp" ++ if ! lsmod 2>/dev/null | grep -q vmcp && modinfo vmcp >/dev/null 2>&1; then ++ modprobe vmcp && module_loaded=0 && sleep 2 ++ fi ++ elif type -t hcp >/dev/null; then ++ cp_command="hcp" ++ if ! lsmod 2>/dev/null | grep -q cpint; then ++ modprobe cpint && module_loaded=0 && sleep 2 ++ fi ++ else ++ pr_log_stdout "${SCRIPTNAME}: Warning: No program to communicate to z/VM CP" ++ pr_skip "z/VM: vmcp not available" ++ return 1 ++ fi ++ vm_userid=$(${cp_command} q userid 2>/dev/null | sed -ne 's/^\([^[:space:]]*\).*$/\1/p') ++ vm_cmds=$(echo "${VM_CMDS}" | sed "s/VMUSERID/${vm_userid}/g") ++ ++ IFS=: ++ for vm_command in ${vm_cmds}; do ++ IFS="${ifs_orig}" ++ while test ${rc_buffer_size} -eq 2 && test ${cp_buffer_size} -lt 1024; do ++ cp_buffer_size=$(( cp_buffer_size * 2 )) ++ eval ${cp_command} -b ${cp_buffer_size}k "${vm_command}" \ ++ >/dev/null 2>&1 ++ rc_buffer_size=$? ++ done ++ call_run_command "${cp_command} -b ${cp_buffer_size}k ${vm_command}" \ ++ "${OUTPUT_FILE_VMCMD}" ++ IFS=: ++ done ++ IFS="${ifs_orig}" ++ ++ if test ${module_loaded} -eq 0 && test "x${cp_command}" = "xhcp"; then ++ rmmod cpint ++ elif test ${module_loaded} -eq 0 && test "x${cp_command}" = "xvmcp"; then ++ rmmod vmcp ++ fi ++ else ++ pr_skip "z/VM: no z/VM environment" ++ fi + } + + ######################################## + collect_hyptop() { +- local param +- local delay=1 # seconds +- local iter=5 +- local sec=`expr ${delay} \\* ${iter}` +- +- case ${RUNTIME_ENVIRONMENT} in +- "z/VM") +- param="\#,c,m,C:s,M:s,o" # z/VM guest fields +- ;; +- "LPAR") +- param="\#,T,c,e,m,C:s,E:s,M:s,o" # all LPAR fields +- ;; +- *) # KVM guest +- pr_skip "hyptop: not available for ${RUNTIME_ENVIRONMENT}" +- return 1 +- ;; +- esac +- pr_collect_output "hyptop for ${RUNTIME_ENVIRONMENT} - ${sec}s" +- call_run_command "hyptop -b -d ${delay} -n ${iter} -f ${param} -S c" "${OUTPUT_FILE_HYPTOP}" ++ local param ++ local delay=1 # seconds ++ local iter=5 ++ local sec=`expr ${delay} \\* ${iter}` ++ ++ case ${RUNTIME_ENVIRONMENT} in ++ "z/VM") ++ param="\#,c,m,C:s,M:s,o" # z/VM guest fields ++ ;; ++ "LPAR") ++ param="\#,T,c,e,m,C:s,E:s,M:s,o" # all LPAR fields ++ ;; ++ *) # KVM guest ++ pr_skip "hyptop: not available for ${RUNTIME_ENVIRONMENT}" ++ return 1 ++ ;; ++ esac ++ pr_collect_output "hyptop for ${RUNTIME_ENVIRONMENT} - ${sec}s" ++ call_run_command "hyptop -b -d ${delay} -n ${iter} -f ${param} -S c" "${OUTPUT_FILE_HYPTOP}" + } + + ######################################## + collect_procfs() { +- local file_name ++ local file_name + +- pr_collect "procfs" ++ pr_collect "procfs" + +- for file_name in ${PROCFILES}; do +- call_collect_file "${file_name}" +- done ++ for file_name in ${PROCFILES}; do ++ call_collect_file "${file_name}" ++ done + } + + ######################################## + collect_sysfs() { +- local debugfs_mounted=0 +- local dir_name +- local file_name +- local rc=0 +- +- pr_collect "sysfs" +- if ! grep -qE "${MOUNT_POINT_DEBUGFS}.*debugfs" /proc/mounts 2>/dev/null; then +- if mount -t debugfs debugfs "${MOUNT_POINT_DEBUGFS}" >/dev/null 2>&1; then +- sleep 2 +- debugfs_mounted=1 +- else +- pr_log_stdout "${SCRIPTNAME}: Warning: Unable to mount debugfs \ +- at \"${MOUNT_POINT_DEBUGFS}\"" +- fi +- fi +- +- # 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. +- # error messages are not written to the log +- if type -t dump2tar >/dev/null; then +- dump2tar /sys -z -o "${OUTPUT_FILE_SYSFS}.tgz" \ +- -x '*/tracing/trace_pipe*' \ +- -x '*/page_idle/bitmap*' \ +- -x '*/tracing/per_cpu/*' \ +- --ignore-failed-read -J 1 -T 5 2>>${OUTPUT_FILE_SYSFS}.err +- rc=$? +- else +- echo "${SCRIPTNAME}: Warning: dump2tar is unavailable" +- rc=255 +- fi +- +- +- if [ ${rc} -eq 0 ] ; then +- echo " all failed entries are logged to ${OUTPUT_FILE_SYSFS}.err" +- else +- if [ $rc -ne 255 ]; then +- echo "${SCRIPTNAME}: Warning: dump2tar failed with $rc" +- fi +- pr_log_stdout " Warning: falling back to slow path" +- call_run_command "find /sys -print0 | sort -z \ +- | xargs -0 -n 10 ls -ld" "${OUTPUT_FILE_SYSFS}.out" +- +- 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 \( -path '*tracing*' -a -name "trace_pipe*" \) \ +- -a -not \( -path '*page_idle*' -a -name 'bitmap*' \) \ +- -a -not -path '*tracing/per_cpu*' \ +- 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}" +- fi ++ local debugfs_mounted=0 ++ local dir_name ++ local file_name ++ local rc=0 ++ ++ pr_collect "sysfs" ++ if ! grep -qE "${MOUNT_POINT_DEBUGFS}.*debugfs" /proc/mounts 2>/dev/null; then ++ if mount -t debugfs debugfs "${MOUNT_POINT_DEBUGFS}" >/dev/null 2>&1; then ++ sleep 2 ++ debugfs_mounted=1 ++ else ++ pr_log_stdout "${SCRIPTNAME}: Warning: Unable to mount debugfs \ ++ at \"${MOUNT_POINT_DEBUGFS}\"" ++ fi ++ fi ++ ++ # 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. ++ # error messages are not written to the log ++ if type -t dump2tar >/dev/null; then ++ dump2tar /sys -z -o "${OUTPUT_FILE_SYSFS}.tgz" \ ++ -x '*/tracing/trace_pipe*' \ ++ -x '*/page_idle/bitmap*' \ ++ -x '*/tracing/per_cpu/*' \ ++ --ignore-failed-read -J 1 -T 5 2>>${OUTPUT_FILE_SYSFS}.err ++ rc=$? ++ else ++ echo "${SCRIPTNAME}: Warning: dump2tar is unavailable" ++ rc=255 ++ fi ++ ++ ++ if [ ${rc} -eq 0 ] ; then ++ echo " all failed entries are logged to ${OUTPUT_FILE_SYSFS}.err" ++ else ++ if [ $rc -ne 255 ]; then ++ echo "${SCRIPTNAME}: Warning: dump2tar failed with $rc" ++ fi ++ pr_log_stdout " Warning: falling back to slow path" ++ call_run_command "find /sys -print0 | sort -z \ ++ | xargs -0 -n 10 ls -ld" "${OUTPUT_FILE_SYSFS}.out" ++ ++ 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 \( -path '*tracing*' -a -name "trace_pipe*" \) \ ++ -a -not \( -path '*page_idle*' -a -name 'bitmap*' \) \ ++ -a -not -path '*tracing/per_cpu*' \ ++ 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}" ++ fi + } + + ######################################## + collect_logfiles() { +- local file_name ++ local file_name + +- pr_collect "log files" ++ pr_collect "log files" + +- for file_name in ${LOGFILES}; do +- call_collect_file "${file_name}" +- done ++ for file_name in ${LOGFILES}; do ++ call_collect_file "${file_name}" ++ done + +- pr_log_stdout "$(logfile_checker "/var/log*")" ++ pr_log_stdout "$(logfile_checker "/var/log*")" + } + + ######################################## + collect_configfiles() { +- local file_name ++ local file_name + +- pr_collect "config files" ++ pr_collect "config files" + +- for file_name in ${CONFIGFILES}; do +- call_collect_file "${file_name}" +- done ++ for file_name in ${CONFIGFILES}; do ++ call_collect_file "${file_name}" ++ done + } + + ######################################## + collect_osaoat() { +- local network_devices +- local network_device +- +- network_devices=$(lsqeth 2>/dev/null | grep "Device name" \ +- | sed 's/D.*:[[:space:]]*\([^[:space:]]*\)[[:space:]]\+/\1/g') +- if type -t qethqoat >/dev/null; then +- if test -n "${network_devices}"; then +- pr_collect_output "osa oat" +- for network_device in ${network_devices}; do +- call_run_command "qethqoat ${network_device}" \ +- "${OUTPUT_FILE_OSAOAT}.out" && +- call_run_command "qethqoat -r ${network_device}" \ +- "${OUTPUT_FILE_OSAOAT}_${network_device}.raw" +- done +- else +- pr_skip "osa oat: no devices" +- fi +- else +- pr_skip "osa oat: qethqoat not available" +- fi ++ local network_devices ++ local network_device ++ ++ network_devices=$(lsqeth 2>/dev/null | grep "Device name" \ ++ | sed 's/D.*:[[:space:]]*\([^[:space:]]*\)[[:space:]]\+/\1/g') ++ if type -t qethqoat >/dev/null; then ++ if test -n "${network_devices}"; then ++ pr_collect_output "osa oat" ++ for network_device in ${network_devices}; do ++ call_run_command "qethqoat ${network_device}" \ ++ "${OUTPUT_FILE_OSAOAT}.out" && ++ call_run_command "qethqoat -r ${network_device}" \ ++ "${OUTPUT_FILE_OSAOAT}_${network_device}.raw" ++ done ++ else ++ pr_skip "osa oat: no devices" ++ fi ++ else ++ pr_skip "osa oat: qethqoat not available" ++ fi + } + + ######################################## + collect_ethtool() { +- local network_devices +- local network_device +- +- network_devices=$(ls /sys/class/net 2>/dev/null) +- if type -t ethtool >/dev/null; then +- if test -n "${network_devices}"; then +- pr_collect_output "ethtool" +- for network_device in ${network_devices}; do +- call_run_command "ethtool ${network_device}" \ +- "${OUTPUT_FILE_ETHTOOL}" +- call_run_command "ethtool -k ${network_device}" \ +- "${OUTPUT_FILE_ETHTOOL}" +- call_run_command "ethtool -a ${network_device}" \ +- "${OUTPUT_FILE_ETHTOOL}" +- call_run_command "ethtool -c ${network_device}" \ +- "${OUTPUT_FILE_ETHTOOL}" +- call_run_command "ethtool --per-queue ${network_device} \ +- --show-coalesce" "${OUTPUT_FILE_ETHTOOL}" +- call_run_command "ethtool -g ${network_device}" \ +- "${OUTPUT_FILE_ETHTOOL}" +- call_run_command "ethtool -i ${network_device}" \ +- "${OUTPUT_FILE_ETHTOOL}" +- call_run_command "ethtool -l ${network_device}" \ +- "${OUTPUT_FILE_ETHTOOL}" +- call_run_command "ethtool -P ${network_device}" \ +- "${OUTPUT_FILE_ETHTOOL}" +- call_run_command "ethtool -S ${network_device}" \ +- "${OUTPUT_FILE_ETHTOOL}" +- call_run_command "ethtool -T ${network_device}" \ +- "${OUTPUT_FILE_ETHTOOL}" +- done +- else +- pr_skip "ethtool: no devices" +- fi +- else +- pr_skip "ethtool: not available" +- fi ++ local network_devices ++ local network_device ++ ++ network_devices=$(ls /sys/class/net 2>/dev/null) ++ if type -t ethtool >/dev/null; then ++ if test -n "${network_devices}"; then ++ pr_collect_output "ethtool" ++ for network_device in ${network_devices}; do ++ call_run_command "ethtool ${network_device}" \ ++ "${OUTPUT_FILE_ETHTOOL}" ++ call_run_command "ethtool -k ${network_device}" \ ++ "${OUTPUT_FILE_ETHTOOL}" ++ call_run_command "ethtool -a ${network_device}" \ ++ "${OUTPUT_FILE_ETHTOOL}" ++ call_run_command "ethtool -c ${network_device}" \ ++ "${OUTPUT_FILE_ETHTOOL}" ++ call_run_command "ethtool --per-queue ${network_device} \ ++ --show-coalesce" "${OUTPUT_FILE_ETHTOOL}" ++ call_run_command "ethtool -g ${network_device}" \ ++ "${OUTPUT_FILE_ETHTOOL}" ++ call_run_command "ethtool -i ${network_device}" \ ++ "${OUTPUT_FILE_ETHTOOL}" ++ call_run_command "ethtool -l ${network_device}" \ ++ "${OUTPUT_FILE_ETHTOOL}" ++ call_run_command "ethtool -P ${network_device}" \ ++ "${OUTPUT_FILE_ETHTOOL}" ++ call_run_command "ethtool -S ${network_device}" \ ++ "${OUTPUT_FILE_ETHTOOL}" ++ call_run_command "ethtool -T ${network_device}" \ ++ "${OUTPUT_FILE_ETHTOOL}" ++ done ++ else ++ pr_skip "ethtool: no devices" ++ fi ++ else ++ pr_skip "ethtool: not available" ++ fi + } + + ######################################## + collect_tc() { +- local network_devices +- local network_device +- +- network_devices=$(ls /sys/class/net 2>/dev/null) +- if type -t tc >/dev/null; then +- if test -n "${network_devices}"; then +- pr_collect_output "Trafic Control" +- for network_device in ${network_devices}; do +- call_run_command "tc -s qdisc show dev ${network_device}" \ +- "${OUTPUT_FILE_TC}" +- done +- else +- pr_skip "Trafic Control: no devices" +- fi +- else +- pr_skip "Trafic Control: tc not available" +- fi ++ local network_devices ++ local network_device ++ ++ network_devices=$(ls /sys/class/net 2>/dev/null) ++ if type -t tc >/dev/null; then ++ if test -n "${network_devices}"; then ++ pr_collect_output "Trafic Control" ++ for network_device in ${network_devices}; do ++ call_run_command "tc -s qdisc show dev ${network_device}" \ ++ "${OUTPUT_FILE_TC}" ++ done ++ else ++ pr_skip "Trafic Control: no devices" ++ fi ++ else ++ pr_skip "Trafic Control: tc not available" ++ fi + } + + ######################################## + collect_bridge() { +- local network_devices +- local network_device +- +- network_devices=$(ls /sys/class/net 2>/dev/null) +- if type -t bridge >/dev/null; then +- if test -n "${network_devices}"; then +- pr_collect_output "bridge" +- for network_device in ${network_devices}; do +- call_run_command "bridge -d link show dev ${network_device}" \ +- "${OUTPUT_FILE_BRIDGE}" +- call_run_command "bridge -s fdb show dev ${network_device}" \ +- "${OUTPUT_FILE_BRIDGE}" +- call_run_command "bridge -d mdb show dev ${network_device}" \ +- "${OUTPUT_FILE_BRIDGE}" +- done +- else +- pr_skip "bridge: no devices" +- fi +- else +- pr_skip "bridge: not available" +- fi ++ local network_devices ++ local network_device ++ ++ network_devices=$(ls /sys/class/net 2>/dev/null) ++ if type -t bridge >/dev/null; then ++ if test -n "${network_devices}"; then ++ pr_collect_output "bridge" ++ for network_device in ${network_devices}; do ++ call_run_command "bridge -d link show dev ${network_device}" \ ++ "${OUTPUT_FILE_BRIDGE}" ++ call_run_command "bridge -s fdb show dev ${network_device}" \ ++ "${OUTPUT_FILE_BRIDGE}" ++ call_run_command "bridge -d mdb show dev ${network_device}" \ ++ "${OUTPUT_FILE_BRIDGE}" ++ done ++ else ++ pr_skip "bridge: no devices" ++ fi ++ else ++ pr_skip "bridge: not available" ++ fi + } + + ######################################## + # OpenVSwitch + collect_ovs() { +- local ovscmd +- local bridge +- local ovscmds +- local ovsbrcmd +- local ovsbrcmds +- +- ovscmds="ovs-dpctl -s show\ +- :ovs-vsctl -t 5 show\ +- :ovsdb-client dump\ +- " +- if type -t ovs-vsctl >/dev/null; then +- pr_collect_output "OpenVSwitch" +- IFS=: +- for ovscmd in ${ovscmds}; do +- IFS=${ifs_orig} call_run_command "${ovscmd}" "${OUTPUT_FILE_OVS}" +- done +- IFS="${ifs_orig}" +- +- for bridge in ${ovs-vsctl list-br}; do +- ovsbrcmds="ovs-ofctl show ${bridge}\ +- :ovs-ofctl dump-flows ${bridge}\ +- :ovs-appctl fdb/show ${bridge}\ +- " +- IFS=: +- for ovsbrcmd in ${ovsbrcmds}; do +- IFS=${ifs_orig} call_run_command "${ovsbrcmd}" "${OUTPUT_FILE_OVS}" +- done +- IFS="${ifs_orig}" +- done +- else +- pr_skip "OpenVSwitch: ovs-vsctl not available" +- fi ++ local ovscmd ++ local bridge ++ local ovscmds ++ local ovsbrcmd ++ local ovsbrcmds ++ ++ ovscmds="ovs-dpctl -s show\ ++ :ovs-vsctl -t 5 show\ ++ :ovsdb-client dump\ ++ " ++ if type -t ovs-vsctl >/dev/null; then ++ pr_collect_output "OpenVSwitch" ++ IFS=: ++ for ovscmd in ${ovscmds}; do ++ IFS=${ifs_orig} call_run_command "${ovscmd}" "${OUTPUT_FILE_OVS}" ++ done ++ IFS="${ifs_orig}" ++ ++ for bridge in ${ovs-vsctl list-br}; do ++ ovsbrcmds="ovs-ofctl show ${bridge}\ ++ :ovs-ofctl dump-flows ${bridge}\ ++ :ovs-appctl fdb/show ${bridge}\ ++ " ++ IFS=: ++ for ovsbrcmd in ${ovsbrcmds}; do ++ IFS=${ifs_orig} call_run_command "${ovsbrcmd}" "${OUTPUT_FILE_OVS}" ++ done ++ IFS="${ifs_orig}" ++ done ++ else ++ pr_skip "OpenVSwitch: ovs-vsctl not available" ++ fi + } + + ######################################## + collect_docker() { +- local container_list +- local network_list +- local item +- +- # check if docker command exists +- if [ "x${DOCKER}" = "xYES" ]; then +- pr_collect_output "docker" +- container_list=$(docker ps -qa) +- network_list=$(docker network ls -q) +- ifs_orig="${IFS}" +- IFS=: +- for item in ${DOCKER_CMDS}; do +- IFS=${ifs_orig} call_run_command "${item}" "${OUTPUT_FILE_DOCKER}" +- done +- IFS="${ifs_orig}" +- +- if test -n "${container_list}"; then +- for item in ${container_list}; do +- call_run_command "docker inspect ${item}" "${OUTPUT_FILE_DOCKER}" +- done +- fi +- +- if test -n "${network_list}"; then +- for item in ${network_list}; do +- call_run_command "docker network inspect ${item}" \ +- "${OUTPUT_FILE_DOCKER}" +- done +- fi +- else +- pr_skip "docker: not available" +- fi ++ local container_list ++ local network_list ++ local item ++ ++ # check if docker command exists ++ if [ "x${DOCKER}" = "xYES" ]; then ++ pr_collect_output "docker" ++ container_list=$(docker ps -qa) ++ network_list=$(docker network ls -q) ++ ifs_orig="${IFS}" ++ IFS=: ++ for item in ${DOCKER_CMDS}; do ++ IFS=${ifs_orig} call_run_command "${item}" "${OUTPUT_FILE_DOCKER}" ++ done ++ IFS="${ifs_orig}" ++ ++ if test -n "${container_list}"; then ++ for item in ${container_list}; do ++ call_run_command "docker inspect ${item}" "${OUTPUT_FILE_DOCKER}" ++ done ++ fi ++ ++ if test -n "${network_list}"; then ++ for item in ${network_list}; do ++ call_run_command "docker network inspect ${item}" \ ++ "${OUTPUT_FILE_DOCKER}" ++ done ++ fi ++ else ++ pr_skip "docker: not available" ++ fi + } + + ######################################## + collect_nvme() { +- local device +- +- if type -t nvme >/dev/null; then +- pr_collect_output "NVME storage" +- call_run_command "nvme list" "${OUTPUT_FILE_NVME}" +- for device in /dev/nvme[0-9]*; do +- if [ -c $device ]; then +- call_run_command "smartctl -x $device" "${OUTPUT_FILE_NVME}" +- call_run_command "nvme fw-log $device" "${OUTPUT_FILE_NVME}" +- call_run_command "nvme smart-log $device" "${OUTPUT_FILE_NVME}" +- call_run_command "nvme error-log $device" "${OUTPUT_FILE_NVME}" +- fi +- done +- else +- pr_skip "nvme: not available" +- fi ++ local device ++ ++ if type -t nvme >/dev/null; then ++ pr_collect_output "NVME storage" ++ call_run_command "nvme list" "${OUTPUT_FILE_NVME}" ++ for device in /dev/nvme[0-9]*; do ++ if [ -c $device ]; then ++ call_run_command "smartctl -x $device" "${OUTPUT_FILE_NVME}" ++ call_run_command "nvme fw-log $device" "${OUTPUT_FILE_NVME}" ++ call_run_command "nvme smart-log $device" "${OUTPUT_FILE_NVME}" ++ call_run_command "nvme error-log $device" "${OUTPUT_FILE_NVME}" ++ fi ++ done ++ else ++ pr_skip "nvme: not available" ++ fi + } + + ######################################## + collect_kvm() { +- local cmd +- local ifs_orig="${IFS}" +- local domain_list +- local domain +- +- # check if KVM virsh command exists +- if [ "x${KVM}" = "xYES" ]; then +- pr_collect_output "KVM" +- IFS=: +- for cmd in ${KVM_CMDS}; do +- IFS=${ifs_orig} call_run_command "${cmd}" "${OUTPUT_FILE_KVM}" +- done +- IFS="${ifs_orig}" +- +- # domain/guest specific commands +- domain_list=$(virsh list --all --name) +- if test -n "${domain_list}"; then +- for domain in ${domain_list}; do +- call_run_command "virsh dominfo ${domain}" "${OUTPUT_FILE_KVM}" +- call_run_command "virsh domblklist ${domain}" "${OUTPUT_FILE_KVM}" +- call_run_command "virsh domstats ${domain}" "${OUTPUT_FILE_KVM}" +- done +- else +- echo "no KVM doamins found" | tee -a ${OUTPUT_FILE_KVM} +- fi +- else +- pr_skip "KVM: no virsh command" +- fi ++ local cmd ++ local ifs_orig="${IFS}" ++ local domain_list ++ local domain ++ ++ # check if KVM virsh command exists ++ if [ "x${KVM}" = "xYES" ]; then ++ pr_collect_output "KVM" ++ IFS=: ++ for cmd in ${KVM_CMDS}; do ++ IFS=${ifs_orig} call_run_command "${cmd}" "${OUTPUT_FILE_KVM}" ++ done ++ IFS="${ifs_orig}" ++ ++ # domain/guest specific commands ++ domain_list=$(virsh list --all --name) ++ if test -n "${domain_list}"; then ++ for domain in ${domain_list}; do ++ call_run_command "virsh dominfo ${domain}" "${OUTPUT_FILE_KVM}" ++ call_run_command "virsh domblklist ${domain}" "${OUTPUT_FILE_KVM}" ++ call_run_command "virsh domstats ${domain}" "${OUTPUT_FILE_KVM}" ++ done ++ else ++ echo "no KVM doamins found" | tee -a ${OUTPUT_FILE_KVM} ++ fi ++ else ++ pr_skip "KVM: no virsh command" ++ fi + } + + ######################################## + post_processing() { +- local file_mtime +- local file_mtime_epoche +- local tmp_file +- local file_name +- local base_dir +- local dir_list +- +- pr_syslog_stdout ${step_num} "Postprocessing" +- +- # wipe possible passwords +- dir_list="${WORKPATH} \ +- ${WORKPATH}etc/ssl/ \ +- ${WORKPATH}etc/libvirt/" +- for base_dir in ${dir_list}; do +- find "${base_dir}" -maxdepth 2 -name "*xml" -o -name "*conf" -o -name "*cnf" \ +- 2>/dev/null | while read -r file_name; do +- file_mtime_epoche=$(stat --format=%Y "${file_name}") +- file_mtime=$(date +%Y%m%d%H%M.%S --date="@${file_mtime_epoche}") +- tmp_file=${file_name}.$$ +- echo " clean pw: ${file_name}" +- if ! sed "s/\(.*[Pp]assw.*=\).*/\1********/g" "${file_name}" > "${tmp_file}"; then +- echo "${SCRIPTNAME}: Warning: Postprocessing failed on ${file_name}" +- fi +- mv "${tmp_file}" "${file_name}" +- touch --time=mtime -t "${file_mtime}" "${file_name}" +- done +- done +- +- # compressing data folder to avoid full unpack for any DBGINFO +- base_dir="${WORKPATH}proc/" +- search4="kallsyms" +- find "${base_dir}" -name ${search4} 2>/dev/null | while read -r file_name; do +- tmp_file=${file_name}-${KERNEL_BASE}.tgz +- echo " compress: ${file_name}" +- if ! tar -czf "${tmp_file}" -C "${base_dir}" "${search4}"; then +- echo "${SCRIPTNAME}: Warning: Postprocessing failed on ${file_name}" +- echo +- else +- rm -f "${file_name}" +- fi +- done ++ local file_mtime ++ local file_mtime_epoche ++ local tmp_file ++ local file_name ++ local base_dir ++ local dir_list ++ ++ pr_syslog_stdout ${step_num} "Postprocessing" ++ ++ # wipe possible passwords ++ dir_list="${WORKPATH} \ ++ ${WORKPATH}etc/ssl/ \ ++ ${WORKPATH}etc/libvirt/" ++ for base_dir in ${dir_list}; do ++ find "${base_dir}" -maxdepth 2 -name "*xml" -o -name "*conf" -o -name "*cnf" \ ++ 2>/dev/null | while read -r file_name; do ++ file_mtime_epoche=$(stat --format=%Y "${file_name}") ++ file_mtime=$(date +%Y%m%d%H%M.%S --date="@${file_mtime_epoche}") ++ tmp_file=${file_name}.$$ ++ echo " clean pw: ${file_name}" ++ if ! sed "s/\(.*[Pp]assw.*=\).*/\1********/g" "${file_name}" > "${tmp_file}"; then ++ echo "${SCRIPTNAME}: Warning: Postprocessing failed on ${file_name}" ++ fi ++ mv "${tmp_file}" "${file_name}" ++ touch --time=mtime -t "${file_mtime}" "${file_name}" ++ done ++ done ++ ++ # compressing data folder to avoid full unpack for any DBGINFO ++ base_dir="${WORKPATH}proc/" ++ search4="kallsyms" ++ find "${base_dir}" -name ${search4} 2>/dev/null | while read -r file_name; do ++ tmp_file=${file_name}-${KERNEL_BASE}.tgz ++ echo " compress: ${file_name}" ++ if ! tar -czf "${tmp_file}" -C "${base_dir}" "${search4}"; then ++ echo "${SCRIPTNAME}: Warning: Postprocessing failed on ${file_name}" ++ echo ++ else ++ rm -f "${file_name}" ++ fi ++ done + } + + ######################################## + # Be aware that this output must be + # redirected into a separate logfile + call_run_command() { +- local rc=0 +- local cmd="${1}" +- local logfile="${2}" +- # extract the raw_command and set cmd_type +- local raw_cmd=$(echo "${cmd}" | sed -ne 's/^\([^[:space:]]*\).*$/\1/p') +- local cmd_type=$(type -t ${raw_cmd}) +- # timeout_ok - like a boolean - is not empty if command exists +- local timeout_ok=$(type -t timeout) +- +- echo "#######################################################" >> "${logfile}" +- echo "${USER}@${SYSTEMHOSTNAME:-localhost}> ${cmd}" >> "${logfile}" +- +- # check calling command type +- if [ "X${cmd_type}" = "Xbuiltin" ]; then +- # command is a builtin (no use of timeout possible) +- eval "${cmd}" >> ${logfile} 2>&1 +- rc=$? +- elif [ "X${cmd_type}" != "X" ]; then +- if [ "X${timeout_ok}" = "Xfile" ]; then +- eval timeout -k ${TOS} ${TOS} "${cmd}" >> ${logfile} 2>&1 +- rc=$? +- else +- # fall back - call all existing commands without timeout +- eval "${cmd}" >> ${logfile} 2>&1 +- rc=$? +- fi +- else +- echo "${SCRIPTNAME}: Warning: Command \"${raw_cmd}\" not available" >> "${logfile}" +- echo >> "${logfile}" +- return 1 +- fi +- +- # log a warning on rc not 0 and define return +- if [ ${rc} ]; then +- echo >> "${logfile}" +- return 0 +- else +- echo "${SCRIPTNAME}: Warning: Command \"${cmd}\" failed" >> "${logfile}" +- echo >> "${logfile}" +- return 1 +- fi ++ local rc=0 ++ local cmd="${1}" ++ local logfile="${2}" ++ # extract the raw_command and set cmd_type ++ local raw_cmd=$(echo "${cmd}" | sed -ne 's/^\([^[:space:]]*\).*$/\1/p') ++ local cmd_type=$(type -t ${raw_cmd}) ++ # timeout_ok - like a boolean - is not empty if command exists ++ local timeout_ok=$(type -t timeout) ++ ++ echo "#######################################################" >> "${logfile}" ++ echo "${USER}@${SYSTEMHOSTNAME:-localhost}> ${cmd}" >> "${logfile}" ++ ++ # check calling command type ++ if [ "X${cmd_type}" = "Xbuiltin" ]; then ++ # command is a builtin (no use of timeout possible) ++ eval "${cmd}" >> ${logfile} 2>&1 ++ rc=$? ++ elif [ "X${cmd_type}" != "X" ]; then ++ if [ "X${timeout_ok}" = "Xfile" ]; then ++ eval timeout -k ${TOS} ${TOS} "${cmd}" >> ${logfile} 2>&1 ++ rc=$? ++ else ++ # fall back - call all existing commands without timeout ++ eval "${cmd}" >> ${logfile} 2>&1 ++ rc=$? ++ fi ++ else ++ echo "${SCRIPTNAME}: Warning: Command \"${raw_cmd}\" not available" >> "${logfile}" ++ echo >> "${logfile}" ++ return 1 ++ fi ++ ++ # log a warning on rc not 0 and define return ++ if [ ${rc} ]; then ++ echo >> "${logfile}" ++ return 0 ++ else ++ echo "${SCRIPTNAME}: Warning: Command \"${cmd}\" failed" >> "${logfile}" ++ echo >> "${logfile}" ++ return 1 ++ fi + } + + ######################################## + call_collect_file() { +- local file_name="${1}" +- local directory_name=$(dirname "${file_name}" 2>/dev/null) +- echo " ${file_name}" +- +- if test ! -e "${WORKPATH}${directory_name}"; then +- mkdir -p "${WORKPATH}${directory_name}" 2>&1 +- fi +- if ! cp -r --preserve=mode,timestamps -dL --parents "${file_name}" "${WORKPATH}" 2>&1; then +- return 1 +- else +- return 0 +- fi ++ local file_name="${1}" ++ local directory_name=$(dirname "${file_name}" 2>/dev/null) ++ echo " ${file_name}" ++ ++ if test ! -e "${WORKPATH}${directory_name}"; then ++ mkdir -p "${WORKPATH}${directory_name}" 2>&1 ++ fi ++ if ! cp -r --preserve=mode,timestamps -dL --parents "${file_name}" "${WORKPATH}" 2>&1; then ++ return 1 ++ else ++ return 0 ++ fi + } + + ######################################## + # print that an instance is already running + print_alreadyrunning() { +- print_version ++ print_version + +- cat < "${LOCKFILE}" +- fi +- if ! mkdir "${WORKPATH}" 2>/dev/null; then +- echo "${SCRIPTNAME}: Error: Target directory \"${WORKPATH}\" already exists or" +- echo " \"${WORKDIR_BASE}\" does not exist!" +- exit 1 +- fi +- chmod 0700 "${WORKPATH}" ++ if test ! -e "${WORKDIR_BASE}"; then ++ mkdir -p "${WORKDIR_BASE}" ++ elif test ! -d "${WORKDIR_BASE}"; then ++ echo "${SCRIPTNAME}: Error: \"${WORKDIR_BASE}\" exists but this is a file!" ++ echo " Please make sure \"${WORKDIR_BASE}\" is a directory." ++ exit 1 ++ fi ++ if test -e "${LOCKFILE}"; then ++ print_alreadyrunning ++ exit 1 ++ else ++ touch "${LOCKFILE}" ++ echo "${DATETIME}" > "${LOCKFILE}" ++ fi ++ if ! mkdir "${WORKPATH}" 2>/dev/null; then ++ echo "${SCRIPTNAME}: Error: Target directory \"${WORKPATH}\" already exists or" ++ echo " \"${WORKDIR_BASE}\" does not exist!" ++ exit 1 ++ fi ++ chmod 0700 "${WORKPATH}" + } + + ######################################## + # create gzip-ped tar file + create_package() { +- local rc_tar +- pr_syslog_stdout ${step_num} "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 +- chmod 0600 "${WORKARCHIVE}" +- pr_stdout " " +- pr_stdout "Collected data was saved to:" +- pr_stdout " >> ${WORKARCHIVE} <<" +- pr_stdout " " +- pr_stdout "Please review all collected data before sending to your" \ +- "service organization." +- pr_stdout " " +- elif [ $rc_tar -eq 127 ]; then +- pr_stdout " " +- pr_stdout "${SCRIPTNAME}: Error: tar command is not available!" +- pr_stdout " Please install the corresponding package!" +- else +- pr_stdout " " +- pr_stdout "${SCRIPTNAME}: Error: Collection of data failed!" +- pr_stdout " The creation of \"${WORKARCHIVE}\" was not successful." +- pr_stdout " Please check the directory \"${WORKDIR_BASE}\"" +- pr_stdout " to provide enough free available space." +- fi ++ local rc_tar ++ pr_syslog_stdout ${step_num} "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 ++ chmod 0600 "${WORKARCHIVE}" ++ pr_stdout " " ++ pr_stdout "Collected data was saved to:" ++ pr_stdout " >> ${WORKARCHIVE} <<" ++ pr_stdout " " ++ pr_stdout "Please review all collected data before sending to your" \ ++ "service organization." ++ pr_stdout " " ++ elif [ $rc_tar -eq 127 ]; then ++ pr_stdout " " ++ pr_stdout "${SCRIPTNAME}: Error: tar command is not available!" ++ pr_stdout " Please install the corresponding package!" ++ else ++ pr_stdout " " ++ pr_stdout "${SCRIPTNAME}: Error: Collection of data failed!" ++ pr_stdout " The creation of \"${WORKARCHIVE}\" was not successful." ++ pr_stdout " Please check the directory \"${WORKDIR_BASE}\"" ++ pr_stdout " to provide enough free available space." ++ fi + } + + ######################################## + # Cleaning up the prepared/collected information + environment_cleanup() { +- if ! rm -rf "${WORKPATH}" 2>/dev/null; then +- pr_stdout " " +- pr_stdout "${SCRIPTNAME}: Warning: Deletion of \"${WORKPATH}\" failed" +- pr_stdout " Please remove the directory manually" +- pr_stdout " " +- fi +- if ! rm -f "${LOCKFILE}" 2>/dev/null; then +- pr_stdout " " +- pr_stdout "${SCRIPTNAME}: Warning: Deletion of \"${LOCKFILE}\" failed" +- pr_stdout " Please remove the file manually" +- pr_stdout " " +- fi ++ if ! rm -rf "${WORKPATH}" 2>/dev/null; then ++ pr_stdout " " ++ pr_stdout "${SCRIPTNAME}: Warning: Deletion of \"${WORKPATH}\" failed" ++ pr_stdout " Please remove the directory manually" ++ pr_stdout " " ++ fi ++ if ! rm -f "${LOCKFILE}" 2>/dev/null; then ++ pr_stdout " " ++ pr_stdout "${SCRIPTNAME}: Warning: Deletion of \"${LOCKFILE}\" failed" ++ pr_stdout " Please remove the file manually" ++ pr_stdout " " ++ fi + } + + ######################################## + # Function to perform a cleanup in case of a received signal + emergency_exit() { +- pr_stdout " " +- pr_stdout "${SCRIPTNAME}: Info: Data collection has been interrupted" +- pr_stdout " Cleanup of temporary collected data" +- environment_cleanup +- pr_stdout "${SCRIPTNAME}: Info: Emergency exit processed" +- +- pr_stdout " " +- logger -t "${SCRIPTNAME}" "Data collection interrupted" +- exit ++ pr_stdout " " ++ pr_stdout "${SCRIPTNAME}: Info: Data collection has been interrupted" ++ pr_stdout " Cleanup of temporary collected data" ++ environment_cleanup ++ pr_stdout "${SCRIPTNAME}: Info: Emergency exit processed" ++ ++ pr_stdout " " ++ logger -t "${SCRIPTNAME}" "Data collection interrupted" ++ exit + } + + ######################################## + # Function to print to stdout when rediretion is active + pr_stdout() { +- echo "${@}" >&8 ++ echo "${@}" >&8 + } + + ######################################## + # Function to print to stdout and into log file when rediretion is active + pr_log_stdout() { +- echo "$@" +- echo "$@" >&8 ++ echo "$@" ++ echo "$@" >&8 + } + + ######################################## + # Function to print to stdout and into log file when rediretion is active + pr_syslog_stdout() { +- echo "$@" >&8 +- echo +- echo "$(date +%H:%M:%S.%N) - $@" +- logger -t "${SCRIPTNAME}" "$@" ++ echo "$@" >&8 ++ echo ++ echo "$(date +%H:%M:%S.%N) - $@" ++ logger -t "${SCRIPTNAME}" "$@" + } + + ######################################## + # print "Collecting ... output" + pr_collect_output() { +- pr_syslog_stdout ${step_num} "Collecting" $1 "output" ++ pr_syslog_stdout ${step_num} "Collecting" $1 "output" + } + + ######################################## + # print "Collecting ..." like fs + pr_collect() { +- pr_syslog_stdout ${step_num} "Collecting" $@ ++ pr_syslog_stdout ${step_num} "Collecting" $@ + } + + ######################################## + # print "Skipping ..." info with reason + pr_skip() { +- pr_syslog_stdout ${step_num} "Skip" $@ ++ pr_syslog_stdout ${step_num} "Skip" $@ + } + + ############################################################################### +@@ -1324,11 +1324,11 @@ logger -t "${SCRIPTNAME}" "Starting data collection" + current_step=1 + # run all collection steps + for step in ${ALL_STEPS}; do +- # generate step numbering +- step_num="${current_step} of ${COLLECTION_COUNT}: " +- # calling step procedure +- ${step} +- current_step=`expr ${current_step} + 1` ++ # generate step numbering ++ step_num="${current_step} of ${COLLECTION_COUNT}: " ++ # calling step procedure ++ ${step} ++ current_step=`expr ${current_step} + 1` + done + + logger -t "${SCRIPTNAME}" "Data collection completed" +-- +2.25.1 + diff -Nru s390-tools-2.20.0/debian/patches/a8b0d7ac-lszcrypt-new-options-to-filter-cards-queues-only.patch s390-tools-2.20.0/debian/patches/a8b0d7ac-lszcrypt-new-options-to-filter-cards-queues-only.patch --- s390-tools-2.20.0/debian/patches/a8b0d7ac-lszcrypt-new-options-to-filter-cards-queues-only.patch 1970-01-01 00:00:00.000000000 +0000 +++ s390-tools-2.20.0/debian/patches/a8b0d7ac-lszcrypt-new-options-to-filter-cards-queues-only.patch 2022-05-20 11:48:34.000000000 +0000 @@ -0,0 +1,169 @@ +From a8b0d7ace8f7aa3d61ae818b3e23bd60c5c53548 Mon Sep 17 00:00:00 2001 +From: Harald Freudenberger +Date: Fri, 18 Feb 2022 16:12:46 +0100 +Subject: [PATCH] lszcrypt: new options to filter cards/queues only +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +New options: + --cardonly + --queueonly +which filter the output to show only card or queue information. + +Signed-off-by: Harald Freudenberger +Signed-off-by: Jan Höppner + +Origin: upstream, https://github.com/ibm-s390-tools/s390-tools/commit/a8b0d7ace8f7aa3d61ae818b3e23bd60c5c53548 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1959548 +Last-Update: 2022-05-25 + +--- + zconf/zcrypt/lszcrypt.8 | 16 +++++++++++++++- + zconf/zcrypt/lszcrypt.c | 40 ++++++++++++++++++++++++++++++++++++++-- + 2 files changed, 53 insertions(+), 3 deletions(-) + +diff --git a/zconf/zcrypt/lszcrypt.8 b/zconf/zcrypt/lszcrypt.8 +index 4e3c3e93..1c53a80e 100644 +--- a/zconf/zcrypt/lszcrypt.8 ++++ b/zconf/zcrypt/lszcrypt.8 +@@ -16,7 +16,7 @@ lszcrypt \- display zcrypt device and configuration information + .SH SYNOPSIS + .TP 9 + .B lszcrypt +-.RB "[" --accelonly | --ccaonly | --ep11only "]" ++.RB "[" "]" + .RB "[" -V "]" + [ + .I +@@ -33,6 +33,9 @@ lszcrypt \- display zcrypt device and configuration information + .B lszcrypt -h + .TP + .B lszcrypt -v ++. TP ++.B ++[--accelonly|--ccaonly|--ep11only] [--cardonly|--queueonly] + .SH DESCRIPTION + The + .B lszcrypt +@@ -121,6 +124,12 @@ Show only information for cards/queues in CCA-Coprocessor mode. + .TP 8 + .B --ep11only + Show only information for cards/queues in EP11-Coprocessor mode. ++.TP 8 ++.B --cardonly ++Show only information for cards but no queue info. ++.TP 8 ++.B --queueonly ++Show only information for queues but no card info. + .SH LISTING DETAILS + Here is an explanation of the columns displayed. Please note that some + of the columns show up in verbose mode only. +@@ -223,6 +232,11 @@ cex2acard/cex2aqueue (CEX2A and CEX3A hardware) and vfio_ap (queue reserved + for use by kvm hypervisor for kvm guests and not accessible to host + applications). It is also valid to have no driver handling a queue which is + shown as a -no-driver- entry. ++.SH NOTES ++Use only one of the mode filtering options --accelonly, --ccaonly, --ep11only. ++Same with card/queue filtering: Use only one of --cardonly, --queueonly. ++However, one of the mode filtering options and one of the card/queue filtering ++can be combined. + .SH EXAMPLES + .TP + .B lszcrypt +diff --git a/zconf/zcrypt/lszcrypt.c b/zconf/zcrypt/lszcrypt.c +index dc807759..a0884417 100644 +--- a/zconf/zcrypt/lszcrypt.c ++++ b/zconf/zcrypt/lszcrypt.c +@@ -32,6 +32,8 @@ static struct lszcrypt_l { + int showaccel; + int showcca; + int showep11; ++ int showcard; ++ int showqueue; + } l; + + /* +@@ -103,6 +105,8 @@ static const struct util_prg prg = { + #define OPT_ACCELONLY 0x81 + #define OPT_CCAONLY 0x82 + #define OPT_EP11ONLY 0x83 ++#define OPT_CARDONLY 0x84 ++#define OPT_QUEUEONLY 0x85 + + static struct util_opt opt_vec[] = { + { +@@ -137,6 +141,16 @@ static struct util_opt opt_vec[] = { + .flags = UTIL_OPT_FLAG_NOSHORT, + .desc = "Show only information from cards/queues in EP11-Coprocessor mode", + }, ++ { ++ .option = {"cardonly", 0, NULL, OPT_CARDONLY}, ++ .flags = UTIL_OPT_FLAG_NOSHORT, ++ .desc = "Show only information from cards but no queue info", ++ }, ++ { ++ .option = {"queueonly", 0, NULL, OPT_QUEUEONLY}, ++ .flags = UTIL_OPT_FLAG_NOSHORT, ++ .desc = "Show only information from queues but no card info", ++ }, + UTIL_OPT_HELP, + UTIL_OPT_VERSION, + UTIL_OPT_END +@@ -522,6 +536,9 @@ static void show_subdevice(struct util_rec *rec, const char *grp_dev, + !util_path_is_readable("%s/%s/online", grp_dev, sub_dev))) + return; + ++ if (!l.showqueue) ++ return; ++ + util_rec_set(rec, "card", sub_dev); + read_subdev_rec_default(rec, grp_dev, sub_dev); + read_subdev_rec_verbose(rec, grp_dev, sub_dev); +@@ -669,8 +686,10 @@ static void show_device(struct util_rec *rec, const char *device) + read_rec_default(rec, grp_dev); + read_rec_verbose(rec, grp_dev); + +- util_rec_print(rec); +- show_subdevices(rec, grp_dev); ++ if (l.showcard) ++ util_rec_print(rec); ++ if (l.showqueue) ++ show_subdevices(rec, grp_dev); + out_free: + free(grp_dev); + } +@@ -856,6 +875,12 @@ int main(int argc, char **argv) + case OPT_EP11ONLY: + l.showep11 = 1; + break; ++ case OPT_CARDONLY: ++ l.showcard = 1; ++ break; ++ case OPT_QUEUEONLY: ++ l.showqueue = 1; ++ break; + case 'h': + util_prg_print_help(); + util_opt_print_help(); +@@ -881,6 +906,17 @@ int main(int argc, char **argv) + return EXIT_FAILURE; + } + ++ switch (l.showcard + l.showqueue) { ++ case 0: ++ l.showcard = l.showqueue = 1; ++ break; ++ case 1: ++ break; ++ default: ++ warnx("Only one of --cardonly or --queueonly can be specified"); ++ return EXIT_FAILURE; ++ } ++ + if (optind == argc) + show_devices_all(); + else +-- +2.25.1 + diff -Nru s390-tools-2.20.0/debian/patches/abec41f-dbginfo.sh-alphabetic-order-of-log-and-config-files.patch s390-tools-2.20.0/debian/patches/abec41f-dbginfo.sh-alphabetic-order-of-log-and-config-files.patch --- s390-tools-2.20.0/debian/patches/abec41f-dbginfo.sh-alphabetic-order-of-log-and-config-files.patch 1970-01-01 00:00:00.000000000 +0000 +++ s390-tools-2.20.0/debian/patches/abec41f-dbginfo.sh-alphabetic-order-of-log-and-config-files.patch 2022-05-20 11:48:34.000000000 +0000 @@ -0,0 +1,96 @@ +From abec41f514eea8b26ade6ffac88168f90a686ba5 Mon Sep 17 00:00:00 2001 +From: Joern Siglen +Date: Fri, 4 Feb 2022 13:11:41 +0100 +Subject: [PATCH] dbginfo.sh: alphabetic order of log- and config files +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +as order itself does not matter for collection of log and config files, +we decided to use alphabetic order for better maintenance + +Signed-off-by: Joern Siglen +Reviewed-by: Mario Held +Reviewed-by: Steffen Maier +Signed-off-by: Jan Höppner + +Origin: upstream, https://github.com/ibm-s390-tools/s390-tools/commit/abec41f514eea8b26ade6ffac88168f90a686ba5 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1971959 +Last-Update: 2022-05-25 + +--- + scripts/dbginfo.sh | 22 +++++++++++----------- + 1 file changed, 11 insertions(+), 11 deletions(-) + +diff --git a/scripts/dbginfo.sh b/scripts/dbginfo.sh +index 6cfa4b83..b35883b0 100755 +--- a/scripts/dbginfo.sh ++++ b/scripts/dbginfo.sh +@@ -329,6 +329,9 @@ fi + ######################################## + + LOGFILES="\ ++ /run/containerd/events.log\ ++ /run/docker/libcontainerd/containerd/events.log\ ++ /run/udev/chreiplzfcpmp-[0-9][0-9][a-z][a-z][a-z][a-z]-*\ + /var/log/anaconda.*\ + /var/log/audit\ + /var/log/boot*\ +@@ -341,31 +344,31 @@ LOGFILES="\ + /var/log/lin_tape.trace\ + /var/log/lin_tape.errorlog\ + /var/log/messages*\ +- /var/log/syslog*\ +- /var/log/sa\ +- /var/log/yum.log\ + /var/log/openvswitch/ovs-vswitchd.log\ + /var/log/openvswitch/ovsdb-server.log\ +- /run/docker/libcontainerd/containerd/events.log\ +- /run/containerd/events.log\ +- /run/udev/chreiplzfcpmp-[0-9][0-9][a-z][a-z][a-z][a-z]-*\ ++ /var/log/sa\ ++ /var/log/syslog*\ ++ /var/log/yum.log\ + " + + ######################################## + + CONFIGFILES="\ +- /boot/loader/entries/*.conf\ + /boot/grub2/grub.cfg\ ++ /boot/loader/entries/*.conf\ + /boot/zipl/active_devices.txt\ + /boot/zipl/config\ + /etc/*.conf\ ++ /etc/*release\ + /etc/anacrontab\ ++ /etc/apparmor.d\ + /etc/auto.*\ + /etc/cron.*\ + /etc/crontab\ + /etc/crypttab\ + /etc/default\ + /etc/depmod.d\ ++ /etc/docker\ + /etc/dracut.conf.d\ + /etc/exports\ + /etc/fstab\ +@@ -399,14 +402,11 @@ CONFIGFILES="\ + /etc/systemd\ + /etc/udev*\ + /etc/xinet.d\ +- /etc/*release\ +- /run/udev/rules.d\ + $(find /lib/modules -name modules.dep 2>/dev/null)\ +- /etc/docker\ + /lib/systemd/system/docker.service\ + /usr/lib/systemd/system\ +- /etc/apparmor.d\ + /run/udev/chreiplzfcpmp-ipl-volume-id\ ++ /run/udev/rules.d\ + " + + ######################################## +-- +2.25.1 + diff -Nru s390-tools-2.20.0/debian/patches/b16a6d4f-lszcrypt-add-CEX8S-support.patch s390-tools-2.20.0/debian/patches/b16a6d4f-lszcrypt-add-CEX8S-support.patch --- s390-tools-2.20.0/debian/patches/b16a6d4f-lszcrypt-add-CEX8S-support.patch 1970-01-01 00:00:00.000000000 +0000 +++ s390-tools-2.20.0/debian/patches/b16a6d4f-lszcrypt-add-CEX8S-support.patch 2022-05-20 11:48:34.000000000 +0000 @@ -0,0 +1,85 @@ +From b16a6d4fe1dd5a2338e6f7a9804db493f1577590 Mon Sep 17 00:00:00 2001 +From: Harald Freudenberger +Date: Thu, 11 Nov 2021 10:09:52 +0100 +Subject: [PATCH] lszcrypt: add CEX8S support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Recognize AP type 14 as CEX8S crypto express card. + +Signed-off-by: Harald Freudenberger +Signed-off-by: Jan Höppner + +Origin: upstream, https://github.com/ibm-s390-tools/s390-tools/commit/b16a6d4fe1dd5a2338e6f7a9804db493f1577590 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1959548 +Last-Update: 2022-05-25 + +--- + zconf/zcrypt/lszcrypt.8 | 8 ++++---- + zconf/zcrypt/lszcrypt.c | 3 ++- + 2 files changed, 6 insertions(+), 5 deletions(-) + +diff --git a/zconf/zcrypt/lszcrypt.8 b/zconf/zcrypt/lszcrypt.8 +index ca3e7797..351ce3e6 100644 +--- a/zconf/zcrypt/lszcrypt.8 ++++ b/zconf/zcrypt/lszcrypt.8 +@@ -1,6 +1,6 @@ + .\" lszcrypt.8 + .\" +-.\" Copyright 2019 IBM Corp. ++.\" Copyright IBM Corp. 2019, 2022 + .\" s390-tools is free software; you can redistribute it and/or modify + .\" it under the terms of the MIT license. See LICENSE for details. + .\" +@@ -10,7 +10,7 @@ + .\" nroff -man lszcrypt.8 + .\" to process this source + .\" +-.TH LSZCRYPT 8 "OCT 2020" "s390-tools" ++.TH LSZCRYPT 8 "FEB 2022" "s390-tools" + .SH NAME + lszcrypt \- display zcrypt device and configuration information + .SH SYNOPSIS +@@ -123,7 +123,7 @@ dot for a queue line. + .B TYPE and HWTYPE + The HWTYPE is a numeric value showing which type of hardware the zcrypt + device driver presumes that this crypto card is. The currently known values +-are 7=CEX3C, 8=CEX3A, 10=CEX4, 11=CEX5, 12=CEX6 and 13=CEX7. ++are 7=CEX3C, 8=CEX3A, 10=CEX4, 11=CEX5, 12=CEX6, 13=CEX7 and 14=CEX8. + .br + The TYPE is a human readable value showing the hardware type and the basic + function type (A=Accelerator, C=CCA Coprocessor, P=EP11 Coprocessor). So +@@ -204,7 +204,7 @@ operations within the guests. + .B DRIVER + .br + Shows which card or queue device driver currently handles this crypto +-resource. Currently known drivers are cex4card/cex4queue (CEX4-CEX7 ++resource. Currently known drivers are cex4card/cex4queue (CEX4-CEX8 + hardware), cex2card/cex2cqueue (CEX2C and CEX3C hardware), + cex2acard/cex2aqueue (CEX2A and CEX3A hardware) and vfio_ap (queue reserved + for use by kvm hypervisor for kvm guests and not accessible to host +diff --git a/zconf/zcrypt/lszcrypt.c b/zconf/zcrypt/lszcrypt.c +index ce70cabe..57d6c236 100644 +--- a/zconf/zcrypt/lszcrypt.c ++++ b/zconf/zcrypt/lszcrypt.c +@@ -1,7 +1,7 @@ + /** + * lszcrypt - Display zcrypt devices and configuration settings + * +- * Copyright IBM Corp. 2008, 2020 ++ * Copyright IBM Corp. 2008, 2022 + * + * s390-tools is free software; you can redistribute it and/or modify + * it under the terms of the MIT license. See LICENSE for details. +@@ -306,6 +306,7 @@ static void show_capability(const char *id_str) + case 11: /* CEX5S */ + case 12: /* CEX6S */ + case 13: /* CEX7S */ ++ case 14: /* CEX8S */ + if (func_val & MASK_ACCEL) { + if (func_val & MASK_RSA4K) + printf("%s", CAP_RSA4K); +-- +2.25.1 + diff -Nru s390-tools-2.20.0/debian/patches/bcbb6fca-zcryptstats-add-CEX8-support.patch s390-tools-2.20.0/debian/patches/bcbb6fca-zcryptstats-add-CEX8-support.patch --- s390-tools-2.20.0/debian/patches/bcbb6fca-zcryptstats-add-CEX8-support.patch 1970-01-01 00:00:00.000000000 +0000 +++ s390-tools-2.20.0/debian/patches/bcbb6fca-zcryptstats-add-CEX8-support.patch 2022-05-20 11:48:34.000000000 +0000 @@ -0,0 +1,99 @@ +From bcbb6fcae6aecd6d87d72e64bd27d8683188b61c Mon Sep 17 00:00:00 2001 +From: Harald Freudenberger +Date: Wed, 17 Nov 2021 11:56:00 +0100 +Subject: [PATCH] zcryptstats: add CEX8 support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add the CEX8 crypto card to the list of known crypto cards. + +Signed-off-by: Harald Freudenberger +Reviewed-by: Ingo Franzki +Signed-off-by: Jan Höppner + +Origin: upstream, https://github.com/ibm-s390-tools/s390-tools/commit/bcbb6fcae6aecd6d87d72e64bd27d8683188b61c +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1959548 +Last-Update: 2022-05-25 + +--- + zconf/zcrypt/zcryptstats.c | 30 ++++++++++++++++-------------- + 1 file changed, 16 insertions(+), 14 deletions(-) + +diff --git a/zconf/zcrypt/zcryptstats.c b/zconf/zcrypt/zcryptstats.c +index 2f2c4d18..b81d1cee 100644 +--- a/zconf/zcrypt/zcryptstats.c ++++ b/zconf/zcrypt/zcryptstats.c +@@ -1,7 +1,7 @@ + /* + * zcryptstats - Show usage statistics of IBM Crypto Express adapters + * +- * Copyright IBM Corp. 2019 ++ * Copyright IBM Corp. 2019, 2022 + * + * s390-tools is free software; you can redistribute it and/or modify + * it under the terms of the MIT license. See LICENSE for details. +@@ -148,8 +148,9 @@ struct chsc_cmb_area { + #define CRYPTO_TYPE_CEX5S 11 + #define CRYPTO_TYPE_CEX6S 12 + #define CRYPTO_TYPE_CEX7S 13 ++#define CRYPTO_TYPE_CEX8S 14 + +-#define CRYPTO_TYPE_TOLERATION CRYPTO_TYPE_CEX7S ++#define CRYPTO_TYPE_TOLERATION CRYPTO_TYPE_CEX8S + + struct crypto_counter { + const char *name; +@@ -236,8 +237,8 @@ static const struct crypto_mode mode_pcica[1] = { + .counters = counter_pcica }, + }; + +-#define NUM_CEX4567_MODES 11 +-static const struct crypto_mode mode_cex4567[NUM_CEX4567_MODES] = { ++#define NUM_CEX45678_MODES 11 ++static const struct crypto_mode mode_cex45678[NUM_CEX45678_MODES] = { + { 0 }, + { 0 }, + { 0 }, +@@ -257,7 +258,7 @@ static const struct crypto_mode mode_cex4567[NUM_CEX4567_MODES] = { + .counters = counter_ep11 }, + }; + +-#define NUM_CRYPTO_TYPES 14 ++#define NUM_CRYPTO_TYPES 15 + static const struct crypto_type crypto_types[NUM_CRYPTO_TYPES] = { + { 0 }, + { 0 }, +@@ -276,14 +277,16 @@ static const struct crypto_type crypto_types[NUM_CRYPTO_TYPES] = { + .modes = mode_accel }, + { .name = "CEX3C", .num_modes = NUM_COPROC_MODES, + .modes = mode_coproc }, +- { .name = "CEX4", .num_modes = NUM_CEX4567_MODES, +- .modes = mode_cex4567 }, +- { .name = "CEX5", .num_modes = NUM_CEX4567_MODES, +- .modes = mode_cex4567 }, +- { .name = "CEX6", .num_modes = NUM_CEX4567_MODES, +- .modes = mode_cex4567 }, +- { .name = "CEX7", .num_modes = NUM_CEX4567_MODES, +- .modes = mode_cex4567 }, ++ { .name = "CEX4", .num_modes = NUM_CEX45678_MODES, ++ .modes = mode_cex45678 }, ++ { .name = "CEX5", .num_modes = NUM_CEX45678_MODES, ++ .modes = mode_cex45678 }, ++ { .name = "CEX6", .num_modes = NUM_CEX45678_MODES, ++ .modes = mode_cex45678 }, ++ { .name = "CEX7", .num_modes = NUM_CEX45678_MODES, ++ .modes = mode_cex45678 }, ++ { .name = "CEX8", .num_modes = NUM_CEX45678_MODES, ++ .modes = mode_cex45678 }, + }; + + +@@ -2424,4 +2427,3 @@ out: + + return rc; + } +- +-- +2.25.1 + diff -Nru s390-tools-2.20.0/debian/patches/be47b51-dbginfo.sh-re-group-commands-by-z-device.patch s390-tools-2.20.0/debian/patches/be47b51-dbginfo.sh-re-group-commands-by-z-device.patch --- s390-tools-2.20.0/debian/patches/be47b51-dbginfo.sh-re-group-commands-by-z-device.patch 1970-01-01 00:00:00.000000000 +0000 +++ s390-tools-2.20.0/debian/patches/be47b51-dbginfo.sh-re-group-commands-by-z-device.patch 2022-05-20 11:48:34.000000000 +0000 @@ -0,0 +1,79 @@ +From be47b51890433693ca0e92316ce6e1492c046e73 Mon Sep 17 00:00:00 2001 +From: Joern Siglen +Date: Wed, 16 Feb 2022 11:48:21 +0100 +Subject: [PATCH] dbginfo.sh: (re)group commands by z device +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This change will group the commands executed for Z device subsystem +into a section with a comment. +By grouping, we try to enhance the handling in our runtime.out file and +help to understand the purpose of command groups. + +In addition we did get feedback for promoting some commands to the top. +lspci -t was added on request of SMEs during the discussions + +Signed-off-by: Joern Siglen +Reviewed-by: Sa Liu +Reviewed-by: Mario Held +Acked-by: Nicklas Schnelle +Signed-off-by: Jan Höppner + +Origin: upstream, https://github.com/ibm-s390-tools/s390-tools/commit/be47b51890433693ca0e92316ce6e1492c046e73 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1971959 +Last-Update: 2022-05-25 + +--- + scripts/dbginfo.sh | 19 ++++++++++++------- + 1 file changed, 12 insertions(+), 7 deletions(-) + +diff --git a/scripts/dbginfo.sh b/scripts/dbginfo.sh +index 98e8a3ed..e1b2ba04 100755 +--- a/scripts/dbginfo.sh ++++ b/scripts/dbginfo.sh +@@ -435,20 +435,27 @@ CMDS="uname -a\ + :mount\ + " + ++# Z device subsystem commands (first commands in non alphabetical order) ++CMDS="${CMDS}\ ++ :lschp\ ++ :lscss\ ++ :lszdev\ ++ :find /dev -print0 | sort -z | xargs -0 -n 10 ls -ld\ ++ :lspci -t\ ++ :lspci -vv\ ++ :lstape\ ++ :smc_dbg\ ++ " ++ + CMDS="${CMDS}\ + :dmsetup ls\ + :dmsetup ls --tree\ + :dmsetup table\ + :dmsetup table --target multipath\ + :dmsetup status\ +- :lschp\ +- :lscss\ + :lsdasd\ + :lsdasd -u\ +- :lspci -vv\ + :lsscsi\ +- :lstape\ +- :lszdev\ + :lszfcp\ + :lszfcp -D\ + :lszfcp -V\ +@@ -466,8 +473,6 @@ CMDS="${CMDS}\ + :multipath -d\ + :multipath -t\ + :pvpath -qa\ +- :find /dev -print0 | sort -z | xargs -0 -n 10 ls -ld\ +- :smc_dbg\ + :lvdisplay\ + :ziorep_config -ADM\ + " +-- +2.25.1 + diff -Nru s390-tools-2.20.0/debian/patches/cce5f51-cpumf-lscpumf-Add-IBM-z16-extended-counter-set-def.patch s390-tools-2.20.0/debian/patches/cce5f51-cpumf-lscpumf-Add-IBM-z16-extended-counter-set-def.patch --- s390-tools-2.20.0/debian/patches/cce5f51-cpumf-lscpumf-Add-IBM-z16-extended-counter-set-def.patch 1970-01-01 00:00:00.000000000 +0000 +++ s390-tools-2.20.0/debian/patches/cce5f51-cpumf-lscpumf-Add-IBM-z16-extended-counter-set-def.patch 2022-05-20 11:48:34.000000000 +0000 @@ -0,0 +1,623 @@ +From cce5f510c317e87a46a7ef9c5e70b4b141592b1c Mon Sep 17 00:00:00 2001 +From: Thomas Richter +Date: Fri, 13 May 2022 13:26:50 +0200 +Subject: [PATCH] cpumf/lscpumf: Add IBM z16 extended counter set definitions +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add IBM z16 extended counter set. For each counter in this set +add the counter number, the short and long description and the +counter number. + +Signed-off-by: Thomas Richter +Acked-by: Sumanth Korikkar +Signed-off-by: Jan Höppner + +Origin: upstream, https://github.com/ibm-s390-tools/s390-tools/commit/cce5f510c317e87a46a7ef9c5e70b4b141592b1c +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1960119 +Last-Update: 2022-05-24 + +--- + cpumf/lscpumf.c | 583 ++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 583 insertions(+) + +--- a/cpumf/lscpumf.c ++++ b/cpumf/lscpumf.c +@@ -2559,6 +2559,586 @@ + }, + }; + ++static struct counters cpumcf_z16_counters[] = { ++ { ++ .ctrnum = 128, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "L1D_RO_EXCL_WRITES", ++ .desc = "A directory write to the Level-1 Data cache where" ++ "\n\t\tthe line was originally in a Read-Only state in the" ++ "\n\t\tcache but has been updated to be in the Exclusive" ++ "\n\t\tstate that allows stores to the cache line.", ++ }, ++ { ++ .ctrnum = 129, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "DTLB2_WRITES", ++ .desc = "A translation has been written into The Translation" ++ "\n\t\tLookaside Buffer 2 (TLB2) and the request was made" ++ "\n\t\tby the Level-1 Data cache. This is a replacement" ++ "\n\t\tfor what was provided for the DTLB on z13 and prior" ++ "\n\t\tmachines.", ++ }, ++ { ++ .ctrnum = 130, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "DTLB2_MISSES", ++ .desc = "A TLB2 miss is in progress for a request made by" ++ "\n\t\tthe Level-1 Data cache. Incremented by one for" ++ "\n\t\tevery TLB2 miss in progress for the Level-1 Data" ++ "\n\t\tcache on this cycle. This is a replacement for what" ++ "\n\t\twas provided for the DTLB on z13 and prior" ++ "\n\t\tmachines.", ++ }, ++ { ++ .ctrnum = 131, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "CRSTE_1MB_WRITES", ++ .desc = "A translation entry was written into the Combined" ++ "\n\t\tRegion and Segment Table Entry array in the Level-2" ++ "\n\t\tTLB for a one-megabyte page.", ++ }, ++ { ++ .ctrnum = 132, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "DTLB2_GPAGE_WRITES", ++ .desc = "A translation entry for a two-gigabyte page was" ++ "\n\t\twritten into the Level-2 TLB.", ++ }, ++ { ++ .ctrnum = 134, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "ITLB2_WRITES", ++ .desc = "A translation entry has been written into the" ++ "\n\t\tTranslation Lookaside Buffer 2 (TLB2) and the" ++ "\n\t\trequest was made by the instruction cache. This is" ++ "\n\t\ta replacement for what was provided for the ITLB on" ++ "\n\t\tz13 and prior machines.", ++ }, ++ { ++ .ctrnum = 135, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "ITLB2_MISSES", ++ .desc = "A TLB2 miss is in progress for a request made by" ++ "\n\t\tthe Level-1 Instruction cache. Incremented by one" ++ "\n\t\tfor every TLB2 miss in progress for the Level-1" ++ "\n\t\tInstruction cache in a cycle. This is a replacement" ++ "\n\t\tfor what was provided for the ITLB on z13 and prior" ++ "\n\t\tmachines.", ++ }, ++ { ++ .ctrnum = 137, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "TLB2_PTE_WRITES", ++ .desc = "A translation entry was written into the Page Table" ++ "\n\t\tEntry array in the Level-2 TLB.", ++ }, ++ { ++ .ctrnum = 138, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "TLB2_CRSTE_WRITES", ++ .desc = "Translation entries were written into the Combined" ++ "\n\t\tRegion and Segment Table Entry array and the Page" ++ "\n\t\tTable Entry array in the Level-2 TLB.", ++ }, ++ { ++ .ctrnum = 139, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "TLB2_ENGINES_BUSY", ++ .desc = "The number of Level-2 TLB translation engines busy" ++ "\n\t\tin a cycle.", ++ }, ++ { ++ .ctrnum = 140, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "TX_C_TEND", ++ .desc = "A TEND instruction has completed in a constrained" ++ "\n\t\ttransactional-execution mode.", ++ }, ++ { ++ .ctrnum = 141, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "TX_NC_TEND", ++ .desc = "A TEND instruction has completed in a non-" ++ "\n\t\tconstrained transactional-execution mode.", ++ }, ++ { ++ .ctrnum = 143, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "L1C_TLB2_MISSES", ++ .desc = "Increments by one for any cycle where a level-1" ++ "\n\t\tcache or level-2 TLB miss is in progress.", ++ }, ++ { ++ .ctrnum = 145, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "DCW_REQ", ++ .desc = "A directory write to the Level-1 Data cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tfrom the requestor’s Level-2 cache.", ++ }, ++ { ++ .ctrnum = 146, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "DCW_REQ_IV", ++ .desc = "A directory write to the Level-1 Data cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tfrom the requestor’s Level-2 cache with" ++ "\n\t\tintervention.", ++ }, ++ { ++ .ctrnum = 147, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "DCW_REQ_CHIP_HIT", ++ .desc = "A directory write to the Level-1 Data cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tfrom the requestor’s Level-2 cache after using" ++ "\n\t\tchip level horizontal persistence, Chip-HP hit.", ++ }, ++ { ++ .ctrnum = 148, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "DCW_REQ_DRAWER_HIT", ++ .desc = "A directory write to the Level-1 Data cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tfrom the requestor’s Level-2 cache after using" ++ "\n\t\tdrawer level horizontal persistence, Drawer-HP hit.", ++ }, ++ { ++ .ctrnum = 149, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "DCW_ON_CHIP", ++ .desc = "A directory write to the Level-1 Data cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tfrom an On-Chip Level-2 cache.", ++ }, ++ { ++ .ctrnum = 150, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "DCW_ON_CHIP_IV", ++ .desc = "A directory write to the Level-1 Data cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tfrom an On-Chip Level-2 cache with intervention.", ++ }, ++ { ++ .ctrnum = 151, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "DCW_ON_CHIP_CHIP_HIT", ++ .desc = "A directory write to the Level-1 Data cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tfrom an On-Chip Level-2 cache after using chip" ++ "\n\t\tlevel horizontal persistence, Chip-HP hit.", ++ }, ++ { ++ .ctrnum = 152, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "DCW_ON_CHIP_DRAWER_HIT", ++ .desc = "A directory write to the Level-1 Data cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tfrom an On-Chip Level-2 cache using drawer level" ++ "\n\t\thorizontal persistence, Drawer-HP hit.", ++ }, ++ { ++ .ctrnum = 153, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "DCW_ON_MODULE", ++ .desc = "A directory write to the Level-1 Data cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tfrom an On-Module Level-2 cache.", ++ }, ++ { ++ .ctrnum = 154, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "DCW_ON_DRAWER", ++ .desc = "A directory write to the Level-1 Data cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tfrom an On-Drawer Level-2 cache.", ++ }, ++ { ++ .ctrnum = 155, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "DCW_OFF_DRAWER", ++ .desc = "A directory write to the Level-1 Data cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tfrom an Off-Drawer Level-2 cache.", ++ }, ++ { ++ .ctrnum = 156, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "DCW_ON_CHIP_MEMORY", ++ .desc = "A directory write to the Level-1 Data cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tfrom On-Chip memory.", ++ }, ++ { ++ .ctrnum = 157, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "DCW_ON_MODULE_MEMORY", ++ .desc = "A directory write to the Level-1 Data cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tfrom On-Module memory.", ++ }, ++ { ++ .ctrnum = 158, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "DCW_ON_DRAWER_MEMORY", ++ .desc = "A directory write to the Level-1 Data cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tfrom On-Drawer memory.", ++ }, ++ { ++ .ctrnum = 159, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "DCW_OFF_DRAWER_MEMORY", ++ .desc = "A directory write to the Level-1 Data cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tfrom Off-Drawer memory.", ++ }, ++ { ++ .ctrnum = 160, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "IDCW_ON_MODULE_IV", ++ .desc = "A directory write to the Level-1 Data or Level-1" ++ "\n\t\tInstruction cache directory where the returned" ++ "\n\t\tcache line was sourced from an On-Module Level-2" ++ "\n\t\tcache with intervention.", ++ }, ++ { ++ .ctrnum = 161, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "IDCW_ON_MODULE_CHIP_HIT", ++ .desc = "A directory write to the Level-1 Data or Level-1" ++ "\n\t\tInstruction cache directory where the returned" ++ "\n\t\tcache line was sourced from an On-Module Level-2" ++ "\n\t\tcache using chip horizontal persistence, Chip-HP" ++ "\n\t\thit.", ++ }, ++ { ++ .ctrnum = 162, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "IDCW_ON_MODULE_DRAWER_HIT", ++ .desc = "A directory write to the Level-1 Data or Level-1" ++ "\n\t\tInstruction cache directory where the returned" ++ "\n\t\tcache line was sourced from an On-Module Level-2" ++ "\n\t\tcache using drawer level horizontal persistence," ++ "\n\t\tDrawer-HP hit.", ++ }, ++ { ++ .ctrnum = 163, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "IDCW_ON_DRAWER_IV", ++ .desc = "A directory write to the Level-1 Data or Level-1" ++ "\n\t\tInstruction cache directory where the returned" ++ "\n\t\tcache line was sourced from an On-Drawer Level-2" ++ "\n\t\tcache with intervention.", ++ }, ++ { ++ .ctrnum = 164, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "IDCW_ON_DRAWER_CHIP_HIT", ++ .desc = "A directory write to the Level-1 Data or Level-1" ++ "\n\t\tinstruction cache directory where the returned" ++ "\n\t\tcache line was sourced from an On-Drawer Level-2" ++ "\n\t\tcache using chip level horizontal persistence, Chip-" ++ "\n\t\tHP hit.", ++ }, ++ { ++ .ctrnum = 165, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "IDCW_ON_DRAWER_DRAWER_HIT", ++ .desc = "A directory write to the Level-1 Data or Level-1" ++ "\n\t\tinstruction cache directory where the returned" ++ "\n\t\tcache line was sourced from an On-Drawer Level-2" ++ "\n\t\tcache using drawer level horizontal persistence," ++ "\n\t\tDrawer-HP hit.", ++ }, ++ { ++ .ctrnum = 166, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "IDCW_OFF_DRAWER_IV", ++ .desc = "A directory write to the Level-1 Data or Level-1" ++ "\n\t\tinstruction cache directory where the returned" ++ "\n\t\tcache line was sourced from an Off-Drawer Level-2" ++ "\n\t\tcache with intervention.", ++ }, ++ { ++ .ctrnum = 167, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "IDCW_OFF_DRAWER_CHIP_HIT", ++ .desc = "A directory write to the Level-1 Data or Level-1" ++ "\n\t\tinstruction cache directory where the returned" ++ "\n\t\tcache line was sourced from an Off-Drawer Level-2" ++ "\n\t\tcache using chip level horizontal persistence, Chip-" ++ "\n\t\tHP hit.", ++ }, ++ { ++ .ctrnum = 168, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "IDCW_OFF_DRAWER_DRAWER_HIT", ++ .desc = "A directory write to the Level-1 Data or Level-1" ++ "\n\t\tInstruction cache directory where the returned" ++ "\n\t\tcache line was sourced from an Off-Drawer Level-2" ++ "\n\t\tcache using drawer level horizontal persistence," ++ "\n\t\tDrawer-HP hit.", ++ }, ++ { ++ .ctrnum = 169, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "ICW_REQ", ++ .desc = "A directory write to the Level-1 Instruction cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tthe requestors Level-2 cache.", ++ }, ++ { ++ .ctrnum = 170, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "ICW_REQ_IV", ++ .desc = "A directory write to the Level-1 Instruction cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tfrom the requestors Level-2 cache with" ++ "\n\t\tintervention.", ++ }, ++ { ++ .ctrnum = 171, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "ICW_REQ_CHIP_HIT", ++ .desc = "A directory write to the Level-1 Instruction cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tfrom the requestors Level-2 cache using chip level" ++ "\n\t\thorizontal persistence, Chip-HP hit.", ++ }, ++ { ++ .ctrnum = 172, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "ICW_REQ_DRAWER_HIT", ++ .desc = "A directory write to the Level-1 Instruction cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tfrom the requestor’s Level-2 cache using drawer" ++ "\n\t\tlevel horizontal persistence, Drawer-HP hit.", ++ }, ++ { ++ .ctrnum = 173, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "ICW_ON_CHIP", ++ .desc = "A directory write to the Level-1 Instruction cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tfrom an On-Chip Level-2 cache.", ++ }, ++ { ++ .ctrnum = 174, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "ICW_ON_CHIP_IV", ++ .desc = "A directory write to the Level-1 Instruction cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tan On-Chip Level-2 cache with intervention.", ++ }, ++ { ++ .ctrnum = 175, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "ICW_ON_CHIP_CHIP_HIT", ++ .desc = "A directory write to the Level-1 Instruction cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tfrom an On-Chip Level-2 cache using chip level" ++ "\n\t\thorizontal persistence, Chip-HP hit.", ++ }, ++ { ++ .ctrnum = 176, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "ICW_ON_CHIP_DRAWER_HIT", ++ .desc = "A directory write to the Level-1 Instruction cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tfrom an On-Chip level 2 cache using drawer level" ++ "\n\t\thorizontal persistence, Drawer-HP hit.", ++ }, ++ { ++ .ctrnum = 177, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "ICW_ON_MODULE", ++ .desc = "A directory write to the Level-1 Instruction cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tfrom an On-Module Level-2 cache.", ++ }, ++ { ++ .ctrnum = 178, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "ICW_ON_DRAWER", ++ .desc = "A directory write to the Level-1 Instruction cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tan On-Drawer Level-2 cache.", ++ }, ++ { ++ .ctrnum = 179, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "ICW_OFF_DRAWER", ++ .desc = "A directory write to the Level-1 Instruction cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tan Off-Drawer Level-2 cache.", ++ }, ++ { ++ .ctrnum = 180, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "ICW_ON_CHIP_MEMORY", ++ .desc = "A directory write to the Level-1 Instruction cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tfrom On-Chip memory.", ++ }, ++ { ++ .ctrnum = 181, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "ICW_ON_MODULE_MEMORY", ++ .desc = "A directory write to the Level-1 Instruction cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tfrom On-Module memory.", ++ }, ++ { ++ .ctrnum = 182, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "ICW_ON_DRAWER_MEMORY", ++ .desc = "A directory write to the Level-1 Instruction cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tfrom On-Drawer memory.", ++ }, ++ { ++ .ctrnum = 183, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "ICW_OFF_DRAWER_MEMORY", ++ .desc = "A directory write to the Level-1 Instruction cache" ++ "\n\t\tdirectory where the returned cache line was sourced" ++ "\n\t\tfrom Off-Drawer memory.", ++ }, ++ { ++ .ctrnum = 224, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "BCD_DFP_EXECUTION_SLOTS", ++ .desc = "Count of floating point execution slots used for" ++ "\n\t\tfinished Binary Coded Decimal to Decimal Floating" ++ "\n\t\tPoint conversions. Instructions: CDZT, CXZT, CZDT," ++ "\n\t\tCZXT.", ++ }, ++ { ++ .ctrnum = 225, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "VX_BCD_EXECUTION_SLOTS", ++ .desc = "Count of floating point execution slots used for" ++ "\n\t\tfinished vector arithmetic Binary Coded Decimal" ++ "\n\t\tinstructions. Instructions: VAP, VSP, VMP, VMSP," ++ "\n\t\tVDP, VSDP, VRP, VLIP, VSRP, VPSOP, VCP, VTP, VPKZ," ++ "\n\t\tVUPKZ, VCVB, VCVBG, VCVD, VCVDG.", ++ }, ++ { ++ .ctrnum = 226, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "DECIMAL_INSTRUCTIONS", ++ .desc = "Decimal instruction dispatched. Instructions: CVB," ++ "\n\t\tCVD, AP, CP, DP, ED, EDMK, MP, SRP, SP, ZAP.", ++ }, ++ { ++ .ctrnum = 232, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "LAST_HOST_TRANSLATIONS", ++ .desc = "Last Host Translation done", ++ }, ++ { ++ .ctrnum = 244, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "TX_NC_TABORT", ++ .desc = "A transaction abort has occurred in a non-" ++ "\n\t\tconstrained transactional-execution mode.", ++ }, ++ { ++ .ctrnum = 245, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "TX_C_TABORT_NO_SPECIAL", ++ .desc = "A transaction abort has occurred in a constrained" ++ "\n\t\ttransactional-execution mode and the CPU is not" ++ "\n\t\tusing any special logic to allow the transaction to" ++ "\n\t\tcomplete.", ++ }, ++ { ++ .ctrnum = 246, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "TX_C_TABORT_SPECIAL", ++ .desc = "A transaction abort has occurred in a constrained" ++ "\n\t\ttransactional-execution mode and the CPU is using" ++ "\n\t\tspecial logic to allow the transaction to complete.", ++ }, ++ { ++ .ctrnum = 248, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "DFLT_ACCESS", ++ .desc = "Cycles CPU spent obtaining access to Deflate unit", ++ }, ++ { ++ .ctrnum = 253, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "DFLT_CYCLES", ++ .desc = "Cycles CPU is using Deflate unit", ++ }, ++ { ++ .ctrnum = 256, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "SORTL", ++ .desc = "Increments by one for every SORT LISTS instruction" ++ "\n\t\texecuted.", ++ }, ++ { ++ .ctrnum = 265, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "DFLT_CC", ++ .desc = "Increments by one for every DEFLATE CONVERSION CALL" ++ "\n\t\tinstruction executed.", ++ }, ++ { ++ .ctrnum = 266, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "DFLT_CCFINISH", ++ .desc = "Increments by one for every DEFLATE CONVERSION CALL" ++ "\n\t\tinstruction executed that ended in Condition Codes" ++ "\n\t\t0, 1 or 2.", ++ }, ++ { ++ .ctrnum = 267, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "NNPA_INVOCATIONS", ++ .desc = "Increments by one for every Neural Network" ++ "\n\t\tProcessing Assist instruction executed.", ++ }, ++ { ++ .ctrnum = 268, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "NNPA_COMPLETIONS", ++ .desc = "Increments by one for every Neural Network" ++ "\n\t\tProcessing Assist instruction executed that ended" ++ "\n\t\tin Condition Codes 0, 1 or 2.", ++ }, ++ { ++ .ctrnum = 269, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "NNPA_WAIT_LOCK", ++ .desc = "Cycles CPU spent obtaining access to IBM Z" ++ "\n\t\tIntegrated Accelerator for AI.", ++ }, ++ { ++ .ctrnum = 270, ++ .ctrset = CPUMF_CTRSET_EXTENDED, ++ .name = "NNPA_HOLD_LOCK", ++ .desc = "Cycles CPU is using IBM Z Integrated Accelerator" ++ "\n\t\tfor AI.", ++ }, ++ { ++ .ctrnum = 448, ++ .ctrset = CPUMF_CTRSET_MT_DIAG, ++ .name = "MT_DIAG_CYCLES_ONE_THR_ACTIVE", ++ .desc = "Cycle count with one thread active", ++ }, ++ { ++ .ctrnum = 449, ++ .ctrset = CPUMF_CTRSET_MT_DIAG, ++ .name = "MT_DIAG_CYCLES_TWO_THR_ACTIVE", ++ .desc = "Cycle count with two threads active", ++ }, ++}; ++ + /* Return the type number of the CPU Measurement facility from the sysfs file. + * If the type number is equal to PERF_TYPE_RAW, then the prefix is 'r' to + * specify the raw counter number by the perf tool. +@@ -2991,6 +3571,9 @@ + *len = ARRAY_SIZE(cpumcf_z15_counters); + read_ccerror(cp, *len); + break; ++ case UTIL_ARCH_MACHINE_TYPE_Z16: ++ cp = cpumcf_z16_counters; ++ *len = ARRAY_SIZE(cpumcf_z16_counters); + } + break; + } diff -Nru s390-tools-2.20.0/debian/patches/fcb503e-dbginfo.sh-sync-excludes-in-sysfs-data-collection.patch s390-tools-2.20.0/debian/patches/fcb503e-dbginfo.sh-sync-excludes-in-sysfs-data-collection.patch --- s390-tools-2.20.0/debian/patches/fcb503e-dbginfo.sh-sync-excludes-in-sysfs-data-collection.patch 1970-01-01 00:00:00.000000000 +0000 +++ s390-tools-2.20.0/debian/patches/fcb503e-dbginfo.sh-sync-excludes-in-sysfs-data-collection.patch 2022-05-20 11:48:34.000000000 +0000 @@ -0,0 +1,63 @@ +From fcb503ea3c9bd8612726aaea9d46e98af86fc049 Mon Sep 17 00:00:00 2001 +From: Joern Siglen +Date: Fri, 4 Feb 2022 12:15:02 +0100 +Subject: [PATCH] dbginfo.sh: sync excludes in sysfs data collection +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +critical paths in dump2tar data collection have been already excluded - +this update will sync the excludes in the fall back, running in case +dump2tar is missing or failing on a system +By this we also sync the filtering to match exact the same pattern. + +Reported by: Steffen Maier +Signed-off-by: Joern Siglen +Reviewed-by: Sa Liu + +Fixes: 12c84469fd02 ("dbginfo.sh: exclude reading page_idle/bitmap sysfs +attribute") +Fixes: b627b8d8e1ab ("Initial s390-tools-2.0.0 import") + +Signed-off-by: Jan Höppner + +Origin: upstream, https://github.com/ibm-s390-tools/s390-tools/commit/fcb503ea3c9bd8612726aaea9d46e98af86fc049 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1971959 +Last-Update: 2022-05-25 + +--- + scripts/dbginfo.sh | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/scripts/dbginfo.sh b/scripts/dbginfo.sh +index 59f040f2..6cfa4b83 100755 +--- a/scripts/dbginfo.sh ++++ b/scripts/dbginfo.sh +@@ -743,8 +743,10 @@ collect_sysfs() { + # more than 5 seconds (-T 5) such as an active ftrace buffer. + # error messages are not written to the log + dump2tar /sys -z -o "${OUTPUT_FILE_SYSFS}.tgz" \ +- -x '*/tracing/trace_pipe*' -x '*/page_idle/bitmap*' \ +- -x '*/tracing/per_cpu/*' --ignore-failed-read -J 1 -T 5 2>>${OUTPUT_FILE_SYSFS}.err ++ -x '*/tracing/trace_pipe*' \ ++ -x '*/page_idle/bitmap*' \ ++ -x '*/tracing/per_cpu/*' \ ++ --ignore-failed-read -J 1 -T 5 2>>${OUTPUT_FILE_SYSFS}.err + + if [ $? -ne 0 ] ; then + echo "${SCRIPTNAME}: Warning: dump2tar failed or is unavailable" +@@ -756,7 +758,10 @@ collect_sysfs() { + mkdir -p "${WORKPATH}${dir_name}" + done + +- find /sys -noleaf -type f -perm /444 -a -not -name "*trace_pipe*"\ ++ find /sys -noleaf -type f -perm /444 \ ++ -a -not \( -path '*tracing*' -a -name "trace_pipe*" \) \ ++ -a -not \( -path '*page_idle*' -a -name 'bitmap*' \) \ ++ -a -not -path '*tracing/per_cpu*' \ + 2>/dev/null | while IFS= read -r file_name; do + echo " ${file_name}" + if ! dd if="${file_name}" status=noxfer iflag=nonblock \ +-- +2.25.1 + diff -Nru s390-tools-2.20.0/debian/patches/series s390-tools-2.20.0/debian/patches/series --- s390-tools-2.20.0/debian/patches/series 2022-04-12 09:54:53.000000000 +0000 +++ s390-tools-2.20.0/debian/patches/series 2022-05-20 11:48:34.000000000 +0000 @@ -14,4 +14,39 @@ 0906293c-genprotimg-enable-pckmo-and-disable-pckmo-are-mutual.patch 5394cd36-genprotimg-add-PV-guest-dump-support.patch 78b0533-genprotimg-remove-DigiCert-root-CA-pinning.patch + +# LP: #1971993 673ff37-genprotimg-check_hostkeydoc-relax-default-issuer-che.patch + +# LP: #1960119 +0d15a07-chreipl-fcp-mpath-bundle-a-pre-cooked-man-page.patch +2515832-util_arch-Add-IBM-z16-as-known-machine.patch + +# LP: #1959548 +cce5f51-cpumf-lscpumf-Add-IBM-z16-extended-counter-set-def.patch +b16a6d4f-lszcrypt-add-CEX8S-support.patch +bcbb6fca-zcryptstats-add-CEX8-support.patch +4382901d-lszcrypt-show-AP-bus-msg-size-limit-capability.patch +27dce331-lszcrypt-add-support-for-checkstop-state.patch +a29b3c89-lszcrypt-new-options-to-show-only-accel-cca-or-ep11-.patch +a8b0d7ac-lszcrypt-new-options-to-filter-cards-queues-only.patch +46fd42af-lszcrypt-new-option-to-show-the-serial-numbers-of-CC.patch + +# LP: #1971959 +3a13cb4-dbginfo.sh-unify-console-output.patch +2eea614-dbginfo.sh-unify-indents-prettify-code.patch +fcb503e-dbginfo.sh-sync-excludes-in-sysfs-data-collection.patch +abec41f-dbginfo.sh-alphabetic-order-of-log-and-config-files.patch +164d481-dbginfo.sh-check-existence-of-dump2tar-before-execut.patch +50a4740-dbginfo.sh-replace-which-by-builtin-command-type-for.patch +2ab27bd-dbginfo.sh-update-copyright-date.patch +a8579a0-dbginfo.sh-replace-indents-with-8char-tab.patch +81920f7-dbginfo.sh-re-group-commands-for-network.patch +a0d6edf-dbginfo.sh-re-group-commands-by-long-output.patch +812df79-dbginfo.sh-re-group-commands-by-topic.patch +2677a41-dbginfo.sh-re-group-commands-by-system-state.patch +be47b51-dbginfo.sh-re-group-commands-by-z-device.patch +02a0d12-dbginfo.sh-re-group-commands-by-block-scsi.patch + +# LP: #1978323 +0981df6-cmsfs-fuse-fix-enabling-of-hard_remove-option.patch diff -Nru s390-tools-2.20.0/debian/rules s390-tools-2.20.0/debian/rules --- s390-tools-2.20.0/debian/rules 2022-02-06 10:27:24.000000000 +0000 +++ s390-tools-2.20.0/debian/rules 2022-05-20 11:48:34.000000000 +0000 @@ -26,14 +26,14 @@ dh_install -ps390-tools-statd dh_install -ps390-tools-osasnmpd dh_install -ps390-tools-zkey - dh_install $(if $(SIGN_SIPL),-Xstage3.bin) -Xcpuplugd -Xosasnmpd -Xprocd -Xfsstatd -X60-readahead.rules -Xzkey + dh_install -ps390-tools-chreipl-fcp-mpath + dh_install $(if $(SIGN_SIPL),-Xstage3.bin) -Xcpuplugd -Xosasnmpd -Xprocd -Xfsstatd -X60-readahead.rules -Xzkey -Xchreipl-fcp-mpath $(if $(SIGN_SIPL),echo 'signing:Depends=s390-tools-signed (= $(DEB_VERSION))') >> debian/s390-tools.substvars override_dh_fixperms: dh_fixperms chmod 644 debian/s390-tools-zkey/usr/libexec/zkey/zkey-ekmfweb.so chmod 644 debian/s390-tools-zkey/usr/libexec/zkey/zkey-kmip.so - chmod 755 debian/s390-tools-chreipl-fcp-mpath/usr/lib/chreipl-fcp-mpath/chreipl-fcp-mpath-common.sh override_dh_auto_clean: rm -f zipl/boot/.*.d diff -Nru s390-tools-2.20.0/debian/s390-tools-chreipl-fcp-mpath.docs s390-tools-2.20.0/debian/s390-tools-chreipl-fcp-mpath.docs --- s390-tools-2.20.0/debian/s390-tools-chreipl-fcp-mpath.docs 1970-01-01 00:00:00.000000000 +0000 +++ s390-tools-2.20.0/debian/s390-tools-chreipl-fcp-mpath.docs 2022-05-20 11:48:34.000000000 +0000 @@ -0,0 +1 @@ +chreipl-fcp-mpath/README.md diff -Nru s390-tools-2.20.0/debian/s390-tools-chreipl-fcp-mpath.install s390-tools-2.20.0/debian/s390-tools-chreipl-fcp-mpath.install --- s390-tools-2.20.0/debian/s390-tools-chreipl-fcp-mpath.install 2022-02-06 10:27:24.000000000 +0000 +++ s390-tools-2.20.0/debian/s390-tools-chreipl-fcp-mpath.install 2022-05-20 11:48:34.000000000 +0000 @@ -1,3 +1,4 @@ usr/lib/chreipl-fcp-mpath/chreipl-fcp-mpath-common.sh -usr/lib/udev/chreipl-fcp-mpath* /lib/udev/rules.d +usr/lib/udev/chreipl-fcp-mpath* /lib/udev usr/lib/udev/rules.d/*chreipl-fcp-mpath*.rules /lib/udev/rules.d +usr/share/man/man7/chreipl-fcp-mpath* diff -Nru s390-tools-2.20.0/debian/s390-tools.docs s390-tools-2.20.0/debian/s390-tools.docs --- s390-tools-2.20.0/debian/s390-tools.docs 2022-01-31 11:54:24.000000000 +0000 +++ s390-tools-2.20.0/debian/s390-tools.docs 2022-05-20 11:48:34.000000000 +0000 @@ -1,2 +1,3 @@ README.md CHANGELOG.md +genprotimg/README.md /usr/share/s390-tools/genprotimg diff -Nru s390-tools-2.20.0/debian/s390-tools.install s390-tools-2.20.0/debian/s390-tools.install --- s390-tools-2.20.0/debian/s390-tools.install 2022-02-06 10:27:24.000000000 +0000 +++ s390-tools-2.20.0/debian/s390-tools.install 2022-05-20 11:48:34.000000000 +0000 @@ -40,3 +40,6 @@ # lsstp /sbin/lsstp /usr/share/man/man8/lsstp.8 + +# readme +genprotimg/README.md /usr/share/s390-tools/genprotimg