Re: [PATCH -tip -v6] irq_work: generic hard-irq context callbacks

From: huang ying
Date: Wed Sep 29 2010 - 04:30:12 EST


Hi, Frederic,

On Tue, Sep 28, 2010 at 11:56 PM, Frederic Weisbecker
<fweisbec@xxxxxxxxx> wrote:
> On Tue, Sep 28, 2010 at 04:51:48PM +0800, Huang Ying wrote:
>> +++ b/arch/x86/kernel/irq_work.c
>> @@ -0,0 +1,30 @@
>> +/*
>> + * x86 specific code for irq_work
>> + *
>> + * Copyright (C) 2010 Red Hat, Inc., Peter Zijlstra <pzijlstr@xxxxxxxxxx>
>> + */
>> +
>> +#include <linux/kernel.h>
>> +#include <linux/irq_work.h>
>> +#include <linux/hardirq.h>
>> +#include <asm/apic.h>
>> +
>> +void smp_irq_work_interrupt(struct pt_regs *regs)
>> +{
>> + Â Â irq_enter();
>> + Â Â ack_APIC_irq();
>> + Â Â inc_irq_stat(apic_irq_work_irqs);
>> + Â Â irq_work_run();
>> + Â Â irq_exit();
>> +}
>> +
>> +void arch_irq_work_raise(void)
>> +{
>> +#ifdef CONFIG_X86_LOCAL_APIC
>> + Â Â if (!cpu_has_apic)
>> + Â Â Â Â Â Â return;
>> +
>> + Â Â apic->send_IPI_self(IRQ_WORK_VECTOR);
>> + Â Â apic_wait_icr_idle();
>> +#endif
>> +}
>
>
>
> So basically, CONFIG_X86_LOCAL_APIC == !HAVE_IRQ_WORK ?
>
> But IIUC, this will fallback to the timer interrupt:

If !CONFIG_X86_LOCAL_APIC or !cpu_has_apic, this will fallback to the
timer interrupt.

>> @@ -1279,7 +1279,10 @@ void update_process_times(int user_tick)
>> Â Â Â run_local_timers();
>> Â Â Â rcu_check_callbacks(cpu, user_tick);
>> Â Â Â printk_tick();
>> - Â Â perf_event_do_pending();
>> +#ifdef CONFIG_IRQ_WORK
>> + Â Â if (in_irq())
>> + Â Â Â Â Â Â irq_work_run();
>> +#endif
>> Â Â Â scheduler_tick();
>> Â Â Â run_posix_cpu_timers(p);
>> Â}
>
> Then HAVE_IRQ_WORK just means that the arch supports self IPIs.

HAVE_IRQ_WORK means IRQ_WORK is supported on the architecture, it has
nothing to do with self IPIs.

Best Regards,
Huang Ying
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/