Re: [v2 0/6] KVM: arm64: implement vcpu_is_preempted check

From: Marc Zyngier
Date: Sun Nov 06 2022 - 11:35:59 EST


On Fri, 04 Nov 2022 06:20:59 +0000,
Usama Arif <usama.arif@xxxxxxxxxxxxx> wrote:
>
> This patchset adds support for vcpu_is_preempted in arm64, which
> allows the guest to check if a vcpu was scheduled out, which is
> useful to know incase it was holding a lock. vcpu_is_preempted can
> be used to improve performance in locking (see owner_on_cpu usage in
> mutex_spin_on_owner, mutex_can_spin_on_owner, rtmutex_spin_on_owner
> and osq_lock) and scheduling (see available_idle_cpu which is used
> in several places in kernel/sched/fair.c for e.g. in wake_affine to
> determine which CPU can run soonest):

[...]

> pvcy shows a smaller overall improvement (50%) compared to
> vcpu_is_preempted (277%). Host side flamegraph analysis shows that
> ~60% of the host time when using pvcy is spent in kvm_handle_wfx,
> compared with ~1.5% when using vcpu_is_preempted, hence
> vcpu_is_preempted shows a larger improvement.

And have you worked out *why* we spend so much time handling WFE?

M.

--
Without deviation from the norm, progress is not possible.