From: Pierre Morel <pmorel@linux.ibm.com>
To: linux-s390@vger.kernel.org
Cc: frankja@linux.ibm.com, thuth@redhat.com, kvm@vger.kernel.org,
imbrenda@linux.ibm.com, david@redhat.com, nrb@linux.ibm.com,
nsg@linux.ibm.com, cohuck@redhat.com
Subject: [kvm-unit-tests PATCH v4 1/2] s390x: sclp: consider monoprocessor on read_info error
Date: Tue, 30 May 2023 14:52:42 +0200 [thread overview]
Message-ID: <20230530125243.18883-2-pmorel@linux.ibm.com> (raw)
In-Reply-To: <20230530125243.18883-1-pmorel@linux.ibm.com>
A test would hang if an abort happens before SCLP Read SCP
Information has completed.
Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
---
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 acdc8a9..34a31da 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;
+ /*
+ * If we fail here and read_info has not being set,
+ * it means we failed early and we try to abort the test.
+ * We need to return at least one CPU, and obviously we have
+ * at least one, for the smp_teardown to correctly work.
+ */
+ return 1;
}
CPUEntry *sclp_get_cpu_entries(void)
--
2.31.1
next prev parent reply other threads:[~2023-05-30 12:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-30 12:52 [kvm-unit-tests PATCH v4 0/2] Fixing infinite loop on SCLP READ SCP INFO error Pierre Morel
2023-05-30 12:52 ` Pierre Morel [this message]
2023-05-31 6:20 ` [kvm-unit-tests PATCH v4 1/2] s390x: sclp: consider monoprocessor on read_info error Nico Boehr
2023-05-30 12:52 ` [kvm-unit-tests PATCH v4 2/2] s390x: sclp: Implement SCLP_RC_INSUFFICIENT_SCCB_LENGTH Pierre Morel
2023-05-30 15:35 ` Claudio Imbrenda
2023-06-01 12:30 ` Pierre Morel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230530125243.18883-2-pmorel@linux.ibm.com \
--to=pmorel@linux.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=nrb@linux.ibm.com \
--cc=nsg@linux.ibm.com \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox