Hello Sean, Thank you for your answer. It might be easier and my code might be more "portable" if I allow the guest to handle the #BP themselves. When a VMEXIT happens, if I allow KVM to inject the #BP, cause a VMEXIT to userspace, do what I want when that happens and then, allow KVM to restart the guest via KVM_VCPU_RUN, I understand that the guest will handle the #BP and continue execution. What could be the various ways a guest could handle #BP? Can we "make" the guest skip the instruction that caused the #BP ? Best Regards, Arnabjyoti Kalita On Wed, May 11, 2022 at 7:46 PM Sean Christopherson <seanjc@xxxxxxxxxx> wrote: > > On Wed, May 11, 2022, Arnabjyoti Kalita wrote: > > Hello Jim and Sean, > > > > Thank you for your answers. > > > > If I re-inject the #BP back into the guest, does it automatically take > > care of updating the RIP and continuing execution? > > Yes, the guest "automatically" handles the #BP. What the appropriate handling may > be is up to the guest, i.e. skipping an instruction may or may not be the correct > thing to do. Injecting the #BP after VM-Exit is simply emulating what would happen > from the guest's perspective if KVM had never intercepted the #BP in the first place. > > Note, KVM doesn't have to initiate the injection, you can handle that from userspace > via KVM_SET_VCPU_EVENTS. But if it's just as easy to hack KVM, that's totally fine > too, so long as userspace doesn't double inject.