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

Thomas Huth
2019-12-04T10:37:34Z

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

On 04/12/2019 11.06, Janosch Frank wrote:
> On 12/4/19 10:32 AM, Thomas Huth wrote:
>> On 03/12/2019 17.20, Janosch Frank wrote:
>>> The architecture states that we need to reset local IRQs for all CPU
>>> resets. Because the old reset interface did not support the normal CPU
>>> reset we never did that.
>>>
>>> Now that we have a new interface, let's properly clear out local IRQs
>>> and let this commit be a reminder.
>>>
>>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
>>> ---
>>> arch/s390/kvm/kvm-s390.c | 13 +++++++++++++
>>> include/uapi/linux/kvm.h | 4 ++++
>>> 2 files changed, 17 insertions(+)
>>>
>>> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
>>> index d9e6bf3d54f0..602214c5616c 100644
>>> --- a/arch/s390/kvm/kvm-s390.c
>>> +++ b/arch/s390/kvm/kvm-s390.c
>>> @@ -529,6 +529,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
>>> case KVM_CAP_S390_CMMA_MIGRATION:
>>> case KVM_CAP_S390_AIS:
>>> case KVM_CAP_S390_AIS_MIGRATION:
>>> + case KVM_CAP_S390_VCPU_RESETS:
>>> r = 1;
>>> break;
>>> case KVM_CAP_S390_HPAGE_1M:
>>> @@ -3287,6 +3288,13 @@ static int kvm_arch_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu,
>>> return r;
>>> }
>>>
>>> +static int kvm_arch_vcpu_ioctl_normal_reset(struct kvm_vcpu *vcpu)
>>> +{
>>> + kvm_clear_async_pf_completion_queue(vcpu);
>>> + kvm_s390_clear_local_irqs(vcpu);
>>> + return 0;
>>> +}
>>> +
>>> static int kvm_arch_vcpu_ioctl_initial_reset(struct kvm_vcpu *vcpu)
>>> {
>>> kvm_s390_vcpu_initial_reset(vcpu);
>>> @@ -4363,7 +4371,12 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
>>> r = kvm_arch_vcpu_ioctl_set_initial_psw(vcpu, psw);
>>> break;
>>> }
>>> + case KVM_S390_NORMAL_RESET:
>>> + r = kvm_arch_vcpu_ioctl_normal_reset(vcpu);
>>> + break;
>>> case KVM_S390_INITIAL_RESET:
>>> + /* fallthrough */
>>> + case KVM_S390_CLEAR_RESET:
>>> r = kvm_arch_vcpu_ioctl_initial_reset(vcpu);
>>> break;
>>
>> Isn't clear reset supposed to do more than the initial reset? If so, I'd
>> rather expect it the other way round:
>
> In the PV patch I remove the fallthrough and add a function for the
> clear reset. I add the UV reset calls into the
> kvm_arch_vcpu_ioctl_*_reset() functions, therefore I can't fallthrough
> because the Ultravisor does currently not allow staged resets (i.e.
> first initial then clear if a clear reset is needed)

Ok, then it's fine. But in case you respin your patch, it's maybe less
confusing if you swap it.

Thomas

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