From: <jianchuan.wang@windriver.com>
To: <rostedt@goodmis.org>, <bigeasy@linutronix.de>,
<tglx@linutronix.de>, <yang.shi@windriver.com>
Cc: <linux-rt-users@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH] locking_selftest: Save/restore migrate_disable_atomic in locking selftest
Date: Mon, 23 Nov 2015 15:19:38 +0800 [thread overview]
Message-ID: <1448263178-28397-1-git-send-email-jianchuan.wang@windriver.com> (raw)
From: Jianchuan Wang <jianchuan.wang@windriver.com>
System will hang when enabling the kernel option
CONFIG_DEBUG_LOCKING_API_SELFTESTS and CONFIG_SCHED_CONFIG
in the preempt-rt kernel.
In the preempt-rt kernel, migrate_enable()/migrage_disable() are called
in the spinlock and read/write lock; The lock()/unlock() aren't used
in pairs in the selftest processing changes the migrate_disable_atomic
so that the system will hang in the dotest(), the calltrace is :
printk() ..-> vprintk_emit() -> migrage_disable()
-> WARN_ON_ONCE() ..-> warn_slowpath_common() ..-> printk()
For fixing it, we need save the migrate_disable_atomic before self-testing
and restore migrate_disable_atomic after self-testing.
Signed-off-by: Jianchuan Wang <jianchuan.wang@windriver.com>
---
lib/locking-selftest.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/lib/locking-selftest.c b/lib/locking-selftest.c
index b93a610..61798da 100644
--- a/lib/locking-selftest.c
+++ b/lib/locking-selftest.c
@@ -997,10 +997,23 @@ static int unexpected_testcase_failures;
static void dotest(void (*testcase_fn)(void), int expected, int lockclass_mask)
{
unsigned long saved_preempt_count = preempt_count();
+#ifdef CONFIG_SCHED_DEBUG
+ struct task_struct *p = current;
+ int save_migrate_atomic;
+#endif
WARN_ON(irqs_disabled());
+#ifdef CONFIG_SCHED_DEBUG
+ save_migrate_atomic = p->migrate_disable_atomic;
+#endif
+
testcase_fn();
+
+#ifdef CONFIG_SCHED_DEBUG
+ p->migrate_disable_atomic = save_migrate_atomic;
+#endif
+
/*
* Filter out expected failures:
*/
--
1.9.1
next reply other threads:[~2015-11-23 7:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-23 7:19 jianchuan.wang [this message]
2015-11-23 7:30 ` [PATCH] locking_selftest: Save/restore migrate_disable_atomic in locking selftest kbuild test robot
2015-11-23 13:43 ` Steven Rostedt
2015-11-23 14:14 ` [kbuild-all] " Fengguang Wu
2015-11-23 14:17 ` Steven Rostedt
2015-11-23 14:58 ` Fengguang Wu
2015-11-23 14:35 ` Sebastian Andrzej Siewior
2015-11-23 15:03 ` Fengguang Wu
2015-12-01 17:59 ` Sebastian Andrzej Siewior
2015-12-03 1:53 ` Fengguang Wu
2015-12-11 17:24 ` 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=1448263178-28397-1-git-send-email-jianchuan.wang@windriver.com \
--to=jianchuan.wang@windriver.com \
--cc=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=yang.shi@windriver.com \
/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;
as well as URLs for NNTP newsgroup(s).