From owner-freebsd-arch@FreeBSD.ORG Wed Jul 4 01:40:48 2007 Return-Path: X-Original-To: arch@freebsd.org Delivered-To: freebsd-arch@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2C58916A400 for ; Wed, 4 Jul 2007 01:40:48 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.169]) by mx1.freebsd.org (Postfix) with ESMTP id B8B0213C447 for ; Wed, 4 Jul 2007 01:40:47 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: by ug-out-1314.google.com with SMTP id o4so234363uge for ; Tue, 03 Jul 2007 18:40:46 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition:x-google-sender-auth; b=VmzoyIfb5pKpndjdHJIDprRfUayoIadntLiJuT6soYIcBp/qK9uQBAm1FsUfbpiPNWURPihmInEvluAY5MtFnfJMvSIFFilGZnYr65aLNdEgiP6oWMYXqtNbogl+B926IbDWkB2VwwjpwVi31TIiSf7pbHSH0Big38gagReKEsw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition:x-google-sender-auth; b=kFpc1MYu1gfINVZk+qHedgUGFFjfF37OoP7H+1DWxYhSx6XcsH0kfeODYH13wjBKbWbdFeM5Ohmcc+AstUsGIv/23th5mhXnkRvnraSNWib0udOWVGjBE8z3GYprNg7O10weBAis2wvTi4SH8bNwO+5YmxEJ5Mn9idG2dMuDePo= Received: by 10.78.201.15 with SMTP id y15mr3877909huf.1183513246449; Tue, 03 Jul 2007 18:40:46 -0700 (PDT) Received: by 10.78.97.18 with HTTP; Tue, 3 Jul 2007 18:40:46 -0700 (PDT) Message-ID: <3bbf2fe10707031840p211bffcci915468975a348ead@mail.gmail.com> Date: Wed, 4 Jul 2007 03:40:46 +0200 From: "Attilio Rao" Sender: asmrookie@gmail.com To: arch@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Google-Sender-Auth: a2c4dcbcdb842f74 Cc: Subject: [PATCH] LDT handling bugfixing X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2007 01:40:48 -0000 Hello, Here there is a patch I'd like more people could test out before to commit. This basically addresses 2 problems tegge pointed out to me about actual ia32 LDT handlings affecting i386_ldt_grow and set_user_ldt_rv: - Basically, when an LDT entry is updated in the struct proc_ldt of the specified process, what happens is that old entry is freed before the entries in the gdt and the ldtr are updated. This can have huge consequences in particular on SMP environments. - Currently when ldt changes for a proc running on a particular CPU, other threads sharing the same ldt, running on other CPUs, need to update their entries too. Unfortunalty, current code assumes that thread which can share LDT are all in the same process, which is not entirely correct since it doesn't take in account process creating with rfork() where parent and child shares the same VM. This patch should address these two problems and doing a cleanup switching the usage of refcnt interface to use the old-style refcount which is faster for this case. kib alredy reviewed the patch, and other reviews are not only welcome but encouraged. I'm looking, in particular, for people testing at it, in particular if they can run linuxthreads library: http://users.gufi.org/~rookie/works/patches/smpng07032007.diff Thanks, Attilio -- Peace can only be achieved by understanding - A. Einstein