2020-04-21 20:13:52 +00:00
|
|
|
From 67e5a1751b9315d556d99ae3a44140d126f2609f Mon Sep 17 00:00:00 2001
|
2018-08-27 14:32:32 +00:00
|
|
|
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
|
|
|
Date: Thu, 12 Oct 2017 18:37:12 +0200
|
2020-04-21 20:13:52 +00:00
|
|
|
Subject: [PATCH 162/325] srcu: replace local_irqsave() with a locallock
|
|
|
|
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.115-rt48.tar.xz
|
2018-08-27 14:32:32 +00:00
|
|
|
|
|
|
|
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>
|
|
|
|
---
|
2019-04-08 23:49:20 +00:00
|
|
|
kernel/rcu/srcutree.c | 14 +++++++++-----
|
2018-08-27 14:32:32 +00:00
|
|
|
1 file changed, 9 insertions(+), 5 deletions(-)
|
|
|
|
|
2019-04-08 23:49:20 +00:00
|
|
|
diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
|
|
|
|
index df0375453ba1..0f09a1a9e17c 100644
|
2018-08-27 14:32:32 +00:00
|
|
|
--- a/kernel/rcu/srcutree.c
|
|
|
|
+++ b/kernel/rcu/srcutree.c
|
2018-10-30 12:40:05 +00:00
|
|
|
@@ -39,6 +39,7 @@
|
2018-08-27 14:32:32 +00:00
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/srcu.h>
|
|
|
|
#include <linux/cpu.h>
|
|
|
|
+#include <linux/locallock.h>
|
|
|
|
|
|
|
|
#include "rcu.h"
|
|
|
|
#include "rcu_segcblist.h"
|
2019-04-08 23:49:20 +00:00
|
|
|
@@ -760,6 +761,8 @@ static void srcu_flip(struct srcu_struct *sp)
|
2018-08-27 14:32:32 +00:00
|
|
|
* negligible when amoritized over that time period, and the extra latency
|
|
|
|
* of a needlessly non-expedited grace period is similarly negligible.
|
|
|
|
*/
|
|
|
|
+static DEFINE_LOCAL_IRQ_LOCK(sp_llock);
|
|
|
|
+
|
|
|
|
static bool srcu_might_be_idle(struct srcu_struct *sp)
|
|
|
|
{
|
|
|
|
unsigned long curseq;
|
2019-04-08 23:49:20 +00:00
|
|
|
@@ -768,13 +771,13 @@ static bool srcu_might_be_idle(struct srcu_struct *sp)
|
2018-08-27 14:32:32 +00:00
|
|
|
unsigned long t;
|
|
|
|
|
|
|
|
/* If the local srcu_data structure has callbacks, not idle. */
|
|
|
|
- local_irq_save(flags);
|
|
|
|
+ local_lock_irqsave(sp_llock, flags);
|
|
|
|
sdp = this_cpu_ptr(sp->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.
|
2019-04-08 23:49:20 +00:00
|
|
|
@@ -852,7 +855,7 @@ void __call_srcu(struct srcu_struct *sp, struct rcu_head *rhp,
|
2018-08-27 14:32:32 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
rhp->func = func;
|
|
|
|
- local_irq_save(flags);
|
|
|
|
+ local_lock_irqsave(sp_llock, flags);
|
|
|
|
sdp = this_cpu_ptr(sp->sda);
|
|
|
|
spin_lock_rcu_node(sdp);
|
|
|
|
rcu_segcblist_enqueue(&sdp->srcu_cblist, rhp, false);
|
2019-04-08 23:49:20 +00:00
|
|
|
@@ -868,7 +871,8 @@ void __call_srcu(struct srcu_struct *sp, struct rcu_head *rhp,
|
2018-08-27 14:32:32 +00:00
|
|
|
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(sp, sdp, s, do_norm);
|
|
|
|
else if (needexp)
|
2020-01-03 23:36:11 +00:00
|
|
|
--
|
2020-04-09 19:44:24 +00:00
|
|
|
2.25.1
|
2020-01-03 23:36:11 +00:00
|
|
|
|