Skip to content

Commit

Permalink
rcu: use irq-safe locks
Browse files Browse the repository at this point in the history
Some earlier tip/core/rcu patches caused RCU to incorrectly enable irqs
too early in boot.  This caused Yinghai's repeated-kexec testing to
hit oopses, presumably due to so that device interrupts left over from
the prior kernel instance (which would oops the newly booting kernel
before it got a chance to reset said devices).  This patch therefore
converts all the local_irq_disable()s in rcuclassic.c to local_irq_save().

Besides, I never did like local_irq_disable() anyway.  ;-)

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Paul E. McKenney authored and Ingo Molnar committed Aug 21, 2008
1 parent 0c925d7 commit 275a89b
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions kernel/rcuclassic.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ static inline void raise_rcu_softirq(void)
*/
static void rcu_do_batch(struct rcu_data *rdp)
{
unsigned long flags;
struct rcu_head *next, *list;
int count = 0;

Expand All @@ -261,9 +262,9 @@ static void rcu_do_batch(struct rcu_data *rdp)
}
rdp->donelist = list;

local_irq_disable();
local_irq_save(flags);
rdp->qlen -= count;
local_irq_enable();
local_irq_restore(flags);
if (rdp->blimit == INT_MAX && rdp->qlen <= qlowmark)
rdp->blimit = blimit;

Expand Down Expand Up @@ -464,12 +465,14 @@ static void rcu_check_quiescent_state(struct rcu_ctrlblk *rcp,
static void rcu_move_batch(struct rcu_data *this_rdp, struct rcu_head *list,
struct rcu_head **tail, long batch)
{
unsigned long flags;

if (list) {
local_irq_disable();
local_irq_save(flags);
this_rdp->batch = batch;
*this_rdp->nxttail[2] = list;
this_rdp->nxttail[2] = tail;
local_irq_enable();
local_irq_restore(flags);
}
}

Expand Down Expand Up @@ -521,10 +524,11 @@ static void rcu_offline_cpu(int cpu)
static void __rcu_process_callbacks(struct rcu_ctrlblk *rcp,
struct rcu_data *rdp)
{
unsigned long flags;
long completed_snap;

if (rdp->nxtlist) {
local_irq_disable();
local_irq_save(flags);
completed_snap = ACCESS_ONCE(rcp->completed);

/*
Expand Down Expand Up @@ -554,7 +558,7 @@ static void __rcu_process_callbacks(struct rcu_ctrlblk *rcp,
rdp->nxttail[0] = &rdp->nxtlist;
}

local_irq_enable();
local_irq_restore(flags);

if (rcu_batch_after(rdp->batch, rcp->pending)) {
unsigned long flags;
Expand Down

0 comments on commit 275a89b

Please sign in to comment.