From 0e0d01b0a0941669fa1987fe1c48da3ede3f4325f5a289b6278bc8c83dfde802 Mon Sep 17 00:00:00 2001 From: Mark Post Date: Fri, 24 Aug 2018 18:54:31 +0000 Subject: [PATCH] - dasd_reload: * Fixed several syntax errors. * Changed the script to ensure that the DASD volume are actually activated in device number order. * Check for 41-dasd--.rules in addition to the original 51-dasd-.rules. If an old 51-dasd-.rules file is found, rename it to obsolete-51-dasd-.rules, and use chzdev to generate a new rules file. (bsc#1103407) - Added the following patches for bsc#1098069: * s390-tools-sles15-dbginfo-add-data-for-ps-cpprot.patch * s390-tools-sles15-mon_procd-fix-parsing-of-proc-pid-stat.patch - Added the following patch (bsc#1094354) * customize-zdev-root-update-script.patch - Modified ctc_configure to not pass a "protcol=" parameter when configuring LCS devices. (bsc#1096520) OBS-URL: https://build.opensuse.org/package/show/Base:System/s390-tools?expand=0&rev=52 --- ctc_configure | 10 +- customize-zdev-root-update-script.patch | 13 +++ dasd_reload | 103 +++++++++++------- ...les15-dbginfo-add-data-for-ps-cpprot.patch | 69 ++++++++++++ ...n_procd-fix-parsing-of-proc-pid-stat.patch | 71 ++++++++++++ s390-tools.changes | 19 ++++ 6 files changed, 238 insertions(+), 47 deletions(-) create mode 100644 customize-zdev-root-update-script.patch create mode 100644 s390-tools-sles15-dbginfo-add-data-for-ps-cpprot.patch create mode 100644 s390-tools-sles15-mon_procd-fix-parsing-of-proc-pid-stat.patch diff --git a/ctc_configure b/ctc_configure index 0e1fdf1..3d4ee1f 100644 --- a/ctc_configure +++ b/ctc_configure @@ -88,11 +88,6 @@ if [ -z "${CTC_READ_CHAN}" ] || [ -z "${CTC_WRITE_CHAN}" ] || [ -z "${ON_OFF}" ] exit 1 fi -if [ -z "${CTC_MODE}" ]; then - PARM_LIST="${PARM_LIST} protocol=0" -else PARM_LIST="${PARM_LIST} protocol=${CTC_MODE}" -fi - if [ -f /sys/bus/ccw/devices/${CTC_READ_CHAN}/cutype ]; then read CU_TYPE < /sys/bus/ccw/devices/${CTC_READ_CHAN}/cutype else mesg "Psuedo file/sys/bus/ccw/devices/${CTC_READ_CHAN}/cutype doesn't exist." @@ -100,9 +95,14 @@ else mesg "Psuedo file/sys/bus/ccw/devices/${CTC_READ_CHAN}/cutype doesn't exist exit 1 fi +PARM_LIST="" if [ "${CU_TYPE}" == "3088/01" ] || [ "${CU_TYPE}" == "3088/60" ]; then DEV_TYPE="lcs" else DEV_TYPE="ctc" + if [ -z "${CTC_MODE}" ]; then + PARM_LIST="${PARM_LIST} protocol=0" + else PARM_LIST="${PARM_LIST} protocol=${CTC_MODE}" + fi fi if [ "${ON_OFF}" == 0 ]; then diff --git a/customize-zdev-root-update-script.patch b/customize-zdev-root-update-script.patch new file mode 100644 index 0000000..84fa8a2 --- /dev/null +++ b/customize-zdev-root-update-script.patch @@ -0,0 +1,13 @@ +--- s390-tools-2.1.0/zdev/src/zdev-root-update.dracut 2017-09-25 08:15:15.000000000 -0400 ++++ s390-tools-2.1.0/zdev/src/zdev-root-update.dracut 2018-08-23 21:33:40.847755927 -0400 +@@ -20,10 +20,4 @@ + exit 1 + } + +-echo "Installing IPL record" +-zipl --noninteractive || { +- echo "${TOOLNAME}: Error: Could not install IPL record" >&2 +- exit 1 +-} +- + exit 0 diff --git a/dasd_reload b/dasd_reload index 060a6fa..33abc04 100644 --- a/dasd_reload +++ b/dasd_reload @@ -50,16 +50,16 @@ fi dasd_alias= let EXITRC=0 for dev in /sys/bus/ccw/devices/*; do - if [ -f $dev/use_diag ]; then - read _online < $dev/online - read _alias < $dev/alias + if [ -f ${dev}/use_diag ]; then + read _online < ${dev}/online + read _alias < ${dev}/alias if [ "$_online" -eq 1 -a "$_alias" -eq 1 ]; then - echo "setting DASD HyperPAV alias $(basename $dev) offline" - echo "0" > $dev/online - read _online < $dev/online - dasd_alias="$dasd_alias $(basename $dev)" + echo "setting DASD HyperPAV alias $(basename ${dev}) offline" + echo "0" > ${dev}/online + read _online < ${dev}/online + dasd_alias="${dasd_alias} $(basename ${dev})" if [ "$_online" -eq 1 ]; then - echo "failure on setting DASD HyperPAV alias $(basename $dev) offline !" + echo "failure on setting DASD HyperPAV alias $(basename ${dev}) offline !" let EXITRC=4 fi fi @@ -71,16 +71,16 @@ done # dasd_base= for dev in /sys/bus/ccw/devices/*; do - if [ -f $dev/use_diag ]; then - read _online < $dev/online - read _alias < $dev/alias + if [ -f ${dev}/use_diag ]; then + read _online < ${dev}/online + read _alias < ${dev}/alias if [ "$_online" -eq 1 -a "$_alias" -eq 0 ]; then - echo "setting DASD $(basename $dev) offline" - echo "0" > $dev/online - read _online < $dev/online - dasd_base="$dasd_base $(basename $dev)" + echo "setting DASD $(basename ${dev}) offline" + echo "0" > ${dev}/online + read _online < ${dev}/online + dasd_base="${dasd_base} $(basename ${dev})" if [ "$_online" -eq 1 ]; then - echo "failure on setting DASD $(basename $dev) offline !" + echo "failure on setting DASD $(basename ${dev}) offline !" let EXITRC=4 fi fi @@ -91,46 +91,65 @@ udevadm settle module_list= module_test_list="dasd_diag_mod dasd_eckd_mod dasd_fba_mod dasd_mod" -for module in $module_test_list; do - if grep -q "$module" /proc/modules; then - module_list="$module $module_list" - : Unloading $module - /sbin/rmmod $module +for module in ${module_test_list}; do + if grep -q "${module}" /proc/modules; then + module_list="${module} ${module_list}" + : Unloading ${module} + /sbin/rmmod ${module} fi done +udevadm settle +sleep 2 + if [ -d /etc/udev/rules.d ]; then cd /etc/udev/rules.d # # Re-activating "normal" DASD and HyperPAV base devices # - for dasd in $dasd_base; do - file="51-dasd-${dasd}.rules" - if [ -f "$file" ] ; then - echo Activating $dasd - if grep -q use_diag $file ; then - DASD_USE_DIAG=1 - else - DASD_USE_DIAG=0 +# We need to move all the DASD udev rules out from /etc/udev/rules.d +# because if we don't, then when the first DASD volume gets brought +# back online, they are all brought back online, in a non-deterministic +# order, not the numeric order we expect. +# + mv -i 41-dasd-*.rules 51-dasd-*.rules /tmp + cd /tmp + for dasd in ${dasd_base}; do + for file in 41-dasd-*-${dasd}.rules 51-dasd-${dasd}.rules; do + [ -f "${file}" ] || continue +# +# Special handling is needed for old udev rules that start with 51- +# since the chzdev command won't look for that name +# + prefix="$(echo ${file} | cut -f1 -d-)" + if [ "${prefix}" == "51" ]; then + if [ -h /sys/bus/ccw/drivers/dasd-eckd/${dasd} ]; then + mv -i ${file} 41-dasd-eckd-${dasd}.rules + elif [ -h /sys/bus/ccw/drivers/dasd-fba/${dasd} ]; then + mv -i ${file} 41-dasd-fba-${dasd}.rules + else echo "DASD volume ${dasd} is neither an ECKD or FBA device." + let EXITRC=4 + fi fi - /sbin/dasd_configure $dasd 1 $DASD_USE_DIAG - fi + echo Activating ${dasd} + mv -i "${file}" /etc/udev/rules.d/ + /sbin/chzdev dasd --apply --configured -q --no-root-update ${dasd} + lsdasd + break + done done # # Re-activating HyperPAV alias devices # - for dasd in $dasd_alias; do - file="51-dasd-${dasd}.rules" - if [ -f "$file" ] ; then - echo Activating $dasd - if grep -q use_diag $file ; then - DASD_USE_DIAG=1 - else - DASD_USE_DIAG=0 - fi - /sbin/dasd_configure $dasd 1 $DASD_USE_DIAG - fi + for dasd in ${dasd_alias}; do + for file in 41-dasd-*-${dasd}.rules 51-dasd-${dasd}.rules; do + [ -f "${file}" ] || continue + echo Activating ${dasd} + mv -i "${file}" /etc/udev/rules.d/ + /sbin/chzdev dasd --apply --configured -q --no-root-update ${dasd} + break + done done fi diff --git a/s390-tools-sles15-dbginfo-add-data-for-ps-cpprot.patch b/s390-tools-sles15-dbginfo-add-data-for-ps-cpprot.patch new file mode 100644 index 0000000..5cb14b2 --- /dev/null +++ b/s390-tools-sles15-dbginfo-add-data-for-ps-cpprot.patch @@ -0,0 +1,69 @@ +Subject: [PATCH] [BZ 168517] dbginfo.sh: Extend data collection +From: Sa Liu + +Description: dbginfo.sh: Extend data collection +Symptom: This update covers various symptoms on dbginfo.sh data + collection: + - There is no data collected for docker. + - ps command does not show threads infomation. + - There is no run queue statistics and scheduler data. + - z/VM commands do not show multithread, protect + settings and SSI status. +Problem: Following problems exist: + - No analysis is possible for docker data. + - Missing thread information. + - Missing run queue statistics and scheduler data. + - Missing z/VM information. +Solution: - Extend the data collection to collect docker data + - Change ps command to show threads informaton + - Add commands to display run queue statistics and + scheduler data. + - Add z/VM commands to show multithread, protect settings + and SSI status. +Reproduction: Run this script and verify the output +Upstream-ID: - +Problem-ID: 168517 + +Signed-off-by: Sa Liu +--- + scripts/dbginfo.sh | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +--- a/scripts/dbginfo.sh ++++ b/scripts/dbginfo.sh +@@ -375,7 +375,8 @@ CMDS="uname -a\ + :runlevel\ + :iptables -L\ + :ulimit -a\ +- :ps -eo pid,tid,nlwp,policy,user,tname,ni,pri,psr,sgi_p,stat,wchan,start_time,time,pcpu,pmem,vsize,size,rss,share,command\ ++ :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\ + :dmesg -s 1048576\ + :last\ +@@ -470,6 +471,8 @@ VM_CMDS="q userid\ + :q privclass\ + :q cplevel\ + :q cpservice\ ++ :q cpprot user\ ++ :q specex\ + :q ssi\ + :q cpus\ + :q srm\ +@@ -508,6 +511,7 @@ VM_CMDS="q userid\ + :q cache\ + :q nic\ + :q pav\ ++ :q proc\ + :q proc topology\ + :q mt\ + :q qioass\ +@@ -831,7 +835,7 @@ post_processing() { + local tmp_file + local file_name + +- pr_syslog_stdout "11 of ${COLLECTION_COUNT}: Postprocessing" ++ pr_syslog_stdout "${COLLECTION_COUNT} of ${COLLECTION_COUNT}: Postprocessing" + + find "${WORKPATH}etc/libvirt/qemu/" -maxdepth 1 -name "*.xml" 2>/dev/null | while IFS= read -r file_name; do + file_mtime_epoche=$(stat --format=%Y "${file_name}") diff --git a/s390-tools-sles15-mon_procd-fix-parsing-of-proc-pid-stat.patch b/s390-tools-sles15-mon_procd-fix-parsing-of-proc-pid-stat.patch new file mode 100644 index 0000000..36abbcd --- /dev/null +++ b/s390-tools-sles15-mon_procd-fix-parsing-of-proc-pid-stat.patch @@ -0,0 +1,71 @@ +Subject: mon_procd: fix parsing of /proc//stat +From: Gerald Schaefer + +Description: mon_procd: fix parsing of /proc//stat +Symptom: Wrong data from /proc//stat for processes that contain + a ")" in their name. +Problem: The output of /proc//stat will show the process name in + parentheses. The parsing code in read_stat() tries to filter + out the parentheses, which will go wrong when the process name + itself also contains parentheses, e.g. in an output like this: + "2421 ((sd-pam)) S 2420 2420 2420 ..." + In this case, the first closing parentheses will be taken as + end marker, and the sscanf() on the remaining string will + silently fail, leaving its values in uninitialized state and + producing wrong data. +Solution: Use strrchr() instead of strchr() to find the last closing + parentheses. Also add return value checking for sscanf() and + initialize the values to 0. +Reproduction: Use mon_procd on a system with running processes that have a + ")" in their name, like "(sd-pam)". +Upstream-ID: - +Problem-ID: 169483 + +Signed-off-by: Gerald Schaefer +--- + mon_tools/mon_procd.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +--- a/mon_tools/mon_procd.c ++++ b/mon_tools/mon_procd.c +@@ -594,17 +594,18 @@ static void cal_task_pcpu(struct task_t + */ + static int read_stat(struct task_t *task) + { +- int ppid, tty, proc; +- unsigned long flags, pri, nice; +- unsigned long long maj_flt, utime, stime, cutime, cstime; ++ unsigned long long maj_flt = 0, utime = 0, stime = 0, cutime = 0, ++ cstime = 0; ++ unsigned long flags = 0, pri = 0, nice = 0; + char *cmd_start, *cmd_end, *cmdlenp, *cmdp; ++ int ppid = 0, tty = 0, proc = 0, rc; + + snprintf(fname, sizeof(fname), "/proc/%u/stat", task->pid); + if (read_file(fname, buf, sizeof(buf) - 1) == -1) + return 0; + + cmd_start = strchr(buf, '(') + 1; +- cmd_end = strchr(cmd_start, ')'); ++ cmd_end = strrchr(cmd_start, ')'); + name_lens.cmd_len = cmd_end - cmd_start; + cmdlenp = mon_record + sizeof(struct monwrite_hdr); + cmdlenp += sizeof(struct procd_hdr); +@@ -625,7 +626,7 @@ static int read_stat(struct task_t *task + memcpy(cmdlenp, &name_lens.cmd_len, sizeof(__u16)); + + cmd_end += 2; +- sscanf(cmd_end, ++ rc = sscanf(cmd_end, + "%c %d %*d %*d %d %*d " + "%lu %*s %*s %Lu %*s " + "%Lu %Lu %Lu %Lu " +@@ -642,6 +643,8 @@ static int read_stat(struct task_t *task + &utime, &stime, &cutime, &cstime, + &pri, &nice, + &proc); ++ if (rc != 12) ++ syslog(LOG_ERR, "bad data in %s \n", fname); + task->ppid = (__u32)ppid; + task->tty = (__u16)tty; + task->flags = (__u32)flags; diff --git a/s390-tools.changes b/s390-tools.changes index 6e39792..5cc7764 100644 --- a/s390-tools.changes +++ b/s390-tools.changes @@ -1,3 +1,22 @@ +------------------------------------------------------------------- +Fri Aug 24 18:47:06 UTC 2018 - mpost@suse.com + +- dasd_reload: + * Fixed several syntax errors. + * Changed the script to ensure that the DASD volume are actually + activated in device number order. + * Check for 41-dasd--.rules in addition to the + original 51-dasd-.rules. If an old 51-dasd-.rules + file is found, rename it to obsolete-51-dasd-.rules, and + use chzdev to generate a new rules file. (bsc#1103407) +- Added the following patches for bsc#1098069: + * s390-tools-sles15-dbginfo-add-data-for-ps-cpprot.patch + * s390-tools-sles15-mon_procd-fix-parsing-of-proc-pid-stat.patch +- Added the following patch (bsc#1094354) + * customize-zdev-root-update-script.patch +- Modified ctc_configure to not pass a "protcol=" parameter when + configuring LCS devices. (bsc#1096520) + ------------------------------------------------------------------- Wed May 30 10:22:01 CEST 2018 - hare@suse.de