From owner-freebsd-ports-bugs@FreeBSD.ORG Thu Feb 3 00:00:27 2011 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B50A2106566C for ; Thu, 3 Feb 2011 00:00:27 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 8C7998FC17 for ; Thu, 3 Feb 2011 00:00:27 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p1300Rl9082318 for ; Thu, 3 Feb 2011 00:00:27 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p1300ROH082300; Thu, 3 Feb 2011 00:00:27 GMT (envelope-from gnats) Resent-Date: Thu, 3 Feb 2011 00:00:27 GMT Resent-Message-Id: <201102030000.p1300ROH082300@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Thomas Bach Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A60B106566C for ; Wed, 2 Feb 2011 23:57:39 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 2F96F8FC12 for ; Wed, 2 Feb 2011 23:57:39 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p12NvcsQ044882 for ; Wed, 2 Feb 2011 23:57:38 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id p12Nvc2x044881; Wed, 2 Feb 2011 23:57:38 GMT (envelope-from nobody) Message-Id: <201102022357.p12Nvc2x044881@red.freebsd.org> Date: Wed, 2 Feb 2011 23:57:38 GMT From: Thomas Bach To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: ports/154474: [PATCH] cpupowerd cannot calculate FIDs from dev.cpu.x.freq_levels X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Feb 2011 00:00:27 -0000 >Number: 154474 >Category: ports >Synopsis: [PATCH] cpupowerd cannot calculate FIDs from dev.cpu.x.freq_levels >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Feb 03 00:00:26 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Thomas Bach >Release: 8.2-PRERELEASE >Organization: >Environment: # uname -a FreeBSD taris.fritz.box 8.2-PRERELEASE FreeBSD 8.2-PRERELEASE #0: Sun Jan 30 14:50:11 CET 2011 root@taris.fritz.box:/usr/obj/usr/src/sys/GENERIC amd64 >Description: cpupword tries to determine FIDs from the frequencies from dev.cpu.x.freq_levels which reports wrong levels: # sysctl dev.cpu.0.freq_levels dev.cpu.0.freq_levels: 2500/50000 2400/46099 2200/38878 2000/32400 1800/26625 1575/23296 1350/19968 1125/16640 1000/12800 875/11200 750/9600 625/8000 500/6400 375/4800 250/3200 125/1600 to calculate the actual fid it executes: # grep '\-\ 8' * msr_amd.c: *fid = (frequency/100) - 8; Returning '-7' when coming to the frequency 125: # /usr/local/sbin/cpupowerd -s cpupowerd 0.2.1 written by Markus Strobl. WARNING: This program could cause damage to your Hardware! FID (-7) out of range! Initialisation failed! >How-To-Repeat: Running 'cpupowerd -s' on an amd64 # cat /usr/compat/linux/proc/cpuinfo processor : 0 vendor_id : AuthenticAMD cpu family : 15 model : 1 model name : AMD Athlon(tm) Dual Core Processor 4850e stepping : 2 processor : 1 vendor_id : AuthenticAMD cpu family : 15 model : 1 model name : AMD Athlon(tm) Dual Core Processor 4850e stepping : 2 flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 b19 mmx fxsr xmm sse2 cpu MHz : 2506.52 bogomips : 2506.52 (Yet I don't know how to extract the information with freebsd commands :P) >Fix: dev.powernow.0.freq_settings gives the right possible frequencies on my system/cpu. So the quick fix is to change the line snprintf(levels_sysctl, sizeof(levels_sysctl), "dev.cpu.%d.freq_levels", mastercpuid); to snprintf(levels_sysctl, sizeof(levels_sysctl), "dev.powernow.%d.freq_settings", mastercpuid); # diff /tmp/cpu_bsd.c cpu_bsd.c 426c426 < snprintf(levels_sysctl, sizeof(levels_sysctl), "dev.powernow.%d.freq_settings", mastercpuid); --- > snprintf(levels_sysctl, sizeof(levels_sysctl), "dev.cpu.%d.freq_levels", mastercpuid); Anyway, having dev.cpu.0.freq_levels reporting the right frequencies would be much cleaner. >Release-Note: >Audit-Trail: >Unformatted: