[PATCH 19/22] s390x: sclp: treat system as single processor when read_info is NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Pierre Morel <pmorel@xxxxxxxxxxxxx>

When a test abort()s before SCLP read info is completed, the assertion
on read_info in sclp_read_info() will fail. Since abort() eventually
calls smp_teardown() which in turn calls sclp_get_cpu_num(), this will
cause an infinite abort() chain, causing the test to hang.

Fix this by considering the system single processor when read_info is
missing.

Signed-off-by: Pierre Morel <pmorel@xxxxxxxxxxxxx>
Reviewed-by: Nico Boehr <nrb@xxxxxxxxxxxxx>
Link: https://lore.kernel.org/r/20230601164537.31769-2-pmorel@xxxxxxxxxxxxx
Signed-off-by: Nico Boehr <nrb@xxxxxxxxxxxxx>
---
 lib/s390x/sclp.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c
index 390fde7..15662aa 100644
--- a/lib/s390x/sclp.c
+++ b/lib/s390x/sclp.c
@@ -119,8 +119,15 @@ 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;
+	/*
+	 * Don't abort here if read_info is NULL since abort() calls
+	 * smp_teardown() which eventually calls this function and thus
+	 * causes an infinite abort() chain, causing the test to hang.
+	 * Since we obviously have at least one CPU, just return one.
+	 */
+	return 1;
 }
 
 CPUEntry *sclp_get_cpu_entries(void)
-- 
2.41.0




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux