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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2007-01-03 at 11:43 +0100, Björn Steinbrink wrote:
> [Re-added lkml to the CC list, please don't drop anything from CC]

yes, since I would not have replied to this ;)

> 
> On 2007.01.03 17:39:48 +0800, [email protected] 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 ;)

It would delay the processing of the softirqs for a full tick or more.

Note that changing to sub_preempt_count(HARDIRQ_OFFSET) is not enough,
you would then need to add a preempt_disable() right afterwards, which
would just be an extra subtraction that is avoided in the current
implementation.

But the big thing is that the softirqs should be handled as soon as they
can be.

-- Steve


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux