Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to check CPU voltage...
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2  
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
impact0r
n00b
n00b


Joined: 24 Feb 2012
Posts: 63

PostPosted: Sun Mar 04, 2012 11:51 pm    Post subject: Reply with quote

haarp wrote:
You don't have the msr module loaded

Darn, I thought about it a minute after posting.

So, I am getting this
Code:
06174b2706004b17

Would that be the same V for both cores?
Would you know how could I feed it to conky to make it display the Voltages in proper digits?
Back to top
View user's profile Send private message
haarp
Guru
Guru


Joined: 31 Oct 2007
Posts: 372

PostPosted: Mon Mar 05, 2012 8:43 am    Post subject: Reply with quote

The last 2 digits are 17, which is 24 in decimal. Insert that in the formula and you get exactly 1V.

The 2 digits before that are 4b. b is 11 in decimal, and the 4 means to add another 0.5. Your current CPU multiplier is 11.5 :P Assuming 200MHz FSB, that's 2.3GHz core clock.

You can check each individual core by running rdmsr with -p0 and -p1. On a C2D, I think each core runs in the same state anyway, so both should be the same.
Extracting that information is possible with a bit of dirty messing in bash. I don't know how to get it into conky though.
Back to top
View user's profile Send private message
impact0r
n00b
n00b


Joined: 24 Feb 2012
Posts: 63

PostPosted: Mon Mar 05, 2012 8:51 am    Post subject: Reply with quote

Yes, this is Core 2 Duo, but only 2.1Ghz (ThinkPad R61).

I do have a modded bios that enables Intel Dynamic Acceleration (IDA) on Both Cores of Core 2 Duo processor, which should translate into top of 2.3Ghz, but as far as I know some work is required for the linux to actually take advantage of it (like here http://forum.notebookreview.com/windows-os-software/477704-how-enable-intel-dynamic-acceleration-ida-both-cores-core-2-duo-35.html#post7717709), but I am not sure I understand what needs to be done. Also, conky that displays my CPU frequency updated every second never goes beyond 2100MHz.
Back to top
View user's profile Send private message
haarp
Guru
Guru


Joined: 31 Oct 2007
Posts: 372

PostPosted: Mon Mar 05, 2012 8:54 am    Post subject: Reply with quote

It probably runs in Dual IDA mode then. Linux tends to display a wrong core clock because it relies on the state table it gets from the CPU. You can use benchmarks to verify the increased speed, or use CPU-Z in Wine to read the core clock (it will not display much else, but core clock will be correct)

In fact, I have written a throttlestop-like script for Linux. I could upload it if you're interested. It's optimized for my Core 2 Extreme, but should work on all Core2.
Back to top
View user's profile Send private message
impact0r
n00b
n00b


Joined: 24 Feb 2012
Posts: 63

PostPosted: Mon Mar 05, 2012 9:08 am    Post subject: Reply with quote

Strange, I run CPUz 64bit and all I got was constant 2094Mhz even when conky shows it being downlocked to 800Mhz

What does your script do exactly?
Back to top
View user's profile Send private message
haarp
Guru
Guru


Joined: 31 Oct 2007
Posts: 372

PostPosted: Mon Mar 05, 2012 9:17 am    Post subject: Reply with quote

CPU-Z loads the CPU for short bursts of time. So under Linux, it will always jump into the highest P-state during that.

The script is designed to overclock Core 2 Extreme/ES CPUs or undervolt any Core 2 CPU. It may or may not work with dual IDA, but I'm curious to find out!

Code:
#!/bin/bash

# c2e-overclock v0.5.5 by haarp (main.haarp ÄT gmail DÖT com)
# License: Free to use, modify and distribute anywhere for non-commercial use
# as long as the author is credited. Permission is required for commercial use.
# If you modify this, please let the author know so he can improve it.

# TODO: more sanity checks and strip 0x on payload if present

# Uses the following MSRs:
# FLEX_RATIO (0x194)      controls maximum FID/VID on Extreme/ES CPUs
# IA32_PERF_STATUS (0x198)   shows min, max, current FID/VID
# IA32_PERF_CTL (0x199)      requests a new FID/VID
# IA32_CLOCK_MODULATION (0x19A)   shows/controls clock modulation

# default (X9100): 266x   11.5 @ 1.1875V - 4B26
# undervolt:      11.5 @ 1.0500V - 4B1B !! may need more voltage
# overclock 1:      12.5 @ 1.1875V - 4C26 (may need clockmod)
# overclock 2:      13.0 @ 1.2125V - 0D28 (needs clockmod) !! may need more voltage
# overclock 3:      13.5 @ 1.2625V - 4D2C (overload!)

enableoc() {
   if [[ $oldgovernor && ! $(echo $payload | cut -b 1-2) = $(echo $oldpayload | cut -b 1-2) ]]; then
      echo "New clockspeed differs, disabling CPU frequency scaling."
      for i in $cpulist; do
         echo performance >/sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor
      done
      changedgovernor=1
   fi

   echo "Switching CPU to 0x$payload."
   setclock $payload
}
disableoc() {
   echo "Restoring CPU to 0x$oldpayload."
   setclock $oldpayload

   if [[ $changedgovernor ]]; then
      echo "Restoring CPU governor to $oldgovernor."
      for i in $cpulist; do
         echo $oldgovernor >/sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor
      done
   fi
}

setclock() {
   for i in $cpulist; do
      wrmsr -p$i 0x194 0x1$1 #change maximum fid/vid
      wrmsr -p$i 0x199 0x$1 #apply new fid/vid
   done
}
clockmod() {
   for i in $cpulist; do
      wrmsr -p$i 0x19A 0x00
   done
}

loadchecks() {
   [[ $(id -u) = "0" ]] || { echo "Not running as root, aborting!"; exit 1; }
   test -c /dev/cpu/0/msr || {  echo "msr module not loaded, aborting!"; exit 1; }
   which wrmsr &>/dev/null || { echo "Could not find wrmsr, aborting!"; exit 1; }
   which rdmsr &>/dev/null || { echo "Could not find rdmsr, aborting!"; exit 1; }

   cpulist=$(grep processor /proc/cpuinfo | awk '{print $3}')
   oldpayload=$(rdmsr -0 0x198 | cut -b 5-8)
   test -e /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor && \
      oldgovernor=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)

}

calcclock() {
   multprefix=$(( 0x$(echo $payload | cut -b 2) ))
   if [[ $(echo $payload | cut -b 1) = 4 ]]; then multsuffix=".5"; else multsuffix=".0"; fi
   multi=$(echo -n "$multprefix$multsuffix")
   voltagem=$(echo "scale=3; 0.7125 + $((0x$(echo $payload | cut -b 3-4) ))*0.0125" | bc)
   voltaged=$(echo "scale=3; 0.8250 + $((0x$(echo $payload | cut -b 3-4) ))*0.0125" | bc)
}

usage() {
   echo "Overclock Intel Core 2 Extreme/ES CPUs or undervolt any Core 2 CPU"
   echo "USE AT YOUR OWN RISK! VERIFY YOUR SETTINGS OR SYSTEM STABILITY MIGHT SUFFER!"
   echo "OC doesnt work with programs that interfere with CPU freq scaling or write MSRs"
   echo "(Linux-PHC, Cpufrequtils, Cpudyn, Powernowd, cpufreqd, cpufreq-applet, etc.)"

   echo -e "\nUsage: $(basename "$0") -p XXXX [-c|-y|-h]"
   echo "Example: '$(basename "$0") -p 4b26 -c' -> x11.5, 1.1875V, disable clockmod"

   echo -e "\n-p XXXX   FID/VID selection, uses 4 hex digits, right->left:"
   echo "   Digit 0-1 = VID      -> U(in V) = 0.7125 + VID*0.0125   (mobile CPUs)"
   echo "                           U(in V) = 0.8250 + VID*0.0125   (desktop CPUs)"
   echo "   Digit 2   = FID      -> Multiplier = FID"
   echo "   Digit 3   = Half-FID -> +0.5 to Multi = 4; +0 to Multi = 0"
   echo "-c   Disable Clock Modulation"
   echo "   Clockmod periodically checks power consumption on some laptops and"
   echo "   engages if it deems it too high (slows down CPU in 12.5% increments)"
   echo "   Disabling this is DANGEROUS and might OVERLOAD the power supply!"
   echo "-y   Assume yes at prompt"
   echo "-h   This help"
}

while getopts ":cyhp:" opt; do
   case $opt in
      p) payload=$OPTARG;;
      c) c=1;;
      y) y=1;;
      h) usage; exit;;
      \?) echo -e "Invalid option: -$OPTARG\nUse -h for help."; exit 1;;
      :) echo -e "Option -$OPTARG requires an argument\nUse -h for help"; exit 1;;
   esac
done
if [[ ! ${#payload} = 4 ]]; then echo -e "No or invalid FID/VID supplied\nUse -h for help"; exit 1; fi

loadchecks

if [[ ! $y ]]; then
   calcclock
        read -p "Would switch CPU to x$multi @ ${voltagem}V/${voltaged}V (mobile/desktop) (0x$payload). Continue? [y/n] " reply
        if [[ ! $reply = [yY] && ! $reply = [yY][eE][sS] ]]; then echo "Aborting!"; exit; fi
fi

trap "disableoc; exit 0" SIGHUP SIGINT SIGTERM
enableoc

#enter infinite loop until terminated
if [[ $c ]]; then
   echo "Forcing clock modulation..."
   while true; do clockmod; sleep 0.25; done
else
   while true; do sleep 0.25; done  #trap cant interrupt sleep, so use very short sleep
fi


Try it with -p 4b17
Back to top
View user's profile Send private message
impact0r
n00b
n00b


Joined: 24 Feb 2012
Posts: 63

PostPosted: Mon Mar 05, 2012 9:37 am    Post subject: Reply with quote

The thing is I already have PHC undervolting my CPU (at least I hope so as I cannot check the Voltage). Do I need to disable something beforehand?
Back to top
View user's profile Send private message
haarp
Guru
Guru


Joined: 31 Oct 2007
Posts: 372

PostPosted: Mon Mar 05, 2012 9:42 am    Post subject: Reply with quote

Oh, I see. That's why you're running at 4b17 instead of 4b27. I was wondering. Be careful, your CPU might need more voltage to run at 2.3GHz. Better try my script with -p 4b27 first.

Yes, you will have to disable PHC for this script to work. The script can do undervolting itself, but not dynamically like PHC. It's either OC, or undervolt.

I am switching between both modes on my laptop based on the AC plug state. On AC -> overclock, on battery -> undervolt.


(It's also possible that PHC is what's preventing dual IDA from working in the first place. Maybe disabling it is all that's needed)
Back to top
View user's profile Send private message
impact0r
n00b
n00b


Joined: 24 Feb 2012
Posts: 63

PostPosted: Mon Mar 05, 2012 10:04 am    Post subject: Reply with quote

So your scrpt makes the CPU run at 100% (or 110%) at all times when on AC, regardless of system load?
Hmm, I quite like the dynamic undervolting.

Do you have an idea how to enable conky to call rdmsr which requires sudo to read 0x198 record?
Back to top
View user's profile Send private message
haarp
Guru
Guru


Joined: 31 Oct 2007
Posts: 372

PostPosted: Mon Mar 05, 2012 10:34 am    Post subject: Reply with quote

impact0r wrote:
So your scrpt makes the CPU run at 100% (or 110%) at all times when on AC, regardless of system load?

Yes. There's nothing I can do about that. PHC would screw up my settings and regular acpi_cpufreq doesn't work properly with this script.
I don't really care though, I don't see the point in saving energy when on AC. The power consumption is almost negligible on mobile CPUs. So what if I'm sucking 10W more out of the wall socket? :P

If have tried contacting the PHC developers to ask them whether they would want to implement my OC method, but their IRC channel is ignored.

I don't use conky, so I can't help you there.


btw, I would still appreciate if you could test my script. I'm curious to know whether it allows dual IDA to work.
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2347

PostPosted: Thu Nov 01, 2012 3:04 am    Post subject: Reply with quote

NeddySeagoon wrote:
impact0r, Welcome to Gentoo

NeddySeagoon ... actually we have just discovered in another thread that impact0r is infact an Arch Linux user and not a Gentoo user. They are just here for the support provided.

best ... khay
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum