![](https://seccdn.libravatar.org/avatar/e2145bc5cf53dda95c308a3c75e8fef3.jpg?s=120&d=mm&r=g)
Hello community, here is the log from the commit of package powerpc-utils for openSUSE:Factory checked in at 2018-12-24 11:35:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/powerpc-utils (Old) and /work/SRC/openSUSE:Factory/.powerpc-utils.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "powerpc-utils" Mon Dec 24 11:35:59 2018 rev:94 rq:660285 version:1.3.6 Changes: -------- --- /work/SRC/openSUSE:Factory/powerpc-utils/powerpc-utils.changes 2018-10-01 09:07:07.739804537 +0200 +++ /work/SRC/openSUSE:Factory/.powerpc-utils.new.28833/powerpc-utils.changes 2018-12-24 11:36:00.861738517 +0100 @@ -1,0 +2,14 @@ +Mon Dec 17 12:26:15 UTC 2018 - Michal Suchanek <msuchanek@suse.de> + +- Update to upstream v1.3.6 (FATE#326519) +- remove upstreamed patches + - bootlist-Display-logical-name-using-bootlist-o-option.patch + - lsslot-Add-ibm-dynamic-memory-v2-parsing-capability.patch + - lsslot-Split-dynamic-memory-v1-parsing-into-separate.patch + - powerpc-utils.bug-1109046_cpu-Limit-number-of-CPUs-for-frequency-calc.patch +- Patch to preserve compatibility with v1.3.4, v1.3.5 + + Revert-lparstat-Show-available-physical-processors-i.patch +- Keep support for ibmvscsis which we still ship + + Revert-ibmvscsis-remove-deprecated-ibmvscsis-scripts.patch + +------------------------------------------------------------------- Old: ---- bootlist-Display-logical-name-using-bootlist-o-option.patch lsslot-Add-ibm-dynamic-memory-v2-parsing-capability.patch lsslot-Split-dynamic-memory-v1-parsing-into-separate.patch powerpc-utils-1.3.5.tar.gz powerpc-utils.bug-1109046_cpu-Limit-number-of-CPUs-for-frequency-calc.patch New: ---- Revert-ibmvscsis-remove-deprecated-ibmvscsis-scripts.patch Revert-lparstat-Show-available-physical-processors-i.patch powerpc-utils-1.3.6.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ powerpc-utils.spec ++++++ --- /var/tmp/diff_new_pack.8aPe8T/_old 2018-12-24 11:36:01.353738081 +0100 +++ /var/tmp/diff_new_pack.8aPe8T/_new 2018-12-24 11:36:01.353738081 +0100 @@ -12,13 +12,13 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # -%define version_unconverted 1.3.5 +%define version_unconverted 1.3.6 Name: powerpc-utils -Version: 1.3.5 +Version: 1.3.6 Release: 0 Summary: Utilities for PowerPC Hardware License: GPL-2.0-or-later @@ -30,10 +30,10 @@ Patch2: ofpathname_powernv.patch Patch3: systemd-dir.patch Patch4: libvirt-service-dep.patch -Patch5: lsslot-Split-dynamic-memory-v1-parsing-into-separate.patch -Patch6: lsslot-Add-ibm-dynamic-memory-v2-parsing-capability.patch -Patch7: bootlist-Display-logical-name-using-bootlist-o-option.patch -Patch8: powerpc-utils.bug-1109046_cpu-Limit-number-of-CPUs-for-frequency-calc.patch +# Still shipping ibmvscsis +Patch5: Revert-ibmvscsis-remove-deprecated-ibmvscsis-scripts.patch +# This adds field in the middle of tool output so revert it again in < 15.1 +Patch6: Revert-lparstat-Show-available-physical-processors-i.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: librtas-devel @@ -64,9 +64,9 @@ %patch3 -p1 %patch4 -p1 %patch5 -p1 +%if 0%{?sle_version} <= 150000 %patch6 -p1 -%patch7 -p1 -%patch8 -p1 +%endif %build autoreconf -fvi ++++++ Revert-ibmvscsis-remove-deprecated-ibmvscsis-scripts.patch ++++++ ++++ 1871 lines (skipped) ++++++ Revert-lparstat-Show-available-physical-processors-i.patch ++++++
From 5e508839f2b928c83a163975ff6a7e4112926a3d Mon Sep 17 00:00:00 2001 From: Michal Suchanek <msuchanek@suse.de> Date: Mon, 17 Dec 2018 13:45:28 +0100 Subject: [PATCH] Revert "lparstat: Show available physical processors in the shared pool"
This reverts commit d1576f88dcc7008bcd3448172caff1b928be1254. --- man/lparstat.8 | 3 -- src/lparstat.c | 75 ++++---------------------------------------------- src/lparstat.h | 10 ------- 3 files changed, 5 insertions(+), 83 deletions(-) diff --git a/man/lparstat.8 b/man/lparstat.8 index 9721580b029f..daa578d122c6 100644 --- a/man/lparstat.8 +++ b/man/lparstat.8 @@ -77,9 +77,6 @@ Shows the percentage of the entitled capacity consumed. Because the time base ov lbusy Shows the percentage of logical processor(s) utilization that occurred while executing at the user and system level. .TP -app -Shows the available physical processors in the shared pool. -.TP phint Shows the number of phantom (targeted to another shared partition in this pool) interruptions received. .SH OPTIONS diff --git a/src/lparstat.c b/src/lparstat.c index ec57c1a22bdc..a3a0155dce2a 100644 --- a/src/lparstat.c +++ b/src/lparstat.c @@ -123,32 +123,6 @@ int get_time_base() return 0; } -void get_sys_uptime(struct sysentry *unused_se, char *uptime) -{ - FILE *f; - char buf[80]; - - f = fopen("/proc/uptime", "r"); - if (!f) { - fprintf(stderr, "Could not open /proc/uptime\n"); - sprintf(uptime, SE_NOT_VALID); - return; - } - - if ((fgets(buf, 80, f)) != NULL) { - char *value; - - value = strchr(buf, ' '); - *value = '\0'; - sprintf(uptime, "%s", buf); - } else { - sprintf(uptime, SE_NOT_VALID); - } - - fclose(f); -} - - void get_cpu_physc(struct sysentry *unused_se, char *buf) { struct sysentry *se; @@ -191,44 +165,6 @@ void get_per_entc(struct sysentry *unused_se, char *buf) sprintf(buf, "%.6f", atof(physc) / atof(entc) * 100.0); } -void get_cpu_app(struct sysentry *unused_se, char *buf) -{ - struct sysentry *se; - float timebase, app, elapsed_time; - long long new_app, old_app, newtime, oldtime; - char *descr, uptime[32]; - - se = get_sysentry("time"); - if (se->old_value[0] == '\0') { - /* Single report since boot */ - get_sysdata("uptime", &descr, uptime); - - if (!strcmp(uptime, SE_NOT_VALID)) { - sprintf(buf, "-"); - return; - } - elapsed_time = atof(uptime); - } else { - newtime = strtoll(se->value, NULL, 0); - oldtime = strtoll(se->old_value, NULL, 0); - elapsed_time = (newtime - oldtime) / 1000000.0; - } - - se = get_sysentry("timebase"); - timebase = atof(se->value); - - se = get_sysentry("pool_idle_time"); - new_app = strtoll(se->value, NULL, 0); - if (se->old_value[0] == '\0') { - old_app = 0; - } else { - old_app = strtoll(se->old_value, NULL, 0); - } - - app = (new_app - old_app)/timebase/elapsed_time; - sprintf(buf, "%.2f", app); -} - int parse_lparcfg() { FILE *f; @@ -601,13 +537,13 @@ int print_iflag_data() void print_default_output(int interval, int count) { - char *fmt = "%5s %5s %5s %8s %8s %5s %5s %5s %5s %5s\n"; + char *fmt = "%5s %5s %5s %8s %8s %5s %5s %5s %5s\n"; char *descr; char buf[128]; int offset; char value[32]; char user[32], sys[32], wait[32], idle[32], physc[32], entc[32]; - char lbusy[32], app[32], vcsw[32], phint[32]; + char lbusy[32], vcsw[32], phint[32]; memset(buf, 0, 128); get_sysdata("shared_processor_mode", &descr, value); @@ -628,9 +564,9 @@ void print_default_output(int interval, int count) fprintf(stdout, "\nSystem Configuration\n%s\n\n", buf); fprintf(stdout, fmt, "\%user", "\%sys", "\%wait", "\%idle", "physc", - "\%entc", "lbusy", "app", "vcsw", "phint"); + "\%entc", "lbusy", "vcsw", "phint"); fprintf(stdout, fmt, "-----", "-----", "-----", "-----", "-----", - "-----", "-----", "-----", "-----", "-----"); + "-----", "-----", "-----", "-----"); do { if (interval) { @@ -647,10 +583,9 @@ void print_default_output(int interval, int count) get_sysdata("physc", &descr, physc); get_sysdata("per_entc", &descr, entc); get_sysdata("phint", &descr, phint); - get_sysdata("app", &descr, app); fprintf(stdout, fmt, user, sys, wait, idle, physc, entc, - lbusy, app, vcsw, phint); + lbusy, vcsw, phint); fflush(stdout); } while (--count > 0); } diff --git a/src/lparstat.h b/src/lparstat.h index 3aee19268f83..7504d87b394a 100644 --- a/src/lparstat.h +++ b/src/lparstat.h @@ -46,8 +46,6 @@ extern void get_smt_mode(struct sysentry *, char *); extern void get_cpu_stat(struct sysentry *, char *); extern void get_cpu_physc(struct sysentry *, char *); extern void get_per_entc(struct sysentry *, char *); -extern void get_cpu_app(struct sysentry *, char *); -extern void get_sys_uptime(struct sysentry *, char *); struct sysentry system_data[] = { /* System Names */ @@ -227,9 +225,6 @@ struct sysentry system_data[] = { {.name = "per_entc", .descr = "Entitled CPU Consumed", .get = &get_per_entc}, - {.name = "app", - .descr = "Available physical CPUs in pool", - .get = &get_cpu_app}, /* Time */ {.name = "time", @@ -243,11 +238,6 @@ struct sysentry system_data[] = { {.name = "phint", .descr = "Phantom Interrupts"}, - /* /proc/uptime */ - {.name = "uptime", - .descr = "System Uptime", - .get = &get_sys_uptime}, - {.name[0] = '\0'}, }; -- 2.19.2 ++++++ powerpc-utils-1.3.5.tar.gz -> powerpc-utils-1.3.6.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/powerpc-utils-1.3.5/Changelog new/powerpc-utils-1.3.6/Changelog --- old/powerpc-utils-1.3.5/Changelog 2018-06-16 03:56:42.000000000 +0200 +++ new/powerpc-utils-1.3.6/Changelog 2018-12-15 01:18:13.000000000 +0100 @@ -1,3 +1,162 @@ +powerpc-utils-1.3.6 +===================================================================== + +commit 01c9cbcf4face809cb6953bc3cd2a30cd075ed16 +Author: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> +Date: Thu Dec 6 17:30:38 2018 -0600 + + lparstat: correct calculation of physc to use tbr + + Currently phsyc is calculated using the sampled PURR values from lparcfg and + a derived timebase that lparstat itself calculates. However, both the Timer + Facilities section in Book III of the ISA and PAPR outline that this resource + calcuation is done by computing the ratio of the PURR delta and the Timebase + Register delta for the sampled period. + + I've sent a patch upstream to the kernel list to also export the Timebase + Register (tbr) in /proc/ppc64/lparcfg [1]. Use this value for calculating + physc value when running on a kernel that exposes tbr. + + [1] https://patchwork.ozlabs.org/patch/1009906/ + + Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> + +commit 7be598c7ffdf1f934e43af88a42e8b1e6391f91e +Author: Aravinda Prasad <aravinda@linux.vnet.ibm.com> +Date: Thu Dec 6 16:21:10 2018 +0530 + + lparstat: Enable desired and maximum memory stats + + This patch enables the display of desired memory + and maximum memory stats with lparstat -i flag. + The value for these stats are already available + in /proc/powerpc/lparcfg file. + + v2: updated man pages. + + Signed-off-by: Aravinda Prasad <aravinda@linux.vnet.ibm.com> + Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> + Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> + +commit d1576f88dcc7008bcd3448172caff1b928be1254 +Author: Aravinda Prasad <aravinda@linux.vnet.ibm.com> +Date: Thu Sep 6 15:01:04 2018 +0530 + + lparstat: Show available physical processors in the shared pool + + This patch adds the "app" field that displays the available + processors in the shared pool. + + The platform provides the summation of the physical processor + pool idle cycles through H_PIC hypercall. This data is updated + in the "pool_idle_time" field of the /proc/ppc64/lparcfg file. + This patch derives the "app" from the "pool_idle_time" field. + + v2: Handle fgets() errors + + Signed-off-by: Aravinda Prasad <aravinda@linux.vnet.ibm.com> + Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> + +commit fac783d18d61af232b957af259a15ed231f6869b +Author: Juliet Kim <julietk@linux.vnet.ibm.com> +Date: Thu Sep 13 15:57:42 2018 -0400 + + ppc64_cpu: Limit number of CPUs for frequency calculation + + The patch limits the number of threads used for CPU frequency calculation + to the minimum of either the actual number of CPUs in the system or + CPU_SETSIZE(currently 1024). In other words, if the number of CPUs in the + system is less than CPU_SETSIZE, a thread is created for each of the CPUs, + otherwise only CPU_SETSIZE threads are created. This is being done because + sched_setaffinity() will only work on CPU_SETSIZE CPUs, anything over the + limit is not supported. + + Signed-off-by: Juliet Kim <julietk@linux.vnet.ibm.com> + Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> + +commit 3ce17a36d10bc09a49af9d56ceadad09708b46f1 +Author: Nathan Fontenot <nfont@linux.vnet.ibm.com> +Date: Thu Jul 19 23:12:40 2018 -0500 + + lsslot: Add ibm,dynamic-memory-v2 parsing capability + + In order to support reporting memory LMB information the lsslot + command needs to know how to parse the ibm,dynamic-memory-v2 + property. This patch adds this support to the shared + drslot_chrp_mem.c file. + + In order to prevent the drmgr command from parsing this v2 property + a new flag is introduce, is_lsslot_cmd. The reason for this is that + we do not support memory DLPAR for ibm,dynamic-memory-v2 from + userspace. + + Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com> + Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> + +commit 6a1b89bb7e9f58262da0f08906674cae3efc7bfc +Author: Nathan Fontenot <nfont@linux.vnet.ibm.com> +Date: Thu Jul 19 23:12:34 2018 -0500 + + lsslot: Split dynamic-memory v1 parsing into separate routine + + In preparation for support of parsing the new ibm,dynamic-memory-v2 + device tree property, this patch splits the current code that + parses the current v1 version of the device tree propertry into + its own routine. + + Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com> + Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> + +commit c3f583a9f62ee33080523c2d1d076fdf8d5520e7 +Author: Mamatha Inamdar <mamatha4@linux.vnet.ibm.com> +Date: Tue Jul 17 21:24:31 2018 +0530 + + Patch to display logical name using bootlist -o option + + Problem: + System unable to boot when OF device path name's set using -r option + EX: # bootlist -m normal -r /vdevice/v-scsi@30000010/disk@8100000000000000 + + Solution: + This patch is to set respective Open firmware device path names(-r) + and logical device path names(-o) using bootlist + + Test Results: + + Without patch: + + # bootlist -m normal -r /vdevice/v-scsi@30000010/disk@8100000000000000 + sda + + # bootlist -m normal -r + sda + + # bootlist -m normal -o + Could not translate sda to logical device name + + With patch: + + # ./bootlist -m normal -r /vdevice/v-scsi@30000010/disk@8100000000000000 + /vdevice/v-scsi@30000010/disk@8100000000000000 + + # ./bootlist -m normal -r + /vdevice/v-scsi@30000010/disk@8100000000000000 + + # ./bootlist -m normal -o + sda + + # ./bootlist -m normal -r sda + /vdevice/v-scsi@30000010/disk@8100000000000000 + + # ./bootlist -m normal -r + /vdevice/v-scsi@30000010/disk@8100000000000000 + + # ./bootlist -m normal -o + sda + + Signed-off-by: Mamatha Inamdar <mamatha4@linux.vnet.ibm.com> + Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> + powerpc-utils-1.3.5 ===================================================================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/powerpc-utils-1.3.5/configure.ac new/powerpc-utils-1.3.6/configure.ac --- old/powerpc-utils-1.3.5/configure.ac 2018-06-16 03:56:42.000000000 +0200 +++ new/powerpc-utils-1.3.6/configure.ac 2018-12-15 01:18:13.000000000 +0100 @@ -1,6 +1,6 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -m4_define([ppu_version], 1.3.5) +m4_define([ppu_version], 1.3.6) AC_PREREQ([2.63]) AC_INIT([powerpc-utils], ppu_version, [nfont@linux.vnet.ibm.com]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/powerpc-utils-1.3.5/man/lparstat.8 new/powerpc-utils-1.3.6/man/lparstat.8 --- old/powerpc-utils-1.3.5/man/lparstat.8 2018-06-16 03:56:42.000000000 +0200 +++ new/powerpc-utils-1.3.6/man/lparstat.8 2018-12-15 01:18:13.000000000 +0100 @@ -77,6 +77,9 @@ lbusy Shows the percentage of logical processor(s) utilization that occurred while executing at the user and system level. .TP +app +Shows the available physical processors in the shared pool. +.TP phint Shows the number of phantom (targeted to another shared partition in this pool) interruptions received. .SH OPTIONS @@ -133,6 +136,12 @@ Minimum Memory Minimum memory this LPAR was defined to ever have. .TP +Desired Memory + Indicates the desired amount of memory. +.TP +Maximum Memory + Maximum possible amount of memory. +.TP Variable Capacity Weight The priority weight assigned to this LPAR which controls how extra (idle) capacity is allocated to it. A weight of -1 indicates a soft cap is in place. .TP diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/powerpc-utils-1.3.5/scripts/bootlist new/powerpc-utils-1.3.6/scripts/bootlist --- old/powerpc-utils-1.3.5/scripts/bootlist 2018-06-16 03:56:42.000000000 +0200 +++ new/powerpc-utils-1.3.6/scripts/bootlist 2018-12-15 01:18:13.000000000 +0100 @@ -453,6 +453,8 @@ if [[ -z ${OF_DEVPATH[$ctr]} ]]; then # See if this is an OF pathname OF_DEVPATH[$ctr]=`get_of_device_name ${LOGICAL_NAMES[$ctr]}` + else + OF_DEVPATH[$ctr]=${LOGICAL_NAMES[$ctr]} fi if [[ -z ${OF_DEVPATH[$ctr]} ]]; then diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/powerpc-utils-1.3.5/src/drmgr/dr.h new/powerpc-utils-1.3.6/src/drmgr/dr.h --- old/powerpc-utils-1.3.5/src/drmgr/dr.h 2018-06-16 03:56:42.000000000 +0200 +++ new/powerpc-utils-1.3.6/src/drmgr/dr.h 2018-12-15 01:18:13.000000000 +0100 @@ -32,6 +32,8 @@ extern int output_level; extern int log_fd; +extern int is_lsslot_cmd; + /* Error Exit Codes */ #define RC_IN_USE 1 #define RC_NONEXISTENT 3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/powerpc-utils-1.3.5/src/drmgr/drmem.h new/powerpc-utils-1.3.6/src/drmgr/drmem.h --- old/powerpc-utils-1.3.5/src/drmgr/drmem.h 2018-06-16 03:56:42.000000000 +0200 +++ new/powerpc-utils-1.3.6/src/drmgr/drmem.h 2018-12-15 01:18:13.000000000 +0100 @@ -37,12 +37,22 @@ uint32_t flags; }; +struct drconf_mem_v2 { + uint32_t seq_lmbs; + uint64_t base_addr; + uint32_t drc_index; + uint32_t aa_index; + uint32_t flags; +} __attribute__((packed)); + #define DRMEM_ASSIGNED 0x00000008 #define DRMEM_DRC_INVALID 0x00000020 #define MEM_PROBE_FILE "/sys/devices/system/memory/probe" #define MEM_BLOCK_SIZE_BYTES "/sys/devices/system/memory/block_size_bytes" #define DYNAMIC_RECONFIG_MEM "/proc/device-tree/ibm,dynamic-reconfiguration-memory" +#define DYNAMIC_RECONFIG_MEM_V1 DYNAMIC_RECONFIG_MEM "/ibm,dynamic-memory" +#define DYNAMIC_RECONFIG_MEM_V2 DYNAMIC_RECONFIG_MEM "/ibm,dynamic-memory-v2" #define LMB_NORMAL_SORT 0 #define LMB_REVERSE_SORT 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/powerpc-utils-1.3.5/src/drmgr/drmgr.c new/powerpc-utils-1.3.6/src/drmgr/drmgr.c --- old/powerpc-utils-1.3.5/src/drmgr/drmgr.c 2018-06-16 03:56:42.000000000 +0200 +++ new/powerpc-utils-1.3.6/src/drmgr/drmgr.c 2018-12-15 01:18:13.000000000 +0100 @@ -38,6 +38,8 @@ int log_fd = 0; int action_cnt = 0; +int is_lsslot_cmd = 0; + static int handle_prrn_event = 0; static int display_usage = 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/powerpc-utils-1.3.5/src/drmgr/drslot_chrp_mem.c new/powerpc-utils-1.3.6/src/drmgr/drslot_chrp_mem.c --- old/powerpc-utils-1.3.5/src/drmgr/drslot_chrp_mem.c 2018-06-16 03:56:42.000000000 +0200 +++ new/powerpc-utils-1.3.6/src/drmgr/drslot_chrp_mem.c 2018-12-15 01:18:13.000000000 +0100 @@ -306,33 +306,54 @@ return rc; } +int add_lmb(struct lmb_list_head *lmb_list, uint32_t drc_index, + uint64_t address, uint64_t lmb_sz, uint32_t aa_index, + uint32_t flags) +{ + struct dr_node *lmb; + + lmb = lmb_list_add(drc_index, lmb_list); + if (lmb == NULL) { + say(DEBUG, "Could not find LMB with drc-index of %x\n", + drc_index); + return -1; + } + + sprintf(lmb->ofdt_path, DYNAMIC_RECONFIG_MEM); + lmb->lmb_size = lmb_sz; + lmb->lmb_address = address; + lmb->lmb_aa_index = aa_index; + + if (flags & DRMEM_ASSIGNED) { + int rc; + + lmb->is_owned = 1; + + /* find the associated sysfs memory blocks */ + rc = get_mem_scns(lmb); + if (rc) + return -1; + } + + lmb_list->lmbs_found++; + return 0; +} /** - * get_dynamic_reconfig_lmbs + * get_dynamic_reconfig_lmbs_v1 * @brief Retrieve lmbs from OF device tree located in the ibm,dynamic-memory * property. * + * @param lmb_sz size of LMBs * @param lmb_list pointer to lmb list head to populate * @returns 0 on success, !0 on failure */ int -get_dynamic_reconfig_lmbs(struct lmb_list_head *lmb_list) +get_dynamic_reconfig_lmbs_v1(uint64_t lmb_sz, struct lmb_list_head *lmb_list) { struct drconf_mem *drmem; - uint64_t lmb_sz; int i, num_entries; int rc = 0; - rc = get_property(DYNAMIC_RECONFIG_MEM, "ibm,lmb-size", - &lmb_sz, sizeof(lmb_sz)); - - /* convert for LE systems */ - lmb_sz = be64toh(lmb_sz); - - if (rc) { - say(DEBUG, "Could not retrieve drconf LMB size\n"); - return rc; - } - lmb_list->drconf_buf_sz = get_property_size(DYNAMIC_RECONFIG_MEM, "ibm,dynamic-memory"); lmb_list->drconf_buf = zalloc(lmb_list->drconf_buf_sz); @@ -360,34 +381,123 @@ drmem = (struct drconf_mem *) (lmb_list->drconf_buf + sizeof(num_entries)); for (i = 0; i < num_entries; i++) { - struct dr_node *lmb; - - lmb = lmb_list_add(be32toh(drmem->drc_index), lmb_list); - if (lmb == NULL) { - say(DEBUG, "Could not find LMB with drc-index of %x\n", - drmem->drc_index); - rc = -1; + rc = add_lmb(lmb_list, be32toh(drmem->drc_index), + be64toh(drmem->address), lmb_sz, + be32toh(drmem->assoc_index), + be32toh(drmem->flags)); + if (rc) break; - } - sprintf(lmb->ofdt_path, DYNAMIC_RECONFIG_MEM); - lmb->lmb_size = lmb_sz; - lmb->lmb_address = be64toh(drmem->address); - lmb->lmb_aa_index = be32toh(drmem->assoc_index); + drmem++; /* trust your compiler */ + } + + return rc; +} + +/** + * get_dynamic_reconfig_lmbs_v2 + * @brief Retrieve the LMBs from the ibm,dynamic-memory-v2 property + * + * @param lmb_sz LMB size + * @param lmb_list pointer to lmb_list head to populate + * @returns 0 on success, !0 on failure. + */ +int get_dynamic_reconfig_lmbs_v2(uint64_t lmb_sz, + struct lmb_list_head *lmb_list) +{ + struct drconf_mem_v2 *drmem; + uint32_t lmb_sets; + int i, rc = 0; + + lmb_list->drconf_buf_sz = get_property_size(DYNAMIC_RECONFIG_MEM, + "ibm,dynamic-memory-v2"); + lmb_list->drconf_buf = zalloc(lmb_list->drconf_buf_sz); + if (lmb_list->drconf_buf == NULL) { + say(DEBUG, "Could not allocate buffer to get dynamic " + "reconfigurable memory\n"); + return -1; + } + + rc = get_property(DYNAMIC_RECONFIG_MEM, "ibm,dynamic-memory-v2", + lmb_list->drconf_buf, lmb_list->drconf_buf_sz); + if (rc) { + say(DEBUG, "Could not retrieve dynamic reconfigurable memory " + "property\n"); + return -1; + } + + /* The first integer of the buffer is the number of lmb sets */ + lmb_sets = *(int *)lmb_list->drconf_buf; + lmb_sets = be32toh(lmb_sets); - if (be32toh(drmem->flags) & DRMEM_ASSIGNED) { - lmb->is_owned = 1; + /* Followed by the actual entries */ + drmem = (struct drconf_mem_v2 *) + (lmb_list->drconf_buf + sizeof(lmb_sets)); - /* find the associated sysfs memory blocks */ - rc = get_mem_scns(lmb); + for (i = 0; i < lmb_sets; i++) { + uint32_t drc_index, seq_lmbs; + uint64_t address; + int j; + + address = be64toh(drmem->base_addr); + drc_index = be32toh(drmem->drc_index); + seq_lmbs = be32toh(drmem->seq_lmbs); + + for (j = 0; j < seq_lmbs; j++) { + uint32_t aa_index = be32toh(drmem->aa_index); + uint32_t flags = be32toh(drmem->flags); + + rc = add_lmb(lmb_list, drc_index, address, + lmb_sz, aa_index, flags); if (rc) break; + + drc_index++; + address += lmb_sz; } - lmb_list->lmbs_found++; drmem++; /* trust your compiler */ } + return rc; +} + +/** + * get_dynamic_reconfig_lmbs + * @brief Retrieve lmbs from OF device tree located in the ibm,dynamic-memory + * property. + * + * @param lmb_list pointer to lmb list head to populate + * @returns 0 on success, !0 on failure + */ +int +get_dynamic_reconfig_lmbs(struct lmb_list_head *lmb_list) +{ + struct stat sbuf; + uint64_t lmb_sz; + int rc = 0; + + rc = get_property(DYNAMIC_RECONFIG_MEM, "ibm,lmb-size", + &lmb_sz, sizeof(lmb_sz)); + + /* convert for LE systems */ + lmb_sz = be64toh(lmb_sz); + + if (rc) { + say(DEBUG, "Could not retrieve drconf LMB size\n"); + return rc; + } + + if (stat(DYNAMIC_RECONFIG_MEM_V1, &sbuf) == 0) { + rc = get_dynamic_reconfig_lmbs_v1(lmb_sz, lmb_list); + } else if (is_lsslot_cmd && + stat(DYNAMIC_RECONFIG_MEM_V2, &sbuf) == 0) { + rc = get_dynamic_reconfig_lmbs_v2(lmb_sz, lmb_list); + } else { + say(ERROR, "No dynamic reconfiguration LMBs found\n"); + return -1; + } + say(INFO, "Found %d LMBs currently allocated\n", lmb_list->lmbs_found); return rc; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/powerpc-utils-1.3.5/src/drmgr/lsslot.c new/powerpc-utils-1.3.6/src/drmgr/lsslot.c --- old/powerpc-utils-1.3.5/src/drmgr/lsslot.c 2018-06-16 03:56:42.000000000 +0200 +++ new/powerpc-utils-1.3.6/src/drmgr/lsslot.c 2018-12-15 01:18:13.000000000 +0100 @@ -35,6 +35,8 @@ int output_level = 0; int log_fd = 0; +int is_lsslot_cmd = 1; + extern int lsslot_chrp_cpu(void); /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/powerpc-utils-1.3.5/src/lparstat.c new/powerpc-utils-1.3.6/src/lparstat.c --- old/powerpc-utils-1.3.5/src/lparstat.c 2018-06-16 03:56:42.000000000 +0200 +++ new/powerpc-utils-1.3.6/src/lparstat.c 2018-12-15 01:18:13.000000000 +0100 @@ -123,23 +123,59 @@ return 0; } +void get_sys_uptime(struct sysentry *unused_se, char *uptime) +{ + FILE *f; + char buf[80]; + + f = fopen("/proc/uptime", "r"); + if (!f) { + fprintf(stderr, "Could not open /proc/uptime\n"); + sprintf(uptime, SE_NOT_VALID); + return; + } + + if ((fgets(buf, 80, f)) != NULL) { + char *value; + + value = strchr(buf, ' '); + *value = '\0'; + sprintf(uptime, "%s", buf); + } else { + sprintf(uptime, SE_NOT_VALID); + } + + fclose(f); +} + + void get_cpu_physc(struct sysentry *unused_se, char *buf) { struct sysentry *se; float elapsed; float new_purr, old_purr; float timebase, physc; - - elapsed = elapsed_time() / 1000000.0; - - se = get_sysentry("timebase"); - timebase = atoi(se->value); + float new_tb, old_tb; se = get_sysentry("purr"); new_purr = strtoll(se->value, NULL, 0); old_purr = strtoll(se->old_value, NULL, 0); - physc = (new_purr - old_purr)/timebase/elapsed; + se = get_sysentry("tbr"); + if (se->value[0] != '\0') { + new_tb = strtoll(se->value, NULL, 0); + old_tb = strtoll(se->old_value, NULL, 0); + + physc = (new_purr - old_purr) / (new_tb - old_tb); + } else { + elapsed = elapsed_time() / 1000000.0; + + se = get_sysentry("timebase"); + timebase = atoi(se->value); + + physc = (new_purr - old_purr)/timebase/elapsed; + } + sprintf(buf, "%.6f", physc); } @@ -155,6 +191,44 @@ sprintf(buf, "%.6f", atof(physc) / atof(entc) * 100.0); } +void get_cpu_app(struct sysentry *unused_se, char *buf) +{ + struct sysentry *se; + float timebase, app, elapsed_time; + long long new_app, old_app, newtime, oldtime; + char *descr, uptime[32]; + + se = get_sysentry("time"); + if (se->old_value[0] == '\0') { + /* Single report since boot */ + get_sysdata("uptime", &descr, uptime); + + if (!strcmp(uptime, SE_NOT_VALID)) { + sprintf(buf, "-"); + return; + } + elapsed_time = atof(uptime); + } else { + newtime = strtoll(se->value, NULL, 0); + oldtime = strtoll(se->old_value, NULL, 0); + elapsed_time = (newtime - oldtime) / 1000000.0; + } + + se = get_sysentry("timebase"); + timebase = atof(se->value); + + se = get_sysentry("pool_idle_time"); + new_app = strtoll(se->value, NULL, 0); + if (se->old_value[0] == '\0') { + old_app = 0; + } else { + old_app = strtoll(se->old_value, NULL, 0); + } + + app = (new_app - old_app)/timebase/elapsed_time; + sprintf(buf, "%.2f", app); +} + int parse_lparcfg() { FILE *f; @@ -527,13 +601,13 @@ void print_default_output(int interval, int count) { - char *fmt = "%5s %5s %5s %8s %8s %5s %5s %5s %5s\n"; + char *fmt = "%5s %5s %5s %8s %8s %5s %5s %5s %5s %5s\n"; char *descr; char buf[128]; int offset; char value[32]; char user[32], sys[32], wait[32], idle[32], physc[32], entc[32]; - char lbusy[32], vcsw[32], phint[32]; + char lbusy[32], app[32], vcsw[32], phint[32]; memset(buf, 0, 128); get_sysdata("shared_processor_mode", &descr, value); @@ -554,9 +628,9 @@ fprintf(stdout, "\nSystem Configuration\n%s\n\n", buf); fprintf(stdout, fmt, "\%user", "\%sys", "\%wait", "\%idle", "physc", - "\%entc", "lbusy", "vcsw", "phint"); + "\%entc", "lbusy", "app", "vcsw", "phint"); fprintf(stdout, fmt, "-----", "-----", "-----", "-----", "-----", - "-----", "-----", "-----", "-----"); + "-----", "-----", "-----", "-----", "-----"); do { if (interval) { @@ -573,9 +647,10 @@ get_sysdata("physc", &descr, physc); get_sysdata("per_entc", &descr, entc); get_sysdata("phint", &descr, phint); + get_sysdata("app", &descr, app); fprintf(stdout, fmt, user, sys, wait, idle, physc, entc, - lbusy, vcsw, phint); + lbusy, app, vcsw, phint); fflush(stdout); } while (--count > 0); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/powerpc-utils-1.3.5/src/lparstat.h new/powerpc-utils-1.3.6/src/lparstat.h --- old/powerpc-utils-1.3.5/src/lparstat.h 2018-06-16 03:56:42.000000000 +0200 +++ new/powerpc-utils-1.3.6/src/lparstat.h 2018-12-15 01:18:13.000000000 +0100 @@ -46,6 +46,8 @@ extern void get_cpu_stat(struct sysentry *, char *); extern void get_cpu_physc(struct sysentry *, char *); extern void get_per_entc(struct sysentry *, char *); +extern void get_cpu_app(struct sysentry *, char *); +extern void get_sys_uptime(struct sysentry *, char *); struct sysentry system_data[] = { /* System Names */ @@ -127,6 +129,8 @@ .descr = "Virtual Processor Dispersions"}, {.name = "purr", .descr = "Processor Utilization Resource Register"}, + {.name = "tbr", + .descr = "Timebase Register"}, {.name = "partition_active_processors", .descr = "Online Virtual CPUs"}, {.name = "partition_potential_processors", @@ -140,6 +144,8 @@ .descr = "Minimum Memory"}, {.name = "DesMem", .descr = "Desired Memory"}, + {.name = "MaxMem", + .descr = "Maximum Memory"}, {.name = "entitled_memory", .descr = "Total I/O Memory Entitlement"}, {.name = "mapped_entitled_memory", @@ -221,6 +227,9 @@ {.name = "per_entc", .descr = "Entitled CPU Consumed", .get = &get_per_entc}, + {.name = "app", + .descr = "Available physical CPUs in pool", + .get = &get_cpu_app}, /* Time */ {.name = "time", @@ -234,6 +243,11 @@ {.name = "phint", .descr = "Phantom Interrupts"}, + /* /proc/uptime */ + {.name = "uptime", + .descr = "System Uptime", + .get = &get_sys_uptime}, + {.name[0] = '\0'}, }; @@ -251,6 +265,7 @@ "MinProcs", "MemTotal", "MinMem", + "DesMem", "MaxMem", "MinEntCap", "partition_max_entitled_capacity", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/powerpc-utils-1.3.5/src/ppc64_cpu.c new/powerpc-utils-1.3.6/src/ppc64_cpu.c --- old/powerpc-utils-1.3.5/src/ppc64_cpu.c 2018-06-16 03:56:42.000000000 +0200 +++ new/powerpc-utils-1.3.6/src/ppc64_cpu.c 2018-12-15 01:18:13.000000000 +0100 @@ -35,6 +35,7 @@ #include <sys/ptrace.h> #include <sys/wait.h> #include <sys/resource.h> +#include <sys/param.h> #ifdef WITH_LIBRTAS #include <librtas.h> @@ -849,7 +850,7 @@ #ifdef HAVE_LINUX_PERF_EVENT_H -static int setup_counters(struct cpu_freq *cpu_freqs) +static int setup_counters(struct cpu_freq *cpu_freqs, int max_thread) { int i; struct perf_event_attr attr; @@ -863,7 +864,7 @@ /* Record how long the event ran for */ attr.read_format |= PERF_FORMAT_TOTAL_TIME_RUNNING; - for (i = 0; i < threads_in_system; i++) { + for (i = 0; i < max_thread; i++) { if (!cpu_online(i)) { cpu_freqs[i].offline = 1; continue; @@ -886,11 +887,11 @@ return 0; } -static void start_counters(struct cpu_freq *cpu_freqs) +static void start_counters(struct cpu_freq *cpu_freqs, int max_thread) { int i; - for (i = 0; i < threads_in_system; i++) { + for (i = 0; i < max_thread; i++) { if (cpu_freqs[i].offline) continue; @@ -898,11 +899,11 @@ } } -static void stop_counters(struct cpu_freq *cpu_freqs) +static void stop_counters(struct cpu_freq *cpu_freqs, int max_thread) { int i; - for (i = 0; i < threads_in_system; i++) { + for (i = 0; i < max_thread; i++) { if (cpu_freqs[i].offline) continue; @@ -915,12 +916,12 @@ uint64_t time_running; }; -static void read_counters(struct cpu_freq *cpu_freqs) +static void read_counters(struct cpu_freq *cpu_freqs, int max_thread) { int i; struct read_format vals; - for (i = 0; i < threads_in_system; i++) { + for (i = 0; i < max_thread; i++) { size_t res; if (cpu_freqs[i].offline) @@ -941,11 +942,11 @@ } } -static void check_threads(struct cpu_freq *cpu_freqs) +static void check_threads(struct cpu_freq *cpu_freqs, int max_thread) { int i; - for (i = 0; i < threads_in_system; i++) { + for (i = 0; i < max_thread; i++) { if (cpu_freqs[i].offline) continue; @@ -1074,21 +1075,27 @@ double sum = 0; unsigned long count = 0; struct cpu_freq *cpu_freqs; + int max_thread; setrlimit_open_files(); - cpu_freqs = calloc(threads_in_system, sizeof(*cpu_freqs)); + max_thread = MIN(threads_in_system, CPU_SETSIZE); + if (max_thread < threads_in_system) + printf("ppc64_cpu currently supports up to %d CPUs\n", + CPU_SETSIZE); + + cpu_freqs = calloc(max_thread, sizeof(*cpu_freqs)); if (!cpu_freqs) return -ENOMEM; - rc = setup_counters(cpu_freqs); + rc = setup_counters(cpu_freqs, max_thread); if (rc) { free(cpu_freqs); return rc; } /* Start a soak thread on each CPU */ - for (i = 0; i < threads_in_system; i++) { + for (i = 0; i < max_thread; i++) { if (cpu_freqs[i].offline) continue; @@ -1103,15 +1110,15 @@ /* Wait for soak threads to start */ usleep(1000000); - start_counters(cpu_freqs); + start_counters(cpu_freqs, max_thread); /* Count for specified timeout in seconds */ usleep(sleep_time * 1000000); - stop_counters(cpu_freqs); - check_threads(cpu_freqs); - read_counters(cpu_freqs); + stop_counters(cpu_freqs, max_thread); + check_threads(cpu_freqs, max_thread); + read_counters(cpu_freqs, max_thread); - for (i = 0; i < threads_in_system; i++) { + for (i = 0; i < max_thread; i++) { double frequency; if (cpu_freqs[i].offline)