Skip to content
This repository has been archived by the owner on Dec 20, 2023. It is now read-only.

Commit

Permalink
irq: Ensure irq_exit() code runs with interrupts disabled
Browse files Browse the repository at this point in the history
We had already a few problems with code called from irq_exit() when
interrupted from a nesting interrupt. This can happen on architectures
which do not define __ARCH_IRQ_EXIT_IRQS_DISABLED.

__ARCH_IRQ_EXIT_IRQS_DISABLED should go away and we want to make it
mandatory to call irq_exit() with interrupts disabled.

As a temporary protection disable interrupts for those architectures
which do not define __ARCH_IRQ_EXIT_IRQS_DISABLED and add a WARN_ONCE
when an architecture which defines __ARCH_IRQ_EXIT_IRQS_DISABLED calls
irq_exit() with interrupts enabled.

Signed-off-by: Thomas Gleixner <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Paul E. McKenney <[email protected]>
Cc: Linus Torvalds <[email protected]>
Link: http://lkml.kernel.org/r/alpine.LFD.2.02.1302202155320.22263@ionos
  • Loading branch information
KAGA-KOKO committed Feb 21, 2013
1 parent e5ab012 commit 74eed01
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions kernel/softirq.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,14 @@ static inline void invoke_softirq(void)
*/
void irq_exit(void)
{
#ifndef __ARCH_IRQ_EXIT_IRQS_DISABLED
unsigned long flags;

local_irq_save(flags);
#else
WARN_ON_ONCE(!irqs_disabled());
#endif

account_irq_exit_time(current);
trace_hardirq_exit();
sub_preempt_count(IRQ_EXIT_OFFSET);
Expand All @@ -354,6 +362,9 @@ void irq_exit(void)
#endif
rcu_irq_exit();
sched_preempt_enable_no_resched();
#ifndef __ARCH_IRQ_EXIT_IRQS_DISABLED
local_irq_restore(flags);
#endif
}

/*
Expand Down

0 comments on commit 74eed01

Please sign in to comment.