From owner-freebsd-questions@FreeBSD.ORG Thu Oct 14 19:43:38 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8A54106566C for ; Thu, 14 Oct 2010 19:43:38 +0000 (UTC) (envelope-from bf1783@googlemail.com) Received: from mail-ew0-f54.google.com (mail-ew0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 4AF0A8FC1B for ; Thu, 14 Oct 2010 19:43:37 +0000 (UTC) Received: by ewy21 with SMTP id 21so2131641ewy.13 for ; Thu, 14 Oct 2010 12:43:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:received:reply-to :in-reply-to:references:date:message-id:subject:from:to:cc :content-type; bh=OBNwFhu+pT5Ioz9CptN3RNiBqJCn9F4JvFj+jhYcQmU=; b=gI5GvkUsG4rdd7iNSDqlTFzvWwQ2RzO2yQ+9wVM9anFt6AH0+NGEpGmklDPqPSjPzC otRXl7ORGyjeRfp6lLYzxdEy+tRSLI/EGoa7rduL9GkJ9X8/Vy6LwfuDJaXGgJJEcXP2 uK3PetDCUVgojzKwY6WXl7QgI4oadnvFqs/C0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; b=BdNYMy1PzM8BYLKVkghvx+5KSoZYzPJ5xKT1QXjm/8pl7aRlk0xMN3us8oyyoCvIM3 bmMQZHdjE/sldm8+2Mj5PP4PEVaMV+7YLbkgtbeuBKz7Ee7uDHQt3Gmd3+J5Pi+IdFZz H4B4SBBP1J0bTvb/act53KARJ33f5X9GkRy6w= MIME-Version: 1.0 Received: by 10.213.113.2 with SMTP id y2mr1111659ebp.25.1287085416874; Thu, 14 Oct 2010 12:43:36 -0700 (PDT) Received: by 10.14.47.14 with HTTP; Thu, 14 Oct 2010 12:43:36 -0700 (PDT) In-Reply-To: <201010102228.33095.bruce@cran.org.uk> References: <201010102228.33095.bruce@cran.org.uk> Date: Thu, 14 Oct 2010 19:43:36 +0000 Message-ID: From: "b. f." To: Bruce Cran Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-questions@freebsd.org Subject: Re: VIA EPIA 5000 and ACPI Cx levels X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: bf1783@gmail.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Oct 2010 19:43:38 -0000 On 10/10/10, Bruce Cran wrote: > On Sunday 10 October 2010 21:49:30 b. f. wrote: > >> If it has an i8254, that can also be used in one-shot mode if >> hint.attimer.0.timecounter=0 is used, since r212778. > > Thanks, I didn't know about that. After enabling it things are quite > different: kern.eventtimer.periodic is now 1, and setting > hw.acpi.cpu.cx_lowest=C2 results in 100% time being reported as being spent > in > C2 mode according to dev.cpu.0.cx_usage - using C3 causes the system to > hang. > Shouldn't a fully loaded CPU spent more time in C1 state though? When I run > a > program that results in 0% idle time cx_usage still reports that no time was > spent in C1 state. I'm not sure what is going on here: if you set hint.attimer.0.timecounter="0" and kern.eventtimer.timer="i8254" in /boot/loader.conf, then the system should try to use the i8254 in one-shot mode, unless you've specifically set periodic mode. If kern.eventtimer.periodic=1, then you are _not_ using one-shot mode. If it was 0 before your latest changes, then you were previously using one-shot mode. But, as I wrote earlier, for kern.hz<128 and kern.eventtimer.singlemul=1, periodic mode may result in more sleeping than one-shot mode, though at a price. This may be what you are seeing. The C-state used is determined in acpi_cpu_idle() in src/sys/dev/acpica/acpi_cpu.c, if you are using ACPI. I think that if the latency for the C2 state is low enough, the number of callouts and interrupts sufficiently low, and the scheduler quanta large enough, it's possible for your machine to mostly use C2 rather than C1. You can take a look at the algorithm, and make some experiments. Note that bus mastering activity, which can include routine USB polling, may prevent the use of C3. This or the high latency of C3 may account for your machine not using it. Also note that you shouldn't use a LAPIC timer if you are using C3 or deeper sleep states. b.