public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederik Deweerdt <frederik.deweerdt@xprog.eu>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	kosaki.motohiro@jp.fujitsu.com, mingo@elte.hu
Subject: Re: [2.6.28] NULL pointer dereference at get_stats()
Date: Tue, 30 Dec 2008 22:37:27 +0100	[thread overview]
Message-ID: <20081230213727.GA2001@gambetta> (raw)
In-Reply-To: <200812310201.GJH43235.OFFLHFMStOJVOQ@I-love.SAKURA.ne.jp>

[Trimmed netdev from cc:]
Hello Tetsuo,

On Wed, Dec 31, 2008 at 02:01:56AM +0900, Tetsuo Handa wrote:
> Hello.
> 
> Frederik Deweerdt wrote:
> > Does adding maxcpus=0 to the boot parameters solve the problem? Stephen
> > suspected a per-cpu variable related problem.
> 
> No, but I got interestring results.
> 
> Result | # of virtual CPUs | Kernel command line
> -------+-------------------+-----------------------------------------
>  OK    | 2                 | ro root=LABEL=/
>  BUG   | 2                 | ro root=LABEL=/ noapic nolapic
>  BUG   | 2                 | ro root=LABEL=/ noapic nolapic maxcpus=0
>  BUG   | 2                 | ro root=LABEL=/ noapic nolapic nosmp
>  BUG   | 2                 | ro root=LABEL=/ maxcpus=0
>  BUG   | 2                 | ro root=LABEL=/ nosmp
>  OK    | 1                 | ro root=LABEL=/
>  OK    | 1                 | ro root=LABEL=/ nolapic noapic
>  OK    | 1                 | ro root=LABEL=/ nolapic noapic maxcpus=0
>  OK    | 1                 | ro root=LABEL=/ nolapic noapic nosmp
> 
> "OK" means NULL pointer dereference didn't happen.
> "BUG" means NULL pointer dereference happened.
> 
> I was adding "noapic" "nolapic" to command line while assigning 2 vcpus.
> Thus, I encountered this problem. Workaround is to remove "noapic" "nolapic".
> 
> Now, it seems to me that this problem is caused by interaction of
> "noapic" "nolapic" "maxcpus=0" "nosmp" options.

Thanks for the thourough testing. I've reviewed the code, and the only
think that looks weird to me is the case where smp_sanity_check() fails.
The attached patch is an attempt to correct this, Tetsuo, could you
test it?

Ingo, could you please have a look at it? It does what commit
deef325086c3897393b8f7d6bccd0340 "x86: disable preemption in
native_smp_prepare_cpus" was looking to fix, but continuing the APIC
setup in case smp_sanity_check fails.


Regards,
Frederik

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index f8500c9..888c6d3 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1188,16 +1188,13 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
 	if (smp_sanity_check(max_cpus) < 0) {
 		printk(KERN_INFO "SMP disabled\n");
 		disable_smp();
-		goto out;
 	}
 
-	preempt_disable();
 	if (read_apic_id() != boot_cpu_physical_apicid) {
 		panic("Boot APIC ID in local APIC unexpected (%d vs %d)",
 		     read_apic_id(), boot_cpu_physical_apicid);
 		/* Or can we switch back to PIC here? */
 	}
-	preempt_enable();
 
 	connect_bsp_APIC();
 
@@ -1230,7 +1227,7 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
 
 	if (is_uv_system())
 		uv_system_init();
-out:
+
 	preempt_enable();
 }
 /*

  reply	other threads:[~2008-12-30 21:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-30 12:53 [2.6.28] NULL pointer dereference at get_stats() Tetsuo Handa
2008-12-30 13:28 ` KOSAKI Motohiro
2008-12-30 14:38   ` Tetsuo Handa
2008-12-30 15:16     ` KOSAKI Motohiro
2008-12-30 15:52 ` Frederik Deweerdt
2008-12-30 17:01   ` Tetsuo Handa
2008-12-30 21:37     ` Frederik Deweerdt [this message]
2008-12-31  2:25       ` Tetsuo Handa
2008-12-31  2:44         ` Tetsuo Handa
2008-12-31  5:09       ` Tetsuo Handa

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=20081230213727.GA2001@gambetta \
    --to=frederik.deweerdt@xprog.eu \
    --cc=akpm@linux-foundation.org \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    /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