Skip to contentSkip to conversation

Fixing infinite loop on SCLP READ SCP INFO error

PATCH Superseded Pierre Morel 2 participants 4 messages Apr 27, 2023 – May 30, 2023

Subsystems (2)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover Fixing infinite loop on SCLP READ SCP INFO error

Aborting on SCLP READ SCP INFO error leads to a deadloop.

The loop is:
abort() -> exit() -> smp_teardown() -> smp_query_num_cpus() -> sclp_get_cpu_num() -> assert() -> abort()

Since smp_setup() is done after sclp_read_info() inside setup() this loop only happens when only the start processor is running. Let sclp_get_cpu_num() return 1 in this case.

Pierre Morel (1):
s390x: sclp: consider monoprocessor on read_info error

 lib/s390x/sclp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Signature · 1 line
2.31.1
#1 lore raw

PATCH v2 1/1 s390x: sclp: consider monoprocessor on read_info error

A test would hang if an abort happens before SCLP Read SCP Information has completed.

---
 lib/s390x/sclp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
lib/s390x/sclp.c +3 -2
index 390fde7..07523dc 100644
@@ -119,8 +119,9 @@ void sclp_read_info(void)
 
 int sclp_get_cpu_num(void)
 {
-	assert(read_info);
-	return read_info->entries_cpu;
+    if (read_info)
+	    return read_info->entries_cpu;
+    return 1;
 }
 
 CPUEntry *sclp_get_cpu_entries(void)
Signature · 1 line
2.31.1
#2 lore raw

Re: [kvm-unit-tests PATCH v2 1/1] s390x: sclp: consider monoprocessor on read_info error

Quoting Pierre Morel (2023-04-27 09:54:50)
[...]

lib/s390x/sclp.c void sclp_read_info(void) · line 124

Quoted 13 lines
lib/s390x/sclp.c +3 -2
index 390fde7..07523dc 100644
@@ -119,8 +119,9 @@ void sclp_read_info(void)
 
 int sclp_get_cpu_num(void)
 {
-       assert(read_info);
-       return read_info->entries_cpu;
+    if (read_info)
+           return read_info->entries_cpu;
+    return 1;

tab/spaces are mixed up here, please fix that.

#3 lore raw

Re: [kvm-unit-tests PATCH v2 1/1] s390x: sclp: consider monoprocessor on read_info error

Quoted 8 lines · Nico Boehr

Quoting Pierre Morel (2023-04-27 09:54:50)
[...]

Quoted 6 lines
lib/s390x/sclp.c +0 -0
index 390fde7..07523dc 100644
@@ -119,8 +119,9 @@ void sclp_read_info(void)
 
Quoted 8 lines

lib/s390x/sclp.c void sclp_read_info(void) · line 124

Quoted 7 lines
lib/s390x/sclp.c +3 -2
  int sclp_get_cpu_num(void)
  {
-       assert(read_info);
-       return read_info->entries_cpu;
+    if (read_info)
+           return read_info->entries_cpu;
+    return 1;

tab/spaces are mixed up here, please fix that.

/o\ yes