mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Any problem if softirq are done in a interrupt context (IRQ stack)?
@ 2007-01-03  8:23 Zefang.Wang
  2007-01-03  9:22 ` Björn Steinbrink
  0 siblings, 1 reply; 4+ messages in thread
From: Zefang.Wang @ 2007-01-03  8:23 UTC (permalink / raw)
  To: linux-kernel; +Cc: Zefang.Wang

Hello all!

Kernel version : 2.6.18
Arch : i386

With the following conditions,  it is possible that softirqs are
executed in a interrupt context rather than process one
1)   CONFIG_4KSTACKS  ----> ON
That means the dedicated IRQ stack is used for hardirq handler

2)   there exist some Hard IRQ which allows interupt enabled when its
handler being executed.
That means a possibility that a HARD IRQ handler is interrupted by
another one.

3)  CONFIG_LOCKDEP  ---> OFF
Instruction sti will be executed by local_irq_enable_in_hardirq()


Let's suppose the following situation.
1)  A process is running without local irq nor bottom half disabled.
2)  A hardware interrupt happened.
3)  After saving context in process kernel stack,   it switch to irq
stack. 
      But notice :  the preempt_count in irq stack will be zero, because
do_irq does not add HARDIRQ_OFFSET to the preept_count. 
      (anyone tell me the reason?)

	if (curctx != irqctx) {
		int arg1, arg2, ebx;

		/* build the stack frame on the IRQ stack */
		isp = (u32*) ((char*)irqctx + sizeof(*irqctx));
		irqctx->tinfo.task = curctx->tinfo.task;
		irqctx->tinfo.previous_esp = current_stack_pointer;

		/*
		 * Copy the softirq bits in preempt_count so that the
		 * softirq checks work in the hardirq context.
		 */
		irqctx->tinfo.preempt_count =
			(irqctx->tinfo.preempt_count & ~SOFTIRQ_MASK) |
			(curctx->tinfo.preempt_count & SOFTIRQ_MASK);


4)  then __do_irq is called, and handle_irq_event is called. Before
that,  local irq is enabled because the interrupt allow it.
5)  during the execution of the hardirq actions,  another hardware
(depth 2 interrurpt) interrupt happened.
6)  SAVE context,  and then hardirq handler,  during the handler,  some
softirq is marked
7)  when depth 2 interrrupt call irq_exit(),  surely do_softirq will be
called because in_interrupt return a FALSE.
     In this point, the stack is still irq stack.  

I don't know whether it cause some problem,  for example, if some
softirq need to make a flag in process control block.
Another problem is that softirq handling should have a lower prioirty
than hard irq, right?

Thanks for your attention and help.

Regards
Zefang


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-01-23 19:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-03  8:23 Any problem if softirq are done in a interrupt context (IRQ stack)? Zefang.Wang
2007-01-03  9:22 ` Björn Steinbrink
     [not found]   ` <1E9D602D891FA142A769E9EF164712EC355CB0@beebe101.NOE.Nokia.com>
2007-01-03 10:43     ` Björn Steinbrink
2007-01-23 19:48       ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®