Skip to contentSkip to conversation

2.6.7-rc2 mismatched preempt count in arch/i386/kernel/irq.c

DISCUSSION Keith Owens 3 participants 4 messages May 31, 2004

lore
Share & tools
lore
#0 lore raw

2.6.7-rc2 (and earlier) arch/i386/kernel/irq.c::do_IRQ() calls irq_exit() which expands into preempt_enable_no_resched(), amongst others. With CONFIG_PREEMPT=y, preempt_enable_no_resched() does dec_preempt_count(). Where is the corresponding inc_preempt_count? AFAICT the use of preempt_enable_no_resched() is unbalanced.

#1 lore raw
Quoted 5 lines · Keith Owens

2.6.7-rc2 (and earlier) arch/i386/kernel/irq.c::do_IRQ() calls irq_exit() which expands into preempt_enable_no_resched(), amongst others. With CONFIG_PREEMPT=y, preempt_enable_no_resched() does dec_preempt_count(). Where is the corresponding inc_preempt_count? AFAICT the use of preempt_enable_no_resched() is unbalanced.

I believe IRQ_EXIT_OFFSET takes care of that;

#define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1)

#define irq_exit() \

do {									\
		preempt_count() -= IRQ_EXIT_OFFSET;			\
		if (!in_interrupt() && softirq_pending(smp_processor_id())) \
			do_softirq();					\
		preempt_enable_no_resched();				\
} while (0)
#2 lore raw
Quoted 12 lines · Zwane Mwaikambo
Quoted 5 lines · Keith Owens

2.6.7-rc2 (and earlier) arch/i386/kernel/irq.c::do_IRQ() calls irq_exit() which expands into preempt_enable_no_resched(), amongst others. With CONFIG_PREEMPT=y, preempt_enable_no_resched() does dec_preempt_count(). Where is the corresponding inc_preempt_count? AFAICT the use of preempt_enable_no_resched() is unbalanced.

I believe IRQ_EXIT_OFFSET takes care of that;

#define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1)

Quoted 7 lines

#define irq_exit() \

do {									\
		preempt_count() -= IRQ_EXIT_OFFSET;			\
		if (!in_interrupt() && softirq_pending(smp_processor_id())) \
			do_softirq();					\
		preempt_enable_no_resched();				\
} while (0)

How ugly ....

#3 lore raw
In reply to Keith Owens
Quoted 6 lines · Keith Owens

2.6.7-rc2 (and earlier) arch/i386/kernel/irq.c::do_IRQ() calls irq_exit() which expands into preempt_enable_no_resched(), amongst others. With CONFIG_PREEMPT=y, preempt_enable_no_resched() does dec_preempt_count(). Where is the corresponding inc_preempt_count? AFAICT the use of preempt_enable_no_resched() is unbalanced.

If preempt is enabled, IRQ_EXIT_OFFSET is HARDIRQ_OFFSET-1.

I believe that is where the preempt_enable_no_resched is balanced.