"big IRQ lock" removal, IRQ cleanups.
Hello.
Quoted 2 lines
- to remove the preemption count increase/decrease code from the lowlevel IRQ assembly code.
So do_IRQ() can start with preempt_count == 0. Suppose another cpu sets TIF_NEED_RESCHED flag at the same time.
spin_lock(&desc->lock) sets preempt_count == 1. Before calling handle_IRQ_event() (which adds IRQ_OFFSET to preempt_count), do_IRQ() does spin_unlock(&desc->lock) and falls into schedule().
Am I missed something?
It seems to me that call to irq_enter() must be shifted from handle_IRQ_event() to do_IRQ().
Oleg.
Quoted 5 lines · Oleg Nesterov
Hello.
Quoted 2 lines
- to remove the preemption count increase/decrease code from the lowlevel IRQ assembly code.
IMHO this is unwise as the system NEEDS to exit to user (or system) space when preempt_count is zero with a garuntee that TIF_NEED_RESCHED is 0. To do this from irq.c means that it must exit with interrupts off and the the low level code needs to keep them off till the irtn. But this is where we test TIF_NEED_RESCHED, and if it is set, schedule() is called and should be called with preempt_count != 0, to avoid stack overflow interrupt loops. And, schedule() returns with the interrupt system on (even if we, unwisely, call it with it off).
Quoted 11 lines
So
do_IRQ()can start withpreempt_count== 0.
Suppose another cpu setsTIF_NEED_RESCHEDflag
at the same time.
spin_lock(&desc->lock)setspreempt_count== 1. Before callinghandle_IRQ_event()(which addsIRQ_OFFSETtopreempt_count),do_IRQ()doesspin_unlock(&desc->lock)and falls intoschedule().Am I missed something?
Nope, you got it right.
Quoted 3 lines
It seems to me that call to
irq_enter()must be shifted fromhandle_IRQ_event()todo_IRQ().
Even then...
Quoted 7 lines
Oleg.
-
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/
Signature · 6 lines
George Anzinger [email protected] High-res-timers: http://sourceforge.net/projects/high-res-timers/ Real time sched: http://sourceforge.net/projects/rtsched/ Preemption patch: http://www.kernel.org/pub/linux/kernel/people/rml
Quoted 6 lines · george anzinger
Quoted 2 lines
Quoted 2 lines
- to remove the preemption count increase/decrease code from the lowlevel IRQ assembly code.
IMHO this is unwise as the system NEEDS to exit to user (or system) space when
preempt_countis zero with a garuntee thatTIF_NEED_RESCHEDis 0. [...]
my comment was too compact - the bumping of the preemption count did not get removed, it's just the dualness that got removed. Both the lowlevel entry code and the irq_enter() code used to do the same thing - now only irq_enter() does it.
in the latest patch irq_enter() is done early in do_IRQ(), and irq_exit() is done before returning from do_IRQ().
Quoted 2 lines
[...] To do this from
irq.cmeans that it must exit with interrupts off and the the low level code needs to keep them off till the irtn. [...]
yes, we are very careful to keep irqs disabled in do_IRQ(), both before and after calling the handler.
Quoted 4 lines
[...] But this is where we test
TIF_NEED_RESCHED, and if it is set,schedule()is called and should be called withpreempt_count!= 0, to avoid stack overflow interrupt loops. And,schedule()returns with the interrupt system on (even if we, unwisely, call it with it off).
yes, in this case schedule() is called with a nonzero preempt count (PREEMPT_ACTIVE), to keep it from recursing into itself.
Quoted 4 lines
Quoted 2 lines
It seems to me that call to
irq_enter()must be shifted fromhandle_IRQ_event()todo_IRQ().Even then...
could you check out the latest patch, can you still see any hole in it? All the above scenarios should be handled correctly.
Ingo