On 10/1/19 11:16 AM, David Hildenbrand wrote: > +static inline bool should_interrupt_instruction(CPUState *cs) > +{ > + /* > + * Something asked us to stop executing chained TBs, e.g., > + * cpu_interrupt() or cpu_exit(). > + */ > + if ((int32_t)atomic_read(&cpu_neg(cs)->icount_decr.u32) < 0) { > + return true; > + } > + > + /* We have a deliverable interrupt pending. */ > + if ((atomic_read(&cs->interrupt_request) & CPU_INTERRUPT_HARD) && > + s390_cpu_has_int(S390_CPU(cs))) { > + return true; > + } > + return false; > +}
The first condition should be true whenever the second condition is true. In particular, tcg_handle_interrupt sets icount_decr.u16.high = -1 for qemu_cpu_is_self; otherwise, qemu_cpu_kick calls cpu_exit which does the same thing. Think of it this way: we only test icount_decr.u32 at the start of each TB, and that's the only thing we have that brings us back to the main loop for any other kind of interrupt. r~