NetBSD Problem Report #48196
From www@NetBSD.org Mon Sep 9 05:03:43 2013
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "Postmaster NetBSD.org" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id D803A7157E
for <gnats-bugs@gnats.NetBSD.org>; Mon, 9 Sep 2013 05:03:43 +0000 (UTC)
Message-Id: <20130909050342.3D27971581@mollari.NetBSD.org>
Date: Mon, 9 Sep 2013 05:03:42 +0000 (UTC)
From: nathanialsloss@yahoo.com.au
Reply-To: nathanialsloss@yahoo.com.au
To: gnats-bugs@NetBSD.org
Subject: PAE non xen crashes immeadiately on boot up
X-Send-Pr-Version: www-1.0
>Number: 48196
>Category: port-i386
>Synopsis: PAE non xen crashes immeadiately on boot up
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: port-i386-maintainer
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Sep 09 05:05:00 +0000 2013
>Closed-Date: Fri Dec 04 05:56:19 +0000 2015
>Last-Modified: Fri Dec 04 05:56:19 +0000 2015
>Originator: Nat Sloss
>Release: NetBSD Current 6.99.23
>Organization:
>Environment:
NetBSD beast 6.99.23 NetBSD 6.99.23 (LOCKDEBUG) #4: Wed Jul 17 22:24:41 EST 2013 build@beast:/usr/src/sys/arch/i386/compile/obj/LOCKDEBUG i386
>Description:
A PAE enabled kernel non xen crashes immediately
I obtain the following from ddb:
fatal double fault in supervisor mode
trap type 13 code c027ff44 eip 8 cs 246 eflags 20 cr2 0 ilevel 0 esp cf
curlwp 0xc0e6ccc0 pid 0 lid 1 lowest kstack 0xc102c000
kernel: user trap double fault, code=0
Stopped in pid 0.1 (system) at 8: invalid address
db{0}> bt
panic: lockdebug_lookup: uninitialized lock (lock=0xc0eb0804, from=c0921dce)
fatal breakpoint trap in supervisor mode
trap type 1 code 0 eip c02810a4 cs 8 eflags 246 cr2 8 ilevel 8 esp c102e154
curlwp 0xc0e6ccc0 pid 0 lid 1 lowest kstack 0xc102c000
Stopped in pid 0.1 (system) at netbsd:breakpoint+0x4: popl %ebp
>How-To-Repeat:
Build a i386 kernel with options PAE andd try to boot it.
>Fix:
The problem is due to the fact that interrupts are enabled before they should be.
So to fix it I applied this patch:
--- ./cpu.c 2013-09-06 12:30:20.000000000 +1000
+++ .#cpu.c.1.102 2012-12-20 15:02:28.000000000 +1100
@@ -1276,6 +1276,7 @@
struct cpu_info *ci = curcpu();
pd_entry_t *l3_pd = ci->ci_pae_l3_pdir;
int i;
+ static int intrEnOK = 0;
/*
* disable interrupts to block TLB shootdowns, which can reload cr3.
@@ -1286,7 +1287,11 @@
for (i = 0 ; i < PDP_SIZE; i++) {
l3_pd[i] = pmap->pm_pdirpa[i] | PG_V;
}
- x86_enable_intr();
+ if (intrEnOK > 1)
+ x86_enable_intr();
+ else
+ intrEnOK++;
+
tlbflush();
#else /* PAE */
lcr3(pmap_pdirpa(pmap, 0));
I would like too request that NetBSD-6 be pulled up and that i386/44995 be reopened as it works in NetBSD current and it is critical to NetBSD-6.
Regards,
Nat.
>Release-Note:
>Audit-Trail:
From: scole_mail <scole_mail@gmx.com>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: port-i386/48196
Date: Wed, 16 Sep 2015 10:31:01 -0400
I am getting the exact same error with 7.0_RC3 and GENERIC with PAE
option. Without PAE, things seem to work fine.
Here is my uname:
NetBSD ugly 7.0_RC3 NetBSD 7.0_RC3 (GENERIC) #0: Wed Sep 16 10:11:01 EDT 2015 root@ugly:/usr/src/sys/arch/i386/compile/GENERIC i386
I didn't try it with the suggested fix in this PR, but can if requested.
Thanks
From: Nathanial Sloss <nat@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: port-i386-maintainer@netbsd.org,
gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org,
scole_mail@gmx.com
Subject: Re: port-i386/48196
Date: Thu, 17 Sep 2015 10:14:26 +1000
Hi,
Please try the following patch:
Index: cpu.c
===================================================================
RCS file: /cvsroot/src/sys/arch/x86/x86/cpu.c,v
retrieving revision 1.115
diff -u -r1.115 cpu.c
--- cpu.c 18 May 2015 13:09:55 -0000 1.115
+++ cpu.c 16 Sep 2015 23:57:35 -0000
@@ -137,6 +137,8 @@
bool sc_wasonline;
};
+#define EFLAGS_IF __BIT(9)
+
#ifdef MULTIPROCESSOR
int mp_cpu_start(struct cpu_info *, paddr_t);
void mp_cpu_start_cleanup(struct cpu_info *);
@@ -1277,6 +1279,7 @@
{
#ifdef PAE
struct cpu_info *ci = curcpu();
+ ulong IntrOK;
pd_entry_t *l3_pd = ci->ci_pae_l3_pdir;
int i;
@@ -1285,11 +1288,14 @@
* while this doesn't block NMIs, it's probably ok as NMIs unlikely
* reload cr3.
*/
+ IntrOK = x86_read_flags() & EFLAGS_IF;
x86_disable_intr();
for (i = 0 ; i < PDP_SIZE; i++) {
l3_pd[i] = pmap->pm_pdirpa[i] | PG_V;
}
- x86_enable_intr();
+
+ if (IntrOK)
+ x86_enable_intr();
tlbflush();
#else /* PAE */
lcr3(pmap_pdirpa(pmap, 0));
If you are successful with pae please let me know.
Best regards,
Nat.
From: matthew green <mrg@eterna.com.au>
To: Nathanial Sloss <nat@netbsd.org>
Cc: port-i386-maintainer@netbsd.org, gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org, scole_mail@gmx.com, gnats-bugs@netbsd.org
Subject: re: port-i386/48196
Date: Thu, 17 Sep 2015 12:43:46 +1000
> Please try the following patch:
this patch works for me (and without it, failure.)
thanks.
.mrg.
From: Masanobu SAITOH <msaitoh@execsw.org>
To: Nathanial Sloss <nat@netbsd.org>, gnats-bugs@netbsd.org
Cc: msaitoh@execsw.org, port-i386-maintainer@netbsd.org,
gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, scole_mail@gmx.com
Subject: Re: port-i386/48196
Date: Thu, 17 Sep 2015 18:28:58 +0900
Hi.
On 2015/09/17 9:14, Nathanial Sloss wrote:
> Hi,
>
> Please try the following patch:
> Index: cpu.c
> ===================================================================
> RCS file: /cvsroot/src/sys/arch/x86/x86/cpu.c,v
> retrieving revision 1.115
> diff -u -r1.115 cpu.c
> --- cpu.c 18 May 2015 13:09:55 -0000 1.115
> +++ cpu.c 16 Sep 2015 23:57:35 -0000
> @@ -137,6 +137,8 @@
> bool sc_wasonline;
> };
>
> +#define EFLAGS_IF __BIT(9)
I think this flags is PSL_I in x86/include/psl.h
> +
> #ifdef MULTIPROCESSOR
> int mp_cpu_start(struct cpu_info *, paddr_t);
> void mp_cpu_start_cleanup(struct cpu_info *);
> @@ -1277,6 +1279,7 @@
> {
> #ifdef PAE
> struct cpu_info *ci = curcpu();
> + ulong IntrOK;
> pd_entry_t *l3_pd = ci->ci_pae_l3_pdir;
> int i;
>
> @@ -1285,11 +1288,14 @@
> * while this doesn't block NMIs, it's probably ok as NMIs unlikely
> * reload cr3.
> */
> + IntrOK = x86_read_flags() & EFLAGS_IF;
> x86_disable_intr();
> for (i = 0 ; i < PDP_SIZE; i++) {
> l3_pd[i] = pmap->pm_pdirpa[i] | PG_V;
> }
> - x86_enable_intr();
> +
> + if (IntrOK)
> + x86_enable_intr();
> tlbflush();
> #else /* PAE */
> lcr3(pmap_pdirpa(pmap, 0));
>
>
> If you are successful with pae please let me know.
>
> Best regards,
>
> Nat.
>
--
-----------------------------------------------
SAITOH Masanobu (msaitoh@execsw.org
msaitoh@netbsd.org)
From: scole_mail <scole_mail@gmx.com>
To: Nathanial Sloss <nat@netbsd.org>
Cc: gnats-bugs@netbsd.org, port-i386-maintainer@netbsd.org,
gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: port-i386/48196
Date: Thu, 17 Sep 2015 09:59:49 -0400
I tried the patch and built a release, and it worked for me.
Thanks!
From: "Nathanial Sloss" <nat@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/48196 CVS commit: src/sys/arch/x86/x86
Date: Thu, 17 Sep 2015 23:48:02 +0000
Module Name: src
Committed By: nat
Date: Thu Sep 17 23:48:01 UTC 2015
Modified Files:
src/sys/arch/x86/x86: cpu.c
Log Message:
Don't disable/re-enable interrupts if they are already disabled.
Addresses PR 48196.
This commit was improved and approved by christos@
To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/sys/arch/x86/x86/cpu.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->pending-pullups
State-Changed-By: nat@NetBSD.org
State-Changed-When: Fri, 18 Sep 2015 00:10:10 +0000
State-Changed-Why:
pullup-7 #984
From: "Jeff Rizzo" <riz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/48196 CVS commit: [netbsd-7] src/sys/arch/x86/x86
Date: Fri, 6 Nov 2015 00:40:03 +0000
Module Name: src
Committed By: riz
Date: Fri Nov 6 00:40:02 UTC 2015
Modified Files:
src/sys/arch/x86/x86 [netbsd-7]: cpu.c
Log Message:
Pull up following revision(s) (requested by nat in ticket #984):
sys/arch/x86/x86/cpu.c: revision 1.116
Don't disable/re-enable interrupts if they are already disabled.
Addresses PR 48196.
This commit was improved and approved by christos@
To generate a diff of this commit:
cvs rdiff -u -r1.111.2.1 -r1.111.2.2 src/sys/arch/x86/x86/cpu.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Jeff Rizzo" <riz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/48196 CVS commit: [netbsd-7-0] src/sys/arch/x86/x86
Date: Sun, 8 Nov 2015 00:15:47 +0000
Module Name: src
Committed By: riz
Date: Sun Nov 8 00:15:47 UTC 2015
Modified Files:
src/sys/arch/x86/x86 [netbsd-7-0]: cpu.c
Log Message:
Pull up following revision(s) (requested by nat in ticket #984):
sys/arch/x86/x86/cpu.c: revision 1.116
Don't disable/re-enable interrupts if they are already disabled.
Addresses PR 48196.
This commit was improved and approved by christos@
To generate a diff of this commit:
cvs rdiff -u -r1.111.2.1 -r1.111.2.1.2.1 src/sys/arch/x86/x86/cpu.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: pending-pullups->closed
State-Changed-By: nat@NetBSD.org
State-Changed-When: Fri, 04 Dec 2015 05:56:19 +0000
State-Changed-Why:
Pullups committed. Thanks to all involved.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.