Re: [RFC][PATCH] irq_work

From: huang ying
Date: Fri Jun 25 2010 - 07:58:59 EST


On Fri, Jun 25, 2010 at 5:30 PM, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>> > You can always miss an NMI since it can always happen before the
>> > callback gets done, and allowing another enqueue before the callback is
>> > complete is asking for trouble.
>>
>> If we move entry->next = NULL before entry->func(entry), we will not
>> miss the NMI. Can you show how to miss it in this way?
>
> <NMI>
> Â...
> Âirq_work_queue(&my_work, func);
> Â...
> <EOI>
> <IPI>
> Âirq_work_run()
>
> Â<NMI>
> Â Âirq_work_queue(&my_work, func); <FAIL>
> Â<EOI>
>
> Â my_func.next = NULL;

entry->func() should follows here. You can collect all information
(maybe some data in a ring buffer) from NMI handler in entry->func().
But if you place entry->NULL after entry->func(), you will really lose
a NMI notification and the information from NMI handler.

> <EOI>

> Really not that hard. Now imagine wrapping irq_work in some state and
> you reusing the state while the function is still running..

So I suggest to use another flag to signify the function is running to
distinguish.

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/