diff --git a/0001-drmgr-Return-from-get_node_by_name-if-matched-DRC-in.patch b/0001-drmgr-Return-from-get_node_by_name-if-matched-DRC-in.patch new file mode 100644 index 0000000..1536976 --- /dev/null +++ b/0001-drmgr-Return-from-get_node_by_name-if-matched-DRC-in.patch @@ -0,0 +1,35 @@ +From 1dc1ecf7dce7825d352b045c98aa51711b58aaca Mon Sep 17 00:00:00 2001 +From: Haren Myneni +Date: Fri, 21 Jun 2024 15:39:42 -0700 +Subject: [PATCH] drmgr: Return from get_node_by_name() if matched DRC index + +Upstream: merged, expected in v1.3.13 +Git-commit: 1dc1ecf7dce7825d352b045c98aa51711b58aaca + +get_node_by_name() should return dr_node if the DRC name or DRC +index is matched. But the current code returns only if the DRC +name is matched. This patch fixes this issue and returns dr_node +if the index is matched. + +Signed-off-by: Haren Myneni +Signed-off-by: Tyrel Datwyler +--- + src/drmgr/common_pci.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/drmgr/common_pci.c b/src/drmgr/common_pci.c +index c6dcfdf..2e0e5fb 100644 +--- a/src/drmgr/common_pci.c ++++ b/src/drmgr/common_pci.c +@@ -969,7 +969,7 @@ get_node_by_name(const char *drc_name, uint32_t node_type) + /* See if the drc index was specified */ + drc_index = strtoul(drc_name, NULL, 0); + if (node->drc_index == drc_index) +- continue; ++ break; + + for (child = node->children; child; child = child->next) { + if (strcmp(drc_name, child->drc_name) == 0) +-- +2.45.2 + diff --git a/0002-lparstat-Fix-Idle-and-busy-PURR-SPURR.patch b/0002-lparstat-Fix-Idle-and-busy-PURR-SPURR.patch new file mode 100644 index 0000000..9a6623c --- /dev/null +++ b/0002-lparstat-Fix-Idle-and-busy-PURR-SPURR.patch @@ -0,0 +1,236 @@ +From 2af8c0b9a285e8a6104560d0f482819e56060443 Mon Sep 17 00:00:00 2001 +From: Saket Kumar Bhaskar +Date: Thu, 18 Jul 2024 00:39:24 +0530 +Subject: [PATCH] lparstat: Fix Idle and busy PURR/SPURR + +Upstream: merged, expected in v1.3.13 +Git-commit: 2af8c0b9a285e8a6104560d0f482819e56060443 + +lparstat -E gives %busy and %idle for actual(PURR based) and normalized +(SPURR based).Idle and busy PURR/SPURR values are not adding upto 100% +in case of dedicated-donate and shared partitions, with the present +formula. Because of this, users might get a false impression of resource +utilisation. This is expected because a core can be in either +idle or busy state out of total of 100(core's shared resource can +either be consumed or be left idle). When lpar is in dedicated-donate +or shared,the purr values are not being counted when the CPU is ceded. +The idle_purr is calculated by taking snapshots of purr values at +every idle entry and idle exit. So, when a CPU is ceded, the calculation +for idle_purr will be wrong as purr is not being counted. + +Before Change: +|-----------------------------------------------------------------| +| Dedicated-donate (8 cores) : | +|----------------------|---------------------|--------------------| +| | Actual | Normalized | +| Stress-ng threads |---------------------|--------------------| +| | %busy | %idle | %busy | %idle | +|----------------------|----------|----------|---------|----------| +| 0 threads | 0.02 | 0.05 | 0.02 | 0.05 | +|----------------------|----------|----------|---------|----------| +| 8 threads | 32.64 | 17.37 | 35.25 | 18.77 | +|----------------------|----------|----------|---------|----------| +| 16 threads | 58.61 | 16.42 | 63.29 | 17.74 | +|----------------------|----------|----------|---------|----------| +| 24 threads | 78.14 | 21.86 | 84.39 | 23.61 | +|----------------------|----------|----------|---------|----------| +| 32 threads | 83.60 | 16.40 | 90.30 | 17.71 | +|----------------------|----------|----------|---------|----------| +| 40 threads | 91.90 | 6.94 | 98.31 | 7.46 | +|----------------------|----------|----------|---------|----------| +| 48 threads | 96.08 | 3.92 | 102.79 | 4.21 | +|----------------------|----------|----------|---------|----------| +| 56 threads | 98.42 | 1.57 | 105.31 | 1.69 | +|----------------------|----------|----------|---------|----------| +| 64 threads | 100.00 | 0.00 | 106.00 | 0.00 | +|----------------------|----------|----------|---------|----------| + +|-----------------------------------------------------------------| +| Shared Capped (8 VP / 4 EC) : | +|----------------------|---------------------|--------------------| +| | Actual | Normalized | +| Stress-ng threads |---------------------|--------------------| +| | %busy | %idle | %busy | %idle | +|----------------------|----------|----------|---------|----------| +| 0 threads | 0.04 | 0.18 | 0.03 | 0.19 | +|----------------------|----------|----------|---------|----------| +| 8 threads | 35.90 | 14.09 | 38.77 | 15.21 | +|----------------------|----------|----------|---------|----------| +| 16 threads | 35.25 | 14.84 | 38.08 | 16.02 | +|----------------------|----------|----------|---------|----------| +| 24 threads | 40.13 | 9.73 | 42.93 | 10.43 | +|----------------------|----------|----------|---------|----------| +| 32 threads | 44.13 | 5.73 | 47.22 | 6.14 | +|----------------------|----------|----------|---------|----------| +| 40 threads | 46.47 | 3.42 | 50.18 | 3.69 | +|----------------------|----------|----------|---------|----------| +| 48 threads | 48.03 | 1.83 | 51.39 | 1.96 | +|----------------------|----------|----------|---------|----------| +| 56 threads | 49.04 | 0.86 | 52.47 | 0.93 | +|----------------------|----------|----------|---------|----------| +| 64 threads | 49.87 | 0.00 | 53.36 | 0.00 | +|----------------------|----------|----------|---------|----------| + +This commit, rather than considering delta_idle_purr for calculation of +idle ticks, takes (delta_tb - delta_purr + delta_idle_purr) as total +ticks for which the CPUs were idle. Here, since delta_idle_purr will +also contain some idle ticks, thats why it is added to the formula. +Since, the output was correct for dedicated capped mode, changes has +been made only for shared and dedicated-donate mode. +Further, no changes has been made for calculation of %busy. + +Similar changes has been done for SPURR. + +After Change: + +|-----------------------------------------------------------------| +| Dedicated-donate (8 cores) : | +|----------------------|---------------------|--------------------| +| | Actual | Normalized | +| Stress-ng threads |---------------------|--------------------| +| | %busy | %idle | %busy | %idle | +|----------------------|----------|----------|---------|----------| +| 0 threads | 0.02 | 99.98 | 0.02 | 100.04 | +|----------------------|----------|----------|---------|----------| +| 8 threads | 35.97 | 64.03 | 38.84 | 61.51 | +|----------------------|----------|----------|---------|----------| +| 16 threads | 58.60 | 41.40 | 63.28 | 37.08 | +|----------------------|----------|----------|---------|----------| +| 24 threads | 78.14 | 21.86 | 84.39 | 23.61 | +|----------------------|----------|----------|---------|----------| +| 32 threads | 83.60 | 16.41 | 90.29 | 17.71 | +|----------------------|----------|----------|---------|----------| +| 40 threads | 92.96 | 7.04 | 100.39 | 7.61 | +|----------------------|----------|----------|---------|----------| +| 48 threads | 96.08 | 3.92 | 103.77 | 4.24 | +|----------------------|----------|----------|---------|----------| +| 56 threads | 98.42 | 1.58 | 105.31 | 1.68 | +|----------------------|----------|----------|---------|----------| +| 64 threads | 100.00 | 0.00 | 107.00 | 0.00 | +|----------------------|----------|----------|---------|----------| + +|-----------------------------------------------------------------| +| Shared Capped (8 VP / 4 EC) : | +|----------------------|---------------------|--------------------| +| | Actual | Normalized | +| Stress-ng threads |---------------------|--------------------| +| | %busy | %idle | %busy | %idle | +|----------------------|----------|----------|---------|----------| +| 0 threads | 0.03 | 99.97 | 0.19 | 99.44 | +|----------------------|----------|----------|---------|----------| +| 8 threads | 35.91 | 64.09 | 38.78 | 61.58 | +|----------------------|----------|----------|---------|----------| +| 16 threads | 36.83 | 63.17 | 39.78 | 60.55 | +|----------------------|----------|----------|---------|----------| +| 24 threads | 40.16 | 59.84 | 43.37 | 56.95 | +|----------------------|----------|----------|---------|----------| +| 32 threads | 44.47 | 55.53 | 48.02 | 52.38 | +|----------------------|----------|----------|---------|----------| +| 40 threads | 46.55 | 53.45 | 50.27 | 50.04 | +|----------------------|----------|----------|---------|----------| +| 48 threads | 48.13 | 51.87 | 52.48 | 47.82 | +|----------------------|----------|----------|---------|----------| +| 56 threads | 49.01 | 50.99 | 52.93 | 47.41 | +|----------------------|----------|----------|---------|----------| +| 64 threads | 49.90 | 50.10 | 53.40 | 46.19 | +|----------------------|----------|----------|---------|----------| + +Before Change: +%idle = delta_idle_purr / delta_tb * 100 + +After Change: +%idle = (delta_tb - delta_purr + delta_idle_purr) / delta_tb * 100 + +Signed-off-by: Saket Kumar Bhaskar +Signed-off-by: Tyrel Datwyler +--- + src/lparstat.c | 49 ++++++++++++++++++++++++++++++++++++++++++------- + 1 file changed, 42 insertions(+), 7 deletions(-) + +diff --git a/src/lparstat.c b/src/lparstat.c +index d2fdb3f..9d9ba1b 100644 +--- a/src/lparstat.c ++++ b/src/lparstat.c +@@ -515,11 +515,17 @@ void get_cpu_idle_purr(struct sysentry *unused_se, char *buf) + { + double delta_tb, delta_purr, delta_idle_purr; + double physc, idle; ++ char *descr; ++ char mode[32]; + + delta_tb = get_scaled_tb(); + delta_purr = get_delta_value("purr"); + delta_idle_purr = get_delta_value("idle_purr"); + ++ get_sysdata("shared_processor_mode", &descr, mode); ++ if (!strcmp(mode, "Dedicated")) ++ get_sysdata("DedDonMode", &descr, mode); ++ + /* + * Given that these values are read from different + * sources (purr from lparcfg and idle_purr from sysfs), +@@ -528,10 +534,23 @@ void get_cpu_idle_purr(struct sysentry *unused_se, char *buf) + */ + if (delta_idle_purr > delta_purr) + delta_idle_purr = delta_purr; +- +- physc = (delta_purr - delta_idle_purr) / delta_tb; +- idle = (delta_purr / delta_tb) - physc; +- idle *= 100.00; ++ /* ++ * Round down delta_purr to delta_tb if delta_tb - delta_purr ++ * error is under -1%. ++ */ ++ if (((delta_tb - delta_purr + delta_idle_purr) / delta_tb * 100) > -1 && ((delta_tb - delta_purr + delta_idle_purr) / delta_tb * 100) < 0) ++ delta_purr = delta_tb; ++ ++ if (!strcmp(mode, "Capped")) { ++ /* For dedicated - capped mode */ ++ physc = (delta_purr - delta_idle_purr) / delta_tb; ++ idle = (delta_purr / delta_tb) - physc; ++ idle *= 100.00; ++ } else { ++ /* For shared and dedicated - donate mode */ ++ idle = (delta_tb - delta_purr + delta_idle_purr) / delta_tb; ++ idle *= 100.00; ++ } + + sprintf(buf, "%.2f", idle); + } +@@ -559,14 +578,30 @@ void get_cpu_idle_spurr(struct sysentry *unused_se, char *buf) + double delta_tb, delta_spurr, delta_idle_spurr; + double physc, idle; + double rfreq; ++ char *descr; ++ char mode[32]; + + delta_tb = get_scaled_tb(); + delta_spurr = get_delta_value("spurr"); + delta_idle_spurr = get_delta_value("idle_spurr"); + +- physc = (delta_spurr - delta_idle_spurr) / delta_tb; +- idle = (delta_spurr / delta_tb) - physc; +- idle *= 100.00; ++ get_sysdata("shared_processor_mode", &descr, mode); ++ if (!strcmp(mode, "Dedicated")) ++ get_sysdata("DedDonMode", &descr, mode); ++ ++ if (delta_spurr > delta_tb) ++ delta_spurr = delta_tb; ++ ++ if (!strcmp(mode, "Capped")) { ++ /* For dedicated - capped mode */ ++ physc = (delta_spurr - delta_idle_spurr) / delta_tb; ++ idle = (delta_spurr / delta_tb) - physc; ++ idle *= 100.00; ++ } else { ++ /* For shared and dedicated - donate mode */ ++ idle = (delta_tb - delta_spurr + delta_idle_spurr) / delta_tb; ++ idle *= 100.00; ++ } + + rfreq = round_off_freq(); + idle += ((idle * rfreq) / 100); +-- +2.45.2 + diff --git a/0003-lparstat-app-Use-pic-value-at-boot-for-accurate-boot.patch b/0003-lparstat-app-Use-pic-value-at-boot-for-accurate-boot.patch new file mode 100644 index 0000000..63e3890 --- /dev/null +++ b/0003-lparstat-app-Use-pic-value-at-boot-for-accurate-boot.patch @@ -0,0 +1,87 @@ +From 81c51b59aacaa66d90d571ee19a2deeda1d45271 Mon Sep 17 00:00:00 2001 +From: Shrikanth Hegde +Date: Tue, 14 May 2024 20:46:43 +0530 +Subject: [PATCH] lparstat: app: Use pic value at boot for accurate boot time + reporting + +Upstream: merged, expected in v1.3.13 +Git-commit: 81c51b59aacaa66d90d571ee19a2deeda1d45271 + +When there are no options specified for lparstat, it is expected to +give reports since LPAR(Logical Partition) boot. APP(Available Physical +Processors) is an indicator for available cores in an Shared Processor +LPAR(SPLPAR). APP is derived using pool_idle_time which is obtained +using H_PIC call. + +The interval based reports show correct APP value while since boot +report shows very high APP values. This happens because in that case APP +is obtained by dividing pool idle time by LPAR uptime. Since pool idle +time is reported by the PowerVM hypervisor since its boot, it need not +align with LPAR boot. + +To fix that use the boot pool idle time added newly in the lparcfg as +below. + +APP = (pool idle time - boot pool idle time) / (uptime * timebase) + +*This depends on "powerpc/pseries: Add pool idle time at LPAR boot" be +merged into kernel* + +Results: (Observe APP values) +======================================================================== +lparstat +System Configuration +type=Shared mode=Uncapped smt=8 lcpu=12 mem=15573440 kB cpus=37 ent=12.00 + +reboot +stress-ng --cpu=$(nproc) -t 600 +sleep 600 +So in this case app is expected to close to 37-6=31. + +====== 6.9-rc1 and lparstat 1.3.10 ============= +%user %sys %wait %idle physc %entc lbusy app vcsw phint +----- ----- ----- ----- ----- ----- ----- ----- ----- ----- +47.48 0.01 0.00 52.51 0.00 0.00 47.49 69099.72 541547 21 + +=== With this patch and this patch to do the above equation === +%user %sys %wait %idle physc %entc lbusy app vcsw phint +----- ----- ----- ----- ----- ----- ----- ----- ----- ----- +47.48 0.01 0.00 52.51 5.73 47.75 47.49 31.21 541753 21 + +Signed-off-by: Shrikanth Hegde +Signed-off-by: Tyrel Datwyler +--- + src/lparstat.c | 3 ++- + src/lparstat.h | 2 ++ + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/lparstat.c b/src/lparstat.c +index 9d9ba1b..30889b2 100644 +--- a/src/lparstat.c ++++ b/src/lparstat.c +@@ -460,7 +460,8 @@ void get_cpu_app(struct sysentry *unused_se, char *buf) + se = get_sysentry("pool_idle_time"); + new_app = strtoll(se->value, NULL, 0); + if (se->old_value[0] == '\0') { +- old_app = 0; ++ se = get_sysentry("boot_pool_idle_time"); ++ old_app = strtoll(se->value, NULL, 0); + } else { + old_app = strtoll(se->old_value, NULL, 0); + } +diff --git a/src/lparstat.h b/src/lparstat.h +index b7c88e9..77203e1 100644 +--- a/src/lparstat.h ++++ b/src/lparstat.h +@@ -124,6 +124,8 @@ struct sysentry system_data[] = { + .get = &get_percent_entry}, + {.name = "pool_idle_time", + .descr = "Shared Processor Pool Idle Time"}, ++ {.name = "boot_pool_idle_time", ++ .descr = "Shared Processor Pool Idle Time"}, + {.name = "pool_num_procs", + .descr = "Shared Processor Pool Processors"}, + {.name = "unallocated_capacity_weight", +-- +2.45.2 + diff --git a/0004-lparstat-Use-CLOCK_BOOTTIME-for-get_time-interface-a.patch b/0004-lparstat-Use-CLOCK_BOOTTIME-for-get_time-interface-a.patch new file mode 100644 index 0000000..eb92018 --- /dev/null +++ b/0004-lparstat-Use-CLOCK_BOOTTIME-for-get_time-interface-a.patch @@ -0,0 +1,238 @@ +From 9572f8c2022fed9783f0f606cbe778ffe0d93fef Mon Sep 17 00:00:00 2001 +From: Shrikanth Hegde +Date: Tue, 14 May 2024 20:46:44 +0530 +Subject: [PATCH] lparstat: Use CLOCK_BOOTTIME for get_time interface and + Deprecate get_sys_upttime + +Upstream: merged, expected in v1.3.13 +Git-commit: 9572f8c2022fed9783f0f606cbe778ffe0d93fef + +"time" is used in lparstat.c to find the time elapsed either since boot +or between two intervals. But it is using gettimeofday which returns the +time elapsed since Epoch. This works for intervals calculations but it +doesn't work for since boot reports. + +Instead use the CLOCK_BOOTTIME interface to get the elapsed time. This +fixes physc, utilization based on purr being wrong since boot. + +Remove "uptime" interface since there are no users of it. One can get +the system uptime by calling "time" itself. + +=============================== ::Test:: ========================== +reboot +stress-ng --cpu=$(nproc) -t 600 +sleep 600 + +Results:: +==================== Shared LPAR ================================== +System Configuration +type=Shared mode=Uncapped smt=8 lcpu=12 mem=15573440 kB cpus=37 ent=12.00 + +lparstat -E <-- Observe utilization values +====== 6.9-rc1 and lparstat 1.3.10 ============= +---Actual--- -Normalized- +%busy %idle Frequency %busy %idle +------ ------ ------------- ------ ------ + 0.00 0.00 3.87GHz[106%] 0.00 0.00 + +==== With this patch and patch 2/3 ============= +---Actual--- -Normalized- +%busy %idle Frequency %busy %idle +------ ------ ------------- ------ ------ + 38.72 0.11 3.87GHz[106%] 41.04 0.12 + +lparstat <-- Observe physc values +====== 6.9-rc1 and lparstat 1.3.10 =================================== +%user %sys %wait %idle physc %entc lbusy app vcsw phint +----- ----- ----- ----- ----- ----- ----- ----- ----- ----- +47.48 0.01 0.00 52.51 0.00 0.00 47.49 69099.72 541547 21 + +=== With this patch and this patch ================================ === +%user %sys %wait %idle physc %entc lbusy app vcsw phint +----- ----- ----- ----- ----- ----- ----- ----- ----- ----- +47.48 0.01 0.00 52.51 5.73 47.75 47.49 31.21 541753 21 + +==================== Dedicated LPAR ================================== +System Configuration +type=Dedicated mode=Capped smt=8 lcpu=12 mem=15573248 kB cpus=0 ent=12.00 + +::lparstat -E:: <-- Observe utilization values. +======= 6.9-rc1 and lparstat 1.3.10 ============= +---Actual--- -Normalized- +%busy %idle Frequency %busy %idle +------ ------ ------------- ------ ------ + 0.00 0.00 3.87GHz[106%] 0.00 0.00 + +=== With this patch and powerpc-utils patch to do the above equation === +---Actual--- -Normalized- +%busy %idle Frequency %busy %idle +------ ------ ------------- ------ ------ + 48.87 51.51 3.87GHz[106%] 51.81 54.60 + +::lparstat:: <-- Observe physc values. +======= 6.9-rc1 and lparstat 1.3.10 ============= +%user %sys %wait %idle physc %entc lbusy app vcsw phint +----- ----- ----- ----- ----- ----- ----- ----- ----- ----- +48.38 0.01 0.00 51.61 0.03 0.25 48.39 0.00 344661 8 + +=== With this patch and powerpc-utils patch to do the above equation === +%user %sys %wait %idle physc %entc lbusy app vcsw phint +----- ----- ----- ----- ----- ----- ----- ----- ----- ----- +48.38 0.01 0.00 51.61 12.05 100.42 48.39 0.00 344877 8 + +============================================================================= + +Interval based lparstat values are same. With this patch the physc and +busy purr/idle purr values show correctly for since boot reports. + +Note: this patch doesn't fix the idle purr being incorrect. That is +currently being investigated. + +Signed-off-by: Shrikanth Hegde +Signed-off-by: Tyrel Datwyler +--- + src/lparstat.c | 57 +++++++++----------------------------------------- + src/lparstat.h | 6 ------ + 2 files changed, 10 insertions(+), 53 deletions(-) + +diff --git a/src/lparstat.c b/src/lparstat.c +index 30889b2..3e9169d 100644 +--- a/src/lparstat.c ++++ b/src/lparstat.c +@@ -36,6 +36,7 @@ + #include "lparstat.h" + #include "pseries_platform.h" + #include "cpu_info_helpers.h" ++#include + + #define LPARCFG_FILE "/proc/ppc64/lparcfg" + #define SE_NOT_FOUND "???" +@@ -255,14 +256,17 @@ long long get_delta_value(char *se_name) + + void get_time() + { +- struct timeval t; + struct sysentry *se; ++ struct timespec ts; ++ int err; + +- gettimeofday(&t, 0); ++ err = clock_gettime(CLOCK_BOOTTIME, &ts); ++ if (err) ++ return; + + se = get_sysentry("time"); + sprintf(se->value, "%lld", +- (long long)t.tv_sec * 1000000LL + (long long)t.tv_usec); ++ (long long)ts.tv_sec); + } + + int get_time_base() +@@ -304,7 +308,6 @@ double get_scaled_tb(void) + online_cores = atoi(se->value); + + elapsed = get_delta_value("time"); +- elapsed = elapsed / 1000000.0; + + se = get_sysentry("timebase"); + timebase = atoi(se->value); +@@ -312,31 +315,6 @@ double get_scaled_tb(void) + return (timebase * elapsed) * online_cores; + } + +-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); +-} +- + int get_nominal_frequency(void) + { + FILE *f; +@@ -403,13 +381,12 @@ void get_cpu_physc(struct sysentry *unused_se, char *buf) + delta_purr = get_delta_value("purr"); + + se = get_sysentry("tbr"); +- if (se->value[0] != '\0') { ++ if (se->old_value[0] != '\0') { + delta_tb = get_delta_value("tbr"); + + physc = delta_purr / delta_tb; + } else { + elapsed = get_delta_value("time"); +- elapsed = elapsed / 1000000.0; + + se = get_sysentry("timebase"); + timebase = atoi(se->value); +@@ -436,23 +413,9 @@ void get_cpu_app(struct sysentry *unused_se, char *buf) + { + struct sysentry *se; + float timebase, app, elapsed_time; +- long long new_app, old_app, delta_time; +- char *descr, uptime[32]; ++ long long new_app, old_app; + +- 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 { +- delta_time = get_delta_value("time"); +- elapsed_time = delta_time / 1000000.0; +- } ++ elapsed_time = get_delta_value("time"); + + se = get_sysentry("timebase"); + timebase = atof(se->value); +diff --git a/src/lparstat.h b/src/lparstat.h +index 77203e1..86e45e4 100644 +--- a/src/lparstat.h ++++ b/src/lparstat.h +@@ -60,7 +60,6 @@ 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 *); + extern void get_cpu_util_purr(struct sysentry *unused_se, char *buf); + extern void get_cpu_idle_purr(struct sysentry *unused_se, char *buf); + extern void get_cpu_util_spurr(struct sysentry *unused_se, char *buf); +@@ -272,11 +271,6 @@ struct sysentry system_data[] = { + {.name = "phint", + .descr = "Phantom Interrupts"}, + +- /* /proc/uptime */ +- {.name = "uptime", +- .descr = "System Uptime", +- .get = &get_sys_uptime}, +- + /* /sys/devices/system/cpu/cpu/ */ + /* Sum of per CPU SPURR registers */ + {.name = "spurr", +-- +2.45.2 + diff --git a/0005-ofpathname-skip-devices-with-no-devspec-when-coorela.patch b/0005-ofpathname-skip-devices-with-no-devspec-when-coorela.patch new file mode 100644 index 0000000..c9321b9 --- /dev/null +++ b/0005-ofpathname-skip-devices-with-no-devspec-when-coorela.patch @@ -0,0 +1,63 @@ +From a56028561ad9c01b5d3a767e50455c561e09191c Mon Sep 17 00:00:00 2001 +From: Tyrel Datwyler +Date: Fri, 26 Jul 2024 16:17:47 -0700 +Subject: [PATCH] ofpathname: skip devices with no devspec when coorelating FC + OF paths + +Upstream: merged, expected in v1.3.13 +Git-commit: a56028561ad9c01b5d3a767e50455c561e09191c + +When using ofpathname to find the logical device associated to a Fibre +Channel or Virtual Fibre Channel OF path an ERR_NO_SYSFS_DEVINFO error +can be returned if a device with no devspec attribute is in the list of +devices to cross reference. + +If a device with no devspec is found simply skip it an continue the +for-loop device search. + +Signed-off-by: Tyrel Datwyler +--- + scripts/ofpathname | 16 ++++++++++++---- + 1 file changed, 12 insertions(+), 4 deletions(-) + +diff --git a/scripts/ofpathname b/scripts/ofpathname +index 833d03f..711ab62 100755 +--- a/scripts/ofpathname ++++ b/scripts/ofpathname +@@ -1649,10 +1649,14 @@ of2l_vfc() + link=$PWD + + local device_dir=${PWD##/*/} +- goto_dir $PWD "devspec" ++ goto_dir $PWD "devspec" 0 ++ if [[ $? -eq 1 ]]; then ++ continue; ++ fi + OF_PATH=`$CAT $PWD/devspec` ++ + if [[ -z $OF_PATH ]]; then +- err $ERR_NO_LOGDEV ++ err $ERR_NO_LOGDEV + fi + + # Skip if this is not the correct FC port +@@ -1727,10 +1731,14 @@ of2l_fc() + + cd $link + local device_dir=${PWD##/*/} +- goto_dir $PWD "devspec" ++ goto_dir $PWD "devspec" 0 ++ if [[ $? -eq 1 ]]; then ++ continue; ++ fi + OF_PATH=`$CAT devspec` ++ + if [[ -z $OF_PATH ]]; then +- err $ERR_NO_LOGDEV ++ err $ERR_NO_LOGDEV; + fi + + # Skip if this is not the correct FC port +-- +2.45.2 + diff --git a/0006-drmgr-Free-nodes-returned-from-configure_connector.patch b/0006-drmgr-Free-nodes-returned-from-configure_connector.patch new file mode 100644 index 0000000..d0b006a --- /dev/null +++ b/0006-drmgr-Free-nodes-returned-from-configure_connector.patch @@ -0,0 +1,46 @@ +From 5db2df531f9c242b13ef6520814c99685144c6d4 Mon Sep 17 00:00:00 2001 +From: Haren Myneni +Date: Sat, 29 Jun 2024 14:14:10 -0700 +Subject: [PATCH] drmgr: Free nodes returned from configure_connector + +Upstream: merged, expected in v1.3.13 +Git-commit: 5db2df531f9c242b13ef6520814c99685144c6d4 + +of_nodes returned from configure_connector should be freed after +updating the device tree and is missing in acquire_hp_resource() +and add_work(). This patch calls free_of_node() in these functions. + +Signed-off-by: Haren Myneni +Signed-off-by: Tyrel Datwyler +--- + src/drmgr/common_pci.c | 1 + + src/drmgr/drslot_chrp_pci.c | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/src/drmgr/common_pci.c b/src/drmgr/common_pci.c +index 2411641..759589a 100644 +--- a/src/drmgr/common_pci.c ++++ b/src/drmgr/common_pci.c +@@ -1434,6 +1434,7 @@ acquire_hp_resource(struct dr_connector *drc, char *of_path) + return -1; + + rc = add_device_tree_nodes(of_path, new_nodes); ++ free_of_node(new_nodes); + if (rc) { + say(ERROR, "add nodes failed for 0x%x\n", drc->index); + return rc; +diff --git a/src/drmgr/drslot_chrp_pci.c b/src/drmgr/drslot_chrp_pci.c +index ac078db..ec3c77c 100644 +--- a/src/drmgr/drslot_chrp_pci.c ++++ b/src/drmgr/drslot_chrp_pci.c +@@ -454,6 +454,7 @@ static int add_work(struct dr_node *node, bool partner_device) + + say(DEBUG, "Adding %s to %s\n", new_nodes->name, node->ofdt_path); + rc = add_device_tree_nodes(node->ofdt_path, new_nodes); ++ free_of_node(new_nodes); + if (rc) { + say(DEBUG, "add_device_tree_nodes failed at %s\n", + node->ofdt_path); +-- +2.45.2 + diff --git a/powerpc-utils.changes b/powerpc-utils.changes index 1f8512f..adb390e 100644 --- a/powerpc-utils.changes +++ b/powerpc-utils.changes @@ -1,3 +1,17 @@ +------------------------------------------------------------------- +Wed Jul 31 10:02:13 UTC 2024 - Michal Suchanek + +- ofpathname: skip devices with no devspec when coorelating FC OF paths (bsc#1228597 ltc#206391). + * 0005-ofpathname-skip-devices-with-no-devspec-when-coorela.patch +- lparstat output fixes (bsc#1228637). + * 0002-lparstat-Fix-Idle-and-busy-PURR-SPURR.patch + * 0003-lparstat-app-Use-pic-value-at-boot-for-accurate-boot.patch + * 0004-lparstat-Use-CLOCK_BOOTTIME-for-get_time-interface-a.patch +- drmgr: Free nodes returned from configure_connector (bsc#1228637). + * 0006-drmgr-Free-nodes-returned-from-configure_connector.patch +- drmgr: Return from get_node_by_name() if matched DRC index (bsc#1228637). + * 0001-drmgr-Return-from-get_node_by_name-if-matched-DRC-in.patch + ------------------------------------------------------------------- Tue Apr 2 08:25:42 UTC 2024 - Michal Suchanek diff --git a/powerpc-utils.spec b/powerpc-utils.spec index ba14acd..672e053 100644 --- a/powerpc-utils.spec +++ b/powerpc-utils.spec @@ -29,8 +29,14 @@ Patch1: powerpc-utils-lsprop.patch Patch2: ofpathname_powernv.patch Patch3: fix_kexec_service_name_for_suse.patch Patch4: libvirt-service-dep.patch +Patch5: 0001-drmgr-Return-from-get_node_by_name-if-matched-DRC-in.patch +Patch6: 0006-drmgr-Free-nodes-returned-from-configure_connector.patch +Patch7: 0005-ofpathname-skip-devices-with-no-devspec-when-coorela.patch Patch8: ppc64_cpu-Support-partial-SMT-level-through-SYS-FS-s.patch Patch9: ppc64_cpu-Clean-up-sysfs-smt-control-error-handling.patch +Patch10: 0002-lparstat-Fix-Idle-and-busy-PURR-SPURR.patch +Patch11: 0003-lparstat-app-Use-pic-value-at-boot-for-accurate-boot.patch +Patch12: 0004-lparstat-Use-CLOCK_BOOTTIME-for-get_time-interface-a.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: libnuma-devel