From: Thomas Huth <thuth@redhat.com>
To: Janosch Frank <frankja@linux.ibm.com>, kvm@vger.kernel.org
Cc: david@redhat.com, borntraeger@de.ibm.com, imbrenda@linux.ibm.com,
cohuck@redhat.com, linux-s390@vger.kernel.org
Subject: Re: [kvm-unit-tests PATCH v2 2/7] s390x: Consolidate sclp read info
Date: Fri, 27 Nov 2020 14:59:04 +0100 [thread overview]
Message-ID: <491a5e03-5c07-97a4-e8e3-99ea97b681b2@redhat.com> (raw)
In-Reply-To: <20201127130629.120469-3-frankja@linux.ibm.com>
On 27/11/2020 14.06, Janosch Frank wrote:
> Let's only read the information once and pass a pointer to it instead
> of calling sclp multiple times.
>
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> Reviewed-by: Cornelia Huck <cohuck@redhat.com>
> ---
> lib/s390x/io.c | 1 +
> lib/s390x/sclp.c | 29 +++++++++++++++++++++++------
> lib/s390x/sclp.h | 3 +++
> lib/s390x/smp.c | 28 +++++++++++-----------------
> 4 files changed, 38 insertions(+), 23 deletions(-)
...
> diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c
> index 4e2ac18..ff56c44 100644
> --- a/lib/s390x/sclp.c
> +++ b/lib/s390x/sclp.c
> @@ -25,6 +25,8 @@ 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__(4096)));
> +static ReadInfo *read_info;
>
> char _sccb[PAGE_SIZE] __attribute__((__aligned__(4096)));
> static volatile bool sclp_busy;
> @@ -110,6 +112,22 @@ static void sclp_read_scp_info(ReadInfo *ri, int length)
> report_abort("READ_SCP_INFO failed");
> }
>
> +void sclp_read_info(void)
> +{
> + sclp_read_scp_info((void *)_read_info, SCCB_SIZE);
> + read_info = (ReadInfo *)_read_info;
> +}
> +
> +int sclp_get_cpu_num(void)
> +{
I forgot to say: Maybe add a
assert(read_info);
here, just in case? (since we can dereference the NULL pointer in the k-u-t)
> + return read_info->entries_cpu;
> +}
> +
> +CPUEntry *sclp_get_cpu_entries(void)
> +{
dito.
> + return (void *)read_info + read_info->offset_cpu;
> +}
Thomas
next prev parent reply other threads:[~2020-11-27 13:59 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-27 13:06 [kvm-unit-tests PATCH v2 0/7] s390x: Add SIE library and simple test Janosch Frank
2020-11-27 13:06 ` [kvm-unit-tests PATCH v2 1/7] s390x: Add test_bit to library Janosch Frank
2020-11-27 13:06 ` [kvm-unit-tests PATCH v2 2/7] s390x: Consolidate sclp read info Janosch Frank
2020-11-27 13:56 ` Thomas Huth
2020-11-27 13:59 ` Thomas Huth [this message]
2020-11-27 13:06 ` [kvm-unit-tests PATCH v2 3/7] s390x: SCLP feature checking Janosch Frank
2020-11-27 14:18 ` Thomas Huth
2020-11-30 10:38 ` Cornelia Huck
2020-11-27 13:06 ` [kvm-unit-tests PATCH v2 4/7] s390x: sie: Add SIE to lib Janosch Frank
2020-11-27 13:06 ` [kvm-unit-tests PATCH v2 5/7] s390x: sie: Add first SIE test Janosch Frank
2020-11-27 16:22 ` Thomas Huth
2020-11-30 10:45 ` Cornelia Huck
2020-11-30 12:42 ` Janosch Frank
2020-11-27 13:06 ` [kvm-unit-tests PATCH v2 6/7] s390x: Add diag318 intercept test Janosch Frank
2020-11-27 16:46 ` Thomas Huth
2020-11-30 12:38 ` Janosch Frank
2020-11-30 11:30 ` Cornelia Huck
2020-11-27 13:06 ` [kvm-unit-tests PATCH v2 7/7] s390x: Fix sclp.h style issues Janosch Frank
2020-11-27 14:25 ` Thomas Huth
2020-11-30 10:49 ` Cornelia Huck
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=491a5e03-5c07-97a4-e8e3-99ea97b681b2@redhat.com \
--to=thuth@redhat.com \
--cc=borntraeger@de.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 \
/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