On 14/01/20 19:58, Sean Christopherson wrote: > I'm not convinced the instruction length needs to be provided to userspace > for this case. Obviously it's not difficult to provide the info, I just > don't understand the value added by doing so. As above, RIP shouldn't > need to be unwound, and blindly skipping an instruction seems like an odd > thing for a VMI engine to do. > The reason to introduce the instruction length was so that userspace could blindly use SPP to emulate ROM behavior. Weijiang's earlier patches in fact _only_ provided that behavior, and I asked him to change it so that, by default, using SPP and not handling it will basically cause an infinite loop of SPP violations. One possibility to clean things up is to change "fault_handled" and fast_page_fault's return value from bool to RET_PF* (false becomes RET_PF_INVALID, true becomes RET_PF_RETRY). direct_page_fault would also have to do something like r = fast_page_fault(vcpu, gpa, level, error_code)) if (r != RET_PF_INVALID) return r; Then fast_page_fault can just return RET_PF_USERSPACE, and this ugly case can go away. + if (vcpu->run->exit_reason == KVM_EXIT_SPP) + r = RET_PF_USERSPACE; + Thanks, Paolo