From owner-cvs-src@FreeBSD.ORG Wed Aug 4 08:24:54 2004 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A759E16A4CE; Wed, 4 Aug 2004 08:24:54 +0000 (GMT) Received: from itchy.rabson.org (mailgate.nlsystems.com [80.177.232.242]) by mx1.FreeBSD.org (Postfix) with ESMTP id DFEED43D39; Wed, 4 Aug 2004 08:24:53 +0000 (GMT) (envelope-from dfr@nlsystems.com) Received: from ns0.nlsystems.com (ns0.nlsystems.com [80.177.232.243]) by itchy.rabson.org (8.12.11/8.12.11) with ESMTP id i748OnbI015014; Wed, 4 Aug 2004 09:24:49 +0100 (BST) (envelope-from dfr@nlsystems.com) From: Doug Rabson To: Maxime Henrion Date: Wed, 4 Aug 2004 09:24:46 +0100 User-Agent: KMail/1.6.2 References: <200408031844.i73IiRb4082245@repoman.freebsd.org> <20040803191313.GB99599@ns1.xcllnt.net> <20040803202342.GH13608@elvis.mu.org> In-Reply-To: <20040803202342.GH13608@elvis.mu.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200408040924.46223.dfr@nlsystems.com> X-Spam-Status: No, hits=0.0 required=5.0 tests=none autolearn=no version=2.63 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on itchy.rabson.org X-Virus-Scanned: clamd / ClamAV version 0.71, clamav-milter version 0.71 X-Virus-Status: Clean cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org cc: Marcel Moolenaar Subject: Re: cvs commit: src/sys/alpha/include cpu.h src/sys/amd64/include cpu.h src/sys/arm/include cpu.h src/sys/i386/include cpu.h src/sys/ia64/include cpu.h src/sys/powerpc/include cpu.h src/sys/sparc64/include cpu.h src/sys/kern kern_mutex.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2004 08:24:54 -0000 On Tuesday 03 August 2004 21:23, Maxime Henrion wrote: > Marcel Moolenaar wrote: > > On Tue, Aug 03, 2004 at 06:44:27PM +0000, Maxime Henrion wrote: > > > mux 2004-08-03 18:44:27 UTC > > > > > > FreeBSD src repository > > > > > > Modified files: > > > sys/alpha/include cpu.h > > > sys/amd64/include cpu.h > > > sys/arm/include cpu.h > > > sys/i386/include cpu.h > > > sys/ia64/include cpu.h > > > sys/powerpc/include cpu.h > > > sys/sparc64/include cpu.h > > > sys/kern kern_mutex.c > > > Log: > > > Instead of calling ia32_pause() conditionally on __i386__ or > > > __amd64__ being defined, define and use a new MD macro, > > > cpu_spinwait(). It only expands to something on i386 and amd64, > > > so the compiled code should be identical. > > > > Cool, but can you explain to me how exactly cpu_spinwait() is to be > > different from cpu_idle() that we cannot use cpu_idle()? > > They serve very different purposes. The cpu_spinwait() macro is used > on x86 and amd64 to insert a "pause" instruction before retrying to > obtain a spin mutex. It is supposed to improve performance on P4 and > newer machines. It is empty on other architectures because we don't > have such a thing, or at least it's not implemented. > > The cpu_idle() hook is called in the idle process, and on x86 it only > does the "sti; hlt" instructions, so it can't fulfill the role of the > cpu_spinwait() macro. In particular, on P4s with HTT, a pause instruction will briefly give all cpu resources to the other virtual cpu, which means that the virtual cpu waiting on the lock is not wasting valuable cpu resources.