Hi Paolo, On Mon, Apr 15, 2024 at 11:32:51AM +0200, Paolo Bonzini wrote: > What do you think about writing this: > > > /* If several instructions disable interrupts, only the first does it. > > */ > > if (inhibit && !(s->flags & HF_INHIBIT_IRQ_MASK)) { > > gen_set_hflag(s, HF_INHIBIT_IRQ_MASK); > > - } else { > > + inhibit_reset = false; > > + } else if (!inhibit && (s->flags & HF_INHIBIT_IRQ_MASK)) { > > gen_reset_hflag(s, HF_INHIBIT_IRQ_MASK); > > + inhibit_reset = true; > > + } else { > > + inhibit_reset = false; > > } > > in a slightly simpler manner: > > inhibit_reset = false; > if (s->flags & HF_INHIBIT_IRQ_MASK) { > gen_reset_hflag(s, HF_INHIBIT_IRQ_MASK); > inhibit_reset = true; > } else if (inhibit) { > gen_set_hflag(s, HF_INHIBIT_IRQ_MASK); > }
Yes, I agree with you that your changes look a bit clearer. I have tested your changes and verified that they fix the reported bug. > No need to submit v3, I can do the change myself when applying. Thank you for your review. Feel free to do that. Thanks, Ruihan Li