[PATCH v6 33/48] KVM: PPC: Book3S HV P9: Improve exit timing accounting coverage

Alexey Kardashevskiy aik at ozlabs.ru
Fri Apr 9 19:40:33 AEST 2021



On 05/04/2021 11:19, Nicholas Piggin wrote:
> The C conversion caused exit timing to become a bit cramped. Expand it
> to cover more of the entry and exit code.
> 
> Signed-off-by: Nicholas Piggin <npiggin at gmail.com>


Reviewed-by: Alexey Kardashevskiy <aik at ozlabs.ru>

> ---
>   arch/powerpc/kvm/book3s_hv_interrupt.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/book3s_hv_interrupt.c b/arch/powerpc/kvm/book3s_hv_interrupt.c
> index e93d2a6456ff..44c77f907f91 100644
> --- a/arch/powerpc/kvm/book3s_hv_interrupt.c
> +++ b/arch/powerpc/kvm/book3s_hv_interrupt.c
> @@ -154,6 +154,8 @@ int kvmhv_vcpu_entry_p9(struct kvm_vcpu *vcpu, u64 time_limit, unsigned long lpc
>   	if (hdec < 0)
>   		return BOOK3S_INTERRUPT_HV_DECREMENTER;
>   
> +	start_timing(vcpu, &vcpu->arch.rm_entry);
> +
>   	if (vc->tb_offset) {
>   		u64 new_tb = tb + vc->tb_offset;
>   		mtspr(SPRN_TBU40, new_tb);
> @@ -204,8 +206,6 @@ int kvmhv_vcpu_entry_p9(struct kvm_vcpu *vcpu, u64 time_limit, unsigned long lpc
>   	 */
>   	mtspr(SPRN_HDEC, hdec);
>   
> -	start_timing(vcpu, &vcpu->arch.rm_entry);
> -
>   	vcpu->arch.ceded = 0;
>   
>   	WARN_ON_ONCE(vcpu->arch.shregs.msr & MSR_HV);
> @@ -349,8 +349,6 @@ int kvmhv_vcpu_entry_p9(struct kvm_vcpu *vcpu, u64 time_limit, unsigned long lpc
>   
>   	accumulate_time(vcpu, &vcpu->arch.rm_exit);
>   
> -	end_timing(vcpu);
> -
>   	/* Advance host PURR/SPURR by the amount used by guest */
>   	purr = mfspr(SPRN_PURR);
>   	spurr = mfspr(SPRN_SPURR);
> @@ -415,6 +413,8 @@ int kvmhv_vcpu_entry_p9(struct kvm_vcpu *vcpu, u64 time_limit, unsigned long lpc
>   
>   	switch_mmu_to_host_radix(kvm, host_pidr);
>   
> +	end_timing(vcpu);
> +
>   	return trap;
>   }
>   EXPORT_SYMBOL_GPL(kvmhv_vcpu_entry_p9);
> 

-- 
Alexey


More information about the Linuxppc-dev mailing list