diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-04 19:21:26 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-04 19:21:26 -0500 |
commit | 0356dbb7fe87ba59558902e536d9f960e87353c1 (patch) | |
tree | 2cb23f809c838f0bd7406845ea0a8e7cb5875c99 | |
parent | e28cc71572da38a5a12c1cfe4d7032017adccf69 (diff) | |
parent | 95235ca2c20ac0b31a8eb39e2d599bcc3e9c9a10 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq
-rw-r--r-- | Documentation/cpu-freq/governors.txt | 62 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c | 3 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/cpufreq/powernow-k8.c | 50 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/cpufreq/powernow-k8.h | 9 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/cpufreq/speedstep-ich.c | 47 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/cpufreq/speedstep-lib.c | 32 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/cpufreq/speedstep-lib.h | 1 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/cpufreq/speedstep-smi.c | 1 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/proc.c | 6 | ||||
-rw-r--r-- | arch/ia64/kernel/setup.c | 8 | ||||
-rw-r--r-- | arch/x86_64/kernel/setup.c | 6 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 24 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq_conservative.c | 10 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq_ondemand.c | 10 | ||||
-rw-r--r-- | include/linux/cpufreq.h | 10 |
15 files changed, 220 insertions, 59 deletions
diff --git a/Documentation/cpu-freq/governors.txt b/Documentation/cpu-freq/governors.txt index 933fae74c337..f4b8dc4237e6 100644 --- a/Documentation/cpu-freq/governors.txt +++ b/Documentation/cpu-freq/governors.txt | |||
@@ -27,6 +27,7 @@ Contents: | |||
27 | 2.2 Powersave | 27 | 2.2 Powersave |
28 | 2.3 Userspace | 28 | 2.3 Userspace |
29 | 2.4 Ondemand | 29 | 2.4 Ondemand |
30 | 2.5 Conservative | ||
30 | 31 | ||
31 | 3. The Governor Interface in the CPUfreq Core | 32 | 3. The Governor Interface in the CPUfreq Core |
32 | 33 | ||
@@ -110,9 +111,64 @@ directory. | |||
110 | 111 | ||
111 | The CPUfreq govenor "ondemand" sets the CPU depending on the | 112 | The CPUfreq govenor "ondemand" sets the CPU depending on the |
112 | current usage. To do this the CPU must have the capability to | 113 | current usage. To do this the CPU must have the capability to |
113 | switch the frequency very fast. | 114 | switch the frequency very quickly. There are a number of sysfs file |
114 | 115 | accessible parameters: | |
115 | 116 | ||
117 | sampling_rate: measured in uS (10^-6 seconds), this is how often you | ||
118 | want the kernel to look at the CPU usage and to make decisions on | ||
119 | what to do about the frequency. Typically this is set to values of | ||
120 | around '10000' or more. | ||
121 | |||
122 | show_sampling_rate_(min|max): the minimum and maximum sampling rates | ||
123 | available that you may set 'sampling_rate' to. | ||
124 | |||
125 | up_threshold: defines what the average CPU usaged between the samplings | ||
126 | of 'sampling_rate' needs to be for the kernel to make a decision on | ||
127 | whether it should increase the frequency. For example when it is set | ||
128 | to its default value of '80' it means that between the checking | ||
129 | intervals the CPU needs to be on average more than 80% in use to then | ||
130 | decide that the CPU frequency needs to be increased. | ||
131 | |||
132 | sampling_down_factor: this parameter controls the rate that the CPU | ||
133 | makes a decision on when to decrease the frequency. When set to its | ||
134 | default value of '5' it means that at 1/5 the sampling_rate the kernel | ||
135 | makes a decision to lower the frequency. Five "lower rate" decisions | ||
136 | have to be made in a row before the CPU frequency is actually lower. | ||
137 | If set to '1' then the frequency decreases as quickly as it increases, | ||
138 | if set to '2' it decreases at half the rate of the increase. | ||
139 | |||
140 | ignore_nice_load: this parameter takes a value of '0' or '1', when set | ||
141 | to '0' (its default) then all processes are counted towards towards the | ||
142 | 'cpu utilisation' value. When set to '1' then processes that are | ||
143 | run with a 'nice' value will not count (and thus be ignored) in the | ||
144 | overal usage calculation. This is useful if you are running a CPU | ||
145 | intensive calculation on your laptop that you do not care how long it | ||
146 | takes to complete as you can 'nice' it and prevent it from taking part | ||
147 | in the deciding process of whether to increase your CPU frequency. | ||
148 | |||
149 | |||
150 | 2.5 Conservative | ||
151 | ---------------- | ||
152 | |||
153 | The CPUfreq governor "conservative", much like the "ondemand" | ||
154 | governor, sets the CPU depending on the current usage. It differs in | ||
155 | behaviour in that it gracefully increases and decreases the CPU speed | ||
156 | rather than jumping to max speed the moment there is any load on the | ||
157 | CPU. This behaviour more suitable in a battery powered environment. | ||
158 | The governor is tweaked in the same manner as the "ondemand" governor | ||
159 | through sysfs with the addition of: | ||
160 | |||
161 | freq_step: this describes what percentage steps the cpu freq should be | ||
162 | increased and decreased smoothly by. By default the cpu frequency will | ||
163 | increase in 5% chunks of your maximum cpu frequency. You can change this | ||
164 | value to anywhere between 0 and 100 where '0' will effectively lock your | ||
165 | CPU at a speed regardless of its load whilst '100' will, in theory, make | ||
166 | it behave identically to the "ondemand" governor. | ||
167 | |||
168 | down_threshold: same as the 'up_threshold' found for the "ondemand" | ||
169 | governor but for the opposite direction. For example when set to its | ||
170 | default value of '20' it means that if the CPU usage needs to be below | ||
171 | 20% between samples to have the frequency decreased. | ||
116 | 172 | ||
117 | 3. The Governor Interface in the CPUfreq Core | 173 | 3. The Governor Interface in the CPUfreq Core |
118 | ============================================= | 174 | ============================================= |
diff --git a/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c b/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c index 04a405345203..2b62dee35c6c 100644 --- a/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c +++ b/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c | |||
@@ -177,9 +177,10 @@ static unsigned int nforce2_fsb_read(int bootfsb) | |||
177 | */ | 177 | */ |
178 | static int nforce2_set_fsb(unsigned int fsb) | 178 | static int nforce2_set_fsb(unsigned int fsb) |
179 | { | 179 | { |
180 | u32 pll, temp = 0; | 180 | u32 temp = 0; |
181 | unsigned int tfsb; | 181 | unsigned int tfsb; |
182 | int diff; | 182 | int diff; |
183 | int pll = 0; | ||
183 | 184 | ||
184 | if ((fsb > max_fsb) || (fsb < NFORCE2_MIN_FSB)) { | 185 | if ((fsb > max_fsb) || (fsb < NFORCE2_MIN_FSB)) { |
185 | printk(KERN_ERR "cpufreq: FSB %d is out of range!\n", fsb); | 186 | printk(KERN_ERR "cpufreq: FSB %d is out of range!\n", fsb); |
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c index 68a1fc87f4ca..0fbbd4c1072e 100644 --- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c | |||
@@ -45,7 +45,7 @@ | |||
45 | 45 | ||
46 | #define PFX "powernow-k8: " | 46 | #define PFX "powernow-k8: " |
47 | #define BFX PFX "BIOS error: " | 47 | #define BFX PFX "BIOS error: " |
48 | #define VERSION "version 1.50.4" | 48 | #define VERSION "version 1.60.0" |
49 | #include "powernow-k8.h" | 49 | #include "powernow-k8.h" |
50 | 50 | ||
51 | /* serialize freq changes */ | 51 | /* serialize freq changes */ |
@@ -216,10 +216,10 @@ static int write_new_vid(struct powernow_k8_data *data, u32 vid) | |||
216 | 216 | ||
217 | do { | 217 | do { |
218 | wrmsr(MSR_FIDVID_CTL, lo, STOP_GRANT_5NS); | 218 | wrmsr(MSR_FIDVID_CTL, lo, STOP_GRANT_5NS); |
219 | if (i++ > 100) { | 219 | if (i++ > 100) { |
220 | printk(KERN_ERR PFX "internal error - pending bit very stuck - no further pstate changes possible\n"); | 220 | printk(KERN_ERR PFX "internal error - pending bit very stuck - no further pstate changes possible\n"); |
221 | return 1; | 221 | return 1; |
222 | } | 222 | } |
223 | } while (query_current_values_with_pending_wait(data)); | 223 | } while (query_current_values_with_pending_wait(data)); |
224 | 224 | ||
225 | if (savefid != data->currfid) { | 225 | if (savefid != data->currfid) { |
@@ -336,7 +336,7 @@ static int core_voltage_pre_transition(struct powernow_k8_data *data, u32 reqvid | |||
336 | /* Phase 2 - core frequency transition */ | 336 | /* Phase 2 - core frequency transition */ |
337 | static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid) | 337 | static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid) |
338 | { | 338 | { |
339 | u32 vcoreqfid, vcocurrfid, vcofiddiff, savevid = data->currvid; | 339 | u32 vcoreqfid, vcocurrfid, vcofiddiff, fid_interval, savevid = data->currvid; |
340 | 340 | ||
341 | if ((reqfid < HI_FID_TABLE_BOTTOM) && (data->currfid < HI_FID_TABLE_BOTTOM)) { | 341 | if ((reqfid < HI_FID_TABLE_BOTTOM) && (data->currfid < HI_FID_TABLE_BOTTOM)) { |
342 | printk(KERN_ERR PFX "ph2: illegal lo-lo transition 0x%x 0x%x\n", | 342 | printk(KERN_ERR PFX "ph2: illegal lo-lo transition 0x%x 0x%x\n", |
@@ -359,9 +359,11 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid) | |||
359 | : vcoreqfid - vcocurrfid; | 359 | : vcoreqfid - vcocurrfid; |
360 | 360 | ||
361 | while (vcofiddiff > 2) { | 361 | while (vcofiddiff > 2) { |
362 | (data->currfid & 1) ? (fid_interval = 1) : (fid_interval = 2); | ||
363 | |||
362 | if (reqfid > data->currfid) { | 364 | if (reqfid > data->currfid) { |
363 | if (data->currfid > LO_FID_TABLE_TOP) { | 365 | if (data->currfid > LO_FID_TABLE_TOP) { |
364 | if (write_new_fid(data, data->currfid + 2)) { | 366 | if (write_new_fid(data, data->currfid + fid_interval)) { |
365 | return 1; | 367 | return 1; |
366 | } | 368 | } |
367 | } else { | 369 | } else { |
@@ -371,7 +373,7 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid) | |||
371 | } | 373 | } |
372 | } | 374 | } |
373 | } else { | 375 | } else { |
374 | if (write_new_fid(data, data->currfid - 2)) | 376 | if (write_new_fid(data, data->currfid - fid_interval)) |
375 | return 1; | 377 | return 1; |
376 | } | 378 | } |
377 | 379 | ||
@@ -464,7 +466,7 @@ static int check_supported_cpu(unsigned int cpu) | |||
464 | set_cpus_allowed(current, cpumask_of_cpu(cpu)); | 466 | set_cpus_allowed(current, cpumask_of_cpu(cpu)); |
465 | 467 | ||
466 | if (smp_processor_id() != cpu) { | 468 | if (smp_processor_id() != cpu) { |
467 | printk(KERN_ERR "limiting to cpu %u failed\n", cpu); | 469 | printk(KERN_ERR PFX "limiting to cpu %u failed\n", cpu); |
468 | goto out; | 470 | goto out; |
469 | } | 471 | } |
470 | 472 | ||
@@ -474,7 +476,7 @@ static int check_supported_cpu(unsigned int cpu) | |||
474 | eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE); | 476 | eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE); |
475 | if (((eax & CPUID_USE_XFAM_XMOD) != CPUID_USE_XFAM_XMOD) || | 477 | if (((eax & CPUID_USE_XFAM_XMOD) != CPUID_USE_XFAM_XMOD) || |
476 | ((eax & CPUID_XFAM) != CPUID_XFAM_K8) || | 478 | ((eax & CPUID_XFAM) != CPUID_XFAM_K8) || |
477 | ((eax & CPUID_XMOD) > CPUID_XMOD_REV_F)) { | 479 | ((eax & CPUID_XMOD) > CPUID_XMOD_REV_G)) { |
478 | printk(KERN_INFO PFX "Processor cpuid %x not supported\n", eax); | 480 | printk(KERN_INFO PFX "Processor cpuid %x not supported\n", eax); |
479 | goto out; | 481 | goto out; |
480 | } | 482 | } |
@@ -517,22 +519,24 @@ static int check_pst_table(struct powernow_k8_data *data, struct pst_s *pst, u8 | |||
517 | printk(KERN_ERR BFX "maxvid exceeded with pstate %d\n", j); | 519 | printk(KERN_ERR BFX "maxvid exceeded with pstate %d\n", j); |
518 | return -ENODEV; | 520 | return -ENODEV; |
519 | } | 521 | } |
520 | if ((pst[j].fid > MAX_FID) | 522 | if (pst[j].fid > MAX_FID) { |
521 | || (pst[j].fid & 1) | 523 | printk(KERN_ERR BFX "maxfid exceeded with pstate %d\n", j); |
522 | || (j && (pst[j].fid < HI_FID_TABLE_BOTTOM))) { | 524 | return -ENODEV; |
525 | } | ||
526 | if (j && (pst[j].fid < HI_FID_TABLE_BOTTOM)) { | ||
523 | /* Only first fid is allowed to be in "low" range */ | 527 | /* Only first fid is allowed to be in "low" range */ |
524 | printk(KERN_ERR PFX "two low fids - %d : 0x%x\n", j, pst[j].fid); | 528 | printk(KERN_ERR BFX "two low fids - %d : 0x%x\n", j, pst[j].fid); |
525 | return -EINVAL; | 529 | return -EINVAL; |
526 | } | 530 | } |
527 | if (pst[j].fid < lastfid) | 531 | if (pst[j].fid < lastfid) |
528 | lastfid = pst[j].fid; | 532 | lastfid = pst[j].fid; |
529 | } | 533 | } |
530 | if (lastfid & 1) { | 534 | if (lastfid & 1) { |
531 | printk(KERN_ERR PFX "lastfid invalid\n"); | 535 | printk(KERN_ERR BFX "lastfid invalid\n"); |
532 | return -EINVAL; | 536 | return -EINVAL; |
533 | } | 537 | } |
534 | if (lastfid > LO_FID_TABLE_TOP) | 538 | if (lastfid > LO_FID_TABLE_TOP) |
535 | printk(KERN_INFO PFX "first fid not from lo freq table\n"); | 539 | printk(KERN_INFO BFX "first fid not from lo freq table\n"); |
536 | 540 | ||
537 | return 0; | 541 | return 0; |
538 | } | 542 | } |
@@ -631,7 +635,7 @@ static int find_psb_table(struct powernow_k8_data *data) | |||
631 | 635 | ||
632 | dprintk("table vers: 0x%x\n", psb->tableversion); | 636 | dprintk("table vers: 0x%x\n", psb->tableversion); |
633 | if (psb->tableversion != PSB_VERSION_1_4) { | 637 | if (psb->tableversion != PSB_VERSION_1_4) { |
634 | printk(KERN_INFO BFX "PSB table is not v1.4\n"); | 638 | printk(KERN_ERR BFX "PSB table is not v1.4\n"); |
635 | return -ENODEV; | 639 | return -ENODEV; |
636 | } | 640 | } |
637 | 641 | ||
@@ -689,7 +693,7 @@ static int find_psb_table(struct powernow_k8_data *data) | |||
689 | * BIOS and Kernel Developer's Guide, which is available on | 693 | * BIOS and Kernel Developer's Guide, which is available on |
690 | * www.amd.com | 694 | * www.amd.com |
691 | */ | 695 | */ |
692 | printk(KERN_INFO PFX "BIOS error - no PSB or ACPI _PSS objects\n"); | 696 | printk(KERN_ERR PFX "BIOS error - no PSB or ACPI _PSS objects\n"); |
693 | return -ENODEV; | 697 | return -ENODEV; |
694 | } | 698 | } |
695 | 699 | ||
@@ -912,7 +916,7 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi | |||
912 | set_cpus_allowed(current, cpumask_of_cpu(pol->cpu)); | 916 | set_cpus_allowed(current, cpumask_of_cpu(pol->cpu)); |
913 | 917 | ||
914 | if (smp_processor_id() != pol->cpu) { | 918 | if (smp_processor_id() != pol->cpu) { |
915 | printk(KERN_ERR "limiting to cpu %u failed\n", pol->cpu); | 919 | printk(KERN_ERR PFX "limiting to cpu %u failed\n", pol->cpu); |
916 | goto err_out; | 920 | goto err_out; |
917 | } | 921 | } |
918 | 922 | ||
@@ -982,6 +986,9 @@ static int __init powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
982 | cpumask_t oldmask = CPU_MASK_ALL; | 986 | cpumask_t oldmask = CPU_MASK_ALL; |
983 | int rc, i; | 987 | int rc, i; |
984 | 988 | ||
989 | if (!cpu_online(pol->cpu)) | ||
990 | return -ENODEV; | ||
991 | |||
985 | if (!check_supported_cpu(pol->cpu)) | 992 | if (!check_supported_cpu(pol->cpu)) |
986 | return -ENODEV; | 993 | return -ENODEV; |
987 | 994 | ||
@@ -1021,7 +1028,7 @@ static int __init powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
1021 | set_cpus_allowed(current, cpumask_of_cpu(pol->cpu)); | 1028 | set_cpus_allowed(current, cpumask_of_cpu(pol->cpu)); |
1022 | 1029 | ||
1023 | if (smp_processor_id() != pol->cpu) { | 1030 | if (smp_processor_id() != pol->cpu) { |
1024 | printk(KERN_ERR "limiting to cpu %u failed\n", pol->cpu); | 1031 | printk(KERN_ERR PFX "limiting to cpu %u failed\n", pol->cpu); |
1025 | goto err_out; | 1032 | goto err_out; |
1026 | } | 1033 | } |
1027 | 1034 | ||
@@ -1162,10 +1169,9 @@ static void __exit powernowk8_exit(void) | |||
1162 | cpufreq_unregister_driver(&cpufreq_amd64_driver); | 1169 | cpufreq_unregister_driver(&cpufreq_amd64_driver); |
1163 | } | 1170 | } |
1164 | 1171 | ||
1165 | MODULE_AUTHOR("Paul Devriendt <paul.devriendt@amd.com> and Mark Langsdorf <mark.langsdorf@amd.com."); | 1172 | MODULE_AUTHOR("Paul Devriendt <paul.devriendt@amd.com> and Mark Langsdorf <mark.langsdorf@amd.com>"); |
1166 | MODULE_DESCRIPTION("AMD Athlon 64 and Opteron processor frequency driver."); | 1173 | MODULE_DESCRIPTION("AMD Athlon 64 and Opteron processor frequency driver."); |
1167 | MODULE_LICENSE("GPL"); | 1174 | MODULE_LICENSE("GPL"); |
1168 | 1175 | ||
1169 | late_initcall(powernowk8_init); | 1176 | late_initcall(powernowk8_init); |
1170 | module_exit(powernowk8_exit); | 1177 | module_exit(powernowk8_exit); |
1171 | |||
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h index b1e85bb36396..d0de37d58e9a 100644 --- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h | |||
@@ -42,7 +42,7 @@ struct powernow_k8_data { | |||
42 | #define CPUID_XFAM 0x0ff00000 /* extended family */ | 42 | #define CPUID_XFAM 0x0ff00000 /* extended family */ |
43 | #define CPUID_XFAM_K8 0 | 43 | #define CPUID_XFAM_K8 0 |
44 | #define CPUID_XMOD 0x000f0000 /* extended model */ | 44 | #define CPUID_XMOD 0x000f0000 /* extended model */ |
45 | #define CPUID_XMOD_REV_F 0x00040000 | 45 | #define CPUID_XMOD_REV_G 0x00060000 |
46 | #define CPUID_USE_XFAM_XMOD 0x00000f00 | 46 | #define CPUID_USE_XFAM_XMOD 0x00000f00 |
47 | #define CPUID_GET_MAX_CAPABILITIES 0x80000000 | 47 | #define CPUID_GET_MAX_CAPABILITIES 0x80000000 |
48 | #define CPUID_FREQ_VOLT_CAPABILITIES 0x80000007 | 48 | #define CPUID_FREQ_VOLT_CAPABILITIES 0x80000007 |
@@ -86,13 +86,14 @@ struct powernow_k8_data { | |||
86 | * low fid table | 86 | * low fid table |
87 | * - lowest entry in the high fid table must be a <= 200MHz + 2 * the entry | 87 | * - lowest entry in the high fid table must be a <= 200MHz + 2 * the entry |
88 | * in the low fid table | 88 | * in the low fid table |
89 | * - the parts can only step at 200 MHz intervals, so 1.9 GHz is never valid | 89 | * - the parts can only step at <= 200 MHz intervals, odd fid values are |
90 | * supported in revision G and later revisions. | ||
90 | * - lowest frequency must be >= interprocessor hypertransport link speed | 91 | * - lowest frequency must be >= interprocessor hypertransport link speed |
91 | * (only applies to MP systems obviously) | 92 | * (only applies to MP systems obviously) |
92 | */ | 93 | */ |
93 | 94 | ||
94 | /* fids (frequency identifiers) are arranged in 2 tables - lo and hi */ | 95 | /* fids (frequency identifiers) are arranged in 2 tables - lo and hi */ |
95 | #define LO_FID_TABLE_TOP 6 /* fid values marking the boundary */ | 96 | #define LO_FID_TABLE_TOP 7 /* fid values marking the boundary */ |
96 | #define HI_FID_TABLE_BOTTOM 8 /* between the low and high tables */ | 97 | #define HI_FID_TABLE_BOTTOM 8 /* between the low and high tables */ |
97 | 98 | ||
98 | #define LO_VCOFREQ_TABLE_TOP 1400 /* corresponding vco frequency values */ | 99 | #define LO_VCOFREQ_TABLE_TOP 1400 /* corresponding vco frequency values */ |
@@ -106,7 +107,7 @@ struct powernow_k8_data { | |||
106 | #define MIN_FREQ 800 /* Min and max freqs, per spec */ | 107 | #define MIN_FREQ 800 /* Min and max freqs, per spec */ |
107 | #define MAX_FREQ 5000 | 108 | #define MAX_FREQ 5000 |
108 | 109 | ||
109 | #define INVALID_FID_MASK 0xffffffc1 /* not a valid fid if these bits are set */ | 110 | #define INVALID_FID_MASK 0xffffffc0 /* not a valid fid if these bits are set */ |
110 | #define INVALID_VID_MASK 0xffffffc0 /* not a valid vid if these bits are set */ | 111 | #define INVALID_VID_MASK 0xffffffc0 /* not a valid vid if these bits are set */ |
111 | 112 | ||
112 | #define VID_OFF 0x3f | 113 | #define VID_OFF 0x3f |
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c b/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c index 5b7d18a06afa..b425cd3d1838 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c | |||
@@ -40,6 +40,7 @@ static struct pci_dev *speedstep_chipset_dev; | |||
40 | */ | 40 | */ |
41 | static unsigned int speedstep_processor = 0; | 41 | static unsigned int speedstep_processor = 0; |
42 | 42 | ||
43 | static u32 pmbase; | ||
43 | 44 | ||
44 | /* | 45 | /* |
45 | * There are only two frequency states for each processor. Values | 46 | * There are only two frequency states for each processor. Values |
@@ -56,34 +57,47 @@ static struct cpufreq_frequency_table speedstep_freqs[] = { | |||
56 | 57 | ||
57 | 58 | ||
58 | /** | 59 | /** |
59 | * speedstep_set_state - set the SpeedStep state | 60 | * speedstep_find_register - read the PMBASE address |
60 | * @state: new processor frequency state (SPEEDSTEP_LOW or SPEEDSTEP_HIGH) | ||
61 | * | 61 | * |
62 | * Tries to change the SpeedStep state. | 62 | * Returns: -ENODEV if no register could be found |
63 | */ | 63 | */ |
64 | static void speedstep_set_state (unsigned int state) | 64 | static int speedstep_find_register (void) |
65 | { | 65 | { |
66 | u32 pmbase; | 66 | if (!speedstep_chipset_dev) |
67 | u8 pm2_blk; | 67 | return -ENODEV; |
68 | u8 value; | ||
69 | unsigned long flags; | ||
70 | |||
71 | if (!speedstep_chipset_dev || (state > 0x1)) | ||
72 | return; | ||
73 | 68 | ||
74 | /* get PMBASE */ | 69 | /* get PMBASE */ |
75 | pci_read_config_dword(speedstep_chipset_dev, 0x40, &pmbase); | 70 | pci_read_config_dword(speedstep_chipset_dev, 0x40, &pmbase); |
76 | if (!(pmbase & 0x01)) { | 71 | if (!(pmbase & 0x01)) { |
77 | printk(KERN_ERR "speedstep-ich: could not find speedstep register\n"); | 72 | printk(KERN_ERR "speedstep-ich: could not find speedstep register\n"); |
78 | return; | 73 | return -ENODEV; |
79 | } | 74 | } |
80 | 75 | ||
81 | pmbase &= 0xFFFFFFFE; | 76 | pmbase &= 0xFFFFFFFE; |
82 | if (!pmbase) { | 77 | if (!pmbase) { |
83 | printk(KERN_ERR "speedstep-ich: could not find speedstep register\n"); | 78 | printk(KERN_ERR "speedstep-ich: could not find speedstep register\n"); |
84 | return; | 79 | return -ENODEV; |
85 | } | 80 | } |
86 | 81 | ||
82 | dprintk("pmbase is 0x%x\n", pmbase); | ||
83 | return 0; | ||
84 | } | ||
85 | |||
86 | /** | ||
87 | * speedstep_set_state - set the SpeedStep state | ||
88 | * @state: new processor frequency state (SPEEDSTEP_LOW or SPEEDSTEP_HIGH) | ||
89 | * | ||
90 | * Tries to change the SpeedStep state. | ||
91 | */ | ||
92 | static void speedstep_set_state (unsigned int state) | ||
93 | { | ||
94 | u8 pm2_blk; | ||
95 | u8 value; | ||
96 | unsigned long flags; | ||
97 | |||
98 | if (state > 0x1) | ||
99 | return; | ||
100 | |||
87 | /* Disable IRQs */ | 101 | /* Disable IRQs */ |
88 | local_irq_save(flags); | 102 | local_irq_save(flags); |
89 | 103 | ||
@@ -315,10 +329,11 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) | |||
315 | cpus_allowed = current->cpus_allowed; | 329 | cpus_allowed = current->cpus_allowed; |
316 | set_cpus_allowed(current, policy->cpus); | 330 | set_cpus_allowed(current, policy->cpus); |
317 | 331 | ||
318 | /* detect low and high frequency */ | 332 | /* detect low and high frequency and transition latency */ |
319 | result = speedstep_get_freqs(speedstep_processor, | 333 | result = speedstep_get_freqs(speedstep_processor, |
320 | &speedstep_freqs[SPEEDSTEP_LOW].frequency, | 334 | &speedstep_freqs[SPEEDSTEP_LOW].frequency, |
321 | &speedstep_freqs[SPEEDSTEP_HIGH].frequency, | 335 | &speedstep_freqs[SPEEDSTEP_HIGH].frequency, |
336 | &policy->cpuinfo.transition_latency, | ||
322 | &speedstep_set_state); | 337 | &speedstep_set_state); |
323 | set_cpus_allowed(current, cpus_allowed); | 338 | set_cpus_allowed(current, cpus_allowed); |
324 | if (result) | 339 | if (result) |
@@ -335,7 +350,6 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) | |||
335 | 350 | ||
336 | /* cpuinfo and default policy values */ | 351 | /* cpuinfo and default policy values */ |
337 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | 352 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; |
338 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; | ||
339 | policy->cur = speed; | 353 | policy->cur = speed; |
340 | 354 | ||
341 | result = cpufreq_frequency_table_cpuinfo(policy, speedstep_freqs); | 355 | result = cpufreq_frequency_table_cpuinfo(policy, speedstep_freqs); |
@@ -400,6 +414,9 @@ static int __init speedstep_init(void) | |||
400 | return -EINVAL; | 414 | return -EINVAL; |
401 | } | 415 | } |
402 | 416 | ||
417 | if (speedstep_find_register()) | ||
418 | return -ENODEV; | ||
419 | |||
403 | return cpufreq_register_driver(&speedstep_driver); | 420 | return cpufreq_register_driver(&speedstep_driver); |
404 | } | 421 | } |
405 | 422 | ||
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c index d368b3f5fce8..7c47005a1805 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c | |||
@@ -320,11 +320,13 @@ EXPORT_SYMBOL_GPL(speedstep_detect_processor); | |||
320 | unsigned int speedstep_get_freqs(unsigned int processor, | 320 | unsigned int speedstep_get_freqs(unsigned int processor, |
321 | unsigned int *low_speed, | 321 | unsigned int *low_speed, |
322 | unsigned int *high_speed, | 322 | unsigned int *high_speed, |
323 | unsigned int *transition_latency, | ||
323 | void (*set_state) (unsigned int state)) | 324 | void (*set_state) (unsigned int state)) |
324 | { | 325 | { |
325 | unsigned int prev_speed; | 326 | unsigned int prev_speed; |
326 | unsigned int ret = 0; | 327 | unsigned int ret = 0; |
327 | unsigned long flags; | 328 | unsigned long flags; |
329 | struct timeval tv1, tv2; | ||
328 | 330 | ||
329 | if ((!processor) || (!low_speed) || (!high_speed) || (!set_state)) | 331 | if ((!processor) || (!low_speed) || (!high_speed) || (!set_state)) |
330 | return -EINVAL; | 332 | return -EINVAL; |
@@ -337,7 +339,7 @@ unsigned int speedstep_get_freqs(unsigned int processor, | |||
337 | return -EIO; | 339 | return -EIO; |
338 | 340 | ||
339 | dprintk("previous speed is %u\n", prev_speed); | 341 | dprintk("previous speed is %u\n", prev_speed); |
340 | 342 | ||
341 | local_irq_save(flags); | 343 | local_irq_save(flags); |
342 | 344 | ||
343 | /* switch to low state */ | 345 | /* switch to low state */ |
@@ -350,8 +352,17 @@ unsigned int speedstep_get_freqs(unsigned int processor, | |||
350 | 352 | ||
351 | dprintk("low speed is %u\n", *low_speed); | 353 | dprintk("low speed is %u\n", *low_speed); |
352 | 354 | ||
355 | /* start latency measurement */ | ||
356 | if (transition_latency) | ||
357 | do_gettimeofday(&tv1); | ||
358 | |||
353 | /* switch to high state */ | 359 | /* switch to high state */ |
354 | set_state(SPEEDSTEP_HIGH); | 360 | set_state(SPEEDSTEP_HIGH); |
361 | |||
362 | /* end latency measurement */ | ||
363 | if (transition_latency) | ||
364 | do_gettimeofday(&tv2); | ||
365 | |||
355 | *high_speed = speedstep_get_processor_frequency(processor); | 366 | *high_speed = speedstep_get_processor_frequency(processor); |
356 | if (!*high_speed) { | 367 | if (!*high_speed) { |
357 | ret = -EIO; | 368 | ret = -EIO; |
@@ -369,6 +380,25 @@ unsigned int speedstep_get_freqs(unsigned int processor, | |||
369 | if (*high_speed != prev_speed) | 380 | if (*high_speed != prev_speed) |
370 | set_state(SPEEDSTEP_LOW); | 381 | set_state(SPEEDSTEP_LOW); |
371 | 382 | ||
383 | if (transition_latency) { | ||
384 | *transition_latency = (tv2.tv_sec - tv1.tv_sec) * USEC_PER_SEC + | ||
385 | tv2.tv_usec - tv1.tv_usec; | ||
386 | dprintk("transition latency is %u uSec\n", *transition_latency); | ||
387 | |||
388 | /* convert uSec to nSec and add 20% for safety reasons */ | ||
389 | *transition_latency *= 1200; | ||
390 | |||
391 | /* check if the latency measurement is too high or too low | ||
392 | * and set it to a safe value (500uSec) in that case | ||
393 | */ | ||
394 | if (*transition_latency > 10000000 || *transition_latency < 50000) { | ||
395 | printk (KERN_WARNING "speedstep: frequency transition measured seems out of " | ||
396 | "range (%u nSec), falling back to a safe one of %u nSec.\n", | ||
397 | *transition_latency, 500000); | ||
398 | *transition_latency = 500000; | ||
399 | } | ||
400 | } | ||
401 | |||
372 | out: | 402 | out: |
373 | local_irq_restore(flags); | 403 | local_irq_restore(flags); |
374 | return (ret); | 404 | return (ret); |
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h index 261a2c9b7f6b..6a727fd3a77e 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h | |||
@@ -44,4 +44,5 @@ extern unsigned int speedstep_get_processor_frequency(unsigned int processor); | |||
44 | extern unsigned int speedstep_get_freqs(unsigned int processor, | 44 | extern unsigned int speedstep_get_freqs(unsigned int processor, |
45 | unsigned int *low_speed, | 45 | unsigned int *low_speed, |
46 | unsigned int *high_speed, | 46 | unsigned int *high_speed, |
47 | unsigned int *transition_latency, | ||
47 | void (*set_state) (unsigned int state)); | 48 | void (*set_state) (unsigned int state)); |
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c b/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c index 2718fb6f6aba..28cc5d524afc 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c | |||
@@ -269,6 +269,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) | |||
269 | result = speedstep_get_freqs(speedstep_processor, | 269 | result = speedstep_get_freqs(speedstep_processor, |
270 | &speedstep_freqs[SPEEDSTEP_LOW].frequency, | 270 | &speedstep_freqs[SPEEDSTEP_LOW].frequency, |
271 | &speedstep_freqs[SPEEDSTEP_HIGH].frequency, | 271 | &speedstep_freqs[SPEEDSTEP_HIGH].frequency, |
272 | NULL, | ||
272 | &speedstep_set_state); | 273 | &speedstep_set_state); |
273 | 274 | ||
274 | if (result) { | 275 | if (result) { |
diff --git a/arch/i386/kernel/cpu/proc.c b/arch/i386/kernel/cpu/proc.c index e7921315ae9d..6d91b274589c 100644 --- a/arch/i386/kernel/cpu/proc.c +++ b/arch/i386/kernel/cpu/proc.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <linux/string.h> | 3 | #include <linux/string.h> |
4 | #include <asm/semaphore.h> | 4 | #include <asm/semaphore.h> |
5 | #include <linux/seq_file.h> | 5 | #include <linux/seq_file.h> |
6 | #include <linux/cpufreq.h> | ||
6 | 7 | ||
7 | /* | 8 | /* |
8 | * Get CPU information for use by the procfs. | 9 | * Get CPU information for use by the procfs. |
@@ -86,8 +87,11 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
86 | seq_printf(m, "stepping\t: unknown\n"); | 87 | seq_printf(m, "stepping\t: unknown\n"); |
87 | 88 | ||
88 | if ( cpu_has(c, X86_FEATURE_TSC) ) { | 89 | if ( cpu_has(c, X86_FEATURE_TSC) ) { |
90 | unsigned int freq = cpufreq_quick_get(n); | ||
91 | if (!freq) | ||
92 | freq = cpu_khz; | ||
89 | seq_printf(m, "cpu MHz\t\t: %u.%03u\n", | 93 | seq_printf(m, "cpu MHz\t\t: %u.%03u\n", |
90 | cpu_khz / 1000, (cpu_khz % 1000)); | 94 | freq / 1000, (freq % 1000)); |
91 | } | 95 | } |
92 | 96 | ||
93 | /* Cache size */ | 97 | /* Cache size */ |
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c index 5add0bcf87a7..088e5dded8dc 100644 --- a/arch/ia64/kernel/setup.c +++ b/arch/ia64/kernel/setup.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <linux/initrd.h> | 43 | #include <linux/initrd.h> |
44 | #include <linux/platform.h> | 44 | #include <linux/platform.h> |
45 | #include <linux/pm.h> | 45 | #include <linux/pm.h> |
46 | #include <linux/cpufreq.h> | ||
46 | 47 | ||
47 | #include <asm/ia32.h> | 48 | #include <asm/ia32.h> |
48 | #include <asm/machvec.h> | 49 | #include <asm/machvec.h> |
@@ -517,6 +518,7 @@ show_cpuinfo (struct seq_file *m, void *v) | |||
517 | char family[32], features[128], *cp, sep; | 518 | char family[32], features[128], *cp, sep; |
518 | struct cpuinfo_ia64 *c = v; | 519 | struct cpuinfo_ia64 *c = v; |
519 | unsigned long mask; | 520 | unsigned long mask; |
521 | unsigned int proc_freq; | ||
520 | int i; | 522 | int i; |
521 | 523 | ||
522 | mask = c->features; | 524 | mask = c->features; |
@@ -549,6 +551,10 @@ show_cpuinfo (struct seq_file *m, void *v) | |||
549 | sprintf(cp, " 0x%lx", mask); | 551 | sprintf(cp, " 0x%lx", mask); |
550 | } | 552 | } |
551 | 553 | ||
554 | proc_freq = cpufreq_quick_get(cpunum); | ||
555 | if (!proc_freq) | ||
556 | proc_freq = c->proc_freq / 1000; | ||
557 | |||
552 | seq_printf(m, | 558 | seq_printf(m, |
553 | "processor : %d\n" | 559 | "processor : %d\n" |
554 | "vendor : %s\n" | 560 | "vendor : %s\n" |
@@ -565,7 +571,7 @@ show_cpuinfo (struct seq_file *m, void *v) | |||
565 | "BogoMIPS : %lu.%02lu\n", | 571 | "BogoMIPS : %lu.%02lu\n", |
566 | cpunum, c->vendor, family, c->model, c->revision, c->archrev, | 572 | cpunum, c->vendor, family, c->model, c->revision, c->archrev, |
567 | features, c->ppn, c->number, | 573 | features, c->ppn, c->number, |
568 | c->proc_freq / 1000000, c->proc_freq % 1000000, | 574 | proc_freq / 1000, proc_freq % 1000, |
569 | c->itc_freq / 1000000, c->itc_freq % 1000000, | 575 | c->itc_freq / 1000000, c->itc_freq % 1000000, |
570 | lpj*HZ/500000, (lpj*HZ/5000) % 100); | 576 | lpj*HZ/500000, (lpj*HZ/5000) % 100); |
571 | #ifdef CONFIG_SMP | 577 | #ifdef CONFIG_SMP |
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c index 750e01dcbdf4..64c4534b930c 100644 --- a/arch/x86_64/kernel/setup.c +++ b/arch/x86_64/kernel/setup.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/edd.h> | 42 | #include <linux/edd.h> |
43 | #include <linux/mmzone.h> | 43 | #include <linux/mmzone.h> |
44 | #include <linux/kexec.h> | 44 | #include <linux/kexec.h> |
45 | #include <linux/cpufreq.h> | ||
45 | 46 | ||
46 | #include <asm/mtrr.h> | 47 | #include <asm/mtrr.h> |
47 | #include <asm/uaccess.h> | 48 | #include <asm/uaccess.h> |
@@ -1256,8 +1257,11 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
1256 | seq_printf(m, "stepping\t: unknown\n"); | 1257 | seq_printf(m, "stepping\t: unknown\n"); |
1257 | 1258 | ||
1258 | if (cpu_has(c,X86_FEATURE_TSC)) { | 1259 | if (cpu_has(c,X86_FEATURE_TSC)) { |
1260 | unsigned int freq = cpufreq_quick_get((unsigned)(c-cpu_data)); | ||
1261 | if (!freq) | ||
1262 | freq = cpu_khz; | ||
1259 | seq_printf(m, "cpu MHz\t\t: %u.%03u\n", | 1263 | seq_printf(m, "cpu MHz\t\t: %u.%03u\n", |
1260 | cpu_khz / 1000, (cpu_khz % 1000)); | 1264 | freq / 1000, (freq % 1000)); |
1261 | } | 1265 | } |
1262 | 1266 | ||
1263 | /* Cache size */ | 1267 | /* Cache size */ |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 815902c2c856..a9163d02983a 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -823,6 +823,30 @@ static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq, unsigne | |||
823 | 823 | ||
824 | 824 | ||
825 | /** | 825 | /** |
826 | * cpufreq_quick_get - get the CPU frequency (in kHz) frpm policy->cur | ||
827 | * @cpu: CPU number | ||
828 | * | ||
829 | * This is the last known freq, without actually getting it from the driver. | ||
830 | * Return value will be same as what is shown in scaling_cur_freq in sysfs. | ||
831 | */ | ||
832 | unsigned int cpufreq_quick_get(unsigned int cpu) | ||
833 | { | ||
834 | struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); | ||
835 | unsigned int ret = 0; | ||
836 | |||
837 | if (policy) { | ||
838 | down(&policy->lock); | ||
839 | ret = policy->cur; | ||
840 | up(&policy->lock); | ||
841 | cpufreq_cpu_put(policy); | ||
842 | } | ||
843 | |||
844 | return (ret); | ||
845 | } | ||
846 | EXPORT_SYMBOL(cpufreq_quick_get); | ||
847 | |||
848 | |||
849 | /** | ||
826 | * cpufreq_get - get the current CPU frequency (in kHz) | 850 | * cpufreq_get - get the current CPU frequency (in kHz) |
827 | * @cpu: CPU number | 851 | * @cpu: CPU number |
828 | * | 852 | * |
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index 2ed5c4363b53..39543a2bed0f 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c | |||
@@ -93,7 +93,7 @@ static inline unsigned int get_cpu_idle_time(unsigned int cpu) | |||
93 | { | 93 | { |
94 | return kstat_cpu(cpu).cpustat.idle + | 94 | return kstat_cpu(cpu).cpustat.idle + |
95 | kstat_cpu(cpu).cpustat.iowait + | 95 | kstat_cpu(cpu).cpustat.iowait + |
96 | ( !dbs_tuners_ins.ignore_nice ? | 96 | ( dbs_tuners_ins.ignore_nice ? |
97 | kstat_cpu(cpu).cpustat.nice : | 97 | kstat_cpu(cpu).cpustat.nice : |
98 | 0); | 98 | 0); |
99 | } | 99 | } |
@@ -127,7 +127,7 @@ show_one(sampling_rate, sampling_rate); | |||
127 | show_one(sampling_down_factor, sampling_down_factor); | 127 | show_one(sampling_down_factor, sampling_down_factor); |
128 | show_one(up_threshold, up_threshold); | 128 | show_one(up_threshold, up_threshold); |
129 | show_one(down_threshold, down_threshold); | 129 | show_one(down_threshold, down_threshold); |
130 | show_one(ignore_nice, ignore_nice); | 130 | show_one(ignore_nice_load, ignore_nice); |
131 | show_one(freq_step, freq_step); | 131 | show_one(freq_step, freq_step); |
132 | 132 | ||
133 | static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused, | 133 | static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused, |
@@ -207,7 +207,7 @@ static ssize_t store_down_threshold(struct cpufreq_policy *unused, | |||
207 | return count; | 207 | return count; |
208 | } | 208 | } |
209 | 209 | ||
210 | static ssize_t store_ignore_nice(struct cpufreq_policy *policy, | 210 | static ssize_t store_ignore_nice_load(struct cpufreq_policy *policy, |
211 | const char *buf, size_t count) | 211 | const char *buf, size_t count) |
212 | { | 212 | { |
213 | unsigned int input; | 213 | unsigned int input; |
@@ -272,7 +272,7 @@ define_one_rw(sampling_rate); | |||
272 | define_one_rw(sampling_down_factor); | 272 | define_one_rw(sampling_down_factor); |
273 | define_one_rw(up_threshold); | 273 | define_one_rw(up_threshold); |
274 | define_one_rw(down_threshold); | 274 | define_one_rw(down_threshold); |
275 | define_one_rw(ignore_nice); | 275 | define_one_rw(ignore_nice_load); |
276 | define_one_rw(freq_step); | 276 | define_one_rw(freq_step); |
277 | 277 | ||
278 | static struct attribute * dbs_attributes[] = { | 278 | static struct attribute * dbs_attributes[] = { |
@@ -282,7 +282,7 @@ static struct attribute * dbs_attributes[] = { | |||
282 | &sampling_down_factor.attr, | 282 | &sampling_down_factor.attr, |
283 | &up_threshold.attr, | 283 | &up_threshold.attr, |
284 | &down_threshold.attr, | 284 | &down_threshold.attr, |
285 | &ignore_nice.attr, | 285 | &ignore_nice_load.attr, |
286 | &freq_step.attr, | 286 | &freq_step.attr, |
287 | NULL | 287 | NULL |
288 | }; | 288 | }; |
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index 17741111246b..e69fd8dd1f1c 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c | |||
@@ -89,7 +89,7 @@ static inline unsigned int get_cpu_idle_time(unsigned int cpu) | |||
89 | { | 89 | { |
90 | return kstat_cpu(cpu).cpustat.idle + | 90 | return kstat_cpu(cpu).cpustat.idle + |
91 | kstat_cpu(cpu).cpustat.iowait + | 91 | kstat_cpu(cpu).cpustat.iowait + |
92 | ( !dbs_tuners_ins.ignore_nice ? | 92 | ( dbs_tuners_ins.ignore_nice ? |
93 | kstat_cpu(cpu).cpustat.nice : | 93 | kstat_cpu(cpu).cpustat.nice : |
94 | 0); | 94 | 0); |
95 | } | 95 | } |
@@ -122,7 +122,7 @@ static ssize_t show_##file_name \ | |||
122 | show_one(sampling_rate, sampling_rate); | 122 | show_one(sampling_rate, sampling_rate); |
123 | show_one(sampling_down_factor, sampling_down_factor); | 123 | show_one(sampling_down_factor, sampling_down_factor); |
124 | show_one(up_threshold, up_threshold); | 124 | show_one(up_threshold, up_threshold); |
125 | show_one(ignore_nice, ignore_nice); | 125 | show_one(ignore_nice_load, ignore_nice); |
126 | 126 | ||
127 | static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused, | 127 | static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused, |
128 | const char *buf, size_t count) | 128 | const char *buf, size_t count) |
@@ -182,7 +182,7 @@ static ssize_t store_up_threshold(struct cpufreq_policy *unused, | |||
182 | return count; | 182 | return count; |
183 | } | 183 | } |
184 | 184 | ||
185 | static ssize_t store_ignore_nice(struct cpufreq_policy *policy, | 185 | static ssize_t store_ignore_nice_load(struct cpufreq_policy *policy, |
186 | const char *buf, size_t count) | 186 | const char *buf, size_t count) |
187 | { | 187 | { |
188 | unsigned int input; | 188 | unsigned int input; |
@@ -223,7 +223,7 @@ __ATTR(_name, 0644, show_##_name, store_##_name) | |||
223 | define_one_rw(sampling_rate); | 223 | define_one_rw(sampling_rate); |
224 | define_one_rw(sampling_down_factor); | 224 | define_one_rw(sampling_down_factor); |
225 | define_one_rw(up_threshold); | 225 | define_one_rw(up_threshold); |
226 | define_one_rw(ignore_nice); | 226 | define_one_rw(ignore_nice_load); |
227 | 227 | ||
228 | static struct attribute * dbs_attributes[] = { | 228 | static struct attribute * dbs_attributes[] = { |
229 | &sampling_rate_max.attr, | 229 | &sampling_rate_max.attr, |
@@ -231,7 +231,7 @@ static struct attribute * dbs_attributes[] = { | |||
231 | &sampling_rate.attr, | 231 | &sampling_rate.attr, |
232 | &sampling_down_factor.attr, | 232 | &sampling_down_factor.attr, |
233 | &up_threshold.attr, | 233 | &up_threshold.attr, |
234 | &ignore_nice.attr, | 234 | &ignore_nice_load.attr, |
235 | NULL | 235 | NULL |
236 | }; | 236 | }; |
237 | 237 | ||
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index d068176b7ad7..c31650df9241 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h | |||
@@ -256,6 +256,16 @@ int cpufreq_update_policy(unsigned int cpu); | |||
256 | /* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */ | 256 | /* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */ |
257 | unsigned int cpufreq_get(unsigned int cpu); | 257 | unsigned int cpufreq_get(unsigned int cpu); |
258 | 258 | ||
259 | /* query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it */ | ||
260 | #ifdef CONFIG_CPU_FREQ | ||
261 | unsigned int cpufreq_quick_get(unsigned int cpu); | ||
262 | #else | ||
263 | static inline unsigned int cpufreq_quick_get(unsigned int cpu) | ||
264 | { | ||
265 | return 0; | ||
266 | } | ||
267 | #endif | ||
268 | |||
259 | 269 | ||
260 | /********************************************************************* | 270 | /********************************************************************* |
261 | * CPUFREQ DEFAULT GOVERNOR * | 271 | * CPUFREQ DEFAULT GOVERNOR * |