Re: [PATCH v3 05/10] KVM: arm64: Support stolen time reporting via shared structure

From: Steven Price
Date: Thu Aug 22 2019 - 09:45:38 EST


On 22/08/2019 11:39, Jonathan Cameron wrote:
> On Wed, 21 Aug 2019 16:36:51 +0100
> Steven Price <steven.price@xxxxxxx> wrote:
>
>> Implement the service call for configuring a shared structure between a
>> VCPU and the hypervisor in which the hypervisor can write the time
>> stolen from the VCPU's execution time by other tasks on the host.
>>
>> The hypervisor allocates memory which is placed at an IPA chosen by user
>> space. The hypervisor then updates the shared structure using
>> kvm_put_guest() to ensure single copy atomicity of the 64-bit value
>> reporting the stolen time in nanoseconds.
>>
>> Whenever stolen time is enabled by the guest, the stolen time counter is
>> reset.
>>
>> The stolen time itself is retrieved from the sched_info structure
>> maintained by the Linux scheduler code. We enable SCHEDSTATS when
>> selecting KVM Kconfig to ensure this value is meaningful.
>>
>> Signed-off-by: Steven Price <steven.price@xxxxxxx>
>
> One totally trivial comment inline... Feel free to ignore :)
>
[...]
>> +int kvm_hypercall_stolen_time(struct kvm_vcpu *vcpu)
>> +{
>> + u64 ret;
>> + int err;
>> +
>> + /*
>> + * Start counting stolen time from the time the guest requests
>> + * the feature enabled.
>> + */
>> + vcpu->arch.steal.steal = 0;
>> + vcpu->arch.steal.last_steal = current->sched_info.run_delay;
>> +
>> + err = kvm_update_stolen_time(vcpu, true);
>> +
>> + if (err)
>> + ret = SMCCC_RET_NOT_SUPPORTED;
>
> Trivial by why not
> return SMCCC_RET_NOT_SUPPORTED;
>
> return vcpu->kvm->arch.pvtime.st_base +
> ...
> Drops the indentation a bit and puts the error handling out of
> line which is slightly nicer to read (to my eyes).

Yes that's a nice change - drops the extra "ret" variable too.

Thanks,

Steve