From owner-freebsd-current@FreeBSD.ORG Tue Sep 2 19:02:24 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 30089106567C for ; Tue, 2 Sep 2008 19:02:24 +0000 (UTC) (envelope-from artemb@gmail.com) Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.27]) by mx1.freebsd.org (Postfix) with ESMTP id 2BC388FC27 for ; Tue, 2 Sep 2008 19:02:22 +0000 (UTC) (envelope-from artemb@gmail.com) Received: by ey-out-2122.google.com with SMTP id 6so997523eyi.7 for ; Tue, 02 Sep 2008 12:02:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=0skUkmKE6EQ765jT6DAZ484pdRr8FbJuciOJPNntvns=; b=gEKn340sRCbXylSHrkbZT8QgvEVryg3iFoWouCvO1pUgyw2UkFkBB1lozqUo0tByAY H1ieVcSs9uLfqy3NDJDrzGK0rdZXJB/WF+mddBlGnKfHavz1DJ6HjGg+C3NZieAWUnlR Kyzgw5Mrsr6wnx63dP+0Wnp+s7VCO9zMkkkc0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=t6Y1RrY/1HjHTVrb/VKYjst8TMldazvC/C9xqanmHWRej9wknno0UhuzXL4bMYbjlv MsTFAjku5EFlY3VPNaVGEzx3iltqmTathBu7ZRueZSdZBwJJeV6E6199U8V3ME6vachG 1cnH3/qRIv2cnjuV1/CKQU24vUZmI9wLqy9Us= Received: by 10.210.92.8 with SMTP id p8mr8769540ebb.7.1220382140304; Tue, 02 Sep 2008 12:02:20 -0700 (PDT) Received: by 10.210.128.7 with HTTP; Tue, 2 Sep 2008 12:02:20 -0700 (PDT) Message-ID: Date: Tue, 2 Sep 2008 12:02:20 -0700 From: "Artem Belevich" Sender: artemb@gmail.com To: "Kostik Belousov" In-Reply-To: <20080902153135.GZ2038@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20080830183804.GG2038@deviant.kiev.zoral.com.ua> <20080830195844.GI2038@deviant.kiev.zoral.com.ua> <20080831071618.GK2038@deviant.kiev.zoral.com.ua> <20080831091639.GM2038@deviant.kiev.zoral.com.ua> <20080902153135.GZ2038@deviant.kiev.zoral.com.ua> X-Google-Sender-Auth: a340882660ba0041 Cc: 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: Tue, 02 Sep 2008 19:02:24 -0000 The latest patch works fine. > Ok, below is the updated patch, that fixes additional problem with > execution of 64bit binaries from 32bit processes. I am not sure whether > your test load includes such operation, but it cannot hurt anyway. Yes, my workload does include running 64-bit binaries from 32-bit ones. --Artem On 9/2/08, Kostik Belousov wrote: > On Sun, Aug 31, 2008 at 11:43:08AM -0700, Artem Belevich wrote: > > I'll not be able to try it till Tuesday. I've been running these > > experiments on a remote box without remotely accessible console. At > > some point yesterday the box had failed to reboot, so no more > > experiments untill I get back to work and restart the system. > > > Ok, below is the updated patch, that fixes additional problem with > execution of 64bit binaries from 32bit processes. I am not sure whether > your test load includes such operation, but it cannot hurt anyway. > > > 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 > > diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c > index 06c0803..f3c41f7 100644 > --- a/sys/amd64/amd64/machdep.c > +++ b/sys/amd64/amd64/machdep.c > @@ -734,6 +734,7 @@ exec_setregs(td, entry, stack, ps_strings) > pcb->pcb_fsbase = 0; > pcb->pcb_gsbase = 0; > critical_exit(); > + pcb->pcb_flags &= ~(PCB_32BIT | PCB_GS32BIT); > load_ds(_udatasel); > load_es(_udatasel); > load_fs(_udatasel); > diff --git a/sys/amd64/ia32/ia32_signal.c b/sys/amd64/ia32/ia32_signal.c > index 9e98656..162dcf9 100644 > --- a/sys/amd64/ia32/ia32_signal.c > +++ b/sys/amd64/ia32/ia32_signal.c > @@ -742,5 +742,6 @@ ia32_setregs(td, entry, stack, ps_strings) > > /* Return via doreti so that we can change to a different %cs */ > pcb->pcb_flags |= PCB_FULLCTX | PCB_32BIT; > + pcb->pcb_flags &= ~PCB_GS32BIT; > td->td_retval[1] = 0; > } > > -- --Artem