From owner-freebsd-acpi@FreeBSD.ORG Tue Jul 12 20:34:43 2011 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 17A7B1065670; Tue, 12 Jul 2011 20:34:43 +0000 (UTC) (envelope-from vmagerya@gmail.com) Received: from mail-vx0-f182.google.com (mail-vx0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id 6AEA78FC0C; Tue, 12 Jul 2011 20:34:42 +0000 (UTC) Received: by vxg33 with SMTP id 33so5165825vxg.13 for ; Tue, 12 Jul 2011 13:34:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Y/QwccWgAL+hqmaRaqdM5a0Nd9W7cmRd8aExtFgHpsQ=; b=FtjgIU0m6CcifR64ejeb7PxzxA8mipSfJ83WnlLYbwSgrDb/vvPNIbcqIWy2XxRFPp qJANcLPjuZ485B85Mk6mm22OKpzfz/zuIXvMVw1RyRqRAotp99dGUadgxA2ZEE6ZaLVn XIXZfITIe9bdFmp9AM9BoAbbc7dmHqzCtF0LU= MIME-Version: 1.0 Received: by 10.52.175.7 with SMTP id bw7mr471509vdc.32.1310502881374; Tue, 12 Jul 2011 13:34:41 -0700 (PDT) Received: by 10.52.188.193 with HTTP; Tue, 12 Jul 2011 13:34:40 -0700 (PDT) In-Reply-To: <4E1C6626.7030108@FreeBSD.org> References: <4E05EB91.9090509@FreeBSD.org> <4E0862A0.7060405@FreeBSD.org> <4E09BADF.7050702@FreeBSD.org> <4E0A41C8.3000904@FreeBSD.org> <4E0CE158.6030804@FreeBSD.org> <4E0DB58F.4070906@FreeBSD.org> <4E130154.9080809@FreeBSD.org> <4E146FDB.2020602@FreeBSD.org> <4E16F61E.80201@FreeBSD.org> <4E1C6626.7030108@FreeBSD.org> Date: Tue, 12 Jul 2011 23:34:40 +0300 Message-ID: From: Vitaly Magerya To: Andriy Gapon Content-Type: text/plain; charset=UTF-8 Cc: freebsd-acpi@freebsd.org Subject: Re: (Missing) power states of an Atom N455-based netbook X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2011 20:34:43 -0000 Andriy Gapon wrote: > on 11/07/2011 19:07 Vitaly Magerya said the following: >> Can you elaborate? From my reading, the only place cpu_cx_lowest >> is used is in acpi_cpu_notify, where sc->cpu_cx_lowest is optionally >> increased to min(cpu_cx_lowest, sc->cpu_cx_count - 1), which should >> be safe in any situation. > > This is exactly the place that I am concerned about. > Probably my mind is clouded but I can not understand why > acpi_cpu_set_cx_lowest() > call is under the condition: > if (sc->cpu_cx_lowest < cpu_cx_lowest) > acpi_cpu_set_cx_lowest(sc, min(cpu_cx_lowest, sc->cpu_cx_count - 1)); > > If you or someone else can explain to me why that condition is there... Now that I think about it, yes it does look like a bug. Here's how to trigger it: 1. Kill devd. 2. Make sure you've got C3, set hw.acpi.cpu.cx_lowest to C3. 3. Plug the power cord in (only C2 is now reported). 4. Look at dev.cpu.N.cx_lowest: it's still C3, even though dev.cpu.N.cx_supported only has C1 and C2. This happens because normally sc->cpu_cx_lowest == cpu_cx_lowest, so the update isn't executed, and sc->cpu_cx_lowest remains as before. In short, that update should probably be executed unconditionally.