On Wed, 05 Feb 2020 19:47:36 +0900, Anton Ivanov wrote: > > +/** > > + * This function can be called from arbitrary host threads, so do not > > + * issue any Linux calls (e.g. prink) if lkl_cpu_get() was not issued > > + * before. > > + */ > > +int lkl_trigger_irq(int irq) > > +{ > > + int ret; > > + > > + if (!irq || irq > NR_IRQS) > > + return -EINVAL; > > + > > + ret = lkl_cpu_try_run_irq(irq); > > + if (ret <= 0) > > + return ret; > > + > > + /* > > + * Since this can be called from Linux context (e.g. lkl_trigger_irq -> > > + * IRQ -> softirq -> lkl_trigger_irq) make sure we are actually allowed > > + * to run irqs at this point > > + */ > > + if (!irqs_enabled) { > > + set_irq_pending(irq); > > + lkl_cpu_put(); > > + return 0; > > + } > > + > > + run_irq(irq); > > + > > + lkl_cpu_put(); > > + > > + return 0; > > Isn't that just: > > if (irqs_enabled) > run_irq(irq); > else > set_irq_pending(irq); > > lkl_cpu_put(); > > return 0; Thanks, this is much cleaner. I will fix this in the next turn. -- Hajime