From: Pierre Morel <pmorel@linux.ibm.com>
To: David Hildenbrand <david@redhat.com>, kvm@vger.kernel.org
Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
borntraeger@de.ibm.com, frankja@linux.ibm.com, cohuck@redhat.com,
thuth@redhat.com, imbrenda@linux.ibm.com, hca@linux.ibm.com,
gor@linux.ibm.com, wintera@linux.ibm.com, seiden@linux.ibm.com,
nrb@linux.ibm.com
Subject: Re: [PATCH v9 2/3] s390x: KVM: guest support for topology function
Date: Mon, 16 May 2022 16:13:10 +0200 [thread overview]
Message-ID: <23b2cb4c-88be-b332-d82f-961e38a069f1@linux.ibm.com> (raw)
In-Reply-To: <2ffb7b35-5066-3e63-7648-7663a9142e7d@redhat.com>
On 5/12/22 11:24, David Hildenbrand wrote:
> On 06.05.22 11:24, Pierre Morel wrote:
>> We let the userland hypervisor know if the machine support the CPU
>> topology facility using a new KVM capability: KVM_CAP_S390_CPU_TOPOLOGY.
>>
>> The PTF instruction will report a topology change if there is any change
>> with a previous STSI_15_1_2 SYSIB.
>> Changes inside a STSI_15_1_2 SYSIB occur if CPU bits are set or clear
>> inside the CPU Topology List Entry CPU mask field, which happens with
>> changes in CPU polarization, dedication, CPU types and adding or
>> removing CPUs in a socket.
>>
>> The reporting to the guest is done using the Multiprocessor
>> Topology-Change-Report (MTCR) bit of the utility entry of the guest's
>> SCA which will be cleared during the interpretation of PTF.
>>
>> To check if the topology has been modified we use a new field of the
>> arch vCPU to save the previous real CPU ID at the end of a schedule
>> and verify on next schedule that the CPU used is in the same socket.
>> We do not report polarization, CPU Type or dedication change.
>>
>> STSI(15.1.x) gives information on the CPU configuration topology.
>> Let's accept the interception of STSI with the function code 15 and
>> let the userland part of the hypervisor handle it when userland
>> support the CPU Topology facility.
>>
>> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
>
> [...]
>
>
>> diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
>> index 0e8603acc105..d9e16b09c8bf 100644
>> --- a/arch/s390/kvm/priv.c
>> +++ b/arch/s390/kvm/priv.c
>> @@ -874,10 +874,12 @@ static int handle_stsi(struct kvm_vcpu *vcpu)
>> if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
>> return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
>>
>> - if (fc > 3) {
>> - kvm_s390_set_psw_cc(vcpu, 3);
>> - return 0;
>> - }
>> + if (fc > 3 && fc != 15)
>> + goto out_no_data;
>> +
>> + /* fc 15 is provided with PTF/CPU topology support */
>> + if (fc == 15 && !test_kvm_facility(vcpu->kvm, 11))
>> + goto out_no_data;
>
>
> Maybe shorter as
>
> if (fc == 15 && !test_kvm_facility(vcpu->kvm, 11))
> goto out_no_data;
> else if (fc > 3)
> goto out_no_data;
>
yes.
>
> Apart from that, LGTM.
>
Thanks,
Pierre
--
Pierre Morel
IBM Lab Boeblingen
next prev parent reply other threads:[~2022-05-16 14:09 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-06 9:24 [PATCH v9 0/3] s390x: KVM: CPU Topology Pierre Morel
2022-05-06 9:24 ` [PATCH v9 1/3] s390x: KVM: ipte lock for SCA access should be contained in KVM Pierre Morel
2022-05-12 9:08 ` David Hildenbrand
2022-05-16 16:30 ` Pierre Morel
2022-05-12 11:32 ` Janosch Frank
2022-05-16 14:13 ` Pierre Morel
2022-05-06 9:24 ` [PATCH v9 2/3] s390x: KVM: guest support for topology function Pierre Morel
2022-05-12 9:24 ` David Hildenbrand
2022-05-16 14:13 ` Pierre Morel [this message]
2022-06-17 14:49 ` Pierre Morel
2022-05-12 11:41 ` Janosch Frank
2022-05-16 10:41 ` Pierre Morel
2022-05-19 9:01 ` Christian Borntraeger
2022-05-19 9:23 ` Pierre Morel
2022-05-19 9:36 ` Christian Borntraeger
2022-05-06 9:24 ` [PATCH v9 3/3] s390x: KVM: resetting the Topology-Change-Report Pierre Morel
2022-05-12 9:31 ` David Hildenbrand
2022-05-12 9:52 ` Claudio Imbrenda
2022-05-12 10:01 ` David Hildenbrand
2022-05-16 14:21 ` Pierre Morel
2022-05-18 14:33 ` David Hildenbrand
2022-05-18 16:55 ` Pierre Morel
2022-05-16 10:36 ` Pierre Morel
2022-05-18 10:51 ` Pierre Morel
2022-05-18 15:26 ` [PATCH v9 0/3] s390x: KVM: CPU Topology Christian Borntraeger
2022-05-18 16:41 ` Pierre Morel
2022-05-19 5:46 ` Heiko Carstens
2022-05-19 8:07 ` Christian Borntraeger
2022-05-19 9:02 ` 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=23b2cb4c-88be-b332-d82f-961e38a069f1@linux.ibm.com \
--to=pmorel@linux.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=nrb@linux.ibm.com \
--cc=seiden@linux.ibm.com \
--cc=thuth@redhat.com \
--cc=wintera@linux.ibm.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).