From owner-freebsd-arch@FreeBSD.ORG Thu May 24 18:08:16 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 1C90A16A4CC; Thu, 24 May 2007 18:08:16 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.freebsd.org (Postfix) with ESMTP id 76AE313C45E; Thu, 24 May 2007 18:08:15 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.8/8.13.8) with ESMTP id l4OI82Ln029981; Thu, 24 May 2007 14:08:02 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: freebsd-arch@freebsd.org Date: Thu, 24 May 2007 11:13:56 -0400 User-Agent: KMail/1.9.6 References: <20070520155103.K632@10.0.0.1> <38601004-BB95-4B8B-87A6-26E2D52B89BA@mac.com> <20070523170449.L9443@10.0.0.1> In-Reply-To: <20070523170449.L9443@10.0.0.1> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200705241113.57372.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Thu, 24 May 2007 14:08:02 -0400 (EDT) X-Virus-Scanned: ClamAV 0.88.3/3290/Thu May 24 07:22:02 2007 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: Marcel Moolenaar , arch@freebsd.org Subject: Re: sched_lock && thread_lock() 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: Thu, 24 May 2007 18:08:16 -0000 On Wednesday 23 May 2007 08:11:15 pm Jeff Roberson wrote: > On Wed, 23 May 2007, Marcel Moolenaar wrote: > > > > >>> The old patch was missing PowerPC & ia64. Will the final version > >>> include those as well? > >> > >> There are a couple of uses of the global scheduler lock in some > >> architecture specific locations. They will continue to be safe with the > >> 4BSD scheduler. I intended to work on these issues with the architecture > >> maintainers after the threadlock patch goes in. Can you suggest some > >> alternative to sched_lock for pmap_switch in ia64? > > > > pmap_switch() is called from cpu_switch() and from pmap_install(). > > So, currently, pmap_install() grabs sched_lock to mimic the > > cpu_switch() path and we assert having sched_lock in pmap_switch(). > > Basically, any lock that serializes cpu_switch() would work, because > > we don't want to switch the thread while in the middle of setting up > > the region registers. > > We could simply use thread_lock() now if this serialization only applies > to preventing multiple access to the same thread. You have to have a spin lock with membar's across cpu_switch() so that curthread-private data is consistent after a thread migrates CPUs. You only really need it for migrations if all your migrations are explicit, in which case a per-CPU lock for a migration queue where both CPUs (old first, then new second) lock the lock during the handoff. -- John Baldwin