* [PATCH v2] KVM: s390: Also reset registers in sync regs for initial cpu reset
@ 2020-03-10 13:12 Christian Borntraeger
2020-03-10 13:21 ` David Hildenbrand
0 siblings, 1 reply; 5+ messages in thread
From: Christian Borntraeger @ 2020-03-10 13:12 UTC (permalink / raw)
To: Christian Borntraeger, Janosch Frank, David Hildenbrand
Cc: KVM, linux-s390, Cornelia Huck, stable
When we do the initial CPU reset we must not only clear the registers
in the internal data structures but also in kvm_run sync_regs. For
modern userspace sync_regs is the only place that it looks at.
Cc: stable@vger.kernel.org
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
arch/s390/kvm/kvm-s390.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index d7ff30e45589..c2e6d4ba4e23 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -3268,7 +3268,10 @@ static void kvm_arch_vcpu_ioctl_initial_reset(struct kvm_vcpu *vcpu)
/* Initial reset is a superset of the normal reset */
kvm_arch_vcpu_ioctl_normal_reset(vcpu);
- /* this equals initial cpu reset in pop, but we don't switch to ESA */
+ /*
+ * This equals initial cpu reset in pop, but we don't switch to ESA.
+ * We do not only reset the internal data, but also ...
+ */
vcpu->arch.sie_block->gpsw.mask = 0;
vcpu->arch.sie_block->gpsw.addr = 0;
kvm_s390_set_prefix(vcpu, 0);
@@ -3278,6 +3281,19 @@ static void kvm_arch_vcpu_ioctl_initial_reset(struct kvm_vcpu *vcpu)
memset(vcpu->arch.sie_block->gcr, 0, sizeof(vcpu->arch.sie_block->gcr));
vcpu->arch.sie_block->gcr[0] = CR0_INITIAL_MASK;
vcpu->arch.sie_block->gcr[14] = CR14_INITIAL_MASK;
+
+ /* ... the data in sync regs */
+ memset(vcpu->run->s.regs.crs, 0, sizeof(vcpu->run->s.regs.crs));
+ vcpu->run->s.regs.ckc = 0;
+ vcpu->run->s.regs.crs[0] = CR0_INITIAL_MASK;
+ vcpu->run->s.regs.crs[14] = CR14_INITIAL_MASK;
+ vcpu->run->psw_addr = 0;
+ vcpu->run->psw_mask = 0;
+ vcpu->run->s.regs.todpr = 0;
+ vcpu->run->s.regs.cputm = 0;
+ vcpu->run->s.regs.ckc = 0;
+ vcpu->run->s.regs.pp = 0;
+ vcpu->run->s.regs.gbea = 1;
vcpu->run->s.regs.fpc = 0;
vcpu->arch.sie_block->gbea = 1;
vcpu->arch.sie_block->pp = 0;
--
2.25.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] KVM: s390: Also reset registers in sync regs for initial cpu reset
2020-03-10 13:12 [PATCH v2] KVM: s390: Also reset registers in sync regs for initial cpu reset Christian Borntraeger
@ 2020-03-10 13:21 ` David Hildenbrand
2020-03-10 13:23 ` Christian Borntraeger
2020-03-16 11:45 ` Cornelia Huck
0 siblings, 2 replies; 5+ messages in thread
From: David Hildenbrand @ 2020-03-10 13:21 UTC (permalink / raw)
To: Christian Borntraeger, Janosch Frank
Cc: KVM, linux-s390, Cornelia Huck, stable
On 10.03.20 14:12, Christian Borntraeger wrote:
> When we do the initial CPU reset we must not only clear the registers
> in the internal data structures but also in kvm_run sync_regs. For
> modern userspace sync_regs is the only place that it looks at.
>
> Cc: stable@vger.kernel.org
# v?
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
> arch/s390/kvm/kvm-s390.c | 18 +++++++++++++++++-
> 1 file changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
> index d7ff30e45589..c2e6d4ba4e23 100644
> --- a/arch/s390/kvm/kvm-s390.c
> +++ b/arch/s390/kvm/kvm-s390.c
> @@ -3268,7 +3268,10 @@ static void kvm_arch_vcpu_ioctl_initial_reset(struct kvm_vcpu *vcpu)
> /* Initial reset is a superset of the normal reset */
> kvm_arch_vcpu_ioctl_normal_reset(vcpu);
>
> - /* this equals initial cpu reset in pop, but we don't switch to ESA */
> + /*
> + * This equals initial cpu reset in pop, but we don't switch to ESA.
> + * We do not only reset the internal data, but also ...
> + */
> vcpu->arch.sie_block->gpsw.mask = 0;
> vcpu->arch.sie_block->gpsw.addr = 0;
> kvm_s390_set_prefix(vcpu, 0);
> @@ -3278,6 +3281,19 @@ static void kvm_arch_vcpu_ioctl_initial_reset(struct kvm_vcpu *vcpu)
> memset(vcpu->arch.sie_block->gcr, 0, sizeof(vcpu->arch.sie_block->gcr));
> vcpu->arch.sie_block->gcr[0] = CR0_INITIAL_MASK;
> vcpu->arch.sie_block->gcr[14] = CR14_INITIAL_MASK;
> +
> + /* ... the data in sync regs */
> + memset(vcpu->run->s.regs.crs, 0, sizeof(vcpu->run->s.regs.crs));
> + vcpu->run->s.regs.ckc = 0;
> + vcpu->run->s.regs.crs[0] = CR0_INITIAL_MASK;
> + vcpu->run->s.regs.crs[14] = CR14_INITIAL_MASK;
> + vcpu->run->psw_addr = 0;
> + vcpu->run->psw_mask = 0;
> + vcpu->run->s.regs.todpr = 0;
> + vcpu->run->s.regs.cputm = 0;
> + vcpu->run->s.regs.ckc = 0;
> + vcpu->run->s.regs.pp = 0;
> + vcpu->run->s.regs.gbea = 1;
> vcpu->run->s.regs.fpc = 0;
> vcpu->arch.sie_block->gbea = 1;
> vcpu->arch.sie_block->pp = 0;
>
Acked-by: David Hildenbrand <david@redhat.com>
However, I do wonder if that ioctl *originally* was designed for that -
IOW if this is rally a stable patch or just some change that makes
sense. IIRC, userspace/QEMU always did the right thing, no? There was no
documentation about the guarantees AFAIK.
--
Thanks,
David / dhildenb
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] KVM: s390: Also reset registers in sync regs for initial cpu reset
2020-03-10 13:21 ` David Hildenbrand
@ 2020-03-10 13:23 ` Christian Borntraeger
2020-03-10 14:55 ` David Hildenbrand
2020-03-16 11:45 ` Cornelia Huck
1 sibling, 1 reply; 5+ messages in thread
From: Christian Borntraeger @ 2020-03-10 13:23 UTC (permalink / raw)
To: David Hildenbrand, Janosch Frank; +Cc: KVM, linux-s390, Cornelia Huck, stable
On 10.03.20 14:21, David Hildenbrand wrote:
> On 10.03.20 14:12, Christian Borntraeger wrote:
>> When we do the initial CPU reset we must not only clear the registers
>> in the internal data structures but also in kvm_run sync_regs. For
>> modern userspace sync_regs is the only place that it looks at.
>>
>> Cc: stable@vger.kernel.org
>
> # v?
>
>> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
>> ---
>> arch/s390/kvm/kvm-s390.c | 18 +++++++++++++++++-
>> 1 file changed, 17 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
>> index d7ff30e45589..c2e6d4ba4e23 100644
>> --- a/arch/s390/kvm/kvm-s390.c
>> +++ b/arch/s390/kvm/kvm-s390.c
>> @@ -3268,7 +3268,10 @@ static void kvm_arch_vcpu_ioctl_initial_reset(struct kvm_vcpu *vcpu)
>> /* Initial reset is a superset of the normal reset */
>> kvm_arch_vcpu_ioctl_normal_reset(vcpu);
>>
>> - /* this equals initial cpu reset in pop, but we don't switch to ESA */
>> + /*
>> + * This equals initial cpu reset in pop, but we don't switch to ESA.
>> + * We do not only reset the internal data, but also ...
>> + */
>> vcpu->arch.sie_block->gpsw.mask = 0;
>> vcpu->arch.sie_block->gpsw.addr = 0;
>> kvm_s390_set_prefix(vcpu, 0);
>> @@ -3278,6 +3281,19 @@ static void kvm_arch_vcpu_ioctl_initial_reset(struct kvm_vcpu *vcpu)
>> memset(vcpu->arch.sie_block->gcr, 0, sizeof(vcpu->arch.sie_block->gcr));
>> vcpu->arch.sie_block->gcr[0] = CR0_INITIAL_MASK;
>> vcpu->arch.sie_block->gcr[14] = CR14_INITIAL_MASK;
>> +
>> + /* ... the data in sync regs */
>> + memset(vcpu->run->s.regs.crs, 0, sizeof(vcpu->run->s.regs.crs));
>> + vcpu->run->s.regs.ckc = 0;
>> + vcpu->run->s.regs.crs[0] = CR0_INITIAL_MASK;
>> + vcpu->run->s.regs.crs[14] = CR14_INITIAL_MASK;
>> + vcpu->run->psw_addr = 0;
>> + vcpu->run->psw_mask = 0;
>> + vcpu->run->s.regs.todpr = 0;
>> + vcpu->run->s.regs.cputm = 0;
>> + vcpu->run->s.regs.ckc = 0;
>> + vcpu->run->s.regs.pp = 0;
>> + vcpu->run->s.regs.gbea = 1;
>> vcpu->run->s.regs.fpc = 0;
>> vcpu->arch.sie_block->gbea = 1;
>> vcpu->arch.sie_block->pp = 0;
>>
>
> Acked-by: David Hildenbrand <david@redhat.com>
>
> However, I do wonder if that ioctl *originally* was designed for that -
> IOW if this is rally a stable patch or just some change that makes
> sense. IIRC, userspace/QEMU always did the right thing, no? There was no
> documentation about the guarantees AFAIK.
>
Yes, I moved forth and back.
Maybe removing cc stable and just adding
Fixes: 7de3f1423ff ("KVM: s390: Add new reset vcpu API")
is better then.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] KVM: s390: Also reset registers in sync regs for initial cpu reset
2020-03-10 13:23 ` Christian Borntraeger
@ 2020-03-10 14:55 ` David Hildenbrand
0 siblings, 0 replies; 5+ messages in thread
From: David Hildenbrand @ 2020-03-10 14:55 UTC (permalink / raw)
To: Christian Borntraeger, Janosch Frank
Cc: KVM, linux-s390, Cornelia Huck, stable
On 10.03.20 14:23, Christian Borntraeger wrote:
>
>
> On 10.03.20 14:21, David Hildenbrand wrote:
>> On 10.03.20 14:12, Christian Borntraeger wrote:
>>> When we do the initial CPU reset we must not only clear the registers
>>> in the internal data structures but also in kvm_run sync_regs. For
>>> modern userspace sync_regs is the only place that it looks at.
>>>
>>> Cc: stable@vger.kernel.org
>>
>> # v?
>>
>>> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
>>> ---
>>> arch/s390/kvm/kvm-s390.c | 18 +++++++++++++++++-
>>> 1 file changed, 17 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
>>> index d7ff30e45589..c2e6d4ba4e23 100644
>>> --- a/arch/s390/kvm/kvm-s390.c
>>> +++ b/arch/s390/kvm/kvm-s390.c
>>> @@ -3268,7 +3268,10 @@ static void kvm_arch_vcpu_ioctl_initial_reset(struct kvm_vcpu *vcpu)
>>> /* Initial reset is a superset of the normal reset */
>>> kvm_arch_vcpu_ioctl_normal_reset(vcpu);
>>>
>>> - /* this equals initial cpu reset in pop, but we don't switch to ESA */
>>> + /*
>>> + * This equals initial cpu reset in pop, but we don't switch to ESA.
>>> + * We do not only reset the internal data, but also ...
>>> + */
>>> vcpu->arch.sie_block->gpsw.mask = 0;
>>> vcpu->arch.sie_block->gpsw.addr = 0;
>>> kvm_s390_set_prefix(vcpu, 0);
>>> @@ -3278,6 +3281,19 @@ static void kvm_arch_vcpu_ioctl_initial_reset(struct kvm_vcpu *vcpu)
>>> memset(vcpu->arch.sie_block->gcr, 0, sizeof(vcpu->arch.sie_block->gcr));
>>> vcpu->arch.sie_block->gcr[0] = CR0_INITIAL_MASK;
>>> vcpu->arch.sie_block->gcr[14] = CR14_INITIAL_MASK;
>>> +
>>> + /* ... the data in sync regs */
>>> + memset(vcpu->run->s.regs.crs, 0, sizeof(vcpu->run->s.regs.crs));
>>> + vcpu->run->s.regs.ckc = 0;
>>> + vcpu->run->s.regs.crs[0] = CR0_INITIAL_MASK;
>>> + vcpu->run->s.regs.crs[14] = CR14_INITIAL_MASK;
>>> + vcpu->run->psw_addr = 0;
>>> + vcpu->run->psw_mask = 0;
>>> + vcpu->run->s.regs.todpr = 0;
>>> + vcpu->run->s.regs.cputm = 0;
>>> + vcpu->run->s.regs.ckc = 0;
>>> + vcpu->run->s.regs.pp = 0;
>>> + vcpu->run->s.regs.gbea = 1;
>>> vcpu->run->s.regs.fpc = 0;
>>> vcpu->arch.sie_block->gbea = 1;
>>> vcpu->arch.sie_block->pp = 0;
>>>
>>
>> Acked-by: David Hildenbrand <david@redhat.com>
>>
>> However, I do wonder if that ioctl *originally* was designed for that -
>> IOW if this is rally a stable patch or just some change that makes
>> sense. IIRC, userspace/QEMU always did the right thing, no? There was no
>> documentation about the guarantees AFAIK.
>>
>
> Yes, I moved forth and back.
> Maybe removing cc stable and just adding
> Fixes: 7de3f1423ff ("KVM: s390: Add new reset vcpu API")
> is better then.
Makes sense.
--
Thanks,
David / dhildenb
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] KVM: s390: Also reset registers in sync regs for initial cpu reset
2020-03-10 13:21 ` David Hildenbrand
2020-03-10 13:23 ` Christian Borntraeger
@ 2020-03-16 11:45 ` Cornelia Huck
1 sibling, 0 replies; 5+ messages in thread
From: Cornelia Huck @ 2020-03-16 11:45 UTC (permalink / raw)
To: David Hildenbrand
Cc: Christian Borntraeger, Janosch Frank, KVM, linux-s390, stable
On Tue, 10 Mar 2020 14:21:23 +0100
David Hildenbrand <david@redhat.com> wrote:
> On 10.03.20 14:12, Christian Borntraeger wrote:
> > When we do the initial CPU reset we must not only clear the registers
> > in the internal data structures but also in kvm_run sync_regs. For
> > modern userspace sync_regs is the only place that it looks at.
> >
> > Cc: stable@vger.kernel.org
>
> # v?
>
> > Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> > ---
> > arch/s390/kvm/kvm-s390.c | 18 +++++++++++++++++-
> > 1 file changed, 17 insertions(+), 1 deletion(-)
> However, I do wonder if that ioctl *originally* was designed for that -
> IOW if this is rally a stable patch or just some change that makes
> sense. IIRC, userspace/QEMU always did the right thing, no? There was no
> documentation about the guarantees AFAIK.
The documentation only refers to the PoP for what is actually reset...
should it also mention the sync regs?
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-03-16 11:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-10 13:12 [PATCH v2] KVM: s390: Also reset registers in sync regs for initial cpu reset Christian Borntraeger
2020-03-10 13:21 ` David Hildenbrand
2020-03-10 13:23 ` Christian Borntraeger
2020-03-10 14:55 ` David Hildenbrand
2020-03-16 11:45 ` Cornelia Huck
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).