Re: [PATCH v7] KVM: s390: Add new reset vcpu API

Janosch Frank
2020-01-27T09:52:43Z

[-- Attachment #1.1: Type: text/plain, Size: 1294 bytes --]

On 1/27/20 9:05 AM, Christian Borntraeger wrote:
>
>
> On 10.01.20 12:45, Janosch Frank wrote:
> [...]
>> +static void kvm_arch_vcpu_ioctl_clear_reset(struct kvm_vcpu *vcpu)
>> +{
>> + struct kvm_sync_regs *regs = &vcpu->run->s.regs;
>> +
>> + /* Clear reset is a superset of the initial reset */
>> + kvm_arch_vcpu_ioctl_normal_reset(vcpu);
>> +
>> + memset(&regs->gprs, 0, sizeof(regs->gprs));
>
>
>
>> + /* Will be picked up because of save_fpu_regs() in the initial reset */
>> + memset(&current->thread.fpu.vxrs, 0, sizeof(current->thread.fpu.vxrs));
>
> So I checked with a userspace that sets f8(call-saved) to 0x123 during this ioctl.
> f8 is 0 afterwards. The guest f8 is also correct, just because QEMU does clear out
> its copy of the fprs and syncs that back via synv regs.
>
> So this must be
>
> /* we have not synced the registers from kvm_run to the thread
> structure. We must clear out kvm_run*/
> memset(&regs->vrs, 0, sizeof(regs->vrs));

Great, thanks!
Meanwhile I had a look at the missing pieces and the guarded storage resets.

>
>
>> + memset(&regs->acrs, 0, sizeof(regs->acrs));
>> +
>> + regs->etoken = 0;
>> + regs->etoken_extension = 0;
>> +
>> + memset(&regs->gscb, 0, sizeof(regs->gscb));
> [....]
>

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]