From nobody@FreeBSD.org  Thu Jul 19 05:03:46 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 739AB16A405
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 19 Jul 2007 05:03:46 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (groups.freebsd.org [69.147.83.33])
	by mx1.freebsd.org (Postfix) with ESMTP id 2387C13C467
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 19 Jul 2007 05:03:46 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.1/8.14.1) with ESMTP id l6J53jSp068147
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 19 Jul 2007 05:03:45 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.1/8.14.1/Submit) id l6J53jwH068146;
	Thu, 19 Jul 2007 05:03:45 GMT
	(envelope-from nobody)
Message-Id: <200707190503.l6J53jwH068146@www.freebsd.org>
Date: Thu, 19 Jul 2007 05:03:45 GMT
From: Bryan Venteicher <mr.kodaik@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [acpi] Nearly duplicate p-state entries reported
X-Send-Pr-Version: www-3.0

>Number:         114722
>Category:       kern
>Synopsis:       [acpi] [patch] Nearly duplicate p-state entries reported
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-acpi
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jul 19 05:10:01 GMT 2007
>Closed-Date:    Wed Jan 16 01:05:43 UTC 2008
>Last-Modified:  Wed Jan 16 01:10:01 UTC 2008
>Originator:     Bryan Venteicher
>Release:        7.0-Current
>Organization:
>Environment:
FreeBSD agonize.daemoninthecloset.org 7.0-CURRENT FreeBSD 7.0-CURRENT #1: Tue Jul 17 23:52:52 CDT 2007     bryanv@agonize.daemoninthecloset.org:/usr/obj/usr/src/sys/AGONIZE  amd64

>Description:
I recently purchased a Lenovo T16 laptop with a 2.0GHz Core2Duo (T7300) processor. ACPI reports nearly identical Px states:
dev.est.0.freq_settings: 2001/35000 2000/35000 1600/25000 1200/16000 800/14000

cpufreq then turns the states into the following frequencies:
dev.cpu.0.freq_levels: 2001/35000 2000/35000 1750/30625 1600/25000 1400/21875 1200/16000 1050/14000 900/12000 800/14000 700/12250 600/10500 500/8750 400/7000 300/5250

If powerd attempts to lower the processor frequency when it at the maximum, the change is rejected since the frequencies are so close:
idle time > 90%, decreasing clock speed from 2001 MHz to 2000 MHz
idle time > 90%, decreasing clock speed from 2001 MHz to 2000 MHz
idle time > 90%, decreasing clock speed from 2001 MHz to 2000 MHz
idle time > 90%, decreasing clock speed from 2001 MHz to 2000 MHz
^Z
Suspended

Manually changing the frequency to a lower value allows powerd to do its thing:
agonize# sysctl dev.cpu.0.freq=1600
dev.cpu.0.freq: 2001 -> 1600
agonize# fg
powerd -v
idle time > 90%, decreasing clock speed from 1600 MHz to 1400 MHz
idle time > 90%, decreasing clock speed from 1400 MHz to 1200 MHz
idle time > 90%, decreasing clock speed from 1200 MHz to 1050 MHz
idle time > 90%, decreasing clock speed from 1050 MHz to 900 MHz
idle time > 90%, decreasing clock speed from 900 MHz to 800 MHz
idle time > 90%, decreasing clock speed from 800 MHz to 700 MHz
idle time > 90%, decreasing clock speed from 700 MHz to 600 MHz
idle time > 90%, decreasing clock speed from 600 MHz to 500 MHz
idle time > 90%, decreasing clock speed from 500 MHz to 400 MHz
idle time > 90%, decreasing clock speed from 400 MHz to 300 MHz

>How-To-Repeat:

>Fix:
--- acpi_perf.c.old     2007-07-18 23:49:28.659122750 -0500
+++ acpi_perf.c 2007-07-18 23:48:45.651093335 -0500
@@ -301,8 +301,8 @@
 
                /* Check for duplicate entries */
                if (count > 0 &&
-                   sc->px_states[count - 1].core_freq ==
-                       sc->px_states[count].core_freq)
+                   CPUFREQ_CMP(sc->px_states[count - 1].core_freq,
+                       sc->px_states[count].core_freq))
                        continue;
 
                count++;
@@ -593,4 +593,3 @@
                *type |= CPUFREQ_FLAG_INFO_ONLY;
        return (0);
 }


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-acpi 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Jul 19 05:56:54 UTC 2007 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=114722 

From: Simon Barner <barner@FreeBSD.org>
To: "mailto:bug-followup"@FreeBSD.org, mr.kodaik@gmail.com
Cc:  
Subject: Re: kern/114722: [acpi] [patch] Nearly duplicate p-state entries
	reported
Date: Wed, 31 Oct 2007 20:03:59 +0100

 I can confirm that this patch makes powered work in adaptive mode on
 my Lenovo T61.
 
 Simon
State-Changed-From-To: open->closed 
State-Changed-By: njl 
State-Changed-When: Wed Jan 16 01:04:56 UTC 2008 
State-Changed-Why:  
Patch committed as rev 1.29 kern_cpu.c and will be MFCd for 7.0 

http://www.freebsd.org/cgi/query-pr.cgi?pr=114722 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/114722: commit references a PR
Date: Wed, 16 Jan 2008 01:05:28 +0000 (UTC)

 njl         2008-01-16 01:05:22 UTC
 
   FreeBSD src repository
 
   Modified files:
     sys/kern             kern_cpu.c 
   Log:
   Remove duplicate cpufreq levels, i.e. ones that are within 25 Mhz of each
   other.  The first one survives, the rest are removed.  So far, it appears
   only some acpi_perf(4) BIOS tables have these invalid states, but address
   this in the core to be sure to handle other potential driver data.
   
   PR:             kern/114722
   Tested by:      stefan.lambrev / moneybookers.com
   MFC after:      3 days
   
   Revision  Changes    Path
   1.29      +11 -0     src/sys/kern/kern_cpu.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
