|
FreeBSD General Other questions regarding FreeBSD which do not fit in any of the categories below. |
|
Thread Tools | Display Modes |
|
|||
Is powerd really working?
Hi,
I have boxes with 6.2-x86 to 7.0-amd64 with CPUs from AMD and Intel ranging between Athlon64, Pentium4, Xeon processors. OK I have setup powerd and when I run powerd I see (for example): idle time > 90%, decreasing clock speed from 2978 MHz to 2605 MHz idle time > 90%, decreasing clock speed from 2605 MHz to 2233 MHz idle time > 90%, decreasing clock speed from 2233 MHz to 1861 MHz idle time > 90%, decreasing clock speed from 1861 MHz to 1489 MHz idle time > 90%, decreasing clock speed from 1489 MHz to 1116 MHz idle time > 90%, decreasing clock speed from 1116 MHz to 744 MHz idle time > 90%, decreasing clock speed from 744 MHz to 372 MHz and sysctl's seem to be in order: dev.cpu.0.freq: 372 dev.cpu.0.freq_levels: 2978/-1 2605/-1 2233/-1 1861/-1 1489/-1 1116/-1 744/-1 372/-1 dev.p4tcc.0.freq_settings: 10000/-1 8750/-1 7500/-1 6250/-1 5000/-1 3750/-1 2500/-1 1250/-1 dev.cpufreq.0.%driver: cpufreq dev.cpufreq.0.%parent: cpu0 However, I downloaded acpi_ppc from http://www.spa.is.uec.ac.jp/~nfukuda/software/ and there comes a program called chkfreq with it which measures the cpu time. It always shows the maximum speed. For example 2992751205 for 3ghz P4 (from the above examples) regardless of what freq is set. OK lets say the chkfreq is faulty, but I tested this on another machine with 6.2 box with: CPU: AMD Athlon(tm) 64 Processor 3500+ (2202.83-MHz 686-class CPU) and acpi_ppc says: cpu0: Px state: P0, 2200MHz, 89000mW, 100us, 7us cpu0: Px state: P1, 2000MHz, 69000mW, 100us, 7us cpu0: Px state: P2, 1800MHz, 50000mW, 100us, 7us cpu0: Px state: P3, 1000MHz, 22000mW, 100us, 7us cpu0: Px method: AMD K8 Cool'n'Quiet and when at 1000mhz chkfreq shows 1001297861 when I unload acpi_ppc it shows 2202845489. Then I load cpufreq and I see: powernow0: <Cool`n'Quiet K8> on cpu0 and run powerd dev.cpu.0.freq: 1000 dev.cpu.0.freq_levels: 2200/89000 2000/69000 1800/50000 1000/22000 dev.powernow.0.freq_settings: 2200/89000 2000/69000 1800/50000 1000/22000 dev.cpufreq.0.%driver: cpufreq dev.cpufreq.0.%parent: cpu0 but when I run chkfreq I get 2202846202 (I checked with -v, powerd does not increase speed while testing) I tested powerd on several machines with p4, athlon64, xeon processors and it seems to work in none of the machines properly. Does anybody know how any way to check for sure if powerd is really working or not? Thanks, Evren |
|
|||
What does acpi_ppc actually check and when? Have you tried using sysctl to check on cpufreq?
|
|
|||
The sysctl shows that the cpu frequency is lowered, acpi_ppc is similar to cpufreq and it doesnt check the speed. There comes a small program with acpi_ppc called chkfreq. This chkfreq program uses the RDTSC assembly command to determine the processor speed:
http://en.wikipedia.org/wiki/RDTSC I think you didnt understand the problem here. What I am saying is that the sysctl is showing wrong processor speed than the actual processor speed in all my machines. In essence, cpufreq is doing nothing and faking us that it changed the speed but the speed doesnt change. Got it? |
|
|||
Look, there's no need to attack someone that is trying to help you. I suggest that if you need help and someone tries to help you, you respond politely. Nobody on these forums needs to help anybody, we do it because we want to help. If you attack someone, then nobody else will likely help you.
If the responder didn't understand the question you have asked, then maybe you can re-word it politely to more accurately ask what you want. No need for things like "Got it" and such.
__________________
I just saved a bunch of money on my car insurance by fleeing the scene of the accident! |
|
|||
I didnt think that 'got it?' was offensive, sorry. I wanted to mean 'do you understand now?' (or is that offensive to ask somebody that too?) perhaps you should excuse me as English is not my native language.
|
|
|||
I apologize, as I misconstrued your tone.
It's easy to misunderstand tones when all you have to go on is typed words. Again, I apologize.
__________________
I just saved a bunch of money on my car insurance by fleeing the scene of the accident! |
|
|||
It is ok. I know that I make this kind of mistakes from time to time. As I said, english is not my native language so I dont always realize what is offensive and not. Thanks for the warning anyway, I will try to be more careful with my choice of words in future.
Back to the subject, I am putting in the source of the chkfreq program below. This is the same program which ships with acpi_ppc. If you are using cpufreq/powerd then please copy/paste this code into a text file and compile and see your processor and check if sysctl is reporting correctly in your case. I think, most of the time cpufreq is doing nothing but it is saying that it is doing something. I was fooled earlier that I thought cpufreq was working but now I am pretty sure that it is doing nothing. Code:
/* * chkfreq.c * * usage: chkfreq [count] */ #include <sys/types.h> #include <sys/time.h> #include <stdio.h> #include <stdlib.h> #include <time.h> static __inline u_int64_t rdtsc(void) { u_int32_t eax, edx; __asm __volatile("rdtsc" : "=a" (eax), "=d" (edx)); return (((u_int64_t)edx << 32) | (u_int64_t)eax); } int main(int argc, char *argv[]) { int n = 1; u_int64_t t1, t2; struct timeval tv1, tv2; struct timespec ts; if (argc > 1) n = atoi(argv[1]); while (n-- > 0) { t1 = rdtsc(); gettimeofday(&tv1, NULL); ts.tv_sec = 0; ts.tv_nsec = 990000000; nanosleep(&ts, NULL); do { t2 = rdtsc(); gettimeofday(&tv2, NULL); tv2.tv_usec += (tv2.tv_sec - tv1.tv_sec) * 1000000; tv2.tv_usec -= tv1.tv_usec; } while (tv2.tv_usec < 1000000); printf("%llu\n", t2 - t1); } return 0; } Evren |
|
|||
Why the seeds of mistrust? Have you overlooked cpufreq source code at least for comparison? Don't get me insulting, but you just sound like "They're cheating us!!!"
IMO, I'd rather trust the utility that exists since 5.(4?) release of FreeBSD as a system component, rather some external softget. |
|
|||
radcapricorn, I already explained why I think it doesnt work and I also gave you a way to test it on your own. Please read my posts as a whole.
What is inside the cpufreq code is not relevant as you can figure out if it works or not by comparing the processor frequency with what the cpufreq sysctl says only. So I explained how I tested the situation and how I test to see if cpufreq is working or not, back to my question, how do 'you' test that cpufreq works? Thanks, Evren |
|
|||
Quote:
Quote:
cpufreq speaks to drivers that do the actual work. Generally, if ACPI system/drivers on your box may lie, so may cpufreq. But in that case it's not powerd/cpufreq fault anymore. Quote:
|
|
|||
Quote:
Also, if you read my first post, I already mentioned that powerd is not increasing the speed during the test. I have verified this by running powerd with -v switch. Actually even more, I have changed the chkfreq's freq sysctl manually without running powerd at all. So there cant be any such issue. Can you explain why you think that cpufreq is working? I mean how do you come to this conclusion? I took it granted that it didnt give errors so it must be working until today myself. But now I see that I was wrong. Quote:
But if cpufreq doesnt work but acpi_ppc works then wouldnt you say that there is a problem in cpufreq which should be fixed? because it is obviously lying to people and it can be fixed? Quote:
I asked this to you in my previous post also. How do you know that cpufreq really works? If you cant give a solid, verifiable answer to this question then it means that it is not a fact that it works, it is your opinion/view that it works which can be right or wrong (which makes an opinion without proof mostly useless eh?) Please understand that I am not trying to be offensive here, but I have put my case with a lot of information and examples and I am getting answers which ignores and omits all those information. I just dont like explaining all again and again. Thanks, Evren |
|
||||||||
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Oh and BTW, have you checked temperature counts while using cpufreq? Don't they change a bit? Mine do. Quote:
Quote:
|
|
|||||
Quote:
In either case, if the processor was slowed down the results wouldnt always show the full speed of the processor. Also if chkfreq didnt work properly then this doesnt explain how it is able to give perfectly correct results when acpi_ppc is used. That said, I am open to suggestions, if you know anything else which can detect running cpu frequency more accurately please let me know. Quote:
You dont know if this is true or not because your assumption is based on sysctl value showing the correct cpu frequency which can be wrong. So you can not say with a high level of certainty that it is false or true. Quote:
Quote:
I tested this by running ubench until the temperature stabilize and used mbmon: CPU: Intel(R) Pentium(R) 4 CPU 3.06GHz (3059.02-MHz 686-class CPU) Lowest speed: dev.cpu.0.freq: 1141 dev.cpu.0.freq_levels: 3044/-1 2663/-1 2283/-1 1902/-1 1522/-1 1141/-1 dev.p4tcc.0.freq_settings: 10000/-1 8750/-1 7500/-1 6250/-1 5000/-1 3750/-1 dev.p4tcc.1.freq_settings: 10000/-1 8750/-1 7500/-1 6250/-1 5000/-1 3750/-1 Temp.= 33.0, 35.0, 61.5; Rot.= 0, 2766, 0 Vcore = 1.55, 3.18; Volt. = 3.38, 5.03, 11.37, -14.92, -7.66 Highest speed: dev.cpu.0.freq: 3044 dev.cpu.0.freq_levels: 3044/-1 2663/-1 2283/-1 1902/-1 1522/-1 1141/-1 dev.p4tcc.0.freq_settings: 10000/-1 8750/-1 7500/-1 6250/-1 5000/-1 3750/-1 dev.p4tcc.1.freq_settings: 10000/-1 8750/-1 7500/-1 6250/-1 5000/-1 3750/-1 Temp.= 33.0, 41.5, 60.0; Rot.= 0, 2812, 0 Vcore = 1.54, 3.17; Volt. = 3.36, 5.08, 11.49, -14.92, -7.66 chkfreq reports about 3059380132 for both... temperature was fluctuating between 60-62 As you can see, sysctl is not very trustable. If I were you I wouldnt be blindly trusting it. Cpufreq is failing on some machines without giving errors. Quote:
Thanks, Evren |
|
|||
My apologies, the cpufreq seems to be working. I dont know how I thought otherwise at first place. Maybe too little sleep However I am now checking all the boxes 1by1 again. I will let you know if I find something weird about this.
|
|
||||
yurtesen,
in the code you gave i am wondering why a 1 sec delay wasn't used directly like: Code:
while (n-- > 0) { __asm__ __volatile__ ("rdtsc" : "=A" (t1)); ts.tv_sec = 1; ts.tv_nsec = 0; nanosleep(&ts, NULL); __asm__ __volatile__ ("rdtsc" : "=A" (t2)); printf("%llu\n", t2 - t1); } |
|
|||
2 yurtesen:
It may well be cpufreq WILL fail on some (unsupported) architecture. And the investigation you started is generally a good thing to do. For example, right now I have some issues with pppd and cannot get any feedback on my problems so the only options I have is to negotiate the developers or to dig through OS source Now, 2 ephemera: This is an OT actually, but as the topic is closed by now (is it?), I may try: nanosleep is a function. How it is implemented, you do not know. Who knows, maybe it is doing some funny things with the CPU, so there is no guarantee that after it you'll get the needed result from rdtsc. Of course, this is a mere guess Last edited by radcapricorn; 12th June 2008 at 11:12 PM. Reason: Overquoting removed |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Working with CVS? | Zmyrgel | OpenBSD General | 15 | 6th October 2009 01:32 PM |
x11 forwarding over ssh not working | kasse | OpenBSD General | 14 | 23rd December 2008 02:21 PM |
pf: why is that rule not working? | ivanatora | FreeBSD General | 14 | 11th December 2008 09:32 AM |
USB not working after suspend | stukov | Other BSD and UNIX/UNIX-like | 5 | 11th August 2008 06:48 PM |
Crontab not working | beandip | FreeBSD General | 6 | 6th August 2008 08:33 PM |