From: "Eric Rannaud" <eric.rannaud@gmail.com>
To: "Andi Kleen" <ak@suse.de>
Cc: "Linus Torvalds" <torvalds@osdl.org>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
"Ingo Molnar" <mingo@elte.hu>, "Andrew Morton" <akpm@osdl.org>,
nagar@watson.ibm.com, "Chandra Seetharaman" <sekharan@us.ibm.com>,
"Jan Beulich" <jbeulich@novell.com>
Subject: Re: BUG-lockdep and freeze (was: Arrr! Linux 2.6.18)
Date: Sat, 30 Sep 2006 23:43:21 +0200 [thread overview]
Message-ID: <5f3c152b0609301443l5061af04w5740babdfa3dbd3b@mail.gmail.com> (raw)
In-Reply-To: <200609302230.24070.ak@suse.de>
On 9/30/06, Andi Kleen <ak@suse.de> wrote:
> Index: linux/arch/i386/kernel/process.c
> ===================================================================
> --- linux.orig/arch/i386/kernel/process.c
> +++ linux/arch/i386/kernel/process.c
> @@ -328,6 +328,7 @@ extern void kernel_thread_helper(void);
> int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
> {
> struct pt_regs regs;
> + int err;
>
> memset(®s, 0, sizeof(regs));
>
> @@ -342,7 +343,9 @@ int kernel_thread(int (*fn)(void *), voi
> regs.eflags = X86_EFLAGS_IF | X86_EFLAGS_SF | X86_EFLAGS_PF | 0x2;
>
> /* Ok, create the new process.. */
> - return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, ®s, 0, NULL, NULL);
> + err = do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, ®s, 0, NULL, NULL);
> + if (err == 0) /* terminate kernel stack */
> + task_pt_regs(current)->eip = 0;
> }
> EXPORT_SYMBOL(kernel_thread);
>
> Index: linux/arch/x86_64/kernel/entry.S
> ===================================================================
> --- linux.orig/arch/x86_64/kernel/entry.S
> +++ linux/arch/x86_64/kernel/entry.S
> @@ -978,6 +978,11 @@ ENTRY(kernel_thread)
> call do_fork
> movq %rax,RAX(%rsp)
> xorl %edi,%edi
> + test %rax,%rax
> + jnz 1f
> + /* terminate stack in child */
> + movq %rdi,RIP(%rsp)
> +1:
>
> /*
> * It isn't worth to check for reschedule here,
>
For the sake of it, I tried your patch (more exactly the version at
the end of that email, againt v2.6.18). It doesn't freeze and prints
the following stack trace:
----
[ 174.630434] BUG: warning at
kernel/lockdep.c:565/print_infinite_recursion_bug()
[ 174.630506]
[ 174.630507] Call Trace:
[ 174.630703] [<ffffffff8020b23d>] show_trace+0xad/0x3b0
[ 174.630760] [<ffffffff8020b785>] dump_stack+0x15/0x20
[ 174.630819] [<ffffffff8024ba7d>] print_infinite_recursion_bug+0x3d/0x50
[ 174.630938] [<ffffffff8024bb8f>] find_usage_backwards+0x2f/0xd0
[ 174.631051] [<ffffffff8024bbf3>] find_usage_backwards+0x93/0xd0
[ 174.631163] [<ffffffff8024bbf3>] find_usage_backwards+0x93/0xd0
[ 174.631277] [<ffffffff8024bbf3>] find_usage_backwards+0x93/0xd0
[ 174.631403] [<ffffffff8024bbf3>] find_usage_backwards+0x93/0xd0
[ 174.631530] [<ffffffff8024bbf3>] find_usage_backwards+0x93/0xd0
[ 174.631655] [<ffffffff8024bbf3>] find_usage_backwards+0x93/0xd0
[ 174.631786] [<ffffffff8024bbf3>] find_usage_backwards+0x93/0xd0
[ 174.631912] [<ffffffff8024bbf3>] find_usage_backwards+0x93/0xd0
[ 174.632039] [<ffffffff8024bbf3>] find_usage_backwards+0x93/0xd0
[ 174.632166] [<ffffffff8024bbf3>] find_usage_backwards+0x93/0xd0
[ 174.632293] [<ffffffff8024bbf3>] find_usage_backwards+0x93/0xd0
[ 174.632419] [<ffffffff8024bbf3>] find_usage_backwards+0x93/0xd0
[ 174.632546] [<ffffffff8024bbf3>] find_usage_backwards+0x93/0xd0
[ 174.632672] [<ffffffff8024bbf3>] find_usage_backwards+0x93/0xd0
[ 174.632798] [<ffffffff8024bbf3>] find_usage_backwards+0x93/0xd0
[ 174.632924] [<ffffffff8024bbf3>] find_usage_backwards+0x93/0xd0
[ 174.633050] [<ffffffff8024bbf3>] find_usage_backwards+0x93/0xd0
[ 174.633176] [<ffffffff8024bbf3>] find_usage_backwards+0x93/0xd0
[ 174.633303] [<ffffffff8024bbf3>] find_usage_backwards+0x93/0xd0
[ 174.633432] [<ffffffff8024bbf3>] find_usage_backwards+0x93/0xd0
[ 174.633559] [<ffffffff8024c5a0>] check_usage+0x40/0x2b0
[ 174.633685] [<ffffffff8024de70>] __lock_acquire+0xa50/0xd20
[ 174.633811] [<ffffffff8024e4cb>] lock_acquire+0x8b/0xc0
[ 174.633941] [<ffffffff804ac5a5>] _spin_lock+0x25/0x40
[ 174.634071] [<ffffffff80227e5b>] double_rq_lock+0x2b/0x50
[ 174.634171] [<ffffffff8022b1bb>] migration_thread+0x22b/0x2e0
[ 174.634272] [<ffffffff80246dca>] kthread+0xda/0x110
[ 174.634392] [<ffffffff8020aaad>] child_rip+0xa/0x11
----
er.
diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c
index 8657c73..5a7ef45 100644
--- a/arch/i386/kernel/process.c
+++ b/arch/i386/kernel/process.c
@@ -336,6 +336,7 @@ __asm__(".section .text\n"
int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
{
struct pt_regs regs;
+ int err;
memset(®s, 0, sizeof(regs));
@@ -350,7 +351,10 @@ int kernel_thread(int (*fn)(void *), voi
regs.eflags = X86_EFLAGS_IF | X86_EFLAGS_SF | X86_EFLAGS_PF | 0x2;
/* Ok, create the new process.. */
- return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, ®s, 0,
NULL, NULL);
+ err = do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, ®s, 0,
NULL, NULL);
+ if (err == 0) /* terminate kernel stack */
+ task_pt_regs(current)->eip = 0;
+ return err;
}
EXPORT_SYMBOL(kernel_thread);
diff --git a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S
index aa8d893..5dce978 100644
--- a/arch/x86_64/kernel/entry.S
+++ b/arch/x86_64/kernel/entry.S
@@ -958,6 +958,11 @@ ENTRY(kernel_thread)
call do_fork
movq %rax,RAX(%rsp)
xorl %edi,%edi
+ test %rax,%rax
+ jnz 1f
+ /* terminate stack in child */
+ movq %rdi,RIP(%rsp)
+1:
/*
* It isn't worth to check for reschedule here,
next prev parent reply other threads:[~2006-09-30 21:43 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-30 19:20 Eric Rannaud
2006-09-30 19:49 ` Peter Zijlstra
2006-09-30 20:23 ` Linus Torvalds
2006-09-30 20:57 ` Eric Rannaud
2006-09-30 19:54 ` Linus Torvalds
2006-09-30 20:21 ` Al Viro
2006-09-30 20:28 ` Linus Torvalds
2006-09-30 20:30 ` Andi Kleen
2006-09-30 20:47 ` Linus Torvalds
2006-09-30 20:49 ` Ingo Molnar
2006-09-30 21:11 ` Linus Torvalds
2006-09-30 21:25 ` Ingo Molnar
2006-09-30 21:57 ` Andi Kleen
2006-09-30 22:09 ` BUG-lockdep and freeze (was: Arrr! Linux 2.6.18) II Andi Kleen
2006-09-30 22:19 ` Eric Rannaud
2006-09-30 22:24 ` Andi Kleen
2006-09-30 22:54 ` BUG-lockdep and freeze (was: Arrr! Linux 2.6.18) Linus Torvalds
2006-10-04 9:21 ` Jan Beulich
2006-10-04 15:12 ` Linus Torvalds
2006-09-30 21:43 ` Eric Rannaud [this message]
2006-09-30 22:03 ` Andi Kleen
2006-09-30 21:56 ` Linus Torvalds
2006-09-30 22:02 ` Andi Kleen
2006-09-30 22:10 ` Ingo Molnar
2006-09-30 22:23 ` Andi Kleen
2006-09-30 22:55 ` Linus Torvalds
2006-09-30 22:59 ` Linus Torvalds
2006-09-30 23:56 ` Andi Kleen
2006-10-01 0:25 ` Linus Torvalds
2006-10-01 0:51 ` Linus Torvalds
2006-10-01 9:27 ` Andi Kleen
2006-10-04 9:25 ` Jan Beulich
2006-10-04 10:52 ` Andi Kleen
2006-10-04 11:58 ` Jan Beulich
2006-10-04 12:03 ` Andi Kleen
2006-10-04 12:10 ` Jan Beulich
2006-09-30 20:43 ` Linus Torvalds
2006-10-04 9:15 ` Jan Beulich
2006-09-30 20:13 ` Andrew Morton
2006-09-30 20:52 ` Eric Rannaud
2006-09-30 21:04 ` Andrew Morton
2006-09-30 22:00 ` Eric Rannaud
2006-09-30 22:05 ` Ingo Molnar
2006-10-01 0:59 ` Eric Rannaud
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=5f3c152b0609301443l5061af04w5740babdfa3dbd3b@mail.gmail.com \
--to=eric.rannaud@gmail.com \
--cc=ak@suse.de \
--cc=akpm@osdl.org \
--cc=jbeulich@novell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=nagar@watson.ibm.com \
--cc=sekharan@us.ibm.com \
--cc=torvalds@osdl.org \
/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
all inboxes | Powered by JetHome®