From: Paul Menage <menage@google.com>
To: peterz@infradead.org, mingo@redhat.com, jdike@addtoit.com
Cc: user-mode-linux-devel@lists.sourceforge.net
Subject: [uml-devel] [PATCH 4/5] UML: Avoid lockdep issues during initialization
Date: Mon, 15 Jun 2009 17:17:45 -0700 [thread overview]
Message-ID: <20090616001744.30398.85320.stgit@menage.mtv.corp.google.com> (raw)
In-Reply-To: <20090616001248.30398.84278.stgit@menage.mtv.corp.google.com>
UML: Avoid lockdep issues during initialization
UML calls atomic_notifier_chain_register() very early during
initialization. When lockdep is in use, the spinlock operations thus
invoked make use of current_thread_info(), which isn't valid in UML
until start_kernel_proc() is reached (running on the init_thread_union
stack rather than the default stack at the top of the address space).
This patch moves the call to the beginning of start_kernel_proc(), and
additionally disables lock debugging for the duration of the call,
since lockdep_init() doesn't occur until start_kernel() is called.
Signed-off-by: Paul Menage <menage@google.com>
---
arch/um/kernel/skas/process.c | 26 ++++++++++++++++++++++++++
arch/um/kernel/um_arch.c | 20 --------------------
2 files changed, 26 insertions(+), 20 deletions(-)
diff --git a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c
index 4a21c5c..2b62a72 100644
--- a/arch/um/kernel/skas/process.c
+++ b/arch/um/kernel/skas/process.c
@@ -5,7 +5,9 @@
#include "linux/init.h"
#include "linux/sched.h"
+#include "linux/debug_locks.h"
#include "as-layout.h"
+#include "shared/kern_util.h"
#include "kern.h"
#include "os.h"
#include "skas.h"
@@ -31,10 +33,34 @@ int new_mm(unsigned long stack)
extern void start_kernel(void);
+static int panic_exit(struct notifier_block *self, unsigned long unused1,
+ void *unused2)
+{
+ bust_spinlocks(1);
+ show_regs(&(current->thread.regs));
+ bust_spinlocks(0);
+ uml_exitcode = 1;
+ os_dump_core();
+ return 0;
+}
+
+static struct notifier_block panic_exit_notifier = {
+ .notifier_call = panic_exit,
+ .next = NULL,
+ .priority = 0
+};
+
static int __init start_kernel_proc(void *unused)
{
int pid;
+ /* lockdep hasn't yet been initialized, but this call takes
+ * spinlocks. Temporarily disable lock debugging */
+ int saved_debug_locks = debug_locks;
+ debug_locks = 0;
+ atomic_notifier_chain_register(&panic_notifier_list,
+ &panic_exit_notifier);
+ debug_locks = saved_debug_locks;
local_irq_disable();
pid = os_getpid();
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 8d84250..364c589 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -223,23 +223,6 @@ static void __init uml_postsetup(void)
return;
}
-static int panic_exit(struct notifier_block *self, unsigned long unused1,
- void *unused2)
-{
- bust_spinlocks(1);
- show_regs(&(current->thread.regs));
- bust_spinlocks(0);
- uml_exitcode = 1;
- os_dump_core();
- return 0;
-}
-
-static struct notifier_block panic_exit_notifier = {
- .notifier_call = panic_exit,
- .next = NULL,
- .priority = 0
-};
-
/* Set during early boot */
unsigned long task_size;
EXPORT_SYMBOL(task_size);
@@ -360,9 +343,6 @@ int __init linux_main(int argc, char **argv)
printf("Kernel virtual memory size shrunk to %lu bytes\n",
virtmem_size);
- atomic_notifier_chain_register(&panic_notifier_list,
- &panic_exit_notifier);
-
uml_postsetup();
stack_protections((unsigned long) &init_thread_info);
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
next prev parent reply other threads:[~2009-06-16 0:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-16 0:17 [uml-devel] [RFC][PATCH 0/5] UML: Support lockdep on x86-64 UML Paul Menage
2009-06-16 0:17 ` [uml-devel] [PATCH 1/5] UML: Fix some apparent bitrot Paul Menage
2009-06-16 0:17 ` [uml-devel] [PATCH 2/5] UML: Enable CONFIG_TRACE_IRQFLAGS_SUPPORT Paul Menage
2009-06-16 0:17 ` [uml-devel] [PATCH 3/5] UML: Enable CONFIG_STACKTRACE_SUPPORT Paul Menage
2009-06-16 0:17 ` Paul Menage [this message]
2009-06-16 0:17 ` [uml-devel] [PATCH 5/5] UML: Remove sigio_lock()/sigio_unlock() lockdep warnings Paul Menage
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=20090616001744.30398.85320.stgit@menage.mtv.corp.google.com \
--to=menage@google.com \
--cc=jdike@addtoit.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/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