Re: [PATCH v3 10/10] KVM: selftests: Add a test for KVM_CAP_EXIT_ON_EMULATION_FAILURE

Sean Christopherson
2022-10-31T18:37:47Z

On Mon, Oct 31, 2022, David Matlack wrote:
> Add a selftest to exercise the KVM_CAP_EXIT_ON_EMULATION_FAILURE
> capability.
>
> This capability is also exercised through
> smaller_maxphyaddr_emulation_test, but that test requires
> allow_smaller_maxphyaddr=Y, which is off by default on Intel when ept=Y
> and unconditionally disabled on AMD when npt=Y. This new test ensures we

Uber nit, avoid pronouns, purely so that "no pronouns" can be an unconditional
guideline, not because "we" is at all ambiguous in this case.

This new test ensures KVM_CAP_EXIT_ON_EMULATION_FAILURE is exercised
independent of allow_smaller_maxphyaddr.

> exercise KVM_CAP_EXIT_ON_EMULATION_FAILURE independent of
> allow_smaller_maxphyaddr.
>
> +static void guest_code(void)
> +{
> + /* Execute flds with an MMIO address to force KVM to emulate it. */
> + flds(MMIO_GVA);

Add tests to verify KVM handles cases where the memory operand splits pages on
both sides? Mostly because I'm curious if KVM actually does the right thing :-)
It'll require creating an extra memslot, but I don't think that should be too
difficult?