On Thu, Jan 12, 2023 at 10:47:13AM -0800, Atish Kumar Patra wrote: > On Thu, Jan 12, 2023 at 3:04 AM Andrew Jones <ajones@xxxxxxxxxxxxxxxx> wrote: > > > > On Thu, Dec 15, 2022 at 09:00:39AM -0800, Atish Patra wrote: ... > > > + * and forwards the error to the userspace. > > > + */ > > > + if (ret < 0) { > > > + next_sepc = false; > > > + goto ecall_done; > > > + } > > > > Shouldn't this ret < 0 check go above the "Handle special error cases..." > > block? > > > > Why ? I thought if an extension handler has both utrap updated and > returns an error, > user space redirection should take precedence. Let me know if it is wrong. My thinking was that utrap cannot be trusted if the handler returned an error. The handler may not even have had a chance to set it before hitting the error condition. IOW, we should check 'ret' right after the handler call. If it's < 0, then from the caller's perspective the handler didn't execute due to a KVM failure and it should be reported to userspace. Thanks, drew