Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 31 Aug 2008 12:16:39 +0300
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Artem Belevich <fbsdlist@src.cx>
Cc:        Bernd Walter <ticso@cicely7.cicely.de>, freebsd-current@freebsd.org
Subject:   Re: __tls_get_addr problem with recent current
Message-ID:  <20080831091639.GM2038@deviant.kiev.zoral.com.ua>
In-Reply-To: <20080831071618.GK2038@deviant.kiev.zoral.com.ua>
References:  <ed91d4a80808300946s49ff076dw64b57f8e9058f2d@mail.gmail.com> <20080830183804.GG2038@deviant.kiev.zoral.com.ua> <ed91d4a80808301250j1a4802d4o412c6b5e30979079@mail.gmail.com> <20080830195844.GI2038@deviant.kiev.zoral.com.ua> <ed91d4a80808301403t5b776d10ubd184bc1ff01215@mail.gmail.com> <20080831071618.GK2038@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help

--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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080831091639.GM2038>