srcu: replace local_irqsave() with a locallock

There are two instances which disable interrupts in order to become a
stable this_cpu_ptr() pointer. The restore part is coupled with
spin_unlock_irqrestore() which does not work on RT.
Replace the local_irq_save() call with the appropriate local_lock()
version of it.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
This commit is contained in:
Sebastian Andrzej Siewior 2017-10-12 18:37:12 +02:00 committed by Alibek Omarov
parent fc049aaf7b
commit 277efec1fa
1 changed files with 8 additions and 5 deletions

View File

@ -25,6 +25,7 @@
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/srcu.h>
#include <linux/locallock.h>
#include "rcu.h"
#include "rcu_segcblist.h"
@ -738,6 +739,7 @@ static void srcu_flip(struct srcu_struct *ssp)
smp_mb(); /* D */ /* Pairs with C. */
}
static DEFINE_LOCAL_IRQ_LOCK(sp_llock);
/*
* If SRCU is likely idle, return true, otherwise return false.
*
@ -768,13 +770,13 @@ static bool srcu_might_be_idle(struct srcu_struct *ssp)
unsigned long tlast;
/* If the local srcu_data structure has callbacks, not idle. */
local_irq_save(flags);
local_lock_irqsave(sp_llock, flags);
sdp = this_cpu_ptr(ssp->sda);
if (rcu_segcblist_pend_cbs(&sdp->srcu_cblist)) {
local_irq_restore(flags);
local_unlock_irqrestore(sp_llock, flags);
return false; /* Callbacks already present, so not idle. */
}
local_irq_restore(flags);
local_unlock_irqrestore(sp_llock, flags);
/*
* No local callbacks, so probabalistically probe global state.
@ -854,7 +856,7 @@ static void __call_srcu(struct srcu_struct *ssp, struct rcu_head *rhp,
}
rhp->func = func;
idx = srcu_read_lock(ssp);
local_irq_save(flags);
local_lock_irqsave(sp_llock, flags);
sdp = this_cpu_ptr(ssp->sda);
spin_lock_rcu_node(sdp);
rcu_segcblist_enqueue(&sdp->srcu_cblist, rhp, false);
@ -870,7 +872,8 @@ static void __call_srcu(struct srcu_struct *ssp, struct rcu_head *rhp,
sdp->srcu_gp_seq_needed_exp = s;
needexp = true;
}
spin_unlock_irqrestore_rcu_node(sdp, flags);
spin_unlock_rcu_node(sdp);
local_unlock_irqrestore(sp_llock, flags);
if (needgp)
srcu_funnel_gp_start(ssp, sdp, s, do_norm);
else if (needexp)