Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1275072
| From | <jianchuan.wang@windriver.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] locking_selftest: Save/restore migrate_disable_atomic in locking selftest |
| Date | 2015-11-23 08:30 +0100 |
| Message-ID | <qxTJw-76I-11@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] locking_selftest: Save/restore migrate_disable_atomic in locking selftest <jianchuan.wang@windriver.com> - 2015-11-23 08:30 +0100
Re: [PATCH] locking_selftest: Save/restore migrate_disable_atomic in locking selftest kbuild test robot <lkp@intel.com> - 2015-11-23 08:40 +0100
Re: [PATCH] locking_selftest: Save/restore migrate_disable_atomic in locking selftest Steven Rostedt <rostedt@goodmis.org> - 2015-11-23 14:50 +0100
Re: [kbuild-all] [PATCH] locking_selftest: Save/restore migrate_disable_atomic in locking selftest Steven Rostedt <rostedt@goodmis.org> - 2015-11-23 15:20 +0100
Re: [kbuild-all] [PATCH] locking_selftest: Save/restore migrate_disable_atomic in locking selftest Fengguang Wu <lkp@intel.com> - 2015-11-23 16:10 +0100
Re: [kbuild-all] [PATCH] locking_selftest: Save/restore migrate_disable_atomic in locking selftest Fengguang Wu <lkp@intel.com> - 2015-11-23 15:20 +0100
Re: [kbuild-all] [PATCH] locking_selftest: Save/restore migrate_disable_atomic in locking selftest Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2015-11-23 15:40 +0100
Re: [kbuild-all] [PATCH] locking_selftest: Save/restore migrate_disable_atomic in locking selftest Fengguang Wu <lkp@intel.com> - 2015-11-23 16:10 +0100
csiph-web