jonomango / hv

Lightweight Intel VT-x Hypervisor.
MIT License
387 stars 78 forks source link

fix timing measure bug #15

Closed wercfz closed 1 year ago

wercfz commented 1 year ago

I found a bug in time measure. Because once nmi occurs, the value of adjust will become very small. As a result, the hide overhide becomes incorrent. The following is fixed code. //auto const adjusted = (vm_exit_overhead - timing_overhead);

/*if (adjusted < lowest) {
    lowest = adjusted;
}*/
if (vm_exit_overhead < lowest_vm_exit_overhead) {
    lowest_vm_exit_overhead = vm_exit_overhead;
}
if (timing_overhead < lowest_timing_overhead) {
    lowest_timing_overhead = timing_overhead;
}
lowest = (lowest_vm_exit_overhead - lowest_timing_overhead);
jonomango commented 1 year ago

fixed in https://github.com/jonomango/hv/commit/70210e2113a2ea634c8bfbaea312b39880f1e265