On Thu, Feb 21, 2019 at 08:38:39AM +0000, Julien Grall wrote: > Hi Roger, > > On Thu, 21 Feb 2019, 08:08 Roger Pau Monné, <roger....@citrix.com> wrote: > > > FWIW, you can also mask the interrupt while waiting for the thread to > > execute the interrupt handler. Ie: > > > > Thank you for providing steps, however where would the masking be done? By > the irqchip or a custom solution?
I'm not familiar with the irqchip infrastructure in Linux, what I proposed below is what FreeBSD does when running interrupt handlers in deferred threads IIRC. If irqchip has a specific handler to dispatch to a thread, then that's the place where the masking should happen. Likely, the unmasking should be done by the irq handling infrastructure after the thread executing the interrupt handler has finished. Isn't there a similar way to handle interrupts in threads for Linux? > > > 1. Interrupt injected > > 2. Execute guest event channel callback > > 3. Scan for pending interrupts > > 4. Mask interrupt > > 5. Clear pending field > > 6. Queue threaded handler > > 7. Go to 3 until all interrupts are drained > > [...] > > 8. Execute interrupt handler in thread > > 9. Unmask interrupt > > > > That should prevent you from stacking interrupts? > > > > Roger. > >