All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Finnegan <pat@computer-refuge.org>
To: linux-kernel@vger.kernel.org, sparclinux@vger.kernel.org
Cc: brylow@cs.purdue.edu
Subject: [PATCH] Re: BUG: 2.6.6-rc3 on SMP/SPARC64 (Sun E3000)?
Date: Wed, 12 May 2004 00:57:44 +0000	[thread overview]
Message-ID: <200405111957.44756.pat@computer-refuge.org> (raw)
In-Reply-To: <200405071049.14725.pat@computer-refuge.org>

On Friday 07 May 2004 10:49, you wrote:
> I've been trying to get 2.6.6-rc3 to work in SMP mode on my E3000
> without much success yet.  It boots fine with a uniprocessor kernel,
> but trying to enable SMP gives me this as the last few lines of the
> kernel messages (booted with -p early printk option):

It appears that the problem is that on Sparc64, smp_processor_id() gives
the hardware ID, not a logical number (ie 0..n for the first n+1 
processors).  I had NR_CPUS set to 8, and the first (boot) CPU was 
numbered by the hardware to be CPU 10.

The patch catches if the boot CPU is greater than NR_CPUS, since that is
possible with Sparc64.  I see that the condition is explicitly checked 
for in smp_tick_init(), but that must not get called soon enough to 
catch the problem (which manifested in sched_init()s call to
wake_up_forked_process() ), so I moved it to smp_prepare_boot_cpu().

Comments?

Pat
-- 
Purdue University ITAP/RCS        ---  http://www.itap.purdue.edu/rcs/
The Computer Refuge               ---  http://computer-refuge.org

--- linux-2.6.6.orig/arch/sparc64/kernel/smp.c  2004-05-09 21:31:55.000000000 -0500
+++ linux-2.6.6/arch/sparc64/kernel/smp.c       2004-05-11 19:46:15.692007000 -0500
@@ -1108,11 +1108,6 @@
        boot_cpu_id = hard_smp_processor_id();
        current_tick_offset = timer_tick_offset;

-       if (boot_cpu_id >= NR_CPUS) {
-               prom_printf("Serious problem, boot cpu id >= NR_CPUS\n");
-               prom_halt();
-       }
-
        cpu_set(boot_cpu_id, cpu_online_map);
        prof_counter(boot_cpu_id) = prof_multiplier(boot_cpu_id) = 1;
 }
@@ -1254,6 +1249,11 @@

 void __devinit smp_prepare_boot_cpu(void)
 {
+       if (hard_smp_processor_id() >= NR_CPUS) {
+               prom_printf("Serious problem, boot cpu id >= NR_CPUS\n");
+               prom_halt();
+       }
+
        current_thread_info()->cpu = hard_smp_processor_id();
        cpu_set(smp_processor_id(), cpu_online_map);
        cpu_set(smp_processor_id(), phys_cpu_present_map);

WARNING: multiple messages have this Message-ID (diff)
From: Patrick Finnegan <pat@computer-refuge.org>
To: linux-kernel@vger.kernel.org, sparclinux@vger.kernel.org
Cc: brylow@cs.purdue.edu
Subject: [PATCH] Re: BUG: 2.6.6-rc3 on SMP/SPARC64 (Sun E3000)?
Date: Tue, 11 May 2004 19:57:44 -0500	[thread overview]
Message-ID: <200405111957.44756.pat@computer-refuge.org> (raw)
In-Reply-To: <200405071049.14725.pat@computer-refuge.org>

On Friday 07 May 2004 10:49, you wrote:
> I've been trying to get 2.6.6-rc3 to work in SMP mode on my E3000
> without much success yet.  It boots fine with a uniprocessor kernel,
> but trying to enable SMP gives me this as the last few lines of the
> kernel messages (booted with -p early printk option):

It appears that the problem is that on Sparc64, smp_processor_id() gives
the hardware ID, not a logical number (ie 0..n for the first n+1 
processors).  I had NR_CPUS set to 8, and the first (boot) CPU was 
numbered by the hardware to be CPU 10.

The patch catches if the boot CPU is greater than NR_CPUS, since that is
possible with Sparc64.  I see that the condition is explicitly checked 
for in smp_tick_init(), but that must not get called soon enough to 
catch the problem (which manifested in sched_init()s call to
wake_up_forked_process() ), so I moved it to smp_prepare_boot_cpu().

Comments?

Pat
-- 
Purdue University ITAP/RCS        ---  http://www.itap.purdue.edu/rcs/
The Computer Refuge               ---  http://computer-refuge.org

--- linux-2.6.6.orig/arch/sparc64/kernel/smp.c  2004-05-09 21:31:55.000000000 -0500
+++ linux-2.6.6/arch/sparc64/kernel/smp.c       2004-05-11 19:46:15.692007000 -0500
@@ -1108,11 +1108,6 @@
        boot_cpu_id = hard_smp_processor_id();
        current_tick_offset = timer_tick_offset;

-       if (boot_cpu_id >= NR_CPUS) {
-               prom_printf("Serious problem, boot cpu id >= NR_CPUS\n");
-               prom_halt();
-       }
-
        cpu_set(boot_cpu_id, cpu_online_map);
        prof_counter(boot_cpu_id) = prof_multiplier(boot_cpu_id) = 1;
 }
@@ -1254,6 +1249,11 @@

 void __devinit smp_prepare_boot_cpu(void)
 {
+       if (hard_smp_processor_id() >= NR_CPUS) {
+               prom_printf("Serious problem, boot cpu id >= NR_CPUS\n");
+               prom_halt();
+       }
+
        current_thread_info()->cpu = hard_smp_processor_id();
        cpu_set(smp_processor_id(), cpu_online_map);
        cpu_set(smp_processor_id(), phys_cpu_present_map);

  parent reply	other threads:[~2004-05-12  0:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-07 15:49 BUG: 2.6.6-rc3 on SMP/SPARC64 (Sun E3000)? & MD Patrick Finnegan
2004-05-08 22:35 ` BUG: 2.6.6-rc3 on SMP/SPARC64 (Sun E3000) & MD / ksymoops output Patrick Finnegan
2004-05-08 22:35   ` Patrick Finnegan
2004-05-12  0:57 ` Patrick Finnegan [this message]
2004-05-12  0:57   ` [PATCH] Re: BUG: 2.6.6-rc3 on SMP/SPARC64 (Sun E3000)? Patrick Finnegan
2004-05-20  4:08   ` David S. Miller
2004-05-20  4:08     ` David S. Miller
2004-05-20  9:30     ` Paul Jackson
2004-05-20  9:30       ` Paul Jackson
2004-05-20 15:44       ` Pete Zaitcev
2004-05-20 15:44         ` Pete Zaitcev
2004-05-20 17:00         ` Paul Jackson
2004-05-20 17:00           ` Paul Jackson

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=200405111957.44756.pat@computer-refuge.org \
    --to=pat@computer-refuge.org \
    --cc=brylow@cs.purdue.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sparclinux@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.