From owner-freebsd-fs@FreeBSD.ORG Thu Nov 29 23:29:50 2012 Return-Path: Delivered-To: fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 890AF71F; Thu, 29 Nov 2012 23:29:50 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id EA0CF8FC08; Thu, 29 Nov 2012 23:29:49 +0000 (UTC) Received: from tom.home (localhost [127.0.0.1]) by kib.kiev.ua (8.14.5/8.14.5) with ESMTP id qATNTiX6024876; Fri, 30 Nov 2012 01:29:44 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.7.1 kib.kiev.ua qATNTiX6024876 Received: (from kostik@localhost) by tom.home (8.14.5/8.14.5/Submit) id qATNTior024875; Fri, 30 Nov 2012 01:29:44 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 30 Nov 2012 01:29:44 +0200 From: Konstantin Belousov To: sig6247 Subject: Re: clang compiled kernel panic when mounting zfs root on i386 Message-ID: <20121129232944.GQ3013@kib.kiev.ua> References: <50b37d46.8584440a.735c.ffffb4e6@mx.google.com> <20121126171658.GD3013@kib.kiev.ua> <20121127071243.D1255@besplex.bde.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="KI6XeYrntNhU1GwB" Content-Disposition: inline In-Reply-To: <20121127071243.D1255@besplex.bde.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: freebsd-current@freebsd.org, fs@freebsd.org X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2012 23:29:50 -0000 --KI6XeYrntNhU1GwB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 27, 2012 at 08:21:05AM +1100, Bruce Evans wrote: > On Mon, 26 Nov 2012, Konstantin Belousov wrote: >=20 > > On Mon, Nov 26, 2012 at 06:31:34AM -0800, sig6247 wrote: > >> > >> Just checked out r243529, this only happens when the kernel is compiled > >> by clang, and only on i386, either recompiling the kernel with gcc or > >> booting from a UFS root works fine. Is it a known problem? > > It looks like that clang uses more stack than gcc, and zfs makes quite > > deep call chains. =2E.. > It would be useful if the stack trace printed the the stack pointer > on every function call, so that you could see how much stack each > function used. Please apply the patch below and obtain the backtrace of the double fault panic again. I will commit the patch later. diff --git a/sys/amd64/amd64/db_trace.c b/sys/amd64/amd64/db_trace.c index cba90f2..2c81f87 100644 --- a/sys/amd64/amd64/db_trace.c +++ b/sys/amd64/amd64/db_trace.c @@ -186,7 +186,8 @@ db_ss(struct db_variable *vp, db_expr_t *valuep, int op) =20 static void db_nextframe(struct amd64_frame **, db_addr_t *, struct thread= *); static int db_numargs(struct amd64_frame *); -static void db_print_stack_entry(const char *, int, char **, long *, db_ad= dr_t); +static void db_print_stack_entry(const char *, int, char **, long *, db_ad= dr_t, + void *); static void decode_syscall(int, struct thread *); =20 static const char * watchtype_str(int type); @@ -230,12 +231,13 @@ db_numargs(fp) } =20 static void -db_print_stack_entry(name, narg, argnp, argp, callpc) +db_print_stack_entry(name, narg, argnp, argp, callpc, frame) const char *name; int narg; char **argnp; long *argp; db_addr_t callpc; + void *frame; { db_printf("%s(", name); #if 0 @@ -250,6 +252,8 @@ db_print_stack_entry(name, narg, argnp, argp, callpc) #endif db_printf(") at "); db_printsym(callpc, DB_STGY_PROC); + if (frame !=3D NULL) + db_printf("/frame 0x%lx", (register_t)frame); db_printf("\n"); } =20 @@ -341,7 +345,7 @@ db_nextframe(struct amd64_frame **fp, db_addr_t *ip, st= ruct thread *td) return; } =20 - db_print_stack_entry(name, 0, 0, 0, rip); + db_print_stack_entry(name, 0, 0, 0, rip, &(*fp)->f_frame); =20 /* * Point to base of trapframe which is just above the @@ -437,7 +441,8 @@ db_backtrace(struct thread *td, struct trapframe *tf, * Don't try to walk back on a stack for a * process that hasn't actually been run yet. */ - db_print_stack_entry(name, 0, 0, 0, pc); + db_print_stack_entry(name, 0, 0, 0, pc, + actframe); break; } first =3D FALSE; @@ -451,7 +456,7 @@ db_backtrace(struct thread *td, struct trapframe *tf, narg =3D db_numargs(frame); } =20 - db_print_stack_entry(name, narg, argnp, argp, pc); + db_print_stack_entry(name, narg, argnp, argp, pc, actframe); =20 if (actframe !=3D frame) { /* `frame' belongs to caller. */ @@ -465,7 +470,7 @@ db_backtrace(struct thread *td, struct trapframe *tf, if (INKERNEL((long)pc) && !INKERNEL((long)frame)) { sym =3D db_search_symbol(pc, DB_STGY_ANY, &offset); db_symbol_values(sym, &name, NULL); - db_print_stack_entry(name, 0, 0, 0, pc); + db_print_stack_entry(name, 0, 0, 0, pc, frame); break; } if (!INKERNEL((long) frame)) { diff --git a/sys/i386/i386/db_trace.c b/sys/i386/i386/db_trace.c index 445d9c5..822cc56 100644 --- a/sys/i386/i386/db_trace.c +++ b/sys/i386/i386/db_trace.c @@ -176,7 +176,8 @@ db_ss(struct db_variable *vp, db_expr_t *valuep, int op) =20 static void db_nextframe(struct i386_frame **, db_addr_t *, struct thread = *); static int db_numargs(struct i386_frame *); -static void db_print_stack_entry(const char *, int, char **, int *, db_add= r_t); +static void db_print_stack_entry(const char *, int, char **, int *, db_add= r_t, + void *); static void decode_syscall(int, struct thread *); =20 static const char * watchtype_str(int type); @@ -220,12 +221,13 @@ retry: } =20 static void -db_print_stack_entry(name, narg, argnp, argp, callpc) +db_print_stack_entry(name, narg, argnp, argp, callpc, frame) const char *name; int narg; char **argnp; int *argp; db_addr_t callpc; + void *frame; { int n =3D narg >=3D 0 ? narg : 5; =20 @@ -242,6 +244,8 @@ db_print_stack_entry(name, narg, argnp, argp, callpc) db_printf(",..."); db_printf(") at "); db_printsym(callpc, DB_STGY_PROC); + if (frame !=3D NULL) + db_printf("/frame 0x%r", (register_t)frame); db_printf("\n"); } =20 @@ -326,7 +330,7 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, str= uct thread *td) return; } =20 - db_print_stack_entry(name, 0, 0, 0, eip); + db_print_stack_entry(name, 0, 0, 0, eip, &(*fp)->f_frame); =20 /* * For a double fault, we have to snag the values from the @@ -467,7 +471,8 @@ db_backtrace(struct thread *td, struct trapframe *tf, s= truct i386_frame *frame, * Don't try to walk back on a stack for a * process that hasn't actually been run yet. */ - db_print_stack_entry(name, 0, 0, 0, pc); + db_print_stack_entry(name, 0, 0, 0, pc, + actframe); break; } first =3D FALSE; @@ -481,7 +486,7 @@ db_backtrace(struct thread *td, struct trapframe *tf, s= truct i386_frame *frame, narg =3D db_numargs(frame); } =20 - db_print_stack_entry(name, narg, argnp, argp, pc); + db_print_stack_entry(name, narg, argnp, argp, pc, actframe); =20 if (actframe !=3D frame) { /* `frame' belongs to caller. */ @@ -495,7 +500,7 @@ db_backtrace(struct thread *td, struct trapframe *tf, s= truct i386_frame *frame, if (INKERNEL((int)pc) && !INKERNEL((int) frame)) { sym =3D db_search_symbol(pc, DB_STGY_ANY, &offset); db_symbol_values(sym, &name, NULL); - db_print_stack_entry(name, 0, 0, 0, pc); + db_print_stack_entry(name, 0, 0, 0, pc, frame); break; } if (!INKERNEL((int) frame)) { --KI6XeYrntNhU1GwB Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQIcBAEBAgAGBQJQt+/nAAoJEJDCuSvBvK1BXUIP/jOiC4stZJ9EEWRosY4ELMDI WJnPA/mukK/tGNY/WXYm3Ro+6tkfe8rbrUoolkIuo3D/dmtunA8JYXA0bkGW3Rbq GsJNfi6Rie4e7I+VkUI5cRzEZ0Atcz5Mw+Vy0ix6UQzGC9TvWvCQI0khfWBVbeyX v1hLx/McVn9iRBCftFtQj0JfGvQmVxLVCMdMQJ59Ds7IwHyPtWbPLtq5f0AEjSfz fCxksMI8sKfvzBHjZA5Cxux5k2Hf97gppXUTAsnHOau2M8oQFNyNNWf7SPnF6iKS Qw5JAhpNePHy6x1VjdiecUjziC4jBeMONWPGRVVwSdYyDNTuzd8kg8bkzPhYaywJ T7+1hjdzvV5fCTVIj53GFnMP60g0cnfyQoEt9nDXW7d6AZofeZWPVtusJUD4bmTz 42btYYzCzMWG/UViGzc3eoYX9kqmi8mut+/0UbaZErLtSlzTb86SXZfmnC/n2OE7 GrnyFXpia1To1YluGWsDV6BrNzhgWZhGmy9C+GyV60alO0MVF18mMRn5OSP1aBIe y2WJhMDTIdL+gnbWnKK0J+AV17BptApVzTfU/3KM2avH7Z83LVngLQDyfSyMtTN0 m3qS7bGMKQXf5oUh+jcGPjGimW4SJYjL75OuyvkWxmXn9IC+RWFhzDR3PyzMf+zc kRpA9qMuQM81N4BSbYjI =Jtls -----END PGP SIGNATURE----- --KI6XeYrntNhU1GwB--