* [kvm-unit-tests PATCH v5 0/2] Fixing infinite loop on SCLP READ SCP INFO error
@ 2023-06-01 16:45 Pierre Morel
2023-06-01 16:45 ` [kvm-unit-tests PATCH v5 1/2] s390x: sclp: treat system as single processor when read_info is NULL Pierre Morel
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Pierre Morel @ 2023-06-01 16:45 UTC (permalink / raw)
To: linux-s390; +Cc: frankja, thuth, kvm, imbrenda, david, nrb, nsg, cohuck
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.
Also provide a bigger buffer for SCLP READ INFO when we have the
extended-length-SCCB facility.
Pierre
Pierre Morel (2):
s390x: sclp: treat system as single processor when read_info is NULL
s390x: sclp: Implement extended-length-SCCB facility
lib/s390x/sclp.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
--
2.31.1
since v4:
- changed comments
(Nico)
- use a big buffer from the start if possible
(Claudio)
since v3:
- added initial patch and merge with comments
Sorry for the noise.
since v2:
- use tabs in first patch
(Nico)
- Added comments
- Added SCLP_RC_INSUFFICIENT_SCCB_LENGTH handling
^ permalink raw reply [flat|nested] 5+ messages in thread* [kvm-unit-tests PATCH v5 1/2] s390x: sclp: treat system as single processor when read_info is NULL
2023-06-01 16:45 [kvm-unit-tests PATCH v5 0/2] Fixing infinite loop on SCLP READ SCP INFO error Pierre Morel
@ 2023-06-01 16:45 ` Pierre Morel
2023-06-01 16:45 ` [kvm-unit-tests PATCH v5 2/2] s390x: sclp: Implement extended-length-SCCB facility Pierre Morel
2023-06-02 8:24 ` [kvm-unit-tests PATCH v5 0/2] Fixing infinite loop on SCLP READ SCP INFO error Nico Boehr
2 siblings, 0 replies; 5+ messages in thread
From: Pierre Morel @ 2023-06-01 16:45 UTC (permalink / raw)
To: linux-s390; +Cc: frankja, thuth, kvm, imbrenda, david, nrb, nsg, cohuck
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@linux.ibm.com>
Reviewed-by: Nico Boehr <nrb@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..adf357b 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.31.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* [kvm-unit-tests PATCH v5 2/2] s390x: sclp: Implement extended-length-SCCB facility
2023-06-01 16:45 [kvm-unit-tests PATCH v5 0/2] Fixing infinite loop on SCLP READ SCP INFO error Pierre Morel
2023-06-01 16:45 ` [kvm-unit-tests PATCH v5 1/2] s390x: sclp: treat system as single processor when read_info is NULL Pierre Morel
@ 2023-06-01 16:45 ` Pierre Morel
2023-06-01 16:58 ` Pierre Morel
2023-06-02 8:24 ` [kvm-unit-tests PATCH v5 0/2] Fixing infinite loop on SCLP READ SCP INFO error Nico Boehr
2 siblings, 1 reply; 5+ messages in thread
From: Pierre Morel @ 2023-06-01 16:45 UTC (permalink / raw)
To: linux-s390; +Cc: frankja, thuth, kvm, imbrenda, david, nrb, nsg, cohuck
When the extended-length-SCCB facility is present use a big
buffer already at first try when calling sclp_read_scp_info()
to avoid the SCLP_RC_INSUFFICIENT_SCCB_LENGTH error.
Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
---
lib/s390x/sclp.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c
index adf357b..e44d299 100644
--- a/lib/s390x/sclp.c
+++ b/lib/s390x/sclp.c
@@ -17,13 +17,14 @@
#include "sclp.h"
#include <alloc_phys.h>
#include <alloc_page.h>
+#include <asm/facility.h>
extern unsigned long stacktop;
static uint64_t storage_increment_size;
static uint64_t max_ram_size;
static uint64_t ram_size;
-char _read_info[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));
+char _read_info[2 * PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));
static ReadInfo *read_info;
struct sclp_facilities sclp_facilities;
@@ -114,6 +115,8 @@ static void sclp_read_scp_info(ReadInfo *ri, int length)
void sclp_read_info(void)
{
sclp_read_scp_info((void *)_read_info, SCCB_SIZE);
+ sclp_read_scp_info((void *)_read_info,
+ test_facility(140) ? sizeof(_read_info) : SCCB_SIZE);
read_info = (ReadInfo *)_read_info;
}
--
2.31.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [kvm-unit-tests PATCH v5 2/2] s390x: sclp: Implement extended-length-SCCB facility
2023-06-01 16:45 ` [kvm-unit-tests PATCH v5 2/2] s390x: sclp: Implement extended-length-SCCB facility Pierre Morel
@ 2023-06-01 16:58 ` Pierre Morel
0 siblings, 0 replies; 5+ messages in thread
From: Pierre Morel @ 2023-06-01 16:58 UTC (permalink / raw)
To: linux-s390; +Cc: frankja, thuth, kvm, imbrenda, david, nrb, nsg, cohuck
On 6/1/23 18:45, Pierre Morel wrote:
> When the extended-length-SCCB facility is present use a big
> buffer already at first try when calling sclp_read_scp_info()
> to avoid the SCLP_RC_INSUFFICIENT_SCCB_LENGTH error.
>
> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
> ---
> lib/s390x/sclp.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c
> index adf357b..e44d299 100644
> --- a/lib/s390x/sclp.c
> +++ b/lib/s390x/sclp.c
> @@ -17,13 +17,14 @@
> #include "sclp.h"
> #include <alloc_phys.h>
> #include <alloc_page.h>
> +#include <asm/facility.h>
>
> extern unsigned long stacktop;
>
> static uint64_t storage_increment_size;
> static uint64_t max_ram_size;
> static uint64_t ram_size;
> -char _read_info[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));
> +char _read_info[2 * PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));
> static ReadInfo *read_info;
> struct sclp_facilities sclp_facilities;
>
> @@ -114,6 +115,8 @@ static void sclp_read_scp_info(ReadInfo *ri, int length)
> void sclp_read_info(void)
> {
This line must go away.....v
> sclp_read_scp_info((void *)_read_info, SCCB_SIZE);
Sorry for the noise.
> + sclp_read_scp_info((void *)_read_info,
> + test_facility(140) ? sizeof(_read_info) : SCCB_SIZE);
> read_info = (ReadInfo *)_read_info;
> }
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [kvm-unit-tests PATCH v5 0/2] Fixing infinite loop on SCLP READ SCP INFO error
2023-06-01 16:45 [kvm-unit-tests PATCH v5 0/2] Fixing infinite loop on SCLP READ SCP INFO error Pierre Morel
2023-06-01 16:45 ` [kvm-unit-tests PATCH v5 1/2] s390x: sclp: treat system as single processor when read_info is NULL Pierre Morel
2023-06-01 16:45 ` [kvm-unit-tests PATCH v5 2/2] s390x: sclp: Implement extended-length-SCCB facility Pierre Morel
@ 2023-06-02 8:24 ` Nico Boehr
2 siblings, 0 replies; 5+ messages in thread
From: Nico Boehr @ 2023-06-02 8:24 UTC (permalink / raw)
To: Pierre Morel, linux-s390
Cc: frankja, thuth, kvm, imbrenda, david, nsg, cohuck
Quoting Pierre Morel (2023-06-01 18:45:35)
> 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.
>
> Also provide a bigger buffer for SCLP READ INFO when we have the
> extended-length-SCCB facility.
>
> Pierre
Thanks for your patience Pierre.
Pushed to devel with the fixup to patch 2.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-06-02 8:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-01 16:45 [kvm-unit-tests PATCH v5 0/2] Fixing infinite loop on SCLP READ SCP INFO error Pierre Morel
2023-06-01 16:45 ` [kvm-unit-tests PATCH v5 1/2] s390x: sclp: treat system as single processor when read_info is NULL Pierre Morel
2023-06-01 16:45 ` [kvm-unit-tests PATCH v5 2/2] s390x: sclp: Implement extended-length-SCCB facility Pierre Morel
2023-06-01 16:58 ` Pierre Morel
2023-06-02 8:24 ` [kvm-unit-tests PATCH v5 0/2] Fixing infinite loop on SCLP READ SCP INFO error Nico Boehr
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox