diff options
author | Richard Henderson <rth@twiddle.net> | 2013-07-12 19:15:56 -0400 |
---|---|---|
committer | Matt Turner <mattst88@gmail.com> | 2013-11-16 19:33:13 -0500 |
commit | fddd87d6e135924b92499917bace103e46c22d00 (patch) | |
tree | 23bbe6a01a32c0ea88f7c2180dbd1f461d822c76 /arch | |
parent | 994dcf7055df88623d25f3593b931a018a76b502 (diff) |
alpha: Allow HZ to be configured
With the 1024Hz default, we spend 50% of QEMU emulation
processing timer interrupts.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/alpha/Kconfig | 36 | ||||
-rw-r--r-- | arch/alpha/kernel/setup.c | 10 | ||||
-rw-r--r-- | arch/alpha/kernel/time.c | 24 |
3 files changed, 59 insertions, 11 deletions
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index 51cc8c353164..a67b971c830a 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig | |||
@@ -627,9 +627,41 @@ config VERBOSE_MCHECK_ON | |||
627 | 627 | ||
628 | Take the default (1) unless you want more control or more info. | 628 | Take the default (1) unless you want more control or more info. |
629 | 629 | ||
630 | choice | ||
631 | prompt "Timer interrupt frequency (HZ)?" | ||
632 | default HZ_128 if ALPHA_QEMU | ||
633 | default HZ_1200 if ALPHA_RAWHIDE | ||
634 | default HZ_1024 | ||
635 | ---help--- | ||
636 | The frequency at which timer interrupts occur. A high frequency | ||
637 | minimizes latency, whereas a low frequency minimizes overhead of | ||
638 | process accounting. The later effect is especially significant | ||
639 | when being run under QEMU. | ||
640 | |||
641 | Note that some Alpha hardware cannot change the interrupt frequency | ||
642 | of the timer. If unsure, say 1024 (or 1200 for Rawhide). | ||
643 | |||
644 | config HZ_32 | ||
645 | bool "32 Hz" | ||
646 | config HZ_64 | ||
647 | bool "64 Hz" | ||
648 | config HZ_128 | ||
649 | bool "128 Hz" | ||
650 | config HZ_256 | ||
651 | bool "256 Hz" | ||
652 | config HZ_1024 | ||
653 | bool "1024 Hz" | ||
654 | config HZ_1200 | ||
655 | bool "1200 Hz" | ||
656 | endchoice | ||
657 | |||
630 | config HZ | 658 | config HZ |
631 | int | 659 | int |
632 | default 1200 if ALPHA_RAWHIDE | 660 | default 32 if HZ_32 |
661 | default 64 if HZ_64 | ||
662 | default 128 if HZ_128 | ||
663 | default 256 if HZ_256 | ||
664 | default 1200 if HZ_1200 | ||
633 | default 1024 | 665 | default 1024 |
634 | 666 | ||
635 | source "drivers/pci/Kconfig" | 667 | source "drivers/pci/Kconfig" |
diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c index c38d6a1b9066..b20af76f12c1 100644 --- a/arch/alpha/kernel/setup.c +++ b/arch/alpha/kernel/setup.c | |||
@@ -1218,6 +1218,7 @@ show_cpuinfo(struct seq_file *f, void *slot) | |||
1218 | char *systype_name; | 1218 | char *systype_name; |
1219 | char *sysvariation_name; | 1219 | char *sysvariation_name; |
1220 | int nr_processors; | 1220 | int nr_processors; |
1221 | unsigned long timer_freq; | ||
1221 | 1222 | ||
1222 | cpu_index = (unsigned) (cpu->type - 1); | 1223 | cpu_index = (unsigned) (cpu->type - 1); |
1223 | cpu_name = "Unknown"; | 1224 | cpu_name = "Unknown"; |
@@ -1229,6 +1230,12 @@ show_cpuinfo(struct seq_file *f, void *slot) | |||
1229 | 1230 | ||
1230 | nr_processors = get_nr_processors(cpu, hwrpb->nr_processors); | 1231 | nr_processors = get_nr_processors(cpu, hwrpb->nr_processors); |
1231 | 1232 | ||
1233 | #if CONFIG_HZ == 1024 || CONFIG_HZ == 1200 | ||
1234 | timer_freq = (100UL * hwrpb->intr_freq) / 4096; | ||
1235 | #else | ||
1236 | timer_freq = 100UL * CONFIG_HZ; | ||
1237 | #endif | ||
1238 | |||
1232 | seq_printf(f, "cpu\t\t\t: Alpha\n" | 1239 | seq_printf(f, "cpu\t\t\t: Alpha\n" |
1233 | "cpu model\t\t: %s\n" | 1240 | "cpu model\t\t: %s\n" |
1234 | "cpu variation\t\t: %ld\n" | 1241 | "cpu variation\t\t: %ld\n" |
@@ -1254,8 +1261,7 @@ show_cpuinfo(struct seq_file *f, void *slot) | |||
1254 | (char*)hwrpb->ssn, | 1261 | (char*)hwrpb->ssn, |
1255 | est_cycle_freq ? : hwrpb->cycle_freq, | 1262 | est_cycle_freq ? : hwrpb->cycle_freq, |
1256 | est_cycle_freq ? "est." : "", | 1263 | est_cycle_freq ? "est." : "", |
1257 | hwrpb->intr_freq / 4096, | 1264 | timer_freq / 100, timer_freq % 100, |
1258 | (100 * hwrpb->intr_freq / 4096) % 100, | ||
1259 | hwrpb->pagesize, | 1265 | hwrpb->pagesize, |
1260 | hwrpb->pa_bits, | 1266 | hwrpb->pa_bits, |
1261 | hwrpb->max_asn, | 1267 | hwrpb->max_asn, |
diff --git a/arch/alpha/kernel/time.c b/arch/alpha/kernel/time.c index ea3395036556..a6bcb3113d81 100644 --- a/arch/alpha/kernel/time.c +++ b/arch/alpha/kernel/time.c | |||
@@ -201,16 +201,26 @@ irqreturn_t timer_interrupt(int irq, void *dev) | |||
201 | void __init | 201 | void __init |
202 | common_init_rtc(void) | 202 | common_init_rtc(void) |
203 | { | 203 | { |
204 | unsigned char x; | 204 | unsigned char x, sel = 0; |
205 | 205 | ||
206 | /* Reset periodic interrupt frequency. */ | 206 | /* Reset periodic interrupt frequency. */ |
207 | x = CMOS_READ(RTC_FREQ_SELECT) & 0x3f; | 207 | #if CONFIG_HZ == 1024 || CONFIG_HZ == 1200 |
208 | /* Test includes known working values on various platforms | 208 | x = CMOS_READ(RTC_FREQ_SELECT) & 0x3f; |
209 | where 0x26 is wrong; we refuse to change those. */ | 209 | /* Test includes known working values on various platforms |
210 | if (x != 0x26 && x != 0x25 && x != 0x19 && x != 0x06) { | 210 | where 0x26 is wrong; we refuse to change those. */ |
211 | printk("Setting RTC_FREQ to 1024 Hz (%x)\n", x); | 211 | if (x != 0x26 && x != 0x25 && x != 0x19 && x != 0x06) { |
212 | CMOS_WRITE(0x26, RTC_FREQ_SELECT); | 212 | sel = RTC_REF_CLCK_32KHZ + 6; |
213 | } | 213 | } |
214 | #elif CONFIG_HZ == 256 || CONFIG_HZ == 128 || CONFIG_HZ == 64 || CONFIG_HZ == 32 | ||
215 | sel = RTC_REF_CLCK_32KHZ + __builtin_ffs(32768 / CONFIG_HZ); | ||
216 | #else | ||
217 | # error "Unknown HZ from arch/alpha/Kconfig" | ||
218 | #endif | ||
219 | if (sel) { | ||
220 | printk(KERN_INFO "Setting RTC_FREQ to %d Hz (%x)\n", | ||
221 | CONFIG_HZ, sel); | ||
222 | CMOS_WRITE(sel, RTC_FREQ_SELECT); | ||
223 | } | ||
214 | 224 | ||
215 | /* Turn on periodic interrupts. */ | 225 | /* Turn on periodic interrupts. */ |
216 | x = CMOS_READ(RTC_CONTROL); | 226 | x = CMOS_READ(RTC_CONTROL); |