openvmm icon indicating copy to clipboard operation
openvmm copied to clipboard

openhcl: support MPERF/APERF MSRs in CVMs

Open chris-oo opened this issue 8 months ago • 2 comments

These are used to help diagnose performance issues in the guest. In a CVM, the paravisor needs to provide this implementation.

chris-oo avatar Apr 04 '25 22:04 chris-oo

@stephensons2022 Can you please assign this ticket to me.

vibhutet avatar Apr 10 '25 18:04 vibhutet

This is on hold - I'm not convinced we can safely expose this capability to the guest. Guests expect this value to be monotonically increasing, so if we directly return the hypervisor value, that could cause issue in the guest.

That leads to a question that if we must sanitize the access, what should we do? Or if we should fully emulate it?

There's a third point that Linux I believe will query APERF/MPERF on every scheduling quantum if available - that would greatly increase the number of exits which would be not what we want. Handling this exit could be extremely expensive depending on if we need to go to the hypervisor, but even just handling it internally would force a full L2 to L1 exit every access.

It seems like if it needs to be performant, it would have to be provided by the hardware. We're discussing a bit more internally about what to do next.

chris-oo avatar May 15 '25 23:05 chris-oo