From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Stanislav Meduna <stano@meduna.org>,
"linux-rt-users@vger.kernel.org" <linux-rt-users@vger.kernel.org>,
Linux ARM Kernel <linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: BUG: spinlock trylock failure on UP, i.MX28 3.12.15-rt25
Date: Fri, 2 May 2014 21:37:05 +0200 [thread overview]
Message-ID: <20140502193705.GI9178@linutronix.de> (raw)
In-Reply-To: <alpine.DEB.2.02.1405022100351.6261@ionos.tec.linutronix.de>
* Thomas Gleixner | 2014-05-02 21:01:50 [+0200]:
>It's different as it CANNOT fail on UP. That's called from the idle
>code and there is no way that anything holds that lock on UP when idle
>runs.
Okay, so I will add the patch here. The same thing (mostly) but it will
also skip the irq_work_needs_cpu() check since we will run the timer
softirq anyway.
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: Fri, 2 May 2014 21:31:50 +0200
Subject: [PATCH] timer: do not spin_trylock() on UP
This will void a warning comming from the spin-lock debugging code. The
lock avoiding idea is from Steven Rostedt.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/timer.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/kernel/timer.c b/kernel/timer.c
index 54596b5..8750875 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -1455,18 +1455,31 @@ void run_local_timers(void)
struct tvec_base *base = __this_cpu_read(tvec_bases);
hrtimer_run_queues();
/*
* We can access this lockless as we are in the timer
* interrupt. If there are no timers queued, nothing to do in
* the timer softirq.
*/
#ifdef CONFIG_PREEMPT_RT_FULL
+
+#ifndef CONFIG_SMP
+ /*
+ * The spin_do_trylock() later may fail as the lock may be hold before
+ * the interrupt arrived. The spin-lock debugging code will raise a
+ * warning if the try_lock fails on UP. Since this is only an
+ * optimization for the FULL_NO_HZ case (not to run the timer softirq on
+ * an nohz_full CPU) we don't really care and shedule the softirq.
+ */
+ raise_softirq(TIMER_SOFTIRQ);
+ return;
+#endif
+
/* On RT, irq work runs from softirq */
if (irq_work_needs_cpu()) {
raise_softirq(TIMER_SOFTIRQ);
return;
}
if (!spin_do_trylock(&base->lock)) {
raise_softirq(TIMER_SOFTIRQ);
return;
--
2.0.0.rc0
>Thanks,
>
> tglx
Sebastian
WARNING: multiple messages have this Message-ID (diff)
From: bigeasy@linutronix.de (Sebastian Andrzej Siewior)
To: linux-arm-kernel@lists.infradead.org
Subject: BUG: spinlock trylock failure on UP, i.MX28 3.12.15-rt25
Date: Fri, 2 May 2014 21:37:05 +0200 [thread overview]
Message-ID: <20140502193705.GI9178@linutronix.de> (raw)
In-Reply-To: <alpine.DEB.2.02.1405022100351.6261@ionos.tec.linutronix.de>
* Thomas Gleixner | 2014-05-02 21:01:50 [+0200]:
>It's different as it CANNOT fail on UP. That's called from the idle
>code and there is no way that anything holds that lock on UP when idle
>runs.
Okay, so I will add the patch here. The same thing (mostly) but it will
also skip the irq_work_needs_cpu() check since we will run the timer
softirq anyway.
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: Fri, 2 May 2014 21:31:50 +0200
Subject: [PATCH] timer: do not spin_trylock() on UP
This will void a warning comming from the spin-lock debugging code. The
lock avoiding idea is from Steven Rostedt.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/timer.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/kernel/timer.c b/kernel/timer.c
index 54596b5..8750875 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -1455,18 +1455,31 @@ void run_local_timers(void)
struct tvec_base *base = __this_cpu_read(tvec_bases);
hrtimer_run_queues();
/*
* We can access this lockless as we are in the timer
* interrupt. If there are no timers queued, nothing to do in
* the timer softirq.
*/
#ifdef CONFIG_PREEMPT_RT_FULL
+
+#ifndef CONFIG_SMP
+ /*
+ * The spin_do_trylock() later may fail as the lock may be hold before
+ * the interrupt arrived. The spin-lock debugging code will raise a
+ * warning if the try_lock fails on UP. Since this is only an
+ * optimization for the FULL_NO_HZ case (not to run the timer softirq on
+ * an nohz_full CPU) we don't really care and shedule the softirq.
+ */
+ raise_softirq(TIMER_SOFTIRQ);
+ return;
+#endif
+
/* On RT, irq work runs from softirq */
if (irq_work_needs_cpu()) {
raise_softirq(TIMER_SOFTIRQ);
return;
}
if (!spin_do_trylock(&base->lock)) {
raise_softirq(TIMER_SOFTIRQ);
return;
--
2.0.0.rc0
>Thanks,
>
> tglx
Sebastian
next prev parent reply other threads:[~2014-05-02 19:37 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-14 19:24 BUG: spinlock trylock failure on UP, i.MX28 3.12.15-rt25 Stanislav Meduna
2014-04-14 23:45 ` Stanislav Meduna
2014-04-14 23:45 ` Stanislav Meduna
2014-04-15 22:08 ` Stanislav Meduna
2014-04-15 22:08 ` Stanislav Meduna
2014-04-17 16:29 ` BUG: spinlock trylock failure on UP - reverting timer patches helps Stanislav Meduna
2014-04-17 16:29 ` Stanislav Meduna
2014-04-17 22:55 ` Stanislav Meduna
2014-04-17 22:55 ` Stanislav Meduna
2014-04-17 23:10 ` jordan
2014-04-17 23:10 ` jordan
2014-04-18 1:15 ` jordan
2014-04-18 1:15 ` jordan
2014-04-18 1:15 ` jordan
2014-04-18 14:45 ` Stanislav Meduna
2014-04-18 14:45 ` Stanislav Meduna
2014-04-18 15:09 ` jordan
2014-04-18 15:09 ` jordan
2014-04-22 11:54 ` BUG: spinlock trylock failure on UP, i.MX28 3.12.15-rt25 Sebastian Andrzej Siewior
2014-04-22 11:54 ` Sebastian Andrzej Siewior
2014-04-22 13:46 ` Steven Rostedt
2014-04-22 13:46 ` Steven Rostedt
2014-04-22 14:09 ` Peter Zijlstra
2014-04-22 14:09 ` Peter Zijlstra
2014-04-23 8:10 ` Sebastian Andrzej Siewior
2014-04-23 8:10 ` Sebastian Andrzej Siewior
2014-04-23 8:50 ` Peter Zijlstra
2014-04-23 8:50 ` Peter Zijlstra
2014-04-22 16:51 ` Sebastian Andrzej Siewior
2014-04-22 16:51 ` Sebastian Andrzej Siewior
2014-04-22 17:48 ` Steven Rostedt
2014-04-22 17:48 ` Steven Rostedt
2014-04-22 18:16 ` Steven Rostedt
2014-04-22 18:16 ` Steven Rostedt
2014-04-23 7:14 ` Sebastian Andrzej Siewior
2014-04-23 7:14 ` Sebastian Andrzej Siewior
2014-04-23 8:49 ` Peter Zijlstra
2014-04-23 8:49 ` Peter Zijlstra
2014-04-23 12:15 ` Steven Rostedt
2014-04-23 12:15 ` Steven Rostedt
2014-05-02 18:38 ` Sebastian Andrzej Siewior
2014-05-02 18:38 ` Sebastian Andrzej Siewior
2014-05-02 19:01 ` Thomas Gleixner
2014-05-02 19:01 ` Thomas Gleixner
2014-05-02 19:36 ` Thomas Gleixner
2014-05-02 19:36 ` Thomas Gleixner
2014-05-02 19:37 ` Sebastian Andrzej Siewior [this message]
2014-05-02 19:37 ` Sebastian Andrzej Siewior
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=20140502193705.GI9178@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=stano@meduna.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.