Initial s390-tools-2.0.0 import

This commit is based on the s390-tools-1.39.0 version.

Changes on top of s390-tools-1.39.0:

 - Add MIT license to all source files
 - Add LICENSE file
 - Transform REAMDE to README.md (markdown)
 - Add AUTHORS.md file
 - Add CONTRIBUTING.md file
 - Move changelog from README to CHANGELOG.md file

Reviewed-by: Stefan Haberland <sth@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
This commit is contained in:
Michael Holzheu
2017-08-07 16:13:17 +02:00
commit b627b8d8e1
647 changed files with 168974 additions and 0 deletions

27
scripts/Makefile Normal file
View File

@@ -0,0 +1,27 @@
include ../common.mak
SCRIPTS = dbginfo.sh zfcpdbf scsi_logging_level
MAN_PAGES = dbginfo.sh.1 zfcpdbf.1
all:
install:
$(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1
@for i in $(SCRIPTS); \
do \
cat $$i | \
sed -e 's+%S390_TOOLS_VERSION%+$(S390_TOOLS_RELEASE)+' \
>$(DESTDIR)$(BINDIR)/$$i; \
chown $(OWNER):$(GROUP) $(DESTDIR)$(BINDIR)/$$i; \
chmod 755 $(DESTDIR)$(BINDIR)/$$i; \
done
@for i in $(MAN_PAGES); \
do \
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 644 $$i \
$(DESTDIR)$(MANDIR)/man1; \
done
clean:
.PHONY: all install clean

1129
scripts/dbginfo.sh Executable file

File diff suppressed because it is too large Load Diff

97
scripts/dbginfo.sh.1 Normal file
View File

@@ -0,0 +1,97 @@
.TH DBGINFO.SH 1 "February 2017" "s390-tools"
.SH NAME
dbginfo.sh \- collect runtime, configuration and trace information
for debugging Linux on System z
.SH SYNOPSIS
.br
\fBdbginfo.sh\fP [OPTIONS]
.br
\fBdbginfo.sh\fP {\-h|\-v}
.SH DESCRIPTION
This script collects runtime, configuration and trace information that can
be used to debug a Linux on System z instance.
For Linux on z/VM, the script also traces information about the z/VM system.
The debug information is written to a file
/tmp/DBGINFO\-<date>\-<time>\-<hostname>\-<processorid>.tgz
where [date] and [time] are the date and time when the debug data was
collected. [hostname] indicates the hostname of the system the data was
collected from. The [processorid] is taken from the processor 0 and indicates
the processor identification.
.SH OPTIONS
.TP
\fB\-h\fP, \fB\-\-help\fP
Print usage information, then exit.
.TP
\fB\-v\fP, \fB\-\-version\fP
Print version information, then exit.
.TP
\fB\-d <DIRECTORY>\fP, \fB\-\-directory <DIRECTORY>\fP
Specify the DIRECTORY where the data collection stores the temporary data and the final archive. The specified directory must already exist. If this parameter is not specified, /tmp is used by default.
.SH FILES
A .tgz file of the form
.PP
.nf
.fam C
DBGINFO\-<year>\-<month>\-<day>\-<hours>\-<minutes>\-<seconds>\-<hostname>\-<processorid>.tgz
.fam T
.fi
is generated and placed in the /tmp directory or in the directory specified by the -d option.
.SH EXAMPLE
Sample invocation:
.P
[root@host]# dbginfo.sh \-d /data\-collection
.br
dbginfo.sh: Debug information script version %S390_TOOLS_VERSION%
.br
Copyright IBM Corp. 2002, 2017
.PP
Hardware platform = s390x
.br
Kernel version = <kernel\-version>
.br
Runtime environment = z/VM
.PP
1 of 11: Collecting command output
.PP
2 of 11: Collecting z/VM command output
.PP
3 of 11: Collecting procfs
.PP
4 of 11: Collecting sysfs
.PP
5 of 11: Collecting log files
.PP
6 of 11: Collecting config files
.PP
7 of 11: Collecting osa oat output skipped \- not available
.PP
8 of 11: Collecting OpenVSwitch output
.PP
9 of 11: Collecting domain xml files
.PP
10a of 11: Collecting docker container output
10b of 11: Collecting docker network output
.PP
11 of 11: Postprocessing
.PP
Finalizing: Creating archive with collected data
.PP
Collected data was saved to:
.br
>> /data\-collection/DBGINFO\-2015\-02\-26\-21\-39\-16\-host\-012345.tgz <<
.SH HINTS
Run the script with root authority.
.br
For Linux on z/VM, only z/VM guest virtual machines with class B privileges
yield the complete debug information.
.SH AUTHOR
Linux on System z development <linux390@de.ibm.com>

278
scripts/scsi_logging_level Executable file
View File

@@ -0,0 +1,278 @@
#!/bin/bash
#
# scsi_logging_level - Conveniently create and set scsi logging level,
# show SCSI_LOG fields in human readable form
#
# Copyright IBM Corp. 2006, 2017
#
# s390-tools is free software; you can redistribute it and/or modify
# it under the terms of the MIT license. See LICENSE for details.
#
SCRIPTNAME="scsi_logging_level"
declare -i LOG_ERROR=0
declare -i LOG_TIMEOUT=0
declare -i LOG_SCAN=0
declare -i LOG_MLQUEUE=0
declare -i LOG_MLCOMPLETE=0
declare -i LOG_LLQUEUE=0
declare -i LOG_LLCOMPLETE=0
declare -i LOG_HLQUEUE=0
declare -i LOG_HLCOMPLETE=0
declare -i LOG_IOCTL=0
declare -i LEVEL=0
_ERROR_SHIFT=0
_TIMEOUT_SHIFT=3
_SCAN_SHIFT=6
_MLQUEUE_SHIFT=9
_MLCOMPLETE_SHIFT=12
_LLQUEUE_SHIFT=15
_LLCOMPLETE_SHIFT=18
_HLQUEUE_SHIFT=21
_HLCOMPLETE_SHIFT=24
_IOCTL_SHIFT=27
SET=0
GET=0
CREATE=0
OPTS=`getopt -o hvcgsa:E:T:S:I:M:L:H: --long \
help,version,create,get,set,all:,error:,timeout:,scan:,ioctl:,\
midlevel:,mlqueue:,mlcomplete:,lowlevel:,llqueue:,llcomplete:,\
highlevel:,hlqueue:,hlcomplete: -n \'$SCRIPTNAME\' -- "$@"`
eval set -- "$OPTS"
# print version info
printversion()
{
cat <<EOF
$SCRIPTNAME: version %S390_TOOLS_VERSION%
Copyright IBM Corp. 2006, 2017
EOF
}
# print usage and help
printhelp()
{
cat <<EOF
Usage: $SCRIPTNAME [OPTIONS]
Create, get or set scsi logging level.
Options:
-h, --help print this help
-v, --version print version information
-s, --set create and set logging level as specified on
command line
-g, --get get current logging level and display it
-c, --create create logging level as specified on command line
-a, --all specify value for all SCSI_LOG fields
-E, --error specify SCSI_LOG_ERROR
-T, --timeout specify SCSI_LOG_TIMEOUT
-S, --scan specify SCSI_LOG_SCAN
-M, --midlevel specify SCSI_LOG_MLQUEUE and SCSI_LOG_MLCOMPLETE
--mlqueue specify SCSI_LOG_MLQUEUE
--mlcomplete specify SCSI_LOG_MLCOMPLETE
-L, --lowlevel specify SCSI_LOG_LLQUEUE and SCSI_LOG_LLCOMPLETE
--llqueue specify SCSI_LOG_LLQUEUE
--llcomplete specify SCSI_LOG_LLCOMPLETE
-H, --highlevel specify SCSI_LOG_HLQUEUE and SCSI_LOG_HLCOMPLETE
--hlqueue specify SCSI_LOG_HLQUEUE
--hlcomplete specify SCSI_LOG_HLCOMPLETE
-I, --ioctl specify SCSI_LOG_IOCTL
Exactly one of the options "-c", "-g" and "-s" has to be specified.
Valid values for SCSI_LOG fields are integers from 0 to 7.
Note: Several SCSI_LOG fields can be specified using several options.
When multiple options specify same SCSI_LOG field the most specific
option has precedence.
Example: "scsi_logging_level --hlqueue 3 --hlcomplete 2 --all 1 -s" sets
SCSI_LOG_HLQUEUE=3, SCSI_LOG_HLCOMPLETE=2 and assigns all other SCSI_LOG
fields the value 1.
EOF
}
check_level()
{
if [ `echo -n $1 | tr --complement [:digit:] 'a' | grep -s 'a'` ]
then
invalid_cmdline "log level '$1' out of range [0, 7]"
fi
if [ $1 -lt 0 -o $1 -gt 7 ]
then
invalid_cmdline "log level '$1' out of range [0, 7]"
fi
}
# check cmd line arguments
check_cmdline()
{
while true ; do
case "$1" in
-a|--all) _ALL=$2; check_level $2
shift 2;;
-c|--create) CREATE=1;
shift 1;;
-g|--get) GET=1
shift 1;;
-h|--help) printhelp
exit 0;;
-s|--set) SET=1
shift 1;;
-v|--version) printversion
exit 0;;
-E|--error) _ERROR=$2; check_level $2
shift 2;;
-T|--timeout) _TIMEOUT=$2; check_level $2
shift 2;;
-S|--scan) _SCAN=$2; check_level $2
shift 2;;
-M|--midlevel) _ML=$2; check_level $2
shift 2;;
--mlqueue) _MLQUEUE=$2; check_level $2
shift 2;;
--mlcomplete) _MLCOMPLETE=$2; check_level $2
shift 2;;
-L|--lowlevel) _LL=$2; check_level $2
shift 2;;
--llqueue) _LLQUEUE=$2; check_level $2
shift 2;;
--llcomplete) _LLCOMPLETE=$2; check_level $2
shift 2;;
-H|--highlevel) _HL=$2; check_level $2
shift 2;;
--hlqueue) _HLQUEUE=$2; check_level $2
shift 2;;
--hlcomplete) _HLCOMPLETE=$2; check_level $2
shift 2;;
-I|--ioctl) _IOCTL=$2; check_level $2
shift 2;;
--) shift; break;;
*) echo "Internal error!" ; exit 1;;
esac
done
if [ -n "$*" ]
then
invalid_cmdline invalid parameter $*
fi
if [ $GET = "1" -a $SET = "1" ]
then
invalid_cmdline options \'-c\', \'-g\' and \'-s\' are mutual exclusive
elif [ $GET = "1" -a $CREATE = "1" ]
then
invalid_cmdline options \'-c\', \'-g\' and \'-s\' are mutual exclusive
elif [ $SET = "1" -a $CREATE = "1" ]
then
invalid_cmdline options \'-c\', \'-g\' and \'-s\' are mutual exclusive
fi
LOG_ERROR=${_ERROR:-${_ALL:-0}}
LOG_TIMEOUT=${_TIMEOUT:-${_ALL:-0}}
LOG_SCAN=${_SCAN:-${_ALL:-0}}
LOG_MLQUEUE=${_MLQUEUE:-${_ML:-${_ALL:-0}}}
LOG_MLCOMPLETE=${_MLCOMPLETE:-${_ML:-${_ALL:-0}}}
LOG_LLQUEUE=${_LLQUEUE:-${_LL:-${_ALL:-0}}}
LOG_LLCOMPLETE=${_LLCOMPLETE:-${_LL:-${_ALL:-0}}}
LOG_HLQUEUE=${_HLQUEUE:-${_HL:-${_ALL:-0}}}
LOG_HLCOMPLETE=${_HLCOMPLETE:-${_HL:-${_ALL:-0}}}
LOG_IOCTL=${_IOCTL:-${_ALL:-0}}
}
invalid_cmdline()
{
echo "$SCRIPTNAME: $*"
echo "$SCRIPTNAME: Try '$SCRIPTNAME --help' for more information."
exit 1
}
get_logging_level()
{
echo "Current scsi logging level:"
LEVEL=`sysctl -n dev.scsi.logging_level`
if [ $? != 0 ]
then
echo "$SCRIPTNAME: could not read scsi logging level" \
"(kernel probably without SCSI_LOGGING support)"
exit 1
fi
}
show_logging_level()
{
echo "dev.scsi.logging_level = $LEVEL"
LOG_ERROR=$((($LEVEL>>$_ERROR_SHIFT) & 7))
LOG_TIMEOUT=$((($LEVEL>>$_TIMEOUT_SHIFT) & 7))
LOG_SCAN=$((($LEVEL>>$_SCAN_SHIFT) & 7))
LOG_MLQUEUE=$((($LEVEL>>$_MLQUEUE_SHIFT) & 7))
LOG_MLCOMPLETE=$((($LEVEL>>$_MLCOMPLETE_SHIFT) & 7))
LOG_LLQUEUE=$((($LEVEL>>$_LLQUEUE_SHIFT) & 7))
LOG_LLCOMPLETE=$((($LEVEL>>$_LLCOMPLETE_SHIFT) & 7))
LOG_HLQUEUE=$((($LEVEL>>$_HLQUEUE_SHIFT) & 7))
LOG_HLCOMPLETE=$((($LEVEL>>$_HLCOMPLETE_SHIFT) & 7))
LOG_IOCTL=$((($LEVEL>>$_IOCTL_SHIFT) & 7))
echo "SCSI_LOG_ERROR=$LOG_ERROR"
echo "SCSI_LOG_TIMEOUT=$LOG_TIMEOUT"
echo "SCSI_LOG_SCAN=$LOG_SCAN"
echo "SCSI_LOG_MLQUEUE=$LOG_MLQUEUE"
echo "SCSI_LOG_MLCOMPLETE=$LOG_MLCOMPLETE"
echo "SCSI_LOG_LLQUEUE=$LOG_LLQUEUE"
echo "SCSI_LOG_LLCOMPLETE=$LOG_LLCOMPLETE"
echo "SCSI_LOG_HLQUEUE=$LOG_HLQUEUE"
echo "SCSI_LOG_HLCOMPLETE=$LOG_HLCOMPLETE"
echo "SCSI_LOG_IOCTL=$LOG_IOCTL"
}
set_logging_level()
{
echo "New scsi logging level:"
sysctl -q -w dev.scsi.logging_level=$LEVEL
if [ $? != 0 ]
then
echo "$SCRIPTNAME: could not write scsi logging level" \
"(kernel probably without SCSI_LOGGING support)"
exit 1
fi
}
create_logging_level()
{
LEVEL=$((($LOG_ERROR & 7)<<$_ERROR_SHIFT))
LEVEL=$(($LEVEL|(($LOG_TIMEOUT & 7)<<$_TIMEOUT_SHIFT)))
LEVEL=$(($LEVEL|(($LOG_SCAN & 7)<<$_SCAN_SHIFT)))
LEVEL=$(($LEVEL|(($LOG_MLQUEUE & 7)<<$_MLQUEUE_SHIFT)))
LEVEL=$(($LEVEL|(($LOG_MLCOMPLETE & 7)<<$_MLCOMPLETE_SHIFT)))
LEVEL=$(($LEVEL|(($LOG_LLQUEUE & 7)<<$_LLQUEUE_SHIFT)))
LEVEL=$(($LEVEL|(($LOG_LLCOMPLETE & 7)<<$_LLCOMPLETE_SHIFT)))
LEVEL=$(($LEVEL|(($LOG_HLQUEUE & 7)<<$_HLQUEUE_SHIFT)))
LEVEL=$(($LEVEL|(($LOG_HLCOMPLETE & 7)<<$_HLCOMPLETE_SHIFT)))
LEVEL=$(($LEVEL|(($LOG_IOCTL & 7)<<$_IOCTL_SHIFT)))
}
check_cmdline $*
if [ $SET = "1" ]
then
create_logging_level
set_logging_level
show_logging_level
elif [ $GET = "1" ]
then
get_logging_level
show_logging_level
elif [ $CREATE = "1" ]
then
create_logging_level
show_logging_level
else
invalid_cmdline missing option \'-g\', \'-s\' or \'-c\'
fi

1278
scripts/zfcpdbf Executable file

File diff suppressed because it is too large Load Diff

99
scripts/zfcpdbf.1 Normal file
View File

@@ -0,0 +1,99 @@
.\" Copyright 2017 IBM Corp.
.\" s390-tools is free software; you can redistribute it and/or modify
.\" it under the terms of the MIT license. See LICENSE for details.
.\"
.TH ZFCPDBF 1 "DEC 2010, JUL 2016" "s390-tools"
.SH NAME
zfcpdbf \- zfcp trace data sort/analyse tool.
.SH SYNOPSIS
.br
\fBzfcpdbf\fR [OPTIONS] <adapter>
.br
\fBzfcpdbf\fR {-h|-v}
.SH DESCRIPTION
\fBzfcpdbf\fR Interprets the information from various logging and tracing sources,
e.g. zfcp-, qdio- and cio-trace records and, if available, system messages.
With offline debug data, such as collected by \fBdbginfo.sh\fR or
extracted from a Linux system dump with \fBcrash\fR version 5.1.0 or
later, zfcpdbf can run on any platform with a suitable Perl language
environment.
Any zfcpdbf since version 1.13.0 works with debug data from any Linux
kernel since version 2.6.38. Recent zfcpdbf versions with older kernel
versions show zeros or empty values for newer trace record fields the
old kernel did not yet have. Older zfcpdbf versions with recent kernel
versions simply show the old trace records fields zfcpdbf already
knows about and ignores any newer trace record fields of the kernel.
For full exploitation, it is recommended to always use the latest
version of zfcpdbf no matter from which kernel version the debug data is.
.SH OPTIONS
.TP
\fB-h\fR, \fB--help\fR
Print usage information, then exit.
.TP
\fB-v\fR, \fB--version\fR
Print version information, then exit.
.TP
\fB-x <AREA[,AREA]>\fR, \fB--exclude=<AREA[,AREA]>\fR
list of trace areas to exclude (default none).
.TP
\fB-i <AREA[,AREA]>\fR, \fB--include=<AREA[,AREA]>\fR
list of trace areas to include (default all).
.TP
\fB-z \fR, \fB--zfcp-only\fR
zfcp trace areas only (short cut).
.TP
\fB-t <DIFF>\fR, \fB--timediff=<DIFF>\fR
highlight requests with a round-trip processing time of <DIFF> or more.
.TP
\fB-e\fR, \fB--def-error\fR
do NOT show deferred error messages.
.TP
\fB-f\fR, \fB--force\fR
force execution on a detected version mismatch.
.TP
\fB-p <PATH>\fR, \fB--path=<PATH>\fR
use directory <PATH> for the location of the trace records.
.TP
\fB-r <PATH>\fR, \fB--root=<PATH>\fR
prepend <ROOT> to standard trace record location.
.TP
\fB-m <ZONE>\fR, \fB--timezone=<ZONE>\fR
set time zone for system message timestamps.
.SH PARAMETERS
<AREA> may be REC, HBA, SAN, SCSI, QDIO, QDIO_SETUP, QDIO_ERROR,
CIO_TRACE, CIO_MSG, CIO_CRW, KERNEL or MULTIPATH.
<DIFF> is the value in seconds which has to be lapsed between sending the request
and receiving its response.
<PATH> is specifying the location(directory) of trace records which were pulled
from another system, e.g. pulled from a dump.
<ROOT> is specifying a directory which has to be prepended to the standard
location of the trace records, e.g. typically used in conjunction with
the result of the dbginfo script.
<PATH> and <ROOT> are only useful if used on non-live systems and therefore
typically used by service- or development-staff.
<ZONE> is a time zone value in the [+-][h]h[:mm] format.
<adapter> aka busid is specifying the host adapter of which the trace information should be processed. if a 4-digit value is provided it is automaitically extended to the correct format 0f 0.0.xxxx.