From: Claudio Imbrenda <imbrenda@linux.ibm.com>
To: Pierre Morel <pmorel@linux.ibm.com>
Cc: linux-s390@vger.kernel.org, frankja@linux.ibm.com,
thuth@redhat.com, kvm@vger.kernel.org, david@redhat.com,
nrb@linux.ibm.com, nsg@linux.ibm.com, cohuck@redhat.com
Subject: Re: [kvm-unit-tests PATCH 1/1] s390x: sclp: consider monoprocessor on read_info error
Date: Tue, 25 Apr 2023 10:26:06 +0200 [thread overview]
Message-ID: <20230425102606.4e9bc606@p-imbrenda> (raw)
In-Reply-To: <20230424174218.64145-2-pmorel@linux.ibm.com>
On Mon, 24 Apr 2023 19:42:18 +0200
Pierre Morel <pmorel@linux.ibm.com> wrote:
> When we can not read SCP information we can not abort during
> sclp_get_cpu_num() because this function is called during exit
> and calling it will lead to an infnite loop.
>
> 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 happens when only the start processor is running.
> Let sclp_get_cpu_num() return 1 in this case.
looks good to me, but please add a comment to explain that this is only
supposed to happen in exceptional circumstances
>
> Fixes: 52076a63d569 ("s390x: Consolidate sclp read info")
> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
> ---
> lib/s390x/sclp.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c
> index acdc8a9..c09360d 100644
> --- a/lib/s390x/sclp.c
> +++ b/lib/s390x/sclp.c
> @@ -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)
next prev parent reply other threads:[~2023-04-25 8:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-24 17:42 [kvm-unit-tests PATCH 0/1] Fixing infinite loop on SCLP READ SCP INFO error Pierre Morel
2023-04-24 17:42 ` [kvm-unit-tests PATCH 1/1] s390x: sclp: consider monoprocessor on read_info error Pierre Morel
2023-04-25 8:26 ` Claudio Imbrenda [this message]
2023-04-25 10:53 ` Pierre Morel
2023-04-25 11:33 ` Janosch Frank
2023-04-25 11:45 ` Pierre Morel
2023-04-25 12:16 ` Claudio Imbrenda
2023-04-25 13:24 ` Pierre Morel
2023-04-25 13:48 ` 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=20230425102606.4e9bc606@p-imbrenda \
--to=imbrenda@linux.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=frankja@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=pmorel@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