From: "Kevin D. Kissell" <kevink@mips.com>
To: "Kevin D. Kissell" <kevink@mips.com>
Cc: Rojhalat Ibrahim <imr@rtschenk.de>,
Mark E Mason <mark.e.mason@broadcom.com>,
linux-mips@linux-mips.org
Subject: Re: Tracking down exception in sched.c
Date: Mon, 20 Feb 2006 21:27:39 +0100 [thread overview]
Message-ID: <43FA263B.9030601@mips.com> (raw)
In-Reply-To: <003c01c6362d$53ea4c90$10eca8c0@grendel>
Kevin D. Kissell wrote:
>> The behavior of the two loops is not the same because sched_init
>> is called long before smp_prepare_cpus. Therefore for_each_cpu
>> only loops once for CPU 0. I know this is not a great fix.
>> I simply reverted the code to what's worked before.
>
> It's certainly the code that I'm still using! ;o) So prom_build_cpu_map
> needs to be called earlier (as in maybe from smp_prepare_boot_cpu?).
OK, when I wrote the above, I was blinded by the fact that I'm personally
doing my SMP (SMTC) work on a downrev development tree, where prom_build_cpu_map()
is still invoked explicitly from smp_prepare_cpus(), just before prom_prepare_cpus().
In those sources, I was able to do what I describe and have the for_each_cpu()
in sched_init() work fine.
But apparently current sources no longer even invoke prom_build_cpu_map(),
having merged that functionality with prom_prepare_cpus(). It looks to me
as if calling prom_prepare_cpus() from smp_prepare_boot_cpu() as in the
patch below, should do the right thing in all current cases, but it *is*
standing the SMP startup logic a bit on its head. Maybe this is why
prom_build_cpu_map() had a separate existence in the first place...
Regards,
Kevin K.
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 5e18986..7ec9579 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -236,7 +236,6 @@ void __init smp_prepare_cpus(unsigned in
init_new_context(current, &init_mm);
current_thread_info()->cpu = 0;
smp_tune_scheduling();
- prom_prepare_cpus(max_cpus);
}
/* preload SMP state for boot cpu */
@@ -251,6 +250,8 @@ void __devinit smp_prepare_boot_cpu(void
cpu_set(0, phys_cpu_present_map);
cpu_set(0, cpu_online_map);
cpu_set(0, cpu_callin_map);
+ /* This is done early to populate phys_cpu_present_map for sched_init */
+ prom_prepare_cpus(max_cpus);
}
/*
next prev parent reply other threads:[~2006-02-20 20:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-10 23:18 Tracking down exception in sched.c Mark E Mason
2006-02-20 12:09 ` Rojhalat Ibrahim
2006-02-20 13:35 ` Kevin D. Kissell
2006-02-20 14:28 ` Rojhalat Ibrahim
2006-02-20 14:52 ` Kevin D. Kissell
2006-02-20 14:52 ` Kevin D. Kissell
2006-02-20 20:27 ` Kevin D. Kissell [this message]
2006-02-21 1:46 ` Ralf Baechle
2006-02-20 14:40 ` Kevin D. Kissell
2006-02-20 14:40 ` Kevin D. Kissell
2006-02-20 13:35 ` Ralf Baechle
2006-02-20 14:35 ` Kevin D. Kissell
2006-02-20 14:35 ` Kevin D. Kissell
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=43FA263B.9030601@mips.com \
--to=kevink@mips.com \
--cc=imr@rtschenk.de \
--cc=linux-mips@linux-mips.org \
--cc=mark.e.mason@broadcom.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