Re: Any problem if softirq are done in a interrupt context (IRQ stack)?

From: Björn Steinbrink
Date: Wed Jan 03 2007 - 05:43:28 EST


[Re-added lkml to the CC list, please don't drop anything from CC]

On 2007.01.03 17:39:48 +0800, Zefang.Wang@xxxxxxxxx wrote:
> Hi!
>
> Thanks very much for your clear explanation !
>
> I have another question about irq_exit(), hope you can help me.
>
> void irq_exit(void)
> {
> account_system_vtime(current);
> trace_hardirq_exit();
> sub_preempt_count(IRQ_EXIT_OFFSET);
> ====================================================================
> Here, IRQ_EXIT_OFFSET is defined as (HARDIRQ_OFFSET-1),
> so the purpose seems that it try to avoid the current process
> from being switched-out druing do_softirq()?
> And, if the preempt_count is not zero, then softirq for
> timer interrupt can set _TIF_NEED_RESCHED flag to current
> process?
> What happened if the above sentence is changed to
> sub_preept_count(HARDIRQ_OFFSET)?
>
> if (!in_interrupt() && local_softirq_pending())
> invoke_softirq();
> preempt_enable_no_resched();
> ==============================================
> The remaining 1 is decremented here.
> }

I can't really help you with that one. I'd assume that you need to make
sure that the current process context is kept while the softirq is
running. Could be, that otherwise the process gets preempted and the
stored process context would be assigned to the new process or
something like that, but I'm just guessing wildly here.
Note that IRQ_EXIT_OFFSET is defined as HARDIRQ_OFFSET if preemption is
disabled, so that's probably key here, I just don't know what kind of
havoc preempting would cause here ;)

Björn
-
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/