From owner-freebsd-current@FreeBSD.ORG Sun Aug 31 09:16:53 2008 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3C9B106566B for ; Sun, 31 Aug 2008 09:16:53 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 7507F8FC17 for ; Sun, 31 Aug 2008 09:16:53 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtp (Exim 4.63 (FreeBSD)) (envelope-from ) id 1KZj3D-000GM4-Nd; Sun, 31 Aug 2008 12:16:51 +0300 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m7V9Gdwg016967 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 31 Aug 2008 12:16:40 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m7V9GddD025587; Sun, 31 Aug 2008 12:16:39 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2/Submit) id m7V9GdUo025584; Sun, 31 Aug 2008 12:16:39 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 31 Aug 2008 12:16:39 +0300 From: Kostik Belousov To: Artem Belevich Message-ID: <20080831091639.GM2038@deviant.kiev.zoral.com.ua> References: <20080830183804.GG2038@deviant.kiev.zoral.com.ua> <20080830195844.GI2038@deviant.kiev.zoral.com.ua> <20080831071618.GK2038@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="fBvfXcdybK7Zhu+D" Content-Disposition: inline In-Reply-To: <20080831071618.GK2038@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.93.3, clamav-milter version 0.93.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1KZj3D-000GM4-Nd fb7775fd1918e6a67c994f4082eb23c0 X-Terabit: YES Cc: Bernd Walter , freebsd-current@freebsd.org Subject: Re: __tls_get_addr problem with recent current X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Aug 2008 09:16:53 -0000 --fBvfXcdybK7Zhu+D Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Aug 31, 2008 at 10:16:18AM +0300, Kostik Belousov wrote: > On Sat, Aug 30, 2008 at 02:03:00PM -0700, Artem Belevich wrote: > > With the new patch kernel has crashed as soon as I ran i386 app, > > though the crash happened within in-kernel thread g_up: > >=20 > > Fatal trap 12: page fault while in kernel mode > > cpuid =3D 2; apic id =3D 02 > > fault virtual address =3D 0x20 > > fault code =3D supervisor read data, page not present > > instruction pointer =3D 0x8:0xffffffff804a821f > > stack pointer =3D 0x10:0xffffffffac280b60 > > frame pointer =3D 0x10:0x0 > > code segment =3D base 0x0, limit 0xfffff, type 0x1b > > =3D DPL 0, pres 1, long 1, def32 0, gran 1 > > processor eflags =3D resume, IOPL =3D 0 > > current process =3D 3 (g_up) > > trap number =3D 12 > > panic: page fault > > cpuid =3D 2 > > Uptime: 37s > > Physical memory: 8169 MB > > Dumping 380 MB: 365 349 333 317 301 285 269 253 237 221 205 189 173 > > 157 141 125 109 93 77 61 45 29 13 > Could you, please, show me the disassembled code around the faulted > %rip ? No need, it seems I found the problem. I trashed the %rdx that contains the third cpu_switch argument. Please, try the updated patch. Thanks for the testing ! diff --git a/sys/amd64/amd64/cpu_switch.S b/sys/amd64/amd64/cpu_switch.S index f34b0cc..03f0eca 100644 --- a/sys/amd64/amd64/cpu_switch.S +++ b/sys/amd64/amd64/cpu_switch.S @@ -249,6 +249,12 @@ store_seg: 1: movl %ds,PCB_DS(%r8) movl %es,PCB_ES(%r8) movl %fs,PCB_FS(%r8) + movq %rdx,%r11 + movl $MSR_FSBASE,%ecx + rdmsr + shlq $32,%rdx + leaq (%rax,%rdx),%r9 + movq %r11,%rdx jmp done_store_seg 2: movq PCB_GS32P(%r8),%rax movq (%rax),%rax --fBvfXcdybK7Zhu+D Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAki6YXYACgkQC3+MBN1Mb4iTVACdFf/FbQdh/YlDlojF9OopXMJV tRMAnj11dnkHE78sE1fVV/rTF7H7Vutv =B+JS -----END PGP SIGNATURE----- --fBvfXcdybK7Zhu+D--