From owner-freebsd-arch@FreeBSD.ORG Mon Apr 21 22:43:13 2008 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2077E106564A for ; Mon, 21 Apr 2008 22:43:13 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from rn-out-0910.google.com (rn-out-0910.google.com [64.233.170.189]) by mx1.freebsd.org (Postfix) with ESMTP id E02AF8FC16 for ; Mon, 21 Apr 2008 22:43:12 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: by rn-out-0910.google.com with SMTP id j40so598610rnf.12 for ; Mon, 21 Apr 2008 15:43:12 -0700 (PDT) Received: by 10.142.11.2 with SMTP id 2mr1926157wfk.297.1208817791345; Mon, 21 Apr 2008 15:43:11 -0700 (PDT) Received: from ?10.0.1.199? ( [24.94.72.120]) by mx.google.com with ESMTPS id 24sm8435415wff.10.2008.04.21.15.43.05 (version=SSLv3 cipher=OTHER); Mon, 21 Apr 2008 15:43:06 -0700 (PDT) Date: Mon, 21 Apr 2008 12:43:42 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: Andrew Gallatin In-Reply-To: <18444.62681.319881.638165@grasshopper.cs.duke.edu> Message-ID: <20080421124258.M942@desktop> References: <20080419004911.R942@desktop> <18444.62681.319881.638165@grasshopper.cs.duke.edu> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: arch@freebsd.org Subject: Re: monitor/mwait support for idle 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: Mon, 21 Apr 2008 22:43:13 -0000 On Mon, 21 Apr 2008, Andrew Gallatin wrote: > > Jeff Roberson writes: > > http://people.freebsd.org/~jeff/mwait.diff > > > > This patch implements support for the x86/amd64 monitor and mwait > > instructions in the idle loop. This also implements idle loop selection > > via a sysctl string. The following loops are supported, in > > decreasing order of performance and power consumption: > > > > spin - Simply returns > > mwait - Always use mwait to sleep. CPU enters C0 or C1 depending on > > how busy it is. > > mwait_hlt - Use mwait when busy but fall back to hlt/acpi when not. > > hlt - pure hlt loop > > acpi - uses acpi_cpu_idle if available and hlt if not. This is the > > default. > > > > Something which may be a bit confusing is that machines like recent > Core2 Xeons will go into C1E when hlt is executed, depending on an MSR > setting that most BIOSes enable (bit 25, MSR 0x1a0). I think C1E > might be a deeper sleep than what is reached by mwait. I confess that > I don't know much about C1E, other than it kills network io intensive > performance, and I turn off this (mis)feature whenever I can. > > It will be interesting to see how much mwait helps. I'm sure it will > save power over my current workaround of disabling hlt altogether :) I don't have any useful measurements for power. For performance I see as much as 10-15% in some workloads. This is due to both latency and cpu time reduction in wakeup heavy workloads that also idle a lot. Jeff > > Drew >