From: Thomas Huth <thuth@redhat.com>
To: Janosch Frank <frankja@linux.ibm.com>, kvm@vger.kernel.org
Cc: linux-s390@vger.kernel.org, david@redhat.com
Subject: Re: [kvm-unit-tests PATCH v2 4/6] s390x: Add initial smp code
Date: Mon, 9 Sep 2019 17:37:20 +0200 [thread overview]
Message-ID: <51f23b0f-a928-1cd3-787d-31aed3ab7005@redhat.com> (raw)
In-Reply-To: <20190905103951.36522-5-frankja@linux.ibm.com>
On 05/09/2019 12.39, Janosch Frank wrote:
> Let's add a rudimentary SMP library, which will scan for cpus and has
> helper functions that manage the cpu state.
>
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
[...]
> +/*Expected to be called from boot cpu */
> +extern uint64_t *stackptr;
> +void smp_setup(void)
> +{
> + int i = 0;
> + unsigned short cpu0_addr = stap();
> + struct ReadCpuInfo *info = (void *)cpu_info_buffer;
> +
> + spin_lock(&lock);
> + sclp_mark_busy();
> + info->h.length = PAGE_SIZE;
> + sclp_service_call(SCLP_READ_CPU_INFO, cpu_info_buffer);
> +
> + if (smp_query_num_cpus() > 1)
> + printf("SMP: Initializing, found %d cpus\n", info->nr_configured);
> +
> + cpus = calloc(info->nr_configured, sizeof(cpus));
> + for (i = 0; i < info->nr_configured; i++) {
> + if (info->entries[i].address == cpu0_addr) {
> + cpu0 = &cpus[i];
> + cpu0->stack = stackptr;
> + cpu0->lowcore = (void *)0;
> + cpu0->active = true;
So here cpus[i].active gets set to true ...
> + }
> + cpus[i].addr = info->entries[i].address;
> + cpus[i].active = false;
... but here it is set back to false.
Maybe move the if-statement below this line?
> + }
> + spin_unlock(&lock);
> +}
[...]
> diff --git a/s390x/cstart64.S b/s390x/cstart64.S
> index 36f7cab..a45ea8f 100644
> --- a/s390x/cstart64.S
> +++ b/s390x/cstart64.S
> @@ -172,6 +172,13 @@ diag308_load_reset:
> lhi %r2, 1
> br %r14
>
> +.globl smp_cpu_setup_state
> +smp_cpu_setup_state:
> + xgr %r1, %r1
> + lmg %r0, %r15, 512(%r1)
Can you use GEN_LC_SW_INT_GRS instead of 512?
> + lctlg %c0, %c0, 776(%r1)
... and here GEN_LC_SW_INT_CR0 instead of 776?
Apart from that, the patch looks fine to me.
Thomas
next prev parent reply other threads:[~2019-09-09 15:37 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-05 10:39 [kvm-unit-tests PATCH v2 0/6] s390x: Add multiboot and smp Janosch Frank
2019-09-05 10:39 ` [kvm-unit-tests PATCH v2 1/6] s390x: Use interrupts in SCLP and add locking Janosch Frank
2019-09-09 9:08 ` Thomas Huth
2019-09-10 10:14 ` David Hildenbrand
2019-09-10 11:24 ` David Hildenbrand
2019-09-10 11:25 ` Janosch Frank
2019-09-10 11:30 ` David Hildenbrand
2019-09-05 10:39 ` [kvm-unit-tests PATCH v2 2/6] s390x: Add linemode console Janosch Frank
2019-09-05 10:39 ` [kvm-unit-tests PATCH v2 3/6] s390x: Add linemode buffer to fix newline on every print Janosch Frank
2019-09-09 9:02 ` David Hildenbrand
2019-09-11 7:57 ` David Hildenbrand
2019-09-19 11:07 ` Janosch Frank
2019-09-05 10:39 ` [kvm-unit-tests PATCH v2 4/6] s390x: Add initial smp code Janosch Frank
2019-09-09 15:37 ` Thomas Huth [this message]
2019-09-11 8:33 ` Janosch Frank
2019-09-10 12:19 ` Thomas Huth
2019-09-05 10:39 ` [kvm-unit-tests PATCH v2 5/6] s390x: Prepare for external calls Janosch Frank
2019-09-09 15:47 ` Thomas Huth
2019-09-05 10:39 ` [kvm-unit-tests PATCH v2 6/6] s390x: SMP test Janosch Frank
2019-09-10 9:43 ` Thomas Huth
2019-09-10 11:11 ` Janosch Frank
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=51f23b0f-a928-1cd3-787d-31aed3ab7005@redhat.com \
--to=thuth@redhat.com \
--cc=david@redhat.com \
--cc=frankja@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