Re: [PATCH v4 3/6] KVM: x86: nSVM: support PAUSE filtering when L0 doesn't intercept PAUSE

From: Maxim Levitsky
Date: Sun Mar 27 2022 - 11:15:02 EST


On Thu, 2022-03-24 at 19:24 +0100, Paolo Bonzini wrote:
> On 3/22/22 18:40, Maxim Levitsky wrote:
> > Allow L1 to use PAUSE filtering if L0 doesn't use it.
> >
> > Signed-off-by: Maxim Levitsky<mlevitsk@xxxxxxxxxx>
>
> Can you enlarge the commit message to explain the logic in
> nested_vmcb02_prepare_control?

No problem, I will do in the next version.

How about this:

KVM: x86: nSVM: support nested PAUSE filtering when possible

Expose the pause filtering and threshold in the guest CPUID
and support PAUSE filtering when possible:

- If the L0 doesn't intercept PAUSE
(cpu_pm=on, or pause_filter_count kvm_amd's parameter is 0),
then allow L1 to have full control over PAUSE filtering.

- Otherwise if the L1 doesn't intercept PAUSE,
use KVM's PAUSE thresholds, and update them even
when running nested.

- Otherwise ignore both host and guest PAUSE thresholds,
because it is not really possible to merge them correctly.

It is expected that in this case, userspace hypervisor (e.g qemu)
will not enable this feature in the guest CPUID, to avoid
having the guest to update both thresholds pointlessly.


Best regards,
Maxim Levitsky

>
> Thanks,
>
> Paolo
>