From owner-svn-src-head@FreeBSD.ORG Mon Dec 1 22:22:23 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C84B106564A for ; Mon, 1 Dec 2008 22:22:23 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.24]) by mx1.freebsd.org (Postfix) with ESMTP id 87F3D8FC1B for ; Mon, 1 Dec 2008 22:22:22 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: by ey-out-2122.google.com with SMTP id 6so1106751eyi.7 for ; Mon, 01 Dec 2008 14:22:20 -0800 (PST) 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=g5wMIqmvR5rKtZFHxLQLu+XernQ0d9SYmgbJ0n+NICo=; b=X4DrJxPk4aUc3Jys8FSMD/fnQfRjzX+J0UaUWW6wH9CIGg2xW3qloxiR7C2hEpU5HV e2PrIH1X0AnPNuKuzYNv0q4JugPMo5yTOYJvqlf7MGFN11l/0Jl/XeOBbuCC+YsEuh79 Q2lk7Rzic4lb+RJimB1gvI9WxTdZ/wuhszGPQ= 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=Ji13EWG3zFJcrEH88G9ozoqHFc7CBpV+zK9i6gBr5/HYxSBPZR61Se6JpOJ9+7gMGL rwBHEILNkym9ecPFIkpERRu8ztUqdx4SMzPPK4SKdrfmGtsKsk3PxQI+aZM8D6pQGd+I 2gJDTaxmmzcVRpTOCMLWTGGRfhL35gHUETJxQ= Received: by 10.86.84.5 with SMTP id h5mr6699089fgb.59.1228170140452; Mon, 01 Dec 2008 14:22:20 -0800 (PST) Received: by 10.86.30.17 with HTTP; Mon, 1 Dec 2008 14:22:20 -0800 (PST) Message-ID: <3bbf2fe10812011422x27b007fdp13c5dbbb1cfb557e@mail.gmail.com> Date: Mon, 1 Dec 2008 23:22:20 +0100 From: "Attilio Rao" Sender: asmrookie@gmail.com To: "John Baldwin" In-Reply-To: <200812011407.06563.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200811220555.mAM5tuIJ007781@svn.freebsd.org> <3c1674c90811221651u338294frcdbd99b386733851@mail.gmail.com> <20081123154138.GS6408@deviant.kiev.zoral.com.ua> <200812011407.06563.jhb@freebsd.org> X-Google-Sender-Auth: ba257e7afced6f96 Cc: Scott Long , src-committers@freebsd.org, Kip Macy , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Kostik Belousov Subject: Re: svn commit: r185162 - in head: . sys/amd64/include sys/arm/include sys/conf sys/dev/bce sys/dev/cxgb sys/dev/cxgb/sys sys/dev/cxgb/ulp/iw_cxgb sys/dev/mxge sys/dev/nxge sys/i386/include sys/i386/in... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2008 22:22:23 -0000 2008/12/1, John Baldwin : > On Sunday 23 November 2008 10:41:38 am Kostik Belousov wrote: > > On Sun, Nov 23, 2008 at 12:51:58AM +0000, Kip Macy wrote: > > > On Sat, Nov 22, 2008 at 11:08 PM, Scott Long wrote: > > > > Kostik Belousov wrote: > > > >> > > > >> On Sat, Nov 22, 2008 at 03:05:22PM -0700, Scott Long wrote: > > > >>> > > > >>> A neat hack would be for the kernel linker to scan the text and do a > > > >>> drop-in replacement of the opcode that is appropriate for the > platform. > > > >>> I can't see how a CPU_XXX definition would work because it's just a > > > >>> compile time construct, one that can be included with any kernel > > > >>> compile. > > > >> > > > >> Yes, it is possible to do that. Less drastic change is to directly > > > >> check features. I moved slow code to separate section to eliminate > > > >> unconditional jump in fast path. > > > >> Only compile-tested. > > > >> > > > > > > > > As long as it works, I think it's a step in the right direction; I'm > > > > assuming that cpu_feature is a symbol filled in at runtime and not a > > > > macro for the cpuid instruction, right? > > > > > > > > Scott > > > > > > > > > > i386/include/md_var.h: > > > <..> > > > extern u_int cpu_exthigh; > > > extern u_int cpu_feature; > > > extern u_int cpu_feature2; > > > extern u_int amd_feature; > > > extern u_int amd_feature2; > > > <...> > > > > > > I'm not thrilled with it, but we can revisit the issue if it makes a > > > measurable difference on someone's workload. > > > > Below is the updated patch. It includes changes made after private comments > > by bde@ and uses symbolic definitions for the bits in the features words. > > I thought about accessing a per-CPU word for serialized instruction in the > > > slow path, but decided that it does not beneficial.\ > > Is the branch really better than just doing what the atomic operations for > mutexes, etc. do and just use 'lock addl $0,%esp' for a barrier in all cases > on i386 and only bother with using the fancier instructions on amd64? Even > amd64 doesn't use *fence yet for the atomic ops actually. I have had a patch > to use it for years, but during testing there was no discernable difference > between the existing 'lock addl' approach vs '*fence'. I'd much rather just > use 486 code for all i386 machines than add a branch, esp. if > the "optimization" the branch is doing isn't an actual optimization. This is exactly what I suggest in private and I'm supportive with this. Attilio -- Peace can only be achieved by understanding - A. Einstein