From: Pierre Morel <pmorel@linux.ibm.com>
To: "Cédric Le Goater" <clg@kaod.org>, qemu-s390x@nongnu.org
Cc: qemu-devel@nongnu.org, borntraeger@de.ibm.com,
pasic@linux.ibm.com, richard.henderson@linaro.org,
david@redhat.com, thuth@redhat.com, cohuck@redhat.com,
mst@redhat.com, pbonzini@redhat.com, kvm@vger.kernel.org,
ehabkost@redhat.com, marcel.apfelbaum@gmail.com,
eblake@redhat.com, armbru@redhat.com, seiden@linux.ibm.com,
nrb@linux.ibm.com, scgl@linux.ibm.com, frankja@linux.ibm.com,
berrange@redhat.com
Subject: Re: [PATCH v11 04/11] s390x/cpu topology: reporting the CPU topology to the guest
Date: Tue, 22 Nov 2022 10:05:42 +0100 [thread overview]
Message-ID: <d82db5c8-171b-1570-e000-25e381843e8d@linux.ibm.com> (raw)
In-Reply-To: <8b29a416-8190-243f-c414-e9e77efae918@kaod.org>
On 11/21/22 15:13, Cédric Le Goater wrote:
>>>> +static char *s390_top_set_level2(S390Topology *topo, char *p)
>>>> +{
>>>> + int i, origin;
>>>> +
>>>> + for (i = 0; i < topo->nr_sockets; i++) {
>>>> + if (!topo->socket[i].active_count) {
>>>> + continue;
>>>> + }
>>>> + p = fill_container(p, 1, i);
>>>> + for (origin = 0; origin < S390_TOPOLOGY_MAX_ORIGIN;
>>>> origin++) {
>>>> + uint64_t mask = 0L;
>>>> +
>>>> + mask = topo->socket[i].mask[origin];
>>>> + if (mask) {
>>>> + p = fill_tle_cpu(p, mask, origin);
>>>> + }
>>>> + }
>>>> + }
>>>> + return p;
>>>> +}
>>>
>>> Why is it not possible to compute this topo information at "runtime",
>>> when stsi is called, without maintaining state in an extra S390Topology
>>> object ? Couldn't we loop on the CPU list to gather the topology bits
>>> for the same result ?
>>>
>>> It would greatly simplify the feature.
>>>
>>> C.
>>>
>>
>> The vCPU are not stored in order of creation in the CPU list and not
>> in a topology order.
>> To be able to build the SYSIB we need an intermediate structure to
>> reorder the CPUs per container.
>>
>> We can do this re-ordering during the STSI interception but the idea
>> was to keep this instruction as fast as possible.> The second reason
>> is to have a structure ready for the QEMU migration when we introduce
>> vCPU migration from a socket to another socket, having then a
>> different internal representation of the topology.
>>
>>
>> However, if as discussed yesterday we use a new cpu flag we would not
>> need any special migration structure in the current series.
>>
>> So it only stays the first reason to do the re-ordering preparation
>> during the plugging of a vCPU, to optimize the STSI instruction.
>>
>> If we think the optimization is not worth it or do not bring enough to
>> be consider, we can do everything during the STSI interception.
>
> Is it called on a hot code path ? AFAICT, it is only called once
> per cpu when started. insert_stsi_3_2_2 is also a guest exit andit
> queries the machine definition in a very similar way.
It is not fully exact, stsi(15) is called at several moments, not only
on CPU creation, but each time the core calls rebuild_sched_domains()
that is for s390 on:
- change in the host topology
- changes in CPUSET: for allowed CPU or load balancing
Regards,
Pierre
>
> Thanks,
>
> C.
>
--
Pierre Morel
IBM Lab Boeblingen
next prev parent reply other threads:[~2022-11-22 9:06 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-03 17:01 [PATCH v11 00/11] s390x: CPU Topology Pierre Morel
2022-11-03 17:01 ` [PATCH v11 01/11] s390x: Register TYPE_S390_CCW_MACHINE properties as class properties Pierre Morel
2022-11-04 6:32 ` Thomas Huth
2022-11-04 10:16 ` Pierre Morel
2022-11-04 10:53 ` Cédric Le Goater
2022-11-04 13:58 ` Pierre Morel
2022-11-04 14:29 ` Thomas Huth
2022-11-04 14:57 ` Pierre Morel
2022-11-06 11:37 ` Thomas Huth
2022-11-07 9:52 ` Pierre Morel
2022-11-03 17:01 ` [PATCH v11 02/11] s390x/cpu topology: add max_threads machine class attribute Pierre Morel
2022-11-03 17:01 ` [PATCH v11 03/11] s390x/cpu topology: core_id sets s390x CPU topology Pierre Morel
2022-11-15 11:15 ` Cédric Le Goater
2022-11-16 10:17 ` Pierre Morel
2022-11-03 17:01 ` [PATCH v11 04/11] s390x/cpu topology: reporting the CPU topology to the guest Pierre Morel
2022-11-15 11:21 ` Cédric Le Goater
2022-11-16 10:27 ` Pierre Morel
2022-11-17 8:40 ` Cédric Le Goater
2022-11-17 9:32 ` Pierre Morel
2022-11-21 14:13 ` Cédric Le Goater
2022-11-22 9:05 ` Pierre Morel [this message]
2022-11-27 10:46 ` Pierre Morel
2022-11-03 17:01 ` [PATCH v11 05/11] s390x/cpu_topology: resetting the Topology-Change-Report Pierre Morel
2022-11-03 17:01 ` [PATCH v11 06/11] s390x/cpu_topology: CPU topology migration Pierre Morel
2022-11-03 17:01 ` [PATCH v11 07/11] target/s390x: interception of PTF instruction Pierre Morel
2022-11-03 17:01 ` [PATCH v11 08/11] s390x/cpu topology: add topology_capable QEMU capability Pierre Morel
2022-11-15 13:27 ` Cédric Le Goater
2022-11-16 11:23 ` Pierre Morel
2022-11-03 17:01 ` [PATCH v11 09/11] s390x/cpu topology: add topology machine property Pierre Morel
2022-11-03 17:20 ` Cornelia Huck
2022-11-04 10:09 ` Pierre Morel
2022-11-15 13:48 ` Cédric Le Goater
2022-11-16 12:39 ` Pierre Morel
[not found] ` <PH0PR22MB3210864C22AD57E5B32F626991079@PH0PR22MB3210.namprd22.prod.outlook.com>
2022-11-16 13:17 ` Thank you! s390x/cpu topology Jadon
2022-11-03 17:01 ` [PATCH v11 10/11] s390x/cpu_topology: activating CPU topology Pierre Morel
2022-11-03 17:01 ` [PATCH v11 11/11] docs/s390x: document s390x cpu topology 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=d82db5c8-171b-1570-e000-25e381843e8d@linux.ibm.com \
--to=pmorel@linux.ibm.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=clg@kaod.org \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=eblake@redhat.com \
--cc=ehabkost@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=nrb@linux.ibm.com \
--cc=pasic@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=scgl@linux.ibm.com \
--cc=seiden@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;
as well as URLs for NNTP newsgroup(s).