Re: [PATCH] KVM: hyper-v: Add new exit reason HYPERV_OVERLAY

From: Alexander Graf
Date: Fri Apr 23 2021 - 06:19:07 EST




On 23.04.21 12:15, Paolo Bonzini wrote:
CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know thecontent is safe.



On 23/04/21 11:58, Alexander Graf wrote:
In theory userspace doesn't know how KVM wishes to implement the
hypercall page, especially if Xen hypercalls are enabled as well.

I'm not sure I agree with that sentiment :). User space is the one that
sets the xen compat mode. All we need to do is declare the ORing as part
of the KVM ABI. Which we effectively are doing already, because it's
part of the ABI to the guest, no?

Good point.  But it may change in the future based on KVM_ENABLE_CAP or
whatever, and duplicating code between userspace and kernel is ugly.  We
already have too many unwritten conventions around CPUID, MSRs, get/set
state ioctls, etc.

Yes, I agree. So we can just declare that there won't be any changes to the hcall page in-kernel handling code going forward, no? :)

If you want to support a new CAP, support an actual overlay page first - and thus actually respect the TLFS.

That said, this definitely tilts the balance against adding an ioctl to
write the hypercall page contents.  Userspace can either use the
KVM_SET_MSR or assemble it on its own, and one of the two should be okay.

Sounds great. And in the future if we need to move the Xen offset, we should rather make the Xen offsetting a parameter from user space.


Alex



Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879