Sync from SUSE:SLFO:Main powerpc-utils revision 69137ccc744bd2d679584c42e050d71d

This commit is contained in:
Adrian Schröter 2024-05-31 15:47:14 +02:00
parent 0bda6ee89d
commit cd52b56351
15 changed files with 113 additions and 862 deletions

View File

@ -1,169 +0,0 @@
From 882335a30d04032d2684e165f70646b368a788b4 Mon Sep 17 00:00:00 2001
From: Wen Xiong <wenxiong@linux.ibm.com>
Date: Tue, 30 Jan 2024 10:49:13 -0600
Subject: [PATCH] bootlist: Support multiple dev paths for a nvme boot device
Multipath splitter drawer is going to support two physical paths for
each nvme device.
This patch adds the support for multiple device/of paths for a nvme boot
device.
For example,
#lsslot -c pci
U50EE.001.WZS000E-P3-C1-R1 U.2 PCI-E capable, Rev 4, 4x lanes with 2x
lanes connected 0581:10:00.0
U50EE.001.WZS000E-P3-C1-R2 U.2 PCI-E capable, Rev 4, 4x lanes with 2x
lanes connected 0521:10:00.0
#nvme list-subsys
nvme-subsys1 -
NQN=nqn.1994-11.com.samsung:nvme:PM1735a:2.5-inch:S6RUNE0R900042
hostnqn=nqn.2014-08.org.nvmexpress:uuid:3c6c1ace-e9b1-4a17-8ff0-6a84d3dd15f4
iopolicy=numa
\
+- nvme1 pcie 0523:20:00.0 live
+- nvme0 pcie 0583:20:00.0 live
# bootlist -m normal nvme1n1
# bootlist -m normal -o
nvme0
nvme1n1
#bootlist -m normal -r
/pci@800000020000583/pci1014,6bc@0/namespace@1
/pci@800000020000523/pci1014,6bc@0/namespace@1
Signed-off-by: Wen Xiong <wenxiong@linux.ibm.com>
[tyreld: fixup whitespace errors]
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
---
scripts/bootlist | 80 +++++++++++++++++++++++++++++++++++++++---------
1 file changed, 66 insertions(+), 14 deletions(-)
diff --git a/scripts/bootlist b/scripts/bootlist
index cc8718e..58c090f 100755
--- a/scripts/bootlist
+++ b/scripts/bootlist
@@ -304,6 +304,21 @@ is_nvmf_device()
fi
}
+# is_multipath_nvme_device
+# Check to see if this is a multipath nvme device
+#
+is_multipath_nvme_device()
+{
+ local res
+
+ res=`$FIND /sys/devices/virtual/nvme-subsystem -name $1 2>/dev/null`
+ if [[ ${#res} = 0 ]]; then
+ echo "no"
+ else
+ echo "yes"
+ fi
+}
+
# get_link
# return the directory path that a link points to.
# The only parameter is the link name.
@@ -340,6 +355,32 @@ add_nvmf()
fi
}
+add_multipath_nvme()
+{
+ local DEVNAME=$1
+
+ ctrl_name=$DEVNAME
+ local startctr=$ctr
+
+ local dir
+ for dir in `$FIND /sys/devices/virtual/nvme-subsystem -name "$ctrl_name"`; do
+ cd $dir
+ cd ..
+ for slave in `ls -d $PWD/nvme*`; do
+ slavedev=${slave##*/}
+ if [[ "$slavedev" != *nvme*n* ]] ; then
+ LOGICAL_NAMES[$ctr]=${slavedev}
+ ctr=$[$ctr + 1]
+ fi
+ done
+ done
+
+ if [[ "$startctr" = "$ctr" ]] ; then
+ LOGICAL_NAMES[$ctr]=$1
+ ctr=$[$ctr + 1]
+ fi
+}
+
add_logical()
{
local DEVNAME=$1
@@ -487,31 +528,40 @@ while [[ -n $1 ]]; do
if [[ "$1" == *"dm-"* ]] ; then
add_logical $1
else
- if [[ "$1" == *"nvme-of"* ]]; then
+ if [[ "$1" == *"nvme-of"* ]] || [[ "$1" == *"namespace"* ]]; then
ctrl_name=`get_logical_device_name $1`
+ master_of_path=$1
else
ctrl_name=$1
ctrl_name=${ctrl_name##*/}
+ master_of_path=`get_of_device_name $1`
fi
+
+ if [[ -z $master_of_path ]]; then
+ echo "Device $1 does not appear to be valid." >&2
+ exit 1
+ fi
+
ctrl_name="${ctrl_name%n[0-9]*}"
is_nvmf=$(is_nvmf_device $ctrl_name)
if [[ $is_nvmf = "yes" ]]; then
- if [[ "$1" == *"nvme-of"* ]]; then
- master_of_path=$1
- else
- master_of_path=`get_of_device_name $1`
- fi
-
- if [[ -z $master_of_path ]]; then
- echo "Device $1 does not appear to be valid." >&2
- exit 1
- fi
-
namespace_base=${master_of_path##*/}
DEVTYPE="nvme-of"
add_nvmf $ctrl_name
else
- add_logical $1
+ is_multipath_nvme=$(is_multipath_nvme_device $ctrl_name)
+ if [[ $is_multipath_nvme = "yes" ]]; then
+ if [[ "$master_of_path" == *namespace* ]] ; then
+ namespace_base=${master_of_path##*/}
+ else
+ echo "Device $1 does not appear to be valid." >&2
+ exit 1
+ fi
+ DEVTYPE="multi-nvme"
+ add_multipath_nvme $ctrl_name
+ else
+ add_logical $1
+ fi
fi
fi
fi
@@ -534,8 +584,10 @@ if [[ ${#LOGICAL_NAMES[*]} -ne 0 ]]; then
if [[ -z ${OF_DEVPATH[$ctr]} ]]; then
# See if this is an OF pathname
OF_DEVPATH[$ctr]=`get_of_device_name ${LOGICAL_NAMES[$ctr]}`
- if [[ $DEVTYPE = "nvme-of" ]]; then
+ if [[ $DEVTYPE = "nvme-of" ]] || [[ $DEVTYPE = "multi-nvme" ]]; then
OF_DEVPATH[$ctr]=${OF_DEVPATH[$ctr]}/$namespace_base
+ else
+ OF_DEVPATH[$ctr]=${OF_DEVPATH[$ctr]}
fi
else
OF_DEVPATH[$ctr]=${LOGICAL_NAMES[$ctr]}
--
2.43.0

View File

@ -1,90 +0,0 @@
From 73ba26c1240a25e7699449e82cfc09dad10fed80 Mon Sep 17 00:00:00 2001
From: Sathvika Vasireddy <sv@linux.ibm.com>
Date: Fri, 9 Dec 2022 15:26:46 +0530
Subject: [PATCH 1/3] lparstat: Fix negative values seen while running lparstat
with -E option
Negative values are seen while running lparstat with -E option.
This is because delta_purr value is less than delta_idle_purr.
Given that these values are read from different sources, a
small variation in the values is possible. So, in such cases,
round down delta_idle_purr to delta_purr.
Without this patch:
=====
System Configuration
type=Dedicated mode=Capped smt=8 lcpu=240 mem=67033290112 kB cpus=0
ent=240.00
---Actual--- -Normalized-
%busy %idle Frequency %busy %idle
------ ------ ------------- ------ ------
-0.03 100.02 3.93GHz[111%] 0.01 110.97
0.00 100.00 3.93GHz[111%] 0.01 110.99
-0.04 100.03 3.93GHz[111%] 0.01 110.98
0.06 99.95 3.93GHz[111%] 0.01 110.99
0.02 99.98 3.93GHz[111%] 0.01 110.99
=====
With this patch:
=====
System Configuration
type=Dedicated mode=Capped smt=8 lcpu=240 mem=67033290112 kB cpus=0
ent=240.00
---Actual--- -Normalized-
%busy %idle Frequency %busy %idle
------ ------ ------------- ------ ------
0.03 99.96 3.93GHz[111%] 0.01 110.98
0.00 100.00 3.93GHz[111%] 0.01 110.99
0.03 99.97 3.93GHz[111%] 0.01 110.99
0.00 100.00 3.93GHz[111%] 0.01 110.99
0.09 99.90 3.93GHz[111%] 0.01 110.99
=====
Reported-by: Shirisha Ganta <shirisha.ganta1@ibm.com>
Signed-off-by: Sathvika Vasireddy <sv@linux.ibm.com>
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
---
src/lparstat.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/lparstat.c b/src/lparstat.c
index 31a4ee8..eebba1f 100644
--- a/src/lparstat.c
+++ b/src/lparstat.c
@@ -492,6 +492,15 @@ void get_cpu_util_purr(struct sysentry *unused_se, char *buf)
delta_purr = get_delta_value("purr");
delta_idle_purr = get_delta_value("idle_purr");
+ /*
+ * Given that these values are read from different
+ * sources (purr from lparcfg and idle_purr from sysfs),
+ * a small variation in the values is possible.
+ * In such cases, round down delta_idle_purr to delta_purr.
+ */
+ if (delta_idle_purr > delta_purr)
+ delta_idle_purr = delta_purr;
+
physc = (delta_purr - delta_idle_purr) / delta_tb;
physc *= 100.00;
@@ -507,6 +516,15 @@ void get_cpu_idle_purr(struct sysentry *unused_se, char *buf)
delta_purr = get_delta_value("purr");
delta_idle_purr = get_delta_value("idle_purr");
+ /*
+ * Given that these values are read from different
+ * sources (purr from lparcfg and idle_purr from sysfs),
+ * a small variation in the values is possible.
+ * In such cases, round down delta_idle_purr to delta_purr.
+ */
+ 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;
--
2.40.1

View File

@ -1,50 +0,0 @@
From 7a5625f2bc012fbbf0cd8384cb4e7761c5de3bb7 Mon Sep 17 00:00:00 2001
From: Laurent Dufour <ldufour@linux.ibm.com>
Date: Tue, 2 May 2023 19:59:27 +0200
Subject: [PATCH 3/3] lparstat: Fix offline threads uninitialized entries
When some threads are offline, lparstat -E is failing like that:
$ ppc64_cpu --info # CPU 20 is offline
Core 0: 0* 1* 2* 3* 4* 5* 6* 7*
Core 1: 8* 9* 10* 11* 12* 13* 14* 15*
Core 2: 16* 17* 18* 19* 20 21* 22* 23*
Core 3: 24* 25* 26* 27* 28* 29* 30* 31*
Core 4: 32* 33* 34* 35* 36* 37* 38* 39*
Core 5: 40* 41* 42* 43* 44* 45* 46* 47*
$ lparstat -E
Failed to read /sys/devices/system/cpu/cpu0/spurr
The message is complaining about CPU0 but the real issue is that in
parse_sysfs_values() the test cpu_sysfs_fds[i].spurr >= 0 is valid even if
the entry has not been initialized (cpu_sysfs_fds is alloc cleared). So
if the number of threads online seen in assign_cpu_sysfs_fds is lower than
threads_in_system, the loop in parse_sysfs_values() will read uninitialized
entry, where .cpu=0.
To prevent that, unset entries in the cpu_sysfs_fds should have the spurr
fd set to -1.
Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
---
src/lparstat.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/lparstat.c b/src/lparstat.c
index a9e7bce..d2fdb3f 100644
--- a/src/lparstat.c
+++ b/src/lparstat.c
@@ -163,6 +163,10 @@ static int assign_cpu_sysfs_fds(int threads_in_system)
cpu_idx++;
}
+ /* Mark extra slots for offline threads unset, see parse_sysfs_values */
+ for (; cpu_idx < threads_in_system; cpu_idx++)
+ cpu_sysfs_fds[cpu_idx].spurr = -1;
+
return 0;
error:
fprintf(stderr, "Failed to open %s: %s\n",
--
2.40.1

View File

@ -1,98 +0,0 @@
From 5d2e43bbf0804da52202f817f7f7fc5f18aafd11 Mon Sep 17 00:00:00 2001
From: Laurent Dufour <ldufour@linux.ibm.com>
Date: Tue, 2 May 2023 16:54:35 +0200
Subject: [PATCH 2/3] lparstat: report mixed SMT state
when SMT state is mixed like this one (CPU 4 is offline):
$ ppc64_cpu --info
Core 0: 0* 1* 2* 3* 4 5* 6* 7*
Core 1: 8* 9* 10* 11* 12* 13* 14* 15*
Core 2: 16* 17* 18* 19* 20* 21* 22* 23*
Core 3: 24* 25* 26* 27* 28* 29* 30* 31*
Core 4: 32* 33* 34* 35* 36* 37* 38* 39*
Core 5: 40* 41* 42* 43* 44* 45* 46* 47*
$ ppc64_cpu --smt
SMT=7: 0
SMT=8: 1-5
ppc64_cpu --smt is handling that nicely but lparstat failed reporting the
SMT state:
$ /usr/sbin/lparstat
Failed to get smt state
System Configuration
type=Dedicated mode=Capped smt=Capped lcpu=6 mem=65969728 kB cpus=0 ent=6.00
%user %sys %wait %idle physc %entc lbusy app vcsw phint
----- ----- ----- ----- ----- ----- ----- ----- ----- -----
0.02 0.01 0.00 99.97 3.41 56.83 0.02 0.00 4061778 156
Makes lparstat reporting "smt=mixed" in that case.
__do_smt is now returning 0 when the SMT state is mixed instead of -1 which
is also reported when an error is detected.
This doesn't change the call made by ppc64_cpu which is using
print_smt_state=true and so is expecting a returned value equal to 0 or -1.
With that patch applied, lparstat print that in the above case:
$lparstat
System Configuration
type=Dedicated mode=Capped smt=Mixed lcpu=6 mem=65969728 kB cpus=0 ent=6.00
%user %sys %wait %idle physc %entc lbusy app vcsw phint
----- ----- ----- ----- ----- ----- ----- ----- ----- -----
0.01 0.01 0.00 99.97 3.43 57.17 0.02 0.00 4105654 156
Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
---
src/common/cpu_info_helpers.c | 4 ++--
src/lparstat.c | 4 +++-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/common/cpu_info_helpers.c b/src/common/cpu_info_helpers.c
index 925f220..c05d96d 100644
--- a/src/common/cpu_info_helpers.c
+++ b/src/common/cpu_info_helpers.c
@@ -245,7 +245,7 @@ int __do_smt(bool numeric, int cpus_in_system, int threads_per_cpu,
if (smt_state == 0)
smt_state = thread + 1;
else if (smt_state > 0)
- smt_state = -1; /* mix of SMT modes */
+ smt_state = 0; /* mix of SMT modes */
}
}
@@ -257,7 +257,7 @@ int __do_smt(bool numeric, int cpus_in_system, int threads_per_cpu,
printf("SMT=1\n");
else
printf("SMT is off\n");
- } else if (smt_state == -1) {
+ } else if (smt_state == 0) {
for (thread = 0; thread < threads_per_cpu; thread++) {
if (CPU_COUNT_S(cpu_state_size,
cpu_states[thread])) {
diff --git a/src/lparstat.c b/src/lparstat.c
index eebba1f..a9e7bce 100644
--- a/src/lparstat.c
+++ b/src/lparstat.c
@@ -884,13 +884,15 @@ void get_smt_mode(struct sysentry *se, char *buf)
}
smt_state = parse_smt_state();
- if (smt_state < 0) {
+ if (smt_state == -1) {
fprintf(stderr, "Failed to get smt state\n");
return;
}
if (smt_state == 1)
sprintf(buf, "Off");
+ else if (smt_state == 0)
+ sprintf(buf, "Mixed");
else
sprintf(buf, "%d", smt_state);
}
--
2.40.1

View File

@ -1,52 +0,0 @@
From d604cc779741c29cbdc8da97cbfc1512fd21fc1b Mon Sep 17 00:00:00 2001
From: Likhitha Korrapati <likhitha@linux.ibm.com>
Date: Fri, 11 Aug 2023 00:41:14 -0500
Subject: [PATCH] nvram man page and --help output are not in sync
The nvram man page and the output from --help option are not in
sync and few of the options are missing in man page.
The options that are missing are ascii, dump, nvram-size, zero.
These options are added through the commit ids [1], [2].
This patch adds the above missing options to the nvram.
[1] https://github.com/ibm-power-utilities/powerpc-utils/commit/0e09f4e2898e7dea556479b018a7f4bf12108099
[2] https://github.com/ibm-power-utilities/powerpc-utils/commit/976dbe9bb7b01b135cac3e7bbd1dce0cdc88636a
Signed-off-by: Likhitha Korrapati <likhitha@linux.ibm.com>
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
---
man/nvram.8 | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/man/nvram.8 b/man/nvram.8
index 2938e34..6071712 100644
--- a/man/nvram.8
+++ b/man/nvram.8
@@ -67,6 +67,22 @@ be more verbose.
\fB\--help
print usage information including other low level options useful for
debugging nvram.
+.TP
+\fB\--ascii \fIname
+print partition contents as ASCII text
+.TP
+\fB\--dump \fIname
+raw dump of partition (use --partitions to see names)
+.TP
+\fB\--nvram-size
+specify size of nvram data, must in multiples of 16 Bytes (for repair
+operations)
+.TP
+\fB\--unzip \fIname
+decompress and print compressed data from partition
+.TP
+\fB\--zero | 0 \fR
+terminate config pairs with a NULL character
.SH FILES
/dev/nvram
.SH AUTHOR
--
2.43.0

View File

@ -1,56 +0,0 @@
From a6d31caf4eaa453d3ec879f02163b3a515789b85 Mon Sep 17 00:00:00 2001
From: Likhitha Korrapati <likhitha@linux.ibm.com>
Date: Mon, 11 Sep 2023 05:23:37 -0500
Subject: [PATCH] powerpc/nvram: Fix Segmentation fault issue in nvram-size.
nvram-size option results in segmentation fault when the user
specifies value larger than the default nvram size
Without the patch:
[root@xxx ~]# nvram --nvram-size 1048592
nvram: WARNING: expected 1048592 bytes, but only read 15360!
Segmentation fault (core dumped)
Segmentation fault is caused because the phead->length is becoming 0.
And because of this the p_start doesn't get updated which makes the
while loop run infinitely resulting in segmentation fault.
This patch adds a condition check for phead->length to avoid infinite
while loop.
With the patch:
[root@xxx src]# ./nvram --nvram-size 1048592
./nvram: WARNING: expected 1048592 bytes, but only read 15360!
[root@xxx src]# ./nvram --nvram-size 268435456
./nvram: WARNING: expected 268435456 bytes, but only read 15360!
[root@xxx src]#
Reported-by: Shirisha Ganta <shirisha@linux.ibm.com>
Signed-off-by: Likhitha Korrapati <likhitha@linux.ibm.com>
[tyreld: fixed up else block]
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
---
src/nvram.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/nvram.c b/src/nvram.c
index 095e747..1987c3d 100644
--- a/src/nvram.c
+++ b/src/nvram.c
@@ -460,8 +460,12 @@ nvram_parse_partitions(struct nvram *nvram)
c_sum = checksum(phead);
if (c_sum != phead->checksum)
warn_msg("this partition checksum should be %02x!\n", c_sum);
- phead->length = be16toh(phead->length);
- p_start += phead->length * NVRAM_BLOCK_SIZE;
+ if (phead->length != 0) {
+ phead->length = be16toh(phead->length);
+ p_start += phead->length * NVRAM_BLOCK_SIZE;
+ } else {
+ break;
+ }
}
if (verbose)
--
2.43.0

View File

@ -1,52 +0,0 @@
From 3f72b8326a2fc9a9dffb4b31d0ce3abf12e24751 Mon Sep 17 00:00:00 2001
From: Likhitha Korrapati <likhitha@linux.ibm.com>
Date: Thu, 25 Jan 2024 15:44:02 +0530
Subject: [PATCH] powerpc/nvram: fix segmentation fault issue in print-config
print-config option in nvram results in segmentation fault when the
user provides a very large value.
without the patch:
[root@xxx powerpc-utils]# nvram --print-config=real-mode?
true
[root@xxx powerpc-utils]# nvram --print-config=$(perl -e 'p
rint "A"x1000000')
Segmentation fault (core dumped)
The Segmentation fault occurs because the code tries to access memory
beyond the bounds of the data at index varlen. varlen is the length of
the string provided by the user.
This patch adds a condition to check whether the length of the data is
greater than varlen to prevent accessing out of bounds.
with the patch:
[root@xxx powerpc-utils]# ./src/nvram --print-config=real-m
ode?
true
[root@xxx powerpc-utils]# ./src/nvram --print-config=$(perl
-e 'print "A"x1000000')
Reported-by: Shirisha Ganta <shirisha@linux.ibm.com>
Signed-off-by: Likhitha Korrapati <likhitha@linux.ibm.com>
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
---
src/nvram.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/nvram.c b/src/nvram.c
index f051e9c..095e747 100644
--- a/src/nvram.c
+++ b/src/nvram.c
@@ -1280,7 +1280,7 @@ print_of_config(struct nvram *nvram, char *config_var, char *pname,
data = (char *)phead + sizeof(*phead);
while (*data != '\0') {
- if ((data[varlen] == '=') &&
+ if (strlen(data) > varlen && (data[varlen] == '=') &&
strncmp(config_var, data, varlen) == 0) {
printf("%s%c", data + varlen + 1, terminator);
rc = 0;
--
2.43.0

BIN
powerpc-utils-1.3.11.tar.gz (Stored with Git LFS)

Binary file not shown.

BIN
powerpc-utils-1.3.12.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,41 +0,0 @@
From 8a7aa61c5f520df03e53e6f7e1d63b7d5c432376 Mon Sep 17 00:00:00 2001
From: Wen Xiong <wenxiong@linux.ibm.com>
Date: Wed, 15 Nov 2023 14:37:43 -0600
Subject: [PATCH] powerpc-utils/scripts/ofpathname: handle nsid of nvme device
as hex number
Git-commit: 8a7aa61c5f520df03e53e6f7e1d63b7d5c432376
Installation fails if nsid of nvme device is greater than 10.
The patch fixes the issue and handle nsid of nvme ad a hex number.
Signed-off-by: Wen Xiong <wenxiong@linux.ibm.com>
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
---
scripts/ofpathname | 2 ++
1 file changed, 2 insertions(+)
diff --git a/scripts/ofpathname b/scripts/ofpathname
index 3abe4d1..833d03f 100755
--- a/scripts/ofpathname
+++ b/scripts/ofpathname
@@ -722,6 +722,7 @@ l2of_nvme()
err $ERR_NO_OFPATH
fi
+ devnsid=$(printf "%x" $devnsid)
OF_PATH="$OF_PATH/$devtype@$devnsid"
# No partition (pZ) specified.
@@ -1798,6 +1799,7 @@ of2l_nvme()
cd $dir
local devnsid=`$CAT ./nsid 2>/dev/null`
+ devnsid=$(printf "%x" $devnsid)
if [[ $devnsid = $nsid ]]; then
LOGICAL_DEVNAME="${dir##*/}"
break
--
2.43.0

View File

@ -1,3 +1,40 @@
-------------------------------------------------------------------
Tue Apr 2 08:25:42 UTC 2024 - Michal Suchanek <msuchanek@suse.com>
- Fix SMT control on powernv with the new kernel interface (bsc#1222163)
* Refresh ppc64_cpu-Clean-up-sysfs-smt-control-error-handling.patch
-------------------------------------------------------------------
Fri Feb 9 12:21:41 UTC 2024 - Michal Suchanek <msuchanek@suse.com>
- Do not print an error when the kernel does not support sysfs smt interface
* ppc64_cpu-Clean-up-sysfs-smt-control-error-handling.patch
-------------------------------------------------------------------
Thu Feb 8 09:43:47 UTC 2024 - Michal Suchanek <msuchanek@suse.com>
- Update to version 1.3.12
* Add drmgr CPU DLPAR hooks
* Fix lsslot output (bsc#1219716 ltc#204541)
- Drop upstreamed patches
* lparstat-Fix-negative-values-seen-while-running-lpar.patch
* lparstat-report-mixed-SMT-state.patch
* lparstat-Fix-offline-threads-uninitialized-entries.patch
* powerpc-utils-scripts-ofpathname-handle-nsid-of-nvme.patch
* bootlist-Support-multiple-dev-paths-for-a-nvme-boot-.patch
* rtas_dbg-Fix-the-large-negative-values-in-rtas_dbg.patch
* powerpc-nvram-fix-segmentation-fault-issue-in-print-.patch
* powerpc-nvram-Fix-Segmentation-fault-issue-in-nvram-.patch
* nvram-man-page-and-help-output-are-not-in-sync.patch
* ppc64_cpu-info-fix-bad-report-when-non-continuous-CP.patch
* hcn-init-Split-services-per-connection-manager.patch
-------------------------------------------------------------------
Mon Feb 5 15:30:16 UTC 2024 - Michal Suchanek <msuchanek@suse.com>
- Use separate hcn-init service for wicked and NM (bsc#1200731 ltc#198485)
* hcn-init-Split-services-per-connection-manager.patch
-------------------------------------------------------------------
Thu Feb 1 09:17:33 UTC 2024 - Michal Suchanek <msuchanek@suse.com>

View File

@ -17,7 +17,7 @@
Name: powerpc-utils
Version: 1.3.11
Version: 1.3.12
Release: 0
Summary: Utilities for PowerPC Hardware
License: GPL-2.0-or-later
@ -29,17 +29,8 @@ Patch1: powerpc-utils-lsprop.patch
Patch2: ofpathname_powernv.patch
Patch3: fix_kexec_service_name_for_suse.patch
Patch4: libvirt-service-dep.patch
Patch5: lparstat-Fix-negative-values-seen-while-running-lpar.patch
Patch6: lparstat-report-mixed-SMT-state.patch
Patch7: lparstat-Fix-offline-threads-uninitialized-entries.patch
Patch8: ppc64_cpu-Support-partial-SMT-level-through-SYS-FS-s.patch
Patch9: powerpc-utils-scripts-ofpathname-handle-nsid-of-nvme.patch
Patch10: bootlist-Support-multiple-dev-paths-for-a-nvme-boot-.patch
Patch11: rtas_dbg-Fix-the-large-negative-values-in-rtas_dbg.patch
Patch12: powerpc-nvram-fix-segmentation-fault-issue-in-print-.patch
Patch13: powerpc-nvram-Fix-Segmentation-fault-issue-in-nvram-.patch
Patch14: nvram-man-page-and-help-output-are-not-in-sync.patch
Patch15: ppc64_cpu-info-fix-bad-report-when-non-continuous-CP.patch
Patch9: ppc64_cpu-Clean-up-sysfs-smt-control-error-handling.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libnuma-devel
@ -96,24 +87,20 @@ ln -sf drmgr %{buildroot}%{_sbindir}/drmig_chrp_pmig
ln -s service %{buildroot}%{_sbindir}/rcsmt_off
install -m 644 systemd/hcn-init.service.suse %{buildroot}%{_unitdir}/hcn-init.service
mkdir -p %{buildroot}/usr/lib/powerpc-utils
install -m 644 scripts/functions.suse %{buildroot}/usr/lib/powerpc-utils/functions.suse
# remove docu installed by make_install as we hand-install them in %%files
rm -rf %{buildroot}%{_docdir}/%{name}/*
%pre
%service_add_pre hcn-init.service smt_off.service smtstate.service
%service_add_pre hcn-init-wicked.service hcn-init-NetworkManager.service smt_off.service smtstate.service
%post
%service_add_post hcn-init.service smt_off.service smtstate.service
%service_add_post hcn-init-wicked.service hcn-init-NetworkManager.service smt_off.service smtstate.service
%preun
%service_del_preun hcn-init.service smt_off.service smtstate.service
%service_del_preun hcn-init-wicked.service hcn-init-NetworkManager.service smt_off.service smtstate.service
%postun
%service_del_postun hcn-init.service smt_off.service smtstate.service
%service_del_postun hcn-init-wicked.service hcn-init-NetworkManager.service smt_off.service smtstate.service
%files
%license COPYING
@ -128,7 +115,8 @@ rm -rf %{buildroot}%{_docdir}/%{name}/*
%config(noreplace) %{_localstatedir}/lib/powerpc-utils/smt.state
%dir /usr/lib/powerpc-utils
/usr/lib/powerpc-utils/functions.suse
%{_unitdir}/hcn-init.service
%{_unitdir}/hcn-init-wicked.service
%{_unitdir}/hcn-init-NetworkManager.service
%{_unitdir}/smt_off.service
%{_unitdir}/smtstate.service

View File

@ -0,0 +1,65 @@
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

View File

@ -1,156 +0,0 @@
From f1a8ed892e18b83cb0483e8f8f8cbc512fa8510c Mon Sep 17 00:00:00 2001
From: Laurent Dufour <ldufour@linux.ibm.com>
Date: Thu, 10 Aug 2023 11:47:07 +0200
Subject: [PATCH] ppc64_cpu/info: fix bad report when non continuous CPU ids
When CPU ids are not continuous, let say that the kernel didn't reuse a set
of CPU ids already used on a different nodes, the output of ppc64_cpu
--info is not correct.
For instance, in the example below the CPU id 48 to 55 haven't been reused
by the kernel when a CPU has been added after a LPM operation.
Note that the system is running in SMT=4.
The numactl -H command is providing the correct set of CPU:
ltczep3-lp4:~ # numactl -H
available: 2 nodes (0-1)
node 0 cpus: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 64 65 66 67 68 69 70 71
node 0 size: 7177 MB
node 0 free: 4235 MB
node 1 cpus: 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
node 1 size: 24508 MB
node 1 free: 23539 MB
node distances:
node 0 1
0: 10 40
1: 40 10
But ppc64_cpu --info is reporting the CPUs 48 to 55 offlined while not
reporting at all the CPU 65 to 71:
ltczep3-lp4:~ # ppc64_cpu --info
Core 0: 0* 1* 2* 3* 4* 5* 6* 7*
Core 1: 8* 9* 10* 11* 12* 13* 14* 15*
Core 2: 16* 17* 18* 19* 20* 21* 22* 23*
Core 3: 24* 25* 26* 27* 28* 29* 30* 31*
Core 4: 32* 33* 34* 35* 36* 37* 38* 39*
Core 5: 40* 41* 42* 43* 44* 45* 46* 47*
Core 6: 48 49 50 51 52 53 54 55
This is because it is considering that the CPU id are continuous which is
not the case here.
To prevent that, when looking for a core, it is now first checking that the
physical_id of the first thread in that core is defined (not -1). If that
the case this means that CPU/core is present.
With that patch applied, ppc64_cpu --info is reporting:
ltczep3-lp4:~ # pc64_cpu --info
Core 0: 0* 1* 2* 3* 4 5 6 7
Core 1: 8* 9* 10* 11* 12 13 14 15
Core 2: 16* 17* 18* 19* 20 21 22 23
Core 3: 24* 25* 26* 27* 28 29 30 31
Core 4: 32* 33* 34* 35* 36 37 38 39
Core 5: 40* 41* 42* 43* 44 45 46 47
Core 6: 64* 65* 66* 67* 68 69 70 71
Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
---
src/common/cpu_info_helpers.c | 14 ++++++++++++++
src/common/cpu_info_helpers.h | 1 +
src/ppc64_cpu.c | 25 +++++++++++++++++--------
3 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/src/common/cpu_info_helpers.c b/src/common/cpu_info_helpers.c
index c05d96d..8c57db8 100644
--- a/src/common/cpu_info_helpers.c
+++ b/src/common/cpu_info_helpers.c
@@ -83,6 +83,20 @@ int __sysattr_is_writeable(char *attribute, int threads_in_system)
return test_sysattr(attribute, W_OK, threads_in_system);
}
+int cpu_physical_id(int thread)
+{
+ char path[SYSFS_PATH_MAX];
+ int rc, physical_id;
+
+ sprintf(path, SYSFS_CPUDIR"/physical_id", thread);
+ rc = get_attribute(path, "%d", &physical_id);
+
+ /* This attribute does not exist in kernels without hotplug enabled */
+ if (rc && errno == ENOENT)
+ return -1;
+ return physical_id;
+}
+
int cpu_online(int thread)
{
char path[SYSFS_PATH_MAX];
diff --git a/src/common/cpu_info_helpers.h b/src/common/cpu_info_helpers.h
index 8f09d79..c063fff 100644
--- a/src/common/cpu_info_helpers.h
+++ b/src/common/cpu_info_helpers.h
@@ -32,6 +32,7 @@
extern int __sysattr_is_readable(char *attribute, int threads_in_system);
extern int __sysattr_is_writeable(char *attribute, int threads_in_system);
+extern int cpu_physical_id(int thread);
extern int cpu_online(int thread);
extern int is_subcore_capable(void);
extern int num_subcores(void);
diff --git a/src/ppc64_cpu.c b/src/ppc64_cpu.c
index 5fdf86a..ad9f4dc 100644
--- a/src/ppc64_cpu.c
+++ b/src/ppc64_cpu.c
@@ -1251,31 +1251,40 @@ static int do_cores_on(char *state)
return 0;
}
+static bool core_is_online(int core)
+{
+ return cpu_physical_id(core * threads_per_cpu) != -1;
+}
+
static int do_info(void)
{
int i, j, thread_num;
char online;
- int subcores = 0;
+ int core, subcores = 0;
if (is_subcore_capable())
subcores = num_subcores();
- for (i = 0; i < cpus_in_system; i++) {
+ for (i = 0, core = 0; core < cpus_in_system; i++) {
+
+ if (!core_is_online(i))
+ continue;
if (subcores > 1) {
- if (i % subcores == 0)
- printf("Core %3d:\n", i/subcores);
- printf(" Subcore %3d: ", i);
+ if (core % subcores == 0)
+ printf("Core %3d:\n", core/subcores);
+ printf(" Subcore %3d: ", core);
} else {
- printf("Core %3d: ", i);
+ printf("Core %3d: ", core);
}
- for (j = 0; j < threads_per_cpu; j++) {
- thread_num = i*threads_per_cpu + j;
+ thread_num = i * threads_per_cpu;
+ for (j = 0; j < threads_per_cpu; j++, thread_num++) {
online = cpu_online(thread_num) ? '*' : ' ';
printf("%4d%c ", thread_num, online);
}
printf("\n");
+ core++;
}
return 0;
}
--
2.43.0

View File

@ -1,75 +0,0 @@
From 9caa77e4477a73064a6deea253fd3faea32648fb Mon Sep 17 00:00:00 2001
From: Likhitha Korrapati <likhitha@linux.ibm.com>
Date: Fri, 17 Nov 2023 01:42:29 -0500
Subject: [PATCH] rtas_dbg: Fix the large negative values in rtas_dbg
without the patch:
[root@xxx powerpc-utils]# rtas_dbg -l ibm,rks-hcalls
Could not get rtas token for ibm,indicator-0002
Could not get rtas token for ibm,integrated-stop-self
Could not get rtas token for ibm,indicator-9005
Could not get rtas token for ibm,extended-os-term
Could not get rtas token for ibm,indicator-0001
Could not get rtas token for ibm,sensor-0009
Could not get rtas token for ibm,recoverable-epow3
Could not get rtas token for ibm,sensor-9005
Could not get rtas token for ibm,change-msix-capable
Could not get rtas token for ibm,sensor-0005
Could not get rtas token for ibm,sensor-0001
ibm,rks-hcalls -536870912
The large negatives values are due to incompatible format(%d).
The data type of the token variable is uint32_t.This patch
modifies the format(%u) to align with its data type(uint32_t).
with the patch:
[root@xxx powerpc-utils]# ./src/rtas_dbg -l ibm,rks-hcalls
Could not get rtas token for ibm,indicator-0002
Could not get rtas token for ibm,integrated-stop-self
Could not get rtas token for ibm,indicator-9005
Could not get rtas token for ibm,extended-os-term
Could not get rtas token for ibm,indicator-0001
Could not get rtas token for ibm,sensor-0009
Could not get rtas token for ibm,recoverable-epow3
Could not get rtas token for ibm,sensor-9005
Could not get rtas token for ibm,change-msix-capable
Could not get rtas token for ibm,sensor-0005
Could not get rtas token for ibm,sensor-0001
ibm,rks-hcalls 3758096384
Reported-by: Shirisha Ganta <shirisha@linux.ibm.com>
Signed-off-by: Likhitha Korrapati <likhitha@linux.ibm.com>
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
---
src/rtas_dbg.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/rtas_dbg.c b/src/rtas_dbg.c
index ebc7474..6c7854a 100644
--- a/src/rtas_dbg.c
+++ b/src/rtas_dbg.c
@@ -200,10 +200,10 @@ void print_rtas_tokens(struct rtas_token *tok, struct rtas_token *tok_list)
struct rtas_token *t;
if (tok)
- printf("%-40s%d\n", tok->name, tok->token);
+ printf("%-40s%u\n", tok->name, tok->token);
else {
for (t = tok_list; t; t = t->next)
- printf("%-40s%d\n", t->name, t->token);
+ printf("%-40s%u\n", t->name, t->token);
}
}
@@ -217,7 +217,7 @@ int set_rtas_dbg(struct rtas_token *tok)
args.nret = htobe32(1);
args.args[0] = htobe32(tok->token);
- printf("Enabling rtas debug for %s (%d)\n", tok->name, tok->token);
+ printf("Enabling rtas debug for %s (%u)\n", tok->name, tok->token);
rc = rtas(&args);
--
2.43.0