RE: [PATCH] KVM: x86: use TPAUSE to replace PAUSE in halt polling

From: Mi, Dapeng1
Date: Tue Aug 30 2022 - 01:56:55 EST


> From: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> Sent: Friday, August 26, 2022 6:14 PM
> To: Mi, Dapeng1 <dapeng1.mi@xxxxxxxxx>; Christopherson,, Sean
> <seanjc@xxxxxxxxxx>
> Cc: rafael@xxxxxxxxxx; daniel.lezcano@xxxxxxxxxx; linux-pm@xxxxxxxxxxxxxxx;
> linux-kernel@xxxxxxxxxxxxxxx; kvm@xxxxxxxxxxxxxxx;
> zhenyuw@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH] KVM: x86: use TPAUSE to replace PAUSE in halt polling
>
> On 8/25/22 13:31, Mi, Dapeng1 wrote:
> >> I say "if", because I think this needs to come with performance
> >> numbers to show the impact on guest latency so that KVM and its users
> >> can make an informed decision.
> >> And if it's unlikely that anyone will ever want to enable TPAUSE for
> >> halt polling, then it's not worth the extra complexity in KVM.
> > I ever run two scheduling related benchmarks, hackbench and schbench, I
> didn't see there are obvious performance impact.
> >
> > Here are the hackbench and schbench data on Intel ADL platform.
>
> Can you confirm (using debugfs for example) that halt polling is used while
> hackbench is running, and not used while it is not running?

Sorry, I may not describe the test case clearly. The hackbench and schbench are run on Host
rather than a VM. When the hackbench or schbench is run on Host, there is a FIO workload running
in a VM in the background and the FIO would trigger a large number of HLT VM-exits and eventually
invoke halt polling.

In this test, I want to check whether potential polling time extending would increase the scheduling
latency on host. But it looks the impact for scheduling latency is quite minimal.

>
> In particular, I think you need to run the server and client on different VMs,
> for example using netperf's UDP_RR test. With hackbench the ping-pong is
> simply between two tasks on the same CPU, and the hypervisor is not
> exercised at all.
>

Here are the netperf's UDP_RR test result between two VMs locate on two different physical machines.

Netperf Vanilla (Avg.) TPAUSE (Avg.) %Delta
UDP_RR (Trans. Rate/s) 503.8 503.9 0.02%

It looks there is no obvious difference with TPAUSE change on UDP RR test.


> Paolo