On 9/30/19 12:55 AM, David Hildenbrand wrote: >> What I think you should do instead is check env_neg(env)->icount_decr, >> exactly >> like we do at the start of every basic block, and use that as an indication >> that you should exit back to the main loop. > > The issue is that when we return to the main loop we really have to > inject an interrupt - otherwise we might simply skip parts of the > (interruptible) instruction and continue with the next one.
Do we? We will return to the main loop with psw.addr still pointing at MVCL, so the interrupt is delivered, and when the exception returns we restart the MVCL. Or, an interrupt is not delivered and we restart from psw.addr and still restart the MVCL. We probably would have to take a hard look at EXECUTE of MVCL to see if that is actually restartable. Not that it makes particular sense to want that combo, but it's required to work. > However, with I/O interrupts, we can actually race against other VCPUs. > So the I/O interrupt might be gone by the time we arrive in the main loop. Of course, but it's no different with this case than any other. If the interrupt has already been handled, then we will simply restart the next TB as per normal. r~