On Mon, Jun 29, 2020 at 03:35:16PM +0200, Paolo Bonzini wrote: > On 29/06/20 15:29, Roman Bolshakov wrote: > >>> macOS 11.0 Beta deprecated hv_vcpu_run() and introduced a special > >>> declaration for hv_vcpu_run_until(), that's not available 10.15 - > >>> HV_DEADLINE_FOREVER (UINT64_MAX, which is bigger than maximum value of > >>> VMX-preeemption counter). Perhaps the performance issue is addressed > >>> there. > >> Possibly. I'm worried that the preemption-timer trick will fail to run > >> there, but we'll see. > >> > > Well, I've got new VM-exits (caused by zero preemption timer) on either > > of my laptops. > > If you have already tried 11.0 that's great. I was worried that it > would forcibly clear the preemption timer bit when passed > HV_DEADLINE_FOREVER. >
I did not but I can check how it works on it then, note that I'm not using hv_vcpu_run_until() because it doesn't have HV_DEADLINE_FOREVER and it performs poorly on macOS 10.15. My approach is based hv_vcpu_run() and should hopefully work almost anywhere where Hypervisor.framework is available because Hypervisor framework exposes timer value (https://developer.apple.com/documentation/hypervisor/vmcs_guest_vmx_timer_value) since macOS 10.10.3+. I can also test how hv_vcpu_run_until() performs with HV_DEADLINE_FOREVER on the Beta. And if the performance issues with VMX-preemption timer and hv_vcpu_run_until() are fixed there. -Roman