From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org,
linux-rt-users <linux-rt-users@vger.kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Carsten Emde <C.Emde@osadl.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
John Kacur <jkacur@redhat.com>,
Paul Gortmaker <paul.gortmaker@windriver.com>,
<stable-rt@vger.kernel.org>
Subject: [PATCH RT 10/12] irqwork: Move irq safe work to irq context
Date: Fri, 26 Feb 2016 16:32:45 -0500 [thread overview]
Message-ID: <20160226213341.582113472@goodmis.org> (raw)
In-Reply-To: 20160226213235.253312067@goodmis.org
[-- Attachment #1: 0010-irqwork-Move-irq-safe-work-to-irq-context.patch --]
[-- Type: text/plain, Size: 2760 bytes --]
3.18.27-rt26-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <tglx@linutronix.de>
On architectures where arch_irq_work_has_interrupt() returns false, we
end up running the irq safe work from the softirq context. That
results in a potential deadlock in the scheduler irq work which
expects that function to be called with interrupts disabled.
Split the irq_work_tick() function into a hard and soft variant. Call
the hard variant from the tick interrupt and add the soft variant to
the timer softirq.
Reported-and-tested-by: Yanjiang Jin <yanjiang.jin@windriver.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable-rt@vger.kernel.org
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
include/linux/irq_work.h | 6 ++++++
kernel/irq_work.c | 9 +++++++++
kernel/time/timer.c | 6 ++----
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/include/linux/irq_work.h b/include/linux/irq_work.h
index 30ef6c214e6f..af7ed9ad52c3 100644
--- a/include/linux/irq_work.h
+++ b/include/linux/irq_work.h
@@ -51,4 +51,10 @@ bool irq_work_needs_cpu(void);
static inline bool irq_work_needs_cpu(void) { return false; }
#endif
+#if defined(CONFIG_IRQ_WORK) && defined(CONFIG_PREEMPT_RT_FULL)
+void irq_work_tick_soft(void);
+#else
+static inline void irq_work_tick_soft(void) { }
+#endif
+
#endif /* _LINUX_IRQ_WORK_H */
diff --git a/kernel/irq_work.c b/kernel/irq_work.c
index 9678fd1382a7..3d5a476b58b9 100644
--- a/kernel/irq_work.c
+++ b/kernel/irq_work.c
@@ -200,8 +200,17 @@ void irq_work_tick(void)
if (!llist_empty(raised) && !arch_irq_work_has_interrupt())
irq_work_run_list(raised);
+
+ if (!IS_ENABLED(CONFIG_PREEMPT_RT_FULL))
+ irq_work_run_list(this_cpu_ptr(&lazy_list));
+}
+
+#if defined(CONFIG_IRQ_WORK) && defined(CONFIG_PREEMPT_RT_FULL)
+void irq_work_tick_soft(void)
+{
irq_work_run_list(this_cpu_ptr(&lazy_list));
}
+#endif
/*
* Synchronize against the irq_work @entry, ensures the entry is not
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index 3a978d000fce..78e39b644780 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -1451,7 +1451,7 @@ void update_process_times(int user_tick)
run_local_timers();
rcu_check_callbacks(cpu, user_tick);
-#if defined(CONFIG_IRQ_WORK) && !defined(CONFIG_PREEMPT_RT_FULL)
+#if defined(CONFIG_IRQ_WORK)
if (in_irq())
irq_work_tick();
#endif
@@ -1467,9 +1467,7 @@ static void run_timer_softirq(struct softirq_action *h)
hrtimer_run_pending();
-#if defined(CONFIG_IRQ_WORK) && defined(CONFIG_PREEMPT_RT_FULL)
- irq_work_tick();
-#endif
+ irq_work_tick_soft();
if (time_after_eq(jiffies, base->timer_jiffies))
__run_timers(base);
--
2.7.0
next prev parent reply other threads:[~2016-02-26 21:43 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-26 21:32 [PATCH RT 00/12] Linux Steven Rostedt
2016-02-26 21:32 ` [PATCH RT 01/12] cpufreq: Remove cpufreq_rwsem Steven Rostedt
2016-02-26 21:32 ` [PATCH RT 03/12] ARM: smp: Move clear_tasks_mm_cpumask() call to __cpu_die() Steven Rostedt
2016-02-26 21:32 ` [PATCH RT 04/12] rtmutex: Handle non enqueued waiters gracefully Steven Rostedt
2016-02-26 21:32 ` [PATCH RT 05/12] locking: locktorture: Do NOT include rwlock.h directly Steven Rostedt
2016-02-26 21:32 ` [PATCH RT 06/12] rtmutex: Use chainwalking control enum Steven Rostedt
2016-02-26 21:32 ` [PATCH RT 07/12] dump stack: dont disable preemption during trace Steven Rostedt
2016-02-27 10:32 ` Sebastian Andrzej Siewior
2016-02-29 15:06 ` Steven Rostedt
2016-02-29 15:07 ` Thomas Gleixner
2016-03-01 14:45 ` Steven Rostedt
2016-03-01 18:25 ` Steven Rostedt
2016-02-26 21:32 ` [PATCH RT 08/12] net: Make synchronize_rcu_expedited() conditional on !RT_FULL Steven Rostedt
2016-02-26 21:32 ` [PATCH RT 09/12] net/core/cpuhotplug: Drain input_pkt_queue lockless Steven Rostedt
2016-02-26 21:32 ` Steven Rostedt [this message]
2016-02-26 21:32 ` [PATCH RT 11/12] sched: Introduce the trace_sched_waking tracepoint Steven Rostedt
2016-02-26 21:32 ` [PATCH RT 12/12] Linux 3.18.27-rt26-rc1 Steven Rostedt
2016-02-26 21:36 ` [PATCH RT 00/12] " Steven Rostedt
[not found] ` <20160226213340.259403556@goodmis.org>
2016-02-26 21:48 ` [PATCH RT 02/12] genirq: Handle force threading of interrupts with primary and thread handler Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160226213341.582113472@goodmis.org \
--to=rostedt@goodmis.org \
--cc=C.Emde@osadl.org \
--cc=bigeasy@linutronix.de \
--cc=jkacur@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=paul.gortmaker@windriver.com \
--cc=stable-rt@vger.kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox