Re: [RFC PATCH 3/9] irq_work: Force raised irq work to run on irq work interrupt

Frederic Weisbecker
2014-09-04T13:33:48Z

On Thu, Sep 04, 2014 at 08:11:37AM +0200, Peter Zijlstra wrote:
> On Thu, Aug 21, 2014 at 04:52:51PM +0200, Frederic Weisbecker wrote:
> > diff --git a/kernel/irq_work.c b/kernel/irq_work.c
> > index e6bcbe7..17bd203 100644
> > --- a/kernel/irq_work.c
> > +++ b/kernel/irq_work.c
> > @@ -22,6 +22,7 @@
> >
> > static DEFINE_PER_CPU(struct llist_head, raised_list);
> > static DEFINE_PER_CPU(struct llist_head, lazy_list);
> > +static bool has_own_interrupt;
> >
> > /*
> > * Claim the entry so that no one else will poke at it.
>
> > +void irq_work_tick(void)
> > +{
> > + if (!has_own_interrupt)
> > + irq_work_run_list(&__get_cpu_var(raised_list));
> > + irq_work_run_list(&__get_cpu_var(lazy_list));
> > +}
> > +
> > /*
> > * Synchronize against the irq_work @entry, ensures the entry is not
> > * currently in use.
>
> Why not something like the below; then it becomes a compile time matter.

Problem is that some archs only have that information at runtime.
See x86 for example which tests cpu_has_apic.