kdb
[Top] [All Lists]

Re: Backtrae before smp_init.

To: "Dong, Edie" <edie.dong@xxxxxxxxx>
Subject: Re: Backtrae before smp_init.
From: Keith Owens <kaos@xxxxxxx>
Date: Wed, 26 Mar 2003 17:14:09 +1100
Cc: kdb@xxxxxxxxxxx
In-reply-to: Your message of "Wed, 26 Mar 2003 14:00:10 +0800." <37FBBA5F3A361C41AB7CE44558C3448E1C5C65@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: kdb-bounce@xxxxxxxxxxx
On Wed, 26 Mar 2003 14:00:10 +0800, 
"Dong, Edie" <edie.dong@xxxxxxxxx> wrote:
>VGhhdCBpcyBzdHJhbmdlciwgSSBnb3QgdGhlIHByb2dyYW0gdG8gIlN0YWNrIGlzIG5vdCBpbiB0

Ugh, please use plain text.

>That is stranger, I got the program to "Stack is not in task_struct, backtrace 
>not available",
>(in kdba_bt_stack), I checked the macro task_has_cpu(p) is false beacuse the 
>initial task is
>not switched yet, and the memory in &p->thread are all 0. (md &p->thread).
>Any hints?

You should have included that information in your original mail,
instead of making us guess what error you were getting.  This is a
kernel bug where it incorrectly sets scheduling fields on the idle
tasks.

diff -ur 2.4.20-pristine/arch/i386/kernel/smpboot.c 
2.4.20-sched/arch/i386/kernel/smpboot.c
--- 2.4.20-pristine/arch/i386/kernel/smpboot.c  Fri Nov 29 11:38:59 2002
+++ 2.4.20-sched/arch/i386/kernel/smpboot.c     Wed Mar 26 16:22:49 2003
@@ -803,8 +803,7 @@
        if (!idle)
                panic("No idle process for CPU %d", cpu);
 
-       idle->processor = cpu;
-       idle->cpus_runnable = 1 << cpu; /* we schedule the first task manually 
*/
+       task_set_cpu_only(idle, cpu);   /* we schedule the first task manually 
*/
 
        map_cpu_to_boot_apicid(cpu, apicid);
 
diff -ur 2.4.20-pristine/include/linux/sched.h 
2.4.20-sched/include/linux/sched.h
--- 2.4.20-pristine/include/linux/sched.h       Mon Mar 17 15:35:32 2003
+++ 2.4.20-sched/include/linux/sched.h  Wed Mar 26 16:14:40 2003
@@ -568,6 +568,12 @@
        tsk->cpus_runnable = 1UL << cpu;
 }
 
+static inline void task_set_cpu_only(struct task_struct *tsk, unsigned int cpu)
+{
+       task_set_cpu(tsk, cpu);
+       tsk->cpus_allowed = 1UL << cpu;
+}
+
 static inline void task_release_cpu(struct task_struct *tsk)
 {
        tsk->cpus_runnable = ~0UL;
diff -ur 2.4.20-pristine/init/main.c 2.4.20-sched/init/main.c
--- 2.4.20-pristine/init/main.c Wed May 29 14:00:22 2002
+++ 2.4.20-sched/init/main.c    Wed Mar 26 16:30:23 2003
@@ -354,6 +354,7 @@
  * enable them
  */
        lock_kernel();
+       task_set_cpu_only(current, 0);
        printk(linux_banner);
        setup_arch(&command_line);
        printk("Kernel command line: %s\n", saved_command_line);
diff -ur 2.4.20-pristine/kernel/sched.c 2.4.20-sched/kernel/sched.c
--- 2.4.20-pristine/kernel/sched.c      Fri Aug 30 13:51:40 2002
+++ 2.4.20-sched/kernel/sched.c Wed Mar 26 16:27:35 2003
@@ -525,6 +525,7 @@
                goto out_unlock;
        }
 #else
+       task_release_cpu(prev);
        prev->policy &= ~SCHED_YIELD;
 #endif /* CONFIG_SMP */
 }


<Prev in Thread] Current Thread [Next in Thread>