Sync from SUSE:SLFO:Main powerpc-utils revision a7538321d8f190c196916ed56ef7f51d
This commit is contained in:
parent
d16dfc0a8c
commit
f64e800c72
@ -1,35 +0,0 @@
|
|||||||
From 1dc1ecf7dce7825d352b045c98aa51711b58aaca Mon Sep 17 00:00:00 2001
|
|
||||||
From: Haren Myneni <haren@linux.ibm.com>
|
|
||||||
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 <haren@linux.ibm.com>
|
|
||||||
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
|
|
||||||
---
|
|
||||||
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
|
|
||||||
|
|
@ -1,99 +0,0 @@
|
|||||||
From a6a7d375d38823a08d358b50866a95f6f326907e Mon Sep 17 00:00:00 2001
|
|
||||||
From: Haren Myneni <haren@linux.ibm.com>
|
|
||||||
Date: Tue, 13 Aug 2024 14:40:23 -0700
|
|
||||||
Subject: [PATCH 1/4] drmgr/pci: Enable in-kernel functionality to update
|
|
||||||
device tree
|
|
||||||
|
|
||||||
drmgr updates the device tree by writing to /proc/ppc64/ofdt. Also
|
|
||||||
invokes configure_connector RTAS call to retrieve new device nodes
|
|
||||||
for IO ADD. But this functionality need /dev/mem access which is
|
|
||||||
restricted under system lockdown.
|
|
||||||
|
|
||||||
The kernel updates provided a sysfs file (/sys/kernel/dlpar) that
|
|
||||||
will allow drmgr command invoke the following interfaces to update
|
|
||||||
the device tree.
|
|
||||||
|
|
||||||
dt add index <DRC index> ---> To add new device nodes to the device
|
|
||||||
tree which is used for IO ADD.
|
|
||||||
|
|
||||||
dt remove index <DRC index> ---> To remove device nodes for IO
|
|
||||||
REMOVE
|
|
||||||
|
|
||||||
This patch checks the kernel interface for the availability of
|
|
||||||
device tree update feature and adds do_dt_kernel_dlpar() to invoke
|
|
||||||
the above kernel interfaces.
|
|
||||||
|
|
||||||
Signed-off-by: Haren Myneni <haren@linux.ibm.com>
|
|
||||||
---
|
|
||||||
src/drmgr/common.c | 6 ++++++
|
|
||||||
src/drmgr/common_pci.c | 29 +++++++++++++++++++++++++++++
|
|
||||||
src/drmgr/dr.h | 1 +
|
|
||||||
3 files changed, 36 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/src/drmgr/common.c b/src/drmgr/common.c
|
|
||||||
index bfec0b9bb966..70f4dfda92a5 100644
|
|
||||||
--- a/src/drmgr/common.c
|
|
||||||
+++ b/src/drmgr/common.c
|
|
||||||
@@ -1504,6 +1504,12 @@ int kernel_dlpar_exists(void)
|
|
||||||
if (strstr(buf, "cpu"))
|
|
||||||
return 1;
|
|
||||||
break;
|
|
||||||
+ case DRC_TYPE_PCI:
|
|
||||||
+ case DRC_TYPE_PHB:
|
|
||||||
+ case DRC_TYPE_SLOT:
|
|
||||||
+ if (strstr(buf, "dt"))
|
|
||||||
+ return 1;
|
|
||||||
+ break;
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
diff --git a/src/drmgr/common_pci.c b/src/drmgr/common_pci.c
|
|
||||||
index 1ef4ec9653b0..374129cf33e0 100644
|
|
||||||
--- a/src/drmgr/common_pci.c
|
|
||||||
+++ b/src/drmgr/common_pci.c
|
|
||||||
@@ -1619,3 +1619,32 @@ int disable_hp_children(char *drc_name)
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+/*
|
|
||||||
+ * kernel interface to update device tree nodes.
|
|
||||||
+ * dlpar dt [add|remove] index <#drc index>
|
|
||||||
+ */
|
|
||||||
+int do_dt_kernel_dlpar(uint32_t index, int action)
|
|
||||||
+{
|
|
||||||
+ char cmdbuf[256];
|
|
||||||
+ int offset;
|
|
||||||
+
|
|
||||||
+ offset = sprintf(cmdbuf, "%s ", "dt");
|
|
||||||
+
|
|
||||||
+ switch (action) {
|
|
||||||
+ case ADD:
|
|
||||||
+ offset += sprintf(cmdbuf + offset, "add ");
|
|
||||||
+ break;
|
|
||||||
+ case REMOVE:
|
|
||||||
+ offset += sprintf(cmdbuf + offset, "remove ");
|
|
||||||
+ break;
|
|
||||||
+ default:
|
|
||||||
+ /* Should not happen */
|
|
||||||
+ say(ERROR, "Invalid action type specified\n");
|
|
||||||
+ return -EINVAL;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ offset += sprintf(cmdbuf + offset, "index 0x%x", index);
|
|
||||||
+
|
|
||||||
+ return do_kernel_dlpar(cmdbuf, offset);
|
|
||||||
+}
|
|
||||||
diff --git a/src/drmgr/dr.h b/src/drmgr/dr.h
|
|
||||||
index 60c31c44b7e3..72ede55547a3 100644
|
|
||||||
--- a/src/drmgr/dr.h
|
|
||||||
+++ b/src/drmgr/dr.h
|
|
||||||
@@ -188,4 +188,5 @@ static inline int do_kernel_dlpar(const char *cmd, int len)
|
|
||||||
{
|
|
||||||
return do_kernel_dlpar_common(cmd, len, 0);
|
|
||||||
}
|
|
||||||
+int do_dt_kernel_dlpar(uint32_t, int);
|
|
||||||
#endif
|
|
||||||
--
|
|
||||||
2.46.0
|
|
||||||
|
|
@ -1,72 +0,0 @@
|
|||||||
From e2388681df4aec97ab9a3f883baf37f51a710a00 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Haren Myneni <haren@linux.ibm.com>
|
|
||||||
Date: Tue, 13 Aug 2024 14:40:26 -0700
|
|
||||||
Subject: [PATCH 2/4] drmgr/SLOT: Add kernel interface support for device tree
|
|
||||||
update
|
|
||||||
|
|
||||||
Use the following kernel interfaces for SLOT device type to update
|
|
||||||
the device tree if this feature is enabled in the kernel.
|
|
||||||
|
|
||||||
dt add index <DRC index> --> for IO add
|
|
||||||
dt remove index <DRC index> --> for IO remove
|
|
||||||
|
|
||||||
Signed-off-by: Haren Myneni <haren@linux.ibm.com>
|
|
||||||
---
|
|
||||||
src/drmgr/drslot_chrp_slot.c | 25 +++++++++++++++++--------
|
|
||||||
1 file changed, 17 insertions(+), 8 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/drmgr/drslot_chrp_slot.c b/src/drmgr/drslot_chrp_slot.c
|
|
||||||
index 0966c256aa01..180b10857add 100644
|
|
||||||
--- a/src/drmgr/drslot_chrp_slot.c
|
|
||||||
+++ b/src/drmgr/drslot_chrp_slot.c
|
|
||||||
@@ -71,7 +71,10 @@ release_slot(struct dr_node *slot)
|
|
||||||
if (rc)
|
|
||||||
return rc;
|
|
||||||
|
|
||||||
- rc = remove_device_tree_nodes(slot->ofdt_path);
|
|
||||||
+ if (kernel_dlpar_exists())
|
|
||||||
+ rc = do_dt_kernel_dlpar(slot->drc_index, REMOVE);
|
|
||||||
+ else
|
|
||||||
+ rc = remove_device_tree_nodes(slot->ofdt_path);
|
|
||||||
if (rc) {
|
|
||||||
acquire_drc(slot->drc_index);
|
|
||||||
return rc;
|
|
||||||
@@ -160,7 +163,6 @@ static int
|
|
||||||
acquire_slot(char *drc_name, struct dr_node **slot)
|
|
||||||
{
|
|
||||||
struct dr_connector drc;
|
|
||||||
- struct of_node *of_nodes;
|
|
||||||
char path[DR_PATH_MAX];
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
@@ -180,14 +182,21 @@ acquire_slot(char *drc_name, struct dr_node **slot)
|
|
||||||
if (rc)
|
|
||||||
return rc;
|
|
||||||
|
|
||||||
- of_nodes = configure_connector(drc.index);
|
|
||||||
- if (of_nodes == NULL) {
|
|
||||||
- release_drc(drc.index, PCI_DLPAR_DEV);
|
|
||||||
- return -1;
|
|
||||||
+ if (kernel_dlpar_exists()) {
|
|
||||||
+ rc = do_dt_kernel_dlpar(drc.index, ADD);
|
|
||||||
+ } else {
|
|
||||||
+ struct of_node *of_nodes;
|
|
||||||
+
|
|
||||||
+ of_nodes = configure_connector(drc.index);
|
|
||||||
+ if (of_nodes == NULL) {
|
|
||||||
+ release_drc(drc.index, PCI_DLPAR_DEV);
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ rc = add_device_tree_nodes(path, of_nodes);
|
|
||||||
+ free_of_node(of_nodes);
|
|
||||||
}
|
|
||||||
|
|
||||||
- rc = add_device_tree_nodes(path, of_nodes);
|
|
||||||
- free_of_node(of_nodes);
|
|
||||||
if (rc) {
|
|
||||||
say(ERROR, "add_device_tree_nodes failed at %s\n", path);
|
|
||||||
release_drc(drc.index, PCI_DLPAR_DEV);
|
|
||||||
--
|
|
||||||
2.46.0
|
|
||||||
|
|
@ -1,236 +0,0 @@
|
|||||||
From 2af8c0b9a285e8a6104560d0f482819e56060443 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Saket Kumar Bhaskar <skb99@linux.ibm.com>
|
|
||||||
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 <skb99@linux.ibm.com>
|
|
||||||
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
|
|
||||||
---
|
|
||||||
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
|
|
||||||
|
|
@ -1,79 +0,0 @@
|
|||||||
From 7038756642711fa53143906b3b3f29900eb4a4ea Mon Sep 17 00:00:00 2001
|
|
||||||
From: Haren Myneni <haren@linux.ibm.com>
|
|
||||||
Date: Tue, 13 Aug 2024 14:40:25 -0700
|
|
||||||
Subject: [PATCH 3/4] drmgr/pci: Add kernel interface support for device tree
|
|
||||||
update
|
|
||||||
|
|
||||||
Use the following kernel interfaces for PCI device type to update
|
|
||||||
the device tree if this feature is enabled in the kernel.
|
|
||||||
|
|
||||||
dt add index <DRC index> --> for IO add
|
|
||||||
dt remove index <DRC index> --> for IO remove
|
|
||||||
|
|
||||||
Signed-off-by: Haren Myneni <haren@linux.ibm.com>
|
|
||||||
---
|
|
||||||
src/drmgr/drslot_chrp_pci.c | 32 ++++++++++++++++++++++----------
|
|
||||||
1 file changed, 22 insertions(+), 10 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/drmgr/drslot_chrp_pci.c b/src/drmgr/drslot_chrp_pci.c
|
|
||||||
index 3b48de30be66..56f8bb397e67 100644
|
|
||||||
--- a/src/drmgr/drslot_chrp_pci.c
|
|
||||||
+++ b/src/drmgr/drslot_chrp_pci.c
|
|
||||||
@@ -366,7 +366,6 @@ static int add_work(struct dr_node *node)
|
|
||||||
int pow_state; /* Tells us if power was turned on when */
|
|
||||||
int iso_state; /* Tells us isolation state after */
|
|
||||||
int rc;
|
|
||||||
- struct of_node *new_nodes;/* nodes returned from configure_connector */
|
|
||||||
|
|
||||||
/* if we're continuing, set LED_ON and see if a card is really there. */
|
|
||||||
if (process_led(node, LED_ON))
|
|
||||||
@@ -425,16 +424,26 @@ static int add_work(struct dr_node *node)
|
|
||||||
* the return status requires a message, print it out
|
|
||||||
* and exit, otherwise, add the nodes to the OF tree.
|
|
||||||
*/
|
|
||||||
- new_nodes = configure_connector(node->drc_index);
|
|
||||||
- if (new_nodes == NULL) {
|
|
||||||
- rtas_set_indicator(ISOLATION_STATE, node->drc_index, ISOLATE);
|
|
||||||
- set_power(node->drc_power, POWER_OFF);
|
|
||||||
- return -1;
|
|
||||||
+ if (kernel_dlpar_exists()) {
|
|
||||||
+ rc = do_dt_kernel_dlpar(node->drc_index, ADD);
|
|
||||||
+ } else {
|
|
||||||
+ struct of_node *new_nodes; /* nodes returned from */
|
|
||||||
+ /* configure_connector */
|
|
||||||
+
|
|
||||||
+ new_nodes = configure_connector(node->drc_index);
|
|
||||||
+ if (new_nodes == NULL) {
|
|
||||||
+ rtas_set_indicator(ISOLATION_STATE, node->drc_index,
|
|
||||||
+ ISOLATE);
|
|
||||||
+ set_power(node->drc_power, POWER_OFF);
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
- 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);
|
|
||||||
@@ -692,7 +701,10 @@ static struct dr_node *remove_work(struct dr_node *all_nodes)
|
|
||||||
* the device tree.
|
|
||||||
*/
|
|
||||||
for (child = node->children; child; child = child->next) {
|
|
||||||
- rc = remove_device_tree_nodes(child->ofdt_path);
|
|
||||||
+ if (kernel_dlpar_exists())
|
|
||||||
+ rc = do_dt_kernel_dlpar(child->drc_index, REMOVE);
|
|
||||||
+ else
|
|
||||||
+ rc = remove_device_tree_nodes(child->ofdt_path);
|
|
||||||
if (rc) {
|
|
||||||
say(ERROR, "%s", sw_error);
|
|
||||||
rtas_set_indicator(ISOLATION_STATE, node->drc_index,
|
|
||||||
--
|
|
||||||
2.46.0
|
|
||||||
|
|
@ -1,87 +0,0 @@
|
|||||||
From 81c51b59aacaa66d90d571ee19a2deeda1d45271 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Shrikanth Hegde <sshegde@linux.ibm.com>
|
|
||||||
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 <sshegde@linux.ibm.com>
|
|
||||||
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
|
|
||||||
---
|
|
||||||
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
|
|
||||||
|
|
@ -1,142 +0,0 @@
|
|||||||
From b8ab373035984dd8aba29f1a0c03dcef6546f004 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Haren Myneni <haren@linux.ibm.com>
|
|
||||||
Date: Tue, 13 Aug 2024 14:40:24 -0700
|
|
||||||
Subject: [PATCH 4/4] drmgr/phb: Add kernel interface support for device tree
|
|
||||||
update
|
|
||||||
|
|
||||||
Use the following kernel interfaces for PHB device type to update
|
|
||||||
the device tree if this feature is enabled in the kernel.
|
|
||||||
|
|
||||||
dt add index <DRC index> --> for IO add
|
|
||||||
dt remove index <DRC index> --> for IO remove
|
|
||||||
|
|
||||||
Signed-off-by: Haren Myneni <haren@linux.ibm.com>
|
|
||||||
---
|
|
||||||
src/drmgr/common_pci.c | 29 +++++++++++++++++++++-------
|
|
||||||
src/drmgr/drslot_chrp_phb.c | 38 ++++++++++++++++++++-----------------
|
|
||||||
2 files changed, 43 insertions(+), 24 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/drmgr/common_pci.c b/src/drmgr/common_pci.c
|
|
||||||
index 374129cf33e0..540864574569 100644
|
|
||||||
--- a/src/drmgr/common_pci.c
|
|
||||||
+++ b/src/drmgr/common_pci.c
|
|
||||||
@@ -1390,7 +1390,6 @@ print_node_list(struct dr_node *first_node)
|
|
||||||
static int
|
|
||||||
acquire_hp_resource(struct dr_connector *drc, char *of_path)
|
|
||||||
{
|
|
||||||
- struct of_node *new_nodes;
|
|
||||||
int state;
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
@@ -1429,12 +1428,21 @@ acquire_hp_resource(struct dr_connector *drc, char *of_path)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state == PRESENT) {
|
|
||||||
- new_nodes = configure_connector(drc->index);
|
|
||||||
- if (new_nodes == NULL)
|
|
||||||
- return -1;
|
|
||||||
+ /*
|
|
||||||
+ * Use kernel DLPAR interface if it is enabled
|
|
||||||
+ */
|
|
||||||
+ if (kernel_dlpar_exists()) {
|
|
||||||
+ rc = do_dt_kernel_dlpar(drc->index, ADD);
|
|
||||||
+ } else {
|
|
||||||
+ struct of_node *new_nodes;
|
|
||||||
+
|
|
||||||
+ new_nodes = configure_connector(drc->index);
|
|
||||||
+ if (new_nodes == NULL)
|
|
||||||
+ return -1;
|
|
||||||
|
|
||||||
- rc = add_device_tree_nodes(of_path, new_nodes);
|
|
||||||
- free_of_node(new_nodes);
|
|
||||||
+ 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;
|
|
||||||
@@ -1490,7 +1498,14 @@ release_hp_resource(struct dr_node *node)
|
|
||||||
{
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
- rc = remove_device_tree_nodes(node->ofdt_path);
|
|
||||||
+ /*
|
|
||||||
+ * Use kernel DLPAR interface if it is enabled
|
|
||||||
+ */
|
|
||||||
+ if (kernel_dlpar_exists())
|
|
||||||
+ rc = do_dt_kernel_dlpar(node->drc_index, REMOVE);
|
|
||||||
+ else
|
|
||||||
+ rc = remove_device_tree_nodes(node->ofdt_path);
|
|
||||||
+
|
|
||||||
if (rc) {
|
|
||||||
say(ERROR, "failed to remove kernel nodes for index 0x%x\n",
|
|
||||||
node->drc_index);
|
|
||||||
diff --git a/src/drmgr/drslot_chrp_phb.c b/src/drmgr/drslot_chrp_phb.c
|
|
||||||
index f59baa4f9e27..ffa17d8f6b7d 100644
|
|
||||||
--- a/src/drmgr/drslot_chrp_phb.c
|
|
||||||
+++ b/src/drmgr/drslot_chrp_phb.c
|
|
||||||
@@ -108,17 +108,16 @@ release_phb(struct dr_node *phb)
|
|
||||||
{
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
- rc = remove_device_tree_nodes(phb->ofdt_path);
|
|
||||||
- if (rc)
|
|
||||||
- return rc;
|
|
||||||
-
|
|
||||||
- if (phb->phb_ic_ofdt_path[0] != '\0') {
|
|
||||||
- rc = remove_device_tree_nodes(phb->phb_ic_ofdt_path);
|
|
||||||
- if (rc)
|
|
||||||
- return rc;
|
|
||||||
+ if (kernel_dlpar_exists())
|
|
||||||
+ rc = do_dt_kernel_dlpar(phb->drc_index, REMOVE);
|
|
||||||
+ else {
|
|
||||||
+ rc = remove_device_tree_nodes(phb->ofdt_path);
|
|
||||||
+ if (!rc && (phb->phb_ic_ofdt_path[0] != '\0'))
|
|
||||||
+ rc = remove_device_tree_nodes(phb->phb_ic_ofdt_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
- rc = release_drc(phb->drc_index, PHB_DEV);
|
|
||||||
+ if (!rc)
|
|
||||||
+ rc = release_drc(phb->drc_index, PHB_DEV);
|
|
||||||
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
@@ -371,7 +370,6 @@ phb_remove_error:
|
|
||||||
static int acquire_phb(char *drc_name, struct dr_node **phb)
|
|
||||||
{
|
|
||||||
struct dr_connector drc;
|
|
||||||
- struct of_node *of_nodes;
|
|
||||||
char path[DR_PATH_MAX];
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
@@ -386,14 +384,20 @@ static int acquire_phb(char *drc_name, struct dr_node **phb)
|
|
||||||
if (rc)
|
|
||||||
return rc;
|
|
||||||
|
|
||||||
- of_nodes = configure_connector(drc.index);
|
|
||||||
- if (of_nodes == NULL) {
|
|
||||||
- release_drc(drc.index, PHB_DEV);
|
|
||||||
- return -1;
|
|
||||||
- }
|
|
||||||
+ if (kernel_dlpar_exists()) {
|
|
||||||
+ rc = do_dt_kernel_dlpar(drc.index, ADD);
|
|
||||||
+ } else {
|
|
||||||
+ struct of_node *of_nodes;
|
|
||||||
|
|
||||||
- rc = add_device_tree_nodes(path, of_nodes);
|
|
||||||
- free_of_node(of_nodes);
|
|
||||||
+ of_nodes = configure_connector(drc.index);
|
|
||||||
+ if (of_nodes == NULL) {
|
|
||||||
+ release_drc(drc.index, PHB_DEV);
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ rc = add_device_tree_nodes(path, of_nodes);
|
|
||||||
+ free_of_node(of_nodes);
|
|
||||||
+ }
|
|
||||||
if (rc) {
|
|
||||||
say(ERROR, "add_device_tree_nodes failed at %s\n", path);
|
|
||||||
release_drc(drc.index, PHB_DEV);
|
|
||||||
--
|
|
||||||
2.46.0
|
|
||||||
|
|
@ -1,238 +0,0 @@
|
|||||||
From 9572f8c2022fed9783f0f606cbe778ffe0d93fef Mon Sep 17 00:00:00 2001
|
|
||||||
From: Shrikanth Hegde <sshegde@linux.ibm.com>
|
|
||||||
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 <sshegde@linux.ibm.com>
|
|
||||||
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
|
|
||||||
---
|
|
||||||
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 <time.h>
|
|
||||||
|
|
||||||
#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<n>/ */
|
|
||||||
/* Sum of per CPU SPURR registers */
|
|
||||||
{.name = "spurr",
|
|
||||||
--
|
|
||||||
2.45.2
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
|||||||
From a56028561ad9c01b5d3a767e50455c561e09191c Mon Sep 17 00:00:00 2001
|
|
||||||
From: Tyrel Datwyler <tyreld@linux.ibm.com>
|
|
||||||
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 <tyreld@linux.ibm.com>
|
|
||||||
---
|
|
||||||
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
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
|||||||
From 5db2df531f9c242b13ef6520814c99685144c6d4 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Haren Myneni <haren@linux.ibm.com>
|
|
||||||
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 <haren@linux.ibm.com>
|
|
||||||
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
|
|
||||||
---
|
|
||||||
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
|
|
||||||
|
|
BIN
powerpc-utils-1.3.12.tar.gz
(Stored with Git LFS)
BIN
powerpc-utils-1.3.12.tar.gz
(Stored with Git LFS)
Binary file not shown.
BIN
powerpc-utils-1.3.13.tar.gz
(Stored with Git LFS)
Normal file
BIN
powerpc-utils-1.3.13.tar.gz
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -1,3 +1,22 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Nov 21 08:10:24 UTC 2024 - Michal Suchanek <msuchanek@suse.de>
|
||||||
|
|
||||||
|
- Update to version 1.3.13 (jsc#PED-9917)
|
||||||
|
* multipath - drmgr support (jsc#PED-9914)
|
||||||
|
- Remove upstreamed patches
|
||||||
|
* ppc64_cpu-Clean-up-sysfs-smt-control-error-handling.patch
|
||||||
|
* ppc64_cpu-Support-partial-SMT-level-through-SYS-FS-s.patch
|
||||||
|
* 0005-ofpathname-skip-devices-with-no-devspec-when-coorela.patch
|
||||||
|
* 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
|
||||||
|
* 0001-drmgr-Return-from-get_node_by_name-if-matched-DRC-in.patch
|
||||||
|
* 0006-drmgr-Free-nodes-returned-from-configure_connector.patch
|
||||||
|
* 0001-drmgr-pci-Enable-in-kernel-functionality-to-update-d.patch
|
||||||
|
* 0002-drmgr-SLOT-Add-kernel-interface-support-for-device-t.patch
|
||||||
|
* 0004-drmgr-phb-Add-kernel-interface-support-for-device-tr.patch
|
||||||
|
* 0003-drmgr-pci-Add-kernel-interface-support-for-device-tr.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Sep 20 06:15:46 UTC 2024 - Michal Suchanek <msuchanek@suse.de>
|
Fri Sep 20 06:15:46 UTC 2024 - Michal Suchanek <msuchanek@suse.de>
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
|
|
||||||
Name: powerpc-utils
|
Name: powerpc-utils
|
||||||
Version: 1.3.12
|
Version: 1.3.13
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: Utilities for PowerPC Hardware
|
Summary: Utilities for PowerPC Hardware
|
||||||
License: GPL-2.0-or-later
|
License: GPL-2.0-or-later
|
||||||
@ -29,18 +29,6 @@ Patch1: powerpc-utils-lsprop.patch
|
|||||||
Patch2: ofpathname_powernv.patch
|
Patch2: ofpathname_powernv.patch
|
||||||
Patch3: fix_kexec_service_name_for_suse.patch
|
Patch3: fix_kexec_service_name_for_suse.patch
|
||||||
Patch4: libvirt-service-dep.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
|
|
||||||
Patch13: 0001-drmgr-pci-Enable-in-kernel-functionality-to-update-d.patch
|
|
||||||
Patch14: 0002-drmgr-SLOT-Add-kernel-interface-support-for-device-t.patch
|
|
||||||
Patch15: 0003-drmgr-pci-Add-kernel-interface-support-for-device-tr.patch
|
|
||||||
Patch16: 0004-drmgr-phb-Add-kernel-interface-support-for-device-tr.patch
|
|
||||||
BuildRequires: autoconf
|
BuildRequires: autoconf
|
||||||
BuildRequires: automake
|
BuildRequires: automake
|
||||||
BuildRequires: libnuma-devel
|
BuildRequires: libnuma-devel
|
||||||
|
@ -1,65 +0,0 @@
|
|||||||
From 8d613e0e81561ce0b1d6ea834b07c73f5f9251a1 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Michal Suchanek <msuchanek@suse.de>
|
|
||||||
Date: Fri, 9 Feb 2024 13:12:33 +0100
|
|
||||||
Subject: [PATCH] ppc64_cpu: Clean up sysfs smt/control error handling
|
|
||||||
|
|
||||||
When the kernel does not support the sysfs intercface do not report an
|
|
||||||
arror, fall back to the old method silently.
|
|
||||||
|
|
||||||
Suggested-by: Nathan Lynch<nathanl@linux.ibm.com>
|
|
||||||
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
|
|
||||||
---
|
|
||||||
v3: retry is needed on ENODEV to support powernv
|
|
||||||
---
|
|
||||||
src/ppc64_cpu.c | 24 +++++++++++++++++++-----
|
|
||||||
1 file changed, 19 insertions(+), 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/ppc64_cpu.c b/src/ppc64_cpu.c
|
|
||||||
index c318928..688152b 100644
|
|
||||||
--- a/src/ppc64_cpu.c
|
|
||||||
+++ b/src/ppc64_cpu.c
|
|
||||||
@@ -364,14 +364,28 @@ static int is_dscr_capable(void)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Depends on kernel's CONFIG_HOTPLUG_CPU
|
|
||||||
+ * Return -1 for fatal error, -2 to retry.
|
|
||||||
*/
|
|
||||||
static int set_smt_control(int smt_state)
|
|
||||||
{
|
|
||||||
if (set_attribute(SYS_SMT_CONTROL, "%d", smt_state)) {
|
|
||||||
- /* Silently ignore kernel not supporting this feature */
|
|
||||||
- if (errno != ENODEV)
|
|
||||||
- perror(SYS_SMT_CONTROL);
|
|
||||||
- return -1;
|
|
||||||
+ switch (errno) {
|
|
||||||
+ case ENOENT:
|
|
||||||
+ /*
|
|
||||||
+ * The kernel does not have the interface.
|
|
||||||
+ * Try the old method.
|
|
||||||
+ */
|
|
||||||
+ return -2;
|
|
||||||
+ case ENODEV:
|
|
||||||
+ /*
|
|
||||||
+ * Setting SMT state not supported by this interface.
|
|
||||||
+ * eg. powernv
|
|
||||||
+ */
|
|
||||||
+ return -2;
|
|
||||||
+ default:
|
|
||||||
+ perror(SYS_SMT_CONTROL);
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -405,7 +419,7 @@ static int do_smt(char *state, bool numeric)
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Try using smt/control if failing, fall back to the legacy way */
|
|
||||||
- if (set_smt_control(smt_state))
|
|
||||||
+ if ((rc = set_smt_control(smt_state)) == -2)
|
|
||||||
rc = set_smt_state(smt_state);
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.44.0
|
|
||||||
|
|
@ -1,71 +0,0 @@
|
|||||||
From 46c524be975a108d2b8d1cadb95003b9c2670c8e Mon Sep 17 00:00:00 2001
|
|
||||||
From: Laurent Dufour <ldufour@linux.ibm.com>
|
|
||||||
Date: Thu, 29 Jun 2023 16:41:37 +0200
|
|
||||||
Subject: [PATCH] ppc64_cpu: Support partial SMT level through SYS FS
|
|
||||||
smt/control files
|
|
||||||
|
|
||||||
The next kernel release will support partial SMT level [1] though the SYS
|
|
||||||
FS file "devices/system/cpu/smt/control". This allows the SMT level to be
|
|
||||||
recorded in the kernel. With the current SMT level stored in the kernel,
|
|
||||||
when a new CPU is added, only the necessary threads are brought online.
|
|
||||||
|
|
||||||
The legacy way to active threads through the SYS FS files
|
|
||||||
'devices/system/cpu/cpu<n>/online', is still used in the case the new SYS
|
|
||||||
FS API is not available. This allows compatibility with the previous kernel
|
|
||||||
versions.
|
|
||||||
|
|
||||||
[1] https://lore.kernel.org/linuxppc-dev/20230705145143.40545-1-ldufour@linux.ibm.com/
|
|
||||||
|
|
||||||
Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
|
|
||||||
---
|
|
||||||
src/ppc64_cpu.c | 20 +++++++++++++++++++-
|
|
||||||
1 file changed, 19 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/src/ppc64_cpu.c b/src/ppc64_cpu.c
|
|
||||||
index 5fdf86a..c33a293 100644
|
|
||||||
--- a/src/ppc64_cpu.c
|
|
||||||
+++ b/src/ppc64_cpu.c
|
|
||||||
@@ -56,6 +56,8 @@
|
|
||||||
#define DIAGNOSTICS_RUN_MODE 42
|
|
||||||
#define CPU_OFFLINE -1
|
|
||||||
|
|
||||||
+#define SYS_SMT_CONTROL "/sys/devices/system/cpu/smt/control"
|
|
||||||
+
|
|
||||||
#ifdef HAVE_LINUX_PERF_EVENT_H
|
|
||||||
struct cpu_freq {
|
|
||||||
int offline;
|
|
||||||
@@ -360,6 +362,20 @@ static int is_dscr_capable(void)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
+/*
|
|
||||||
+ * Depends on kernel's CONFIG_HOTPLUG_CPU
|
|
||||||
+ */
|
|
||||||
+static int set_smt_control(int smt_state)
|
|
||||||
+{
|
|
||||||
+ if (set_attribute(SYS_SMT_CONTROL, "%d", smt_state)) {
|
|
||||||
+ /* Silently ignore kernel not supporting this feature */
|
|
||||||
+ if (errno != ENODEV)
|
|
||||||
+ perror(SYS_SMT_CONTROL);
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
static int do_smt(char *state, bool numeric)
|
|
||||||
{
|
|
||||||
int rc = 0;
|
|
||||||
@@ -388,7 +404,9 @@ static int do_smt(char *state, bool numeric)
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
- rc = set_smt_state(smt_state);
|
|
||||||
+ /* Try using smt/control if failing, fall back to the legacy way */
|
|
||||||
+ if (set_smt_control(smt_state))
|
|
||||||
+ rc = set_smt_state(smt_state);
|
|
||||||
}
|
|
||||||
|
|
||||||
return rc;
|
|
||||||
--
|
|
||||||
2.41.0
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user