[PATCH 1/4] KVM: PPC: Book3S HV P9: Restore stolen time logging in dtl

Fabiano Rosas farosas at linux.ibm.com
Sat May 28 04:45:01 AEST 2022


Nicholas Piggin <npiggin at gmail.com> writes:

> Stolen time logging in dtl was removed from the P9 path, so guests had
> no stolen time accounting. Add it back in a simpler way that still
> avoids locks and per-core accounting code.
>
> Fixes: ecb6a7207f92 ("KVM: PPC: Book3S HV P9: Remove most of the vcore logic")
> Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
> ---
>  arch/powerpc/kvm/book3s_hv.c | 49 +++++++++++++++++++++++++++++++++---
>  1 file changed, 45 insertions(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index 6fa518f6501d..0a0835edb64a 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -248,6 +248,7 @@ static void kvmppc_fast_vcpu_kick_hv(struct kvm_vcpu *vcpu)
>
>  /*
>   * We use the vcpu_load/put functions to measure stolen time.
> + *
>   * Stolen time is counted as time when either the vcpu is able to
>   * run as part of a virtual core, but the task running the vcore
>   * is preempted or sleeping, or when the vcpu needs something done
> @@ -277,6 +278,12 @@ static void kvmppc_fast_vcpu_kick_hv(struct kvm_vcpu *vcpu)
>   * lock.  The stolen times are measured in units of timebase ticks.
>   * (Note that the != TB_NIL checks below are purely defensive;
>   * they should never fail.)
> + *
> + * The POWER9 path is simpler, one vcpu per virtual core so the
> + * former case does not exist. If a vcpu is preempted when it is
> + * BUSY_IN_HOST and not ceded or otherwise blocked, then accumulate
> + * the stolen cycles in busy_stolen. RUNNING is not a preemptible
> + * state in the P9 path.

Do you mean RUNNABLE? The only RUNNING state I see is in relation to the
vcore.



More information about the Linuxppc-dev mailing list