CONFIG_NO_HZ: missed ticks, stall (keyb IRQ required) [2.6.18-rc4-mm1]
Hello all,
on my system I'm having the usual (already known from Con Kolivas earlier dynticks patches) problems with missed ticks: I have to generate keyboard or mouse interrupts to let my system proceed with booting (semi-)properly.
Once in X11 it's better (due to many IRQs being triggered here, I assume), but still not perfect.
This did "work properly" (for whatever reason) with 2.6.19-rc1-mm* and got broken once going to -rc2-mm*, IIRC. -rc4-mm1 is stock version without any local patches (for accurate bug reporting).
x86 UP Athlon 1200, VIA chipset.
Probably some problem with VIA chipsets and APIC, PIT, ...?
Would be nice to get this to work properly, anything I should try to debug?
Andreas Mohr
00:00.0 Host bridge: VIA Technologies, Inc. VT8366/A/7 [Apollo KT266/A/333] 00:01.0 PCI bridge: VIA Technologies, Inc. VT8366/A/7 [Apollo KT266/A/333 AGP] 00:09.0 FireWire (IEEE 1394): VIA Technologies, Inc. IEEE 1394 Host Controller ( rev 46)
00:0a.0 Multimedia audio controller: Aureal Semiconductor Vortex 2 (rev fe) 00:0c.0 Ethernet controller: Intel Corporation 82557/8/9 [Ethernet Pro 100] (rev
08)
00:0d.0 Multimedia audio controller: Aztech System Ltd 3328 Audio (rev 10) 00:10.0 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller
(rev 80)
00:10.1 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller
(rev 80)
00:10.2 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller
(rev 80)
00:10.3 USB Controller: VIA Technologies, Inc. USB 2.0 (rev 82) 00:11.0 ISA bridge: VIA Technologies, Inc. VT8235 ISA Bridge 00:11.1 IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT823x/A/ C PIPC Bus Master IDE (rev 06)
00:11.5 Multimedia audio controller: VIA Technologies, Inc. VT8233/A/8235/8237 A C97 Audio Controller (rev 50)
00:12.0 Ethernet controller: VIA Technologies, Inc. VT6102 [Rhine-II] (rev 74) 01:00.0 VGA compatible controller: ATI Technologies Inc Radeon RV250 If [Radeon 9000] (rev 01)
01:00.1 Display controller: ATI Technologies Inc Radeon RV250 [Radeon 9000] (Sec ondary) (rev 01)
$ cat /proc/acpi/processor/CPU0/*
processor id: 0
acpi id: 0
bus mastering control: no
power management: yes
throttling control: no
limit interface: no
<not supported>
active state: C2
max_cstate: C8
bus master activity: 00000000
maximum allowed latency: 2000 usec
states:
C1: type[C1] promotion[C2] demotion[--] latency[000] usage[00012840] duration[00000000000000000000]
*C2: type[C2] promotion[--] demotion[C1] latency[100] usage[00087632] duration[00000000002335220011]
<not supported># cat /proc/timer_stats Timerstats sample period: 9.36316 s 474, 0 swapper hrtimer_stop_sched_tick (hrtimer_sched_tick) 4, 3172 konsole schedule_timeout (process_timeout) 21, 2547 Xorg do_setitimer (it_real_fn) 188, 3149 knotify schedule_timeout (process_timeout) 13, 0 swapper hrtimer_restart_sched_tick (hrtimer_sched_tick) 56, 3141 artsd schedule_timeout (process_timeout) 37, 1515 modprobe usb_hcd_submit_urb (rh_timer_func) 10, 3141 artsd do_setitimer (it_real_fn) 2, 2547 Xorg schedule_timeout (process_timeout) 19, 3134 kicker schedule_timeout (process_timeout) 1, 3079 ssh-agent do_setitimer (it_real_fn) 1, 3078 ssh-agent do_setitimer (it_real_fn) 5, 0 swapper __netdev_watchdog_up (dev_watchdog) 5, 1 swapper queue_delayed_work_on (delayed_work_timer_fn) 1, 2937 preload schedule_timeout (process_timeout) 10, 3153 klipper schedule_timeout (process_timeout) 9, 3130 kwin schedule_timeout (process_timeout) 9, 3127 kwrapper do_nanosleep (hrtimer_wakeup) 3, 2481 cupsd schedule_timeout (process_timeout) 9, 2925 apache schedule_timeout (process_timeout) 1, 2496 hald schedule_timeout (process_timeout) 4, 2147 ifconfig e100_up (e100_watchdog) 4, 2513 hald-addon-stor do_nanosleep (hrtimer_wakeup) 1, 3446 bash start_this_handle (commit_timeout) 1, 3446 cat start_this_handle (commit_timeout) 1, 2905 cron do_nanosleep (hrtimer_wakeup) 2, 3122 kded schedule_timeout (process_timeout) 1, 2859 chronyd schedule_timeout (process_timeout) 1, 131 pdflush start_this_handle (commit_timeout) 1, 1 init schedule_timeout (process_timeout) 1, 0 swapper page_writeback_init (wb_timer_fn) 1, 4 events/0 do_cache_clean (delayed_work_timer_fn) 1, 1 swapper init_nonfatal_mce_checker (delayed_work_timer_fn) 1, 3120 klauncher schedule_timeout (process_timeout) 1, 1 swapper neigh_table_init_no_netlink (neigh_periodic_timer) 1, 1 swapper rekey_seq_generator (delayed_work_timer_fn) 1, 2621 nmbd schedule_timeout (process_timeout) 901 total events, 100.19 events/sec
.config excerpt (timer-related settings mostly):
CONFIG_X86_32=yCONFIG_GENERIC_TIME=yCONFIG_GENERIC_CLOCKEVENTS=y CONFIG_LOCKDEP_SUPPORT=y CONFIG_STACKTRACE_SUPPORT=y CONFIG_SEMAPHORE_SLEEPERS=yCONFIG_X86=yCONFIG_MMU=yCONFIG_ZONE_DMA=yCONFIG_GENERIC_ISA_DMA=yCONFIG_GENERIC_IOMAP=yCONFIG_GENERIC_BUG=yCONFIG_GENERIC_HWEIGHT=y CONFIG_ARCH_MAY_HAVE_PC_FDC=yCONFIG_DMI=y CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
CONFIG_EXPERIMENTAL=yCONFIG_BROKEN_ON_SMP=y
#
# Processor type and features
#CONFIG_HIGH_RES_TIMERS=yCONFIG_NO_HZ=y
# CONFIG_SMP is not setCONFIG_X86_PC=y
# CONFIG_X86_ELAN is not set
# CONFIG_X86_VOYAGER is not set
# CONFIG_X86_NUMAQ is not set
# CONFIG_X86_SUMMIT is not set
# CONFIG_X86_BIGSMP is not set
# CONFIG_X86_VISWS is not set
# CONFIG_X86_GENERICARCH is not set
# CONFIG_X86_ES7000 is not set
# CONFIG_M386 is not set
# CONFIG_M486 is not set
# CONFIG_M586 is not set
# CONFIG_M586TSC is not set
# CONFIG_M586MMX is not set
# CONFIG_M686 is not set
# CONFIG_MPENTIUMII is not set
# CONFIG_MPENTIUMIII is not set
# CONFIG_MPENTIUMM is not set
# CONFIG_MPENTIUM4 is not set
# CONFIG_MK6 is not setCONFIG_MK7=y
# CONFIG_MK8 is not set
# CONFIG_MCRUSOE is not set
# CONFIG_MEFFICEON is not set
# CONFIG_MWINCHIPC6 is not set
# CONFIG_MWINCHIP2 is not set
# CONFIG_MWINCHIP3D is not set
# CONFIG_MGEODEGX1 is not set
# CONFIG_MGEODE_LX is not set
# CONFIG_MCYRIXIII is not set
# CONFIG_MVIAC3_2 is not setCONFIG_X86_GENERIC=yCONFIG_X86_CMPXCHG=yCONFIG_X86_XADD=yCONFIG_X86_L1_CACHE_SHIFT=7CONFIG_RWSEM_XCHGADD_ALGORITHM=y
# CONFIG_ARCH_HAS_ILOG2_U32 is not set
# CONFIG_ARCH_HAS_ILOG2_U64 is not setCONFIG_GENERIC_CALIBRATE_DELAY=yCONFIG_X86_WP_WORKS_OK=yCONFIG_X86_INVLPG=yCONFIG_X86_BSWAP=yCONFIG_X86_POPAD_OK=yCONFIG_X86_CMPXCHG64=yCONFIG_X86_GOOD_APIC=yCONFIG_X86_INTEL_USERCOPY=yCONFIG_X86_USE_PPRO_CHECKSUM=yCONFIG_X86_USE_3DNOW=yCONFIG_X86_TSC=yCONFIG_HPET_TIMER=yCONFIG_HPET_EMULATE_RTC=y
# CONFIG_PREEMPT_NONE is not setCONFIG_PREEMPT_VOLUNTARY=y
# CONFIG_PREEMPT is not setCONFIG_X86_UP_APIC=yCONFIG_X86_UP_IOAPIC=yCONFIG_X86_LOCAL_APIC=yCONFIG_X86_IO_APIC=yCONFIG_X86_MCE=yCONFIG_X86_MCE_NONFATAL=y
# CONFIG_X86_MCE_P4THERMAL is not setCONFIG_VM86=y
# CONFIG_TOSHIBA is not set
# CONFIG_I8K is not set
# CONFIG_X86_REBOOTFIXUPS is not set
# CONFIG_MICROCODE is not set
# CONFIG_X86_MSR is not set
# CONFIG_X86_CPUID is not set
#
# Power management options (ACPI, APM)
#CONFIG_PM=yCONFIG_PM_LEGACY=y
# CONFIG_PM_DEBUG is not set
# CONFIG_PM_SYSFS_DEPRECATED is not setCONFIG_SOFTWARE_SUSPEND=yCONFIG_PM_STD_PARTITION="/dev/hda2"
#
# ACPI (Advanced Configuration and Power Interface) Support #CONFIG_ACPI=yCONFIG_ACPI_SLEEP=yCONFIG_ACPI_SLEEP_PROC_FS=y
# CONFIG_ACPI_SLEEP_PROC_SLEEP is not set CONFIG_ACPI_AC=yCONFIG_ACPI_BATTERY=yCONFIG_ACPI_BUTTON=yCONFIG_ACPI_VIDEO=yCONFIG_ACPI_HOTKEY=yCONFIG_ACPI_FAN=yCONFIG_ACPI_DOCK=yCONFIG_ACPI_PROCESSOR=yCONFIG_ACPI_THERMAL=y
# CONFIG_ACPI_ASUS is not set
# CONFIG_ACPI_IBM is not set
# CONFIG_ACPI_TOSHIBA is not set
# CONFIG_ACPI_SONY is not set CONFIG_ACPI_BLACKLIST_YEAR=0CONFIG_ACPI_DEBUG=yCONFIG_ACPI_EC=yCONFIG_ACPI_POWER=yCONFIG_ACPI_SYSTEM=yCONFIG_X86_PM_TIMER=yCONFIG_ACPI_CONTAINER=m
# CONFIG_ACPI_SBS is not set
#
# APM (Advanced Power Management) BIOS Support
#CONFIG_APM=y
# CONFIG_APM_IGNORE_USER_SUSPEND is not setCONFIG_APM_DO_ENABLE=yCONFIG_APM_CPU_IDLE=yCONFIG_APM_DISPLAY_BLANK=yCONFIG_APM_RTC_IS_GMT=yCONFIG_APM_ALLOW_INTS=y
# CONFIG_APM_REAL_MODE_POWER_OFF is not set
Quoted 13 lines · Andreas Mohr
Hello all,
on my system I'm having the usual (already known from Con Kolivas earlier dynticks patches) problems with missed ticks: I have to generate keyboard or mouse interrupts to let my system proceed with booting (semi-)properly.
Once in X11 it's better (due to many IRQs being triggered here, I assume), but still not perfect.This did "work properly" (for whatever reason) with 2.6.19-rc1-mm* and got broken once going to -rc2-mm*, IIRC. -rc4-mm1 is stock version without any local patches (for accurate bug reporting).
Quoted 5 lines
x86 UP Athlon 1200, VIA chipset.
Probably some problem with VIA chipsets and APIC, PIT, ...?
Would be nice to get this to work properly, anything I should try to debug?
Can you try:
http://tglx.de/projects/hrtimers/2.6.19-rc4-mm1/patch-2.6.19-rc4-mm1-hrt-dyntick1.patch
on top of -mm please? Can you mail me a boot log of that ?
Thanks,
tglx
Hi,
Quoted 10 lines · Thomas Gleixner
Quoted 5 lines · Andreas Mohr
x86 UP Athlon 1200, VIA chipset.
Probably some problem with VIA chipsets and APIC, PIT, ...?
Would be nice to get this to work properly, anything I should try to debug?
Can you try:
http://tglx.de/projects/hrtimers/2.6.19-rc4-mm1/patch-2.6.19-rc4-mm1-hrt-dyntick1.patch
You applied a nice lameness filter, by secretly making sure that -dyntick1 is unavailable and a new -dyntick2 took its place, right? ;)
Quoted 1 line
on top of -mm please? Can you mail me a boot log of that ?
Attached (went the extra mile and made sure to reply this night already).
It seems we have C2 APIC issues here, from a cursory glance at the log...
Note that it stalls directly after the
input: AT Translated Set 2 keyboard as /class/input/input0
line (from that point on it needs additional "support" via keyboard press).
Don't tell me my chipset is so awfully buggy that the best thing would be to swap mainboards immediately...
Thanks!!
(especially for your nice dynticks work)
Andreas Mohr
Quoted 2 lines · Andreas Mohr
You applied a nice lameness filter, by secretly making sure that -dyntick1 is unavailable and a new -dyntick2 took its place, right? ;)
:)
Quoted 1 line
It seems we have C2 APIC issues here, from a cursory glance at the log...
Yes, it stops in C2. Probably I was a bit over optimistic with the detection. Well it detects it, but not without help from the keyboard operator :(
Quoted 3 lines
Note that it stalls directly after the
input: AT Translated Set 2 keyboard as /class/input/input0
line (from that point on it needs additional "support" via keyboard press).
Does it resume normal operation after the "ACPI: lapic on CPU 0 stops in C2[C2]" message ?
It is easy to fix by marking all AMDs broken again, but I really want to avoid this.
tglx
Quoted 5 lines · Thomas Gleixner
Does it resume normal operation after the "ACPI: lapic on CPU 0 stops in C2[C2]" message ?
It is easy to fix by marking all AMDs broken again, but I really want to avoid this.
Doo, found a brown paperbag bug.
drivers/acpi/processor_idle.c +2 -2
@@ -575,8 +575,8 @@ static void acpi_processor_idle(void)*/ if (pr->power.timer_state_unstable < pr->power.timer_broadcast_on_state) { - pr->power.timer_state_unstable = - pr->power.timer_broadcast_on_state; + pr->power.timer_broadcast_on_state = + pr->power.timer_state_unstable;acpi_propagate_timer_broadcast (pr); }
Quoted 8 lines · Thomas Gleixner
Quoted 5 lines · Thomas Gleixner
Does it resume normal operation after the "ACPI: lapic on CPU 0 stops in C2[C2]" message ?
It is easy to fix by marking all AMDs broken again, but I really want to avoid this.
Doo, found a brown paperbag bug.
I uploaded a new queue with more fixups.
http://tglx.de/projects/hrtimers/2.6.19-rc4-mm1/patch-2.6.19-rc4-mm1-hrt-dyntick4.patch
tglx
Hi,
Quoted 1 line · Thomas Gleixner
I uploaded a new queue with more fixups.
Still no go, stalled after the
ACPI: (supports S0 S1 S3 S4 S5)
line this time (probably statistical fluke though). dmesg.log.gz attached.
# uname -a Linux andi 2.6.19-rc4-mm1-hrt-dyntick4 #1 Fri Nov 10 03:19:06 CET 2006 i686 GNU/Linux
Note that the first boot became unstable somehow (net connections stalled, eventually it hung completely while trying to switch to another tty; Magic SysRq reboot worked). I'm working within second boot right now.
Anything I should investigate? I'll see what I can do for now...
Thanks!
Andreas Mohr
Hi,
Quoted 9 lines · Andreas Mohr
Hi,
Quoted 1 line · Thomas Gleixner
I uploaded a new queue with more fixups.
Still no go, stalled after the
ACPI: (supports S0 S1 S3 S4 S5)
line this time (probably statistical fluke though). dmesg.log.gz attached.
This time with apic=debug (attached), and now we have messages such as:
lapic timer verify: delta 10754906 pmtimer 11935676 (2557644) lapic 1180770(0 1180770 1180807) on cpu 0
which means that the timer *is* unstable.
I'm starting to wonder what I could debug here...
Andreas Mohr
Hi,
[CC'd Len since he might want/be able to help despite this being VIA issue ;)]
Quoted 7 lines · Andreas Mohr
This time with apic=debug (attached), and now we have messages such as:
lapic timer verify: delta 10754906 pmtimer 11935676 (2557644) lapic 1180770(0 1180770 1180807) on cpu 0
which means that the timer *is* unstable.
I'm starting to wonder what I could debug here...
OK, I debugged it some more, and I noticed some very strange ACPI status again...
$ cat /proc/acpi/processor/CPU0/* processor id: 0 acpi id: 0 bus mastering control: no power management: no throttling control: no limit interface: no <not supported> active state: C0 max_cstate: C8 bus master activity: 00000000 maximum allowed latency: 2000 usec states: <not supported>
HOWEVER (dmesg.log.gz):
ACPI: CPU0 (power states: C1[C1] C2[C2])
and
ACPI: lapic on CPU 0 stops in C2[C2]
So according to /proc/acpi/ I don't even *have* C1/C2, however it's still being used.
Oh, wait, I just realized that of course I'm in 2.6.19-rc1-mm1 currently, however booting into 2.6.19-rc4-mm1 *does* list C1/C2 states in /proc/acpi/, in contrast to -rc1-mm1.
That would explain why 2.6.19-rc1-mm1 has no issues whatsoever with dynticks
- since it never even enters C1/C2!
OK, so dynticks in Linux > 2.6.19-rc1-mm1 broke because ACPI C1/C2 suddenly became available which killed my VIA APIC timer in C2.
How probable is it that the APIC timer got killed due to mis-programming in Linux versus VIA chipset design garbage probability? I.e. do you think there's a chance to fix C2 malfunction by going into the innards of VIA chipsets operation?
How useful would it be to simply disable C2 operation (but not C1) in CONFIG_NO_HZ mode after's been determined to kill APIC timer?:
lapic timer verify: delta 3435285 pmtimer 3469523 (743469) lapic 34238(0 34238 3 4338) on cpu 0
lapic timer verify: delta 6022 pmtimer 46853 (10040) lapic 40831(0 40831 40914) on cpu 0
lapic timer verify: delta 66814 pmtimer 136000 (29143) lapic 69186(0 69186 69284 ) on cpu 0
lapic timer verify: delta 19658 pmtimer 22092 (4734) lapic 2434(0 2434 2469) on cpu 0
lapic timer verify: delta 9967 pmtimer 22624 (4848) lapic 12657(0 12657 12693) o n cpu 0
lapic timer verify: delta 9681 pmtimer 21429 (4592) lapic 11748(0 11748 11945) o n cpu 0
lapic timer verify: delta 59879 pmtimer 94822 (20319) lapic 34943(0 34943 35029)
on cpu 0
lapic timer verify: delta 34878 pmtimer 52668 (11286) lapic 17790(0 17790 17876)
on cpu 0
lapic timer verify: delta 32436 pmtimer 78992 (16927) lapic 46556(0 46556 46641)
on cpu 0
lapic timer verify: delta 10450 pmtimer 75002 (16072) lapic 64552(0 64552 64590)
on cpu 0
ACPI: lapic on CPU 0 stops in C2[C2]
Hmm, processor_idle.c in current -dynticks4 seems to contain code to do just
that: disable C states after they've been found harmful to timer operation? But somehow it doesn't seem to work for me here, obviously.
If I don't get any further input on that I'll try to debug it myself soon.
http://www.linuxsymposium.org/proceedings/reprints/Reprint-Brown-OLS2004.pdf
is quite informative about APIC timer issues etc., BTW.
Andreas Mohr
Quoted 8 lines · Andreas Mohr
ACPI: lapic on CPU 0 stops in C2[C2]
How probable is it that the APIC timer got killed due to mis-programming in Linux versus VIA chipset design garbage probability? I.e. do you think there's a chance to fix C2 malfunction by going into the innards of VIA chipsets operation?
How useful would it be to simply disable C2 operation (but not C1) inCONFIG_NO_HZmode after's been determined to kill APIC timer?:
No, we better disable local apic timer in that case. What happens if you boot your machine with ACPI disabled ?
tglx
Hi,
Quoted 10 lines · Thomas Gleixner
Quoted 8 lines · Andreas Mohr
ACPI: lapic on CPU 0 stops in C2[C2]
How probable is it that the APIC timer got killed due to mis-programming in Linux versus VIA chipset design garbage probability? I.e. do you think there's a chance to fix C2 malfunction by going into the innards of VIA chipsets operation?
How useful would it be to simply disable C2 operation (but not C1) inCONFIG_NO_HZmode after's been determined to kill APIC timer?:
Quoted 2 lines
No, we better disable local apic timer in that case. What happens if you boot your machine with ACPI disabled ?
Oh, interesting. Why??
Anyway, acpi=off works perfectly fine (still running -rc4-mm1-dynticks4), as does setting
max_cstate = ACPI_STATE_C1;
in acpi_processor_power_init()!
(currently writing this mail with this hack ;)
So why not simply do
max_cstate = ACPI_STATE_C1;
in case acpi_timer_check_state():
+/*
+ * Some BIOS implementations switch to C3 in the published C2 state. This seems
+ * to be a common problem on AMD boxen.
+ */
yells?
This definitely *is* the problem with my AMD Athlon BIOS, it seems...
Or is it an advantage to switch off lapic in case of C2 brokenness since that will enable us to still safely drive C2 with dynticks despite those BIOS bugs or what?
(if I managed to draw the right conclusions about your lapic statement, that is...)
BTW, my GUI with dynticks seems quite a lot quicker than without. Or is that a placebo? I don't think it is...
Thanks!
Andreas Mohr
Quoted 2 lines · Andreas Mohr
Quoted 2 lines
Quoted 2 lines
How useful would it be to simply disable C2 operation (but not C1) in
CONFIG_NO_HZmode after's been determined to kill APIC timer?:
If the goal is saving power, then disabling dynticks will likely
be more attractive than disabling C2. Perhaps you can measure it?
eg. simply run "bltk -I" to measure idle battery life (http://sourceforge.net/projects/bltk)
But this is even more true when talking about C3 -- it certainly saves more power than dynticks does. This is true for the example system here:
http://ftp.kernel.org/pub/linux/kernel/people/lenb/acpi/doc/OLS2006-bltk-paper.pdf
So given that C3 on every known system that has shipped to date breaks the LAPIC timer (and apparently this applies to C2 on these AMD boxes), dynticks needs a solid story for co-existing with C3.
If (HPET re-programming latency is not prohibititive)
If (there is an HPET/thread)
then using the HPET/thread instead of the LAPIC timer is the way to go
else If ( there is an HPET/core, or /package)
then using the HPET for the timer interrupt to a group of threads maybe the way to go. (interrupt needs to be re-sent to the actual destination via IPI)
else if (PIT re-programming latency is not prohibitive)
then using PIT to cpu0 and IPI to the cpu of interest would work
else
The HW isn't well suited to dynticks,
fall back to a static HZ mode at boot-time.
Though I suppose that "static HZ" could actually be a variable set at boot-time rather than the compile-time scheme we use today. Eg. if a box has high-latency C-states, it certainly wants hz<=64 Boxes with just C1 will not care and would go for hz= faster
-Len
Quoted 3 lines · Len Brown
So given that C3 on every known system that has shipped to date breaks the LAPIC timer (and apparently this applies to C2 on these AMD boxes), dynticks needs a solid story for co-existing with C3.
check out 2.6.19-rc4-mm2: it detects this breakage and works it around by using the PIT as a clock-events source. That did the trick on my laptop which has this problem too. I agree with you that degrading the powersaving mode is not an option.
we've got a question about HPET: it seems all recent hardware has it, but the BIOS rarely mentions it, so the Linux driver does not enable HPET. Is there any chance to enable HPET (in the chipset?) - this would probably be a higher-quality clock-events source than the PIT.
Ingo
Quoted 10 lines · Ingo Molnar
Quoted 3 lines · Len Brown
So given that C3 on every known system that has shipped to date breaks the LAPIC timer (and apparently this applies to C2 on these AMD boxes), dynticks needs a solid story for co-existing with C3.
check out 2.6.19-rc4-mm2: it detects this breakage and works it around by using the PIT as a clock-events source. That did the trick on my laptop which has this problem too. I agree with you that degrading the powersaving mode is not an option.
Andreas tested with the latest -mm1-hrt-dyntick patches, so he has all the checks already. The thing which worries me here is, that we detect the breakage and use the fallback path already, but it still has this weird effect on that system, while others just work fine. I'm cooking a more brute force fallback right now.
tglx
Hi,
Quoted 5 lines · Thomas Gleixner
Andreas tested with the latest -mm1-hrt-dyntick patches, so he has all the checks already. The thing which worries me here is, that we detect the breakage and use the fallback path already, but it still has this weird effect on that system, while others just work fine. I'm cooking a more brute force fallback right now.
That's what I didn't understand all that time:
I do get the "C2 unusable, kills APIC timer" message, so I expected the code to not use C2, but it seems it did use it (causing hangs) and I didn't fully analyze the code whether it truly tried to prevent C2 here (handling was a bit opaque to me, should have analyzed it
more thoroughly to get to know exactly what happens).
And like I said, brutally hard-wiring max_cstate to C1 already fixed dynticks things for me, so it seems as if it still touched C2 before.
Andreas Mohr
Quoted 16 lines · Andreas Mohr
Hi,
Quoted 5 lines · Thomas Gleixner
Andreas tested with the latest -mm1-hrt-dyntick patches, so he has all the checks already. The thing which worries me here is, that we detect the breakage and use the fallback path already, but it still has this weird effect on that system, while others just work fine. I'm cooking a more brute force fallback right now.
That's what I didn't understand all that time:
I do get the "C2 unusable, kills APIC timer" message, so I expected the code to not use C2, but it seems it did use it (causing hangs) and I didn't fully analyze the code whether it truly tried to prevent C2 here (handling was a bit opaque to me, should have analyzed it
more thoroughly to get to know exactly what happens).
Quoted 2 lines
And like I said, brutally hard-wiring
max_cstateto C1 already fixed dynticks things for me, so it seems as if it still touched C2 before.
Yes, it leaves the C states untouched, it uses (should use) PIT instead of the local APIC timer. I'm a bit confused, why this does not work on your box.
tglx
Quoted 7 lines · Thomas Gleixner
Quoted 7 lines
That's what I didn't understand all that time:
I do get the "C2 unusable, kills APIC timer" message, so I expected the code to not use C2, but it seems it did use it (causing hangs) and I didn't fully analyze the code whether it truly tried to prevent C2 here (handling was a bit opaque to me, should have analyzed it
more thoroughly to get to know exactly what happens).
Quoted 6 lines
Quoted 2 lines
And like I said, brutally hard-wiring
max_cstateto C1 already fixed dynticks things for me, so it seems as if it still touched C2 before.Yes, it leaves the C states untouched, it uses (should use) PIT instead of the local APIC timer. I'm a bit confused, why this does not work on your box.
Can you try the patch below please ? I just noticed, that the local APIC gets reprogrammed before we switch back from PIT, which is perfectly fine, but maybe your box does not like that treatment. If this does not help, I'm going to do the never switch back from PIT hackery which I wanted to avoid for performance reasons.
tglx
arch/i386/kernel/apic.c +6 -3
@@ -100,6 +100,7 @@ static struct clock_event_device lapic_c*/ struct lapic_event_device {struct clock_event_device evdev; +enum clock_event_mode mode;unsigned long last_delta;unsigned long counter; };
@@ -224,9 +225,11 @@ static void lapic_next_event(unsigned lostruct lapic_event_device *ldev; ldev = container_of(evt, struct lapic_event_device, evdev); - ldev->last_delta = delta; -apic_write_around (APIC_TMICT , delta); +if (ldev->mode ==CLOCK_EVT_PERIODIC ) { + ldev->last_delta = delta; +apic_write_around (APIC_TMICT , delta); + } }/*
@@ -257,7 +260,7 @@ static void lapic_timer_setup(enum clockapic_write_around (APIC_LVTT , v);break ; } - + ldev->mode = mode;local_irq_restore (flags); }
Hi,
Quoted 10 lines · Thomas Gleixner
Quoted 3 lines · Thomas Gleixner
Yes, it leaves the C states untouched, it uses (should use) PIT instead of the local APIC timer. I'm a bit confused, why this does not work on your box.
Can you try the patch below please ? I just noticed, that the local APIC gets reprogrammed before we switch back from PIT, which is perfectly fine, but maybe your box does not like that treatment. If this does not help, I'm going to do the never switch back from PIT hackery which I wanted to avoid for performance reasons.
I applied the patch, the changes *are* in the tree and I did create and install a new image (with CONFIG_NO_HZ re-enabled and C1 hard-wiring removed), but it failed again, completely. The usual hang during boot with keyboard activity required, and then it didn't even manage to finish booting (I probably was too slow in generating the necessary amount of events).
Let me think a bit about that stuff, maybe I'll be able to figure out what's happening on my system. Or any other ideas?
(since I would like to somehow get this resolved without less than perfect workarounds if possible)
Andreas Mohr
Quoted 10 lines · Andreas Mohr
I applied the patch, the changes *are* in the tree and I did create and install a new image (with
CONFIG_NO_HZre-enabled and C1 hard-wiring removed), but it failed again, completely. The usual hang during boot with keyboard activity required, and then it didn't even manage to finish booting (I probably was too slow in generating the necessary amount of events).Let me think a bit about that stuff, maybe I'll be able to figure out what's happening on my system. Or any other ideas?
(since I would like to somehow get this resolved without less than perfect workarounds if possible)
Yes, I'm going to drop the detection as it can never be perfect and enforce the PIT usage on UP boxen, as it seems that the lapic / BIOS crap is more or less unfixable. Working on a patch against rc5-mm1 right now.
tglx
Quoted 9 lines · Ingo Molnar
Quoted 3 lines
So given that C3 on every known system that has shipped to date breaks the LAPIC timer (and apparently this applies to C2 on these AMD boxes), dynticks needs a solid story for co-existing with C3.
check out 2.6.19-rc4-mm2: it detects this breakage and works it around by using the PIT as a clock-events source. That did the trick on my laptop which has this problem too. I agree with you that degrading the powersaving mode is not an option.
Quoted 4 lines
we've got a question about HPET: it seems all recent hardware has it, but the BIOS rarely mentions it, so the Linux driver does not enable HPET. Is there any chance to enable HPET (in the chipset?) - this would probably be a higher-quality clock-events source than the PIT.
If Windows enumerates and uses the HPET on a box, then Linux should be able to use the HPET on that box too.
I belive that Venki has looked at some of the HPET enumeration issues, and maybe he has some suggestions. Is there an example system on-hand where we know Windows works and Linux does not?
-Len
Hi,
Quoted 8 lines · Len Brown
Quoted 2 lines · Andreas Mohr
Quoted 2 lines
Quoted 2 lines
How useful would it be to simply disable C2 operation (but not C1) in
CONFIG_NO_HZmode after's been determined to kill APIC timer?:If the goal is saving power, then disabling dynticks will likely
be more attractive than disabling C2. Perhaps you can measure it?
eg. simply run "bltk -I" to measure idle battery life (http://sourceforge.net/projects/bltk)
Surely the CMOS battery?? Seriously, no battery here anywhere ;)
Anyway, I was already afraid that I didn't have any of my *two* different power measurement devices here, but then I found one in the drawer (Conrad EKM 265, to be precise).
The results are (waited for values to settle down each time):
-dyntick4, C1, CONFIG_NO_HZ:
83.9W KDE idle, 95.2W bash while 1
-dyntick4, C2 (C1-only hack disabled, kernel rebuilt), CONFIG_NO_HZ off:
84.4W KDE idle, 95.4W bash while 1
-dyntick4, acpi=off (i.e. APM active), -dynticks:
85.5W KDE idle, 95.5W bash while 1Bet you didn't see this coming...
Again, this is Athlon 1200 *desktop*, with some EPOX VIA motherboard ("8K5A3+" ??).
Note that even with dynticks disabled did I have a pause on boot where I had to fiddle with the keyboard once to continue booting, IOW our APIC timer probing disrupts normal interrupt processing due to C2 -> C3 AMD BIOS bug. We might want to fix probing to not require manual generation of the next interrupt event due to APIC timer temporarily being "dead".
Quoted 7 lines
But this is even more true when talking about C3 -- it certainly saves more power than dynticks does. This is true for the example system here:
http://ftp.kernel.org/pub/linux/kernel/people/lenb/acpi/doc/OLS2006-bltk-paper.pdfSo given that C3 on every known system that has shipped to date breaks the LAPIC timer (and apparently this applies to C2 on these AMD boxes), dynticks needs a solid story for co-existing with C3.
Indeed, we need a good and flexible fallback mechanism.
However I would slightly slant dynticks towards being active even in cases where it actually happens to consume *slightly* more power due to C2 disabled, since it *seems* that CPU load is lower with dynticks
(less timer background load) / desktop timing is slightly more precise. And we all want fast desktops that are waaaaay better than XP, right?
Andreas Mohr
Quoted 10 lines · Andreas Mohr
The results are (waited for values to settle down each time):
(quoted diff) +0
-3-dyntick4, C1, CONFIG_NO_HZ: 83.9W KDE idle, 95.2W bash while 1 -dyntick4, C2 (C1-only hack disabled, kernel rebuilt), CONFIG_NO_HZ off: 84.4W KDE idle, 95.4W bash while 1 -dyntick4, acpi=off (i.e. APM active), -dynticks: 85.5W KDE idle, 95.5W bash while 1Bet you didn't see this coming...
interesting that there's any savings from dynticks in this workload. When the CPU is busy then dynticks generates the usual HZ scheduler tick.
could you try the same measurement with a completely idle system too? That is where dynticks has its true effects: longer idle intervals. (but even on an idle system dynticks might not make a difference unless the hardware can utilize the much larger and more predictable idle times that dynticks offers.)
Ingo
Quoted 17 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
How useful would it be to simply disable C2 operation (but not C1) in
CONFIG_NO_HZmode after's been determined to kill APIC timer?:If the goal is saving power, then disabling dynticks will likely be more attractive than disabling C2. Perhaps you can measure it?
(Conrad EKM 265, to be precise).
The results are (waited for values to settle down each time):
(quoted diff) +0
-3-dyntick4, C1, CONFIG_NO_HZ: 83.9W KDE idle, 95.2W bash while 1 -dyntick4, C2 (C1-only hack disabled, kernel rebuilt), CONFIG_NO_HZ off: 84.4W KDE idle, 95.4W bash while 1 -dyntick4, acpi=off (i.e. APM active), -dynticks: 85.5W KDE idle, 95.5W bash while 1
Quoted 4 lines
Bet you didn't see this coming...
Again, this is Athlon 1200 *desktop*, with some EPOX VIA motherboard ("8K5A3+" ??).
Yes, I assumed you were running on a laptop...
These three measurements tell me that there is no significant power savings difference between these configurations on this system.
One has to wonder why the hardware vendor supports C2 on this box, as its sole function seems to be to break the local APIC timer...
BTW. when I've had to measure small idle power differences, I've found variance is smaller when I run at init 1.
Quoted 8 lines
Quoted 7 lines
But this is even more true when talking about C3 -- it certainly saves more power than dynticks does. This is true for the example system here:
http://ftp.kernel.org/pub/linux/kernel/people/lenb/acpi/doc/OLS2006-bltk-paper.pdfSo given that C3 on every known system that has shipped to date breaks the LAPIC timer (and apparently this applies to C2 on these AMD boxes), dynticks needs a solid story for co-existing with C3.
Quoted 6 lines
Indeed, we need a good and flexible fallback mechanism.
However I would slightly slant dynticks towards being active even in cases where it actually happens to consume *slightly* more power due to C2 disabled, since it *seems* that CPU load is lower with dynticks
(less timer background load) / desktop timing is slightly more precise. And we all want fast desktops that are waaaaay better than XP, right?
1.
I don't expect dynticks to save significant power on the desktop. (5-10% would be significant, 1% is not significant)
2.
I do expect dynticks to reduce the load on un-modified virtual guest OSs. 3.
I do expect dynticks it to reduce power on highly power managed mobile systems.
I believe that either #2 or #3 by themselves justify deploying dynticks.
cheers,
-Len