On 02-05-2025 10:33, Manali Shukla wrote:
- /*
* Stash vmcb02's counter if the guest hasn't moved past the guilty
* instrution; otherwise, reset the counter to '0'.
typo instrution -> instruction
*
* In order to detect if L2 has made forward progress or not, track the
* RIP at which a bus lock has occurred on a per-vmcb12 basis. If RIP
* is changed, guest has clearly made forward progress, bus_lock_counter
* still remained '1', so reset bus_lock_counter to '0'. Eg. In the
* scenario, where a buslock happened in L1 before VMRUN, the bus lock
* firmly happened on an instruction in the past. Even if vmcb01's
* counter is still '1', (because the guilty instruction got patched),
* the vCPU has clearly made forward progress and so KVM should reset
* vmcb02's counter to '0'.
*
* If the RIP hasn't changed, stash the bus lock counter at nested VMRUN
* to prevent the same guilty instruction from triggering a VM-Exit. Eg.
* if userspace rate-limits the vCPU, then it's entirely possible that
* L1's tick interrupt is pending by the time userspace re-runs the
* vCPU. If KVM unconditionally clears the counter on VMRUN, then when
* L1 re-enters L2, the same instruction will trigger a VM-Exit and the
* entire cycle start over.
*/
Thanks, Alok