1. 23 9月, 2008 2 次提交
    • T
      clockevents: prevent mode mismatch on cpu online · 27ce4cb4
      Thomas Gleixner 提交于
      Impact: timer hang on CPU online observed on AMD C1E systems
      
      When a CPU is brought online then the broadcast machinery can
      be in the one shot state already. Check this and setup the timer 
      device of the new CPU in one shot mode so the broadcast code
      can pick up the next_event value correctly.
      
      Another AMD C1E oddity, as we switch to broadcast immediately and
      not after the full bring up via the ACPI cpu idle code.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      27ce4cb4
    • T
      clockevents: check broadcast device not tick device · 30274569
      Thomas Gleixner 提交于
      Impact: Possible hang on CPU online observed on AMD C1E machines.
      
      The broadcast setup code looks at the mode of the tick device to
      determine whether it needs to be shut down or setup. This is wrong
      when the broadcast mode is set to one shot already. This can happen
      when a CPU is brought online as it goes through the periodic setup
      first.
      
      The problem went unnoticed as sane systems do not call into that code
      before the switch to one shot for the clock event device happens.
      The AMD C1E idle routine switches over immediately and thereby shuts
      down the just setup device before the first interrupt happens.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      30274569
  2. 17 9月, 2008 1 次提交
    • T
      clockevents: make device shutdown robust · 2344abbc
      Thomas Gleixner 提交于
      The device shut down does not cleanup the next_event variable of the
      clock event device. So when the device is reactivated the possible
      stale next_event value can prevent the device to be reprogrammed as it
      claims to wait on a event already.
      
      This is the root cause of the resurfacing suspend/resume problem,
      where systems need key press to come back to life.
      
      Fix this by setting next_event to KTIME_MAX when the device is shut
      down. Use a separate function for shutdown which takes care of that
      and only keep the direct set mode call in the broadcast code, where we
      can not touch the next_event value.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      2344abbc
  3. 06 9月, 2008 1 次提交
  4. 05 9月, 2008 3 次提交
    • T
      clockevents: prevent endless loop lockup · 1fb9b7d2
      Thomas Gleixner 提交于
      The C1E/HPET bug reports on AMDX2/RS690 systems where tracked down to a
      too small value of the HPET minumum delta for programming an event.
      
      The clockevents code needs to enforce an interrupt event on the clock event
      device in some cases. The enforcement code was stupid and naive, as it just
      added the minimum delta to the current time and tried to reprogram the device.
      When the minimum delta is too small, then this loops forever.
      
      Add a sanity check. Allow reprogramming to fail 3 times, then print a warning
      and double the minimum delta value to make sure, that this does not happen again.
      Use the same function for both tick-oneshot and tick-broadcast code.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      1fb9b7d2
    • T
      clockevents: prevent multiple init/shutdown · 9c17bcda
      Thomas Gleixner 提交于
      While chasing the C1E/HPET bugreports I went through the clock events
      code inch by inch and found that the broadcast device can be initialized
      and shutdown multiple times. Multiple shutdowns are not critical, but
      useless waste of time. Multiple initializations are simply broken. Another
      CPU might have the device in use already after the first initialization and
      the second init could just render it unusable again.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      9c17bcda
    • T
      clockevents: prevent endless loop in periodic broadcast handler · d4496b39
      Thomas Gleixner 提交于
      The reprogramming of the periodic broadcast handler was broken,
      when the first programming returned -ETIME. The clockevents code
      stores the new expiry value in the clock events device next_event field
      only when the programming time has not been elapsed yet. The loop in
      question calculates the new expiry value from the next_event value
      and therefor never increases.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      d4496b39
  5. 08 7月, 2008 1 次提交
    • T
      x86, clockevents: add C1E aware idle function · aa276e1c
      Thomas Gleixner 提交于
      C1E on AMD machines is like C3 but without control from the OS. Up to
      now we disabled the local apic timer for those machines as it stops
      when the CPU goes into C1E. This excludes those machines from high
      resolution timers / dynamic ticks, which hurts especially X2 based
      laptops.
      
      The current boot time C1E detection has another, more serious flaw
      as well: some BIOSes do not enable C1E until the ACPI processor module
      is loaded. This causes systems to stop working after that point.
      
      To work nicely with C1E enabled machines we use a separate idle
      function, which checks on idle entry whether C1E was enabled in the
      Interrupt Pending Message MSR. This allows us to do timer broadcasting
      for C1E and covers the late enablement of C1E as well.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      aa276e1c
  6. 26 6月, 2008 1 次提交
  7. 24 5月, 2008 1 次提交
  8. 21 4月, 2008 1 次提交
  9. 17 4月, 2008 1 次提交
    • R
      [S390] genirq/clockevents: move irq affinity prototypes/inlines to interrupt.h · d7b90689
      Russell King 提交于
      > Generic code is not supposed to include irq.h. Replace this include
      > by linux/hardirq.h instead and add/replace an include of linux/irq.h
      > in asm header files where necessary.
      > This change should only matter for architectures that make use of
      > GENERIC_CLOCKEVENTS.
      > Architectures in question are mips, x86, arm, sh, powerpc, uml and sparc64.
      >
      > I did some cross compile tests for mips, x86_64, arm, powerpc and sparc64.
      > This patch fixes also build breakages caused by the include replacement in
      > tick-common.h.
      
      I generally dislike adding optional linux/* includes in asm/* includes -
      I'm nervous about this causing include loops.
      
      However, there's a separate point to be discussed here.
      
      That is, what interfaces are expected of every architecture in the kernel.
      If generic code wants to be able to set the affinity of interrupts, then
      that needs to become part of the interfaces listed in linux/interrupt.h
      rather than linux/irq.h.
      
      So what I suggest is this approach instead (against Linus' tree of a
      couple of days ago) - we move irq_set_affinity() and irq_can_set_affinity()
      to linux/interrupt.h, change the linux/irq.h includes to linux/interrupt.h
      and include asm/irq_regs.h where needed (asm/irq_regs.h is supposed to be
      rarely used include since not much touches the stacked parent context
      registers.)
      
      Build tested on ARM PXA family kernels and ARM's Realview platform
      kernels which both use genirq.
      
      [ tglx@linutronix.de: add GENERIC_HARDIRQ dependencies ]
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
      d7b90689
  10. 30 1月, 2008 1 次提交
  11. 19 12月, 2007 1 次提交
    • T
      clockevents: fix reprogramming decision in oneshot broadcast · cdc6f27d
      Thomas Gleixner 提交于
      Resolve the following regression of a choppy, almost unusable laptop:
      
       http://lkml.org/lkml/2007/12/7/299
       http://bugzilla.kernel.org/show_bug.cgi?id=9525
      
      A previous version of the code did the reprogramming of the broadcast
      device in the return from idle code. This was removed, but the logic in
      tick_handle_oneshot_broadcast() was kept the same.
      
      When a broadcast interrupt happens we signal the expiry to all CPUs
      which have an expired event. If none of the CPUs has an expired event,
      which can happen in dyntick mode, then we reprogram the broadcast
      device. We do not reprogram otherwise, but this is only correct if all
      CPUs, which are in the idle broadcast state have been woken up.
      
      The code ignores, that there might be pending not yet expired events on
      other CPUs, which are in the idle broadcast state. So the delivery of
      those events can be delayed for quite a time.
      
      Change the tick_handle_oneshot_broadcast() function to check for CPUs,
      which are in broadcast state and are not woken up by the current event,
      and enforce the rearming of the broadcast device for those CPUs.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      cdc6f27d
  12. 06 11月, 2007 1 次提交
  13. 18 10月, 2007 1 次提交
  14. 17 10月, 2007 1 次提交
  15. 15 10月, 2007 1 次提交
    • T
      clockevents: introduce force broadcast notifier · 1595f452
      Thomas Gleixner 提交于
      The 64bit SMP bootup is slightly different to the 32bit one. It enables
      the boot CPU local APIC timer before all CPUs are brought up. Some AMD C1E
      systems have the C1E feature flag only set in the secondary CPU. Due to
      the early enable of the boot CPU local APIC timer the APIC timer is
      registered as a fully functional device. When we detect the wreckage during
      the bringup of the secondary CPU, we need to force the boot CPU into
      broadcast mode. 
      
      Add a new notifier reason and implement the force broadcast in the clock
      events layer.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      1595f452
  16. 13 10月, 2007 2 次提交
  17. 23 9月, 2007 1 次提交
    • T
      clockevents: remove the suspend/resume workaround^Wthinko · b7e113dc
      Thomas Gleixner 提交于
      In a desparate attempt to fix the suspend/resume problem on Andrews
      VAIO I added a workaround which enforced the broadcast of the oneshot
      timer on resume. This was actually resolving the problem on the VAIO
      but was just a stupid workaround, which was not tackling the root
      cause: the assignement of lower idle C-States in the ACPI processor_idle
      code. The cpuidle patches, which utilize the dynamic tick feature and
      go faster into deeper C-states exposed the problem again. The correct
      solution is the previous patch, which prevents lower C-states across
      the suspend/resume.
      
      Remove the enforcement code, including the conditional broadcast timer
      arming, which helped to pamper over the real problem for quite a time.
      The oneshot broadcast flag for the cpu, which runs the resume code can
      never be set at the time when this code is executed. It only gets set,
      when the CPU is entering a lower idle C-State.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-by: NAndrew Morton <akpm@linux-foundation.org>
      Cc: Len Brown <lenb@kernel.org>
      Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
      Cc: Rafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b7e113dc
  18. 16 9月, 2007 2 次提交
  19. 22 7月, 2007 2 次提交
  20. 24 5月, 2007 1 次提交
  21. 17 3月, 2007 1 次提交
    • T
      [PATCH] clockevents: Fix suspend/resume to disk hangs · cd05a1f8
      Thomas Gleixner 提交于
      I finally found a dual core box, which survives suspend/resume without
      crashing in the middle of nowhere. Sigh, I never figured out from the
      code and the bug reports what's going on.
      
      The observed hangs are caused by a stale state transition of the clock
      event devices, which keeps the RCU synchronization away from completion,
      when the non boot CPU is brought back up.
      
      The suspend/resume in oneshot mode needs the similar care as the
      periodic mode during suspend to RAM. My assumption that the state
      transitions during the different shutdown/bringups of s2disk would go
      through the periodic boot phase and then switch over to highres resp.
      nohz mode were simply wrong.
      
      Add the appropriate suspend / resume handling for the non periodic
      modes.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      cd05a1f8
  22. 07 3月, 2007 1 次提交
  23. 17 2月, 2007 3 次提交
    • I
      [PATCH] Add debugging feature /proc/timer_list · 289f480a
      Ingo Molnar 提交于
      add /proc/timer_list, which prints all currently pending (high-res) timers,
      all clock-event sources and their parameters in a human-readable form.
      
      Sample output:
      
      Timer List Version: v0.1
      HRTIMER_MAX_CLOCK_BASES: 2
      now at 4246046273872 nsecs
      
      cpu: 0
       clock 0:
        .index:      0
        .resolution: 1 nsecs
        .get_time:   ktime_get_real
        .offset:     1273998312645738432 nsecs
      active timers:
       clock 1:
        .index:      1
        .resolution: 1 nsecs
        .get_time:   ktime_get
        .offset:     0 nsecs
      active timers:
       #0: <f5a90ec8>, hrtimer_sched_tick, hrtimer_stop_sched_tick, swapper/0
       # expires at 4246432689566 nsecs [in 386415694 nsecs]
       #1: <f5a90ec8>, hrtimer_wakeup, do_nanosleep, pcscd/2050
       # expires at 4247018194689 nsecs [in 971920817 nsecs]
       #2: <f5a90ec8>, hrtimer_wakeup, do_nanosleep, irqbalance/1909
       # expires at 4247351358392 nsecs [in 1305084520 nsecs]
       #3: <f5a90ec8>, hrtimer_wakeup, do_nanosleep, crond/2157
       # expires at 4249097614968 nsecs [in 3051341096 nsecs]
       #4: <f5a90ec8>, it_real_fn, do_setitimer, syslogd/1888
       # expires at 4251329900926 nsecs [in 5283627054 nsecs]
        .expires_next   : 4246432689566 nsecs
        .hres_active    : 1
        .check_clocks   : 0
        .nr_events      : 31306
        .idle_tick      : 4246020791890 nsecs
        .tick_stopped   : 1
        .idle_jiffies   : 986504
        .idle_calls     : 40700
        .idle_sleeps    : 36014
        .idle_entrytime : 4246019418883 nsecs
        .idle_sleeptime : 4178181972709 nsecs
      
      cpu: 1
       clock 0:
        .index:      0
        .resolution: 1 nsecs
        .get_time:   ktime_get_real
        .offset:     1273998312645738432 nsecs
      active timers:
       clock 1:
        .index:      1
        .resolution: 1 nsecs
        .get_time:   ktime_get
        .offset:     0 nsecs
      active timers:
       #0: <f5a90ec8>, hrtimer_sched_tick, hrtimer_restart_sched_tick, swapper/0
       # expires at 4246050084568 nsecs [in 3810696 nsecs]
       #1: <f5a90ec8>, hrtimer_wakeup, do_nanosleep, atd/2227
       # expires at 4261010635003 nsecs [in 14964361131 nsecs]
       #2: <f5a90ec8>, hrtimer_wakeup, do_nanosleep, smartd/2332
       # expires at 5469485798970 nsecs [in 1223439525098 nsecs]
        .expires_next   : 4246050084568 nsecs
        .hres_active    : 1
        .check_clocks   : 0
        .nr_events      : 24043
        .idle_tick      : 4246046084568 nsecs
        .tick_stopped   : 0
        .idle_jiffies   : 986510
        .idle_calls     : 26360
        .idle_sleeps    : 22551
        .idle_entrytime : 4246043874339 nsecs
        .idle_sleeptime : 4170763761184 nsecs
      
      tick_broadcast_mask: 00000003
      event_broadcast_mask: 00000001
      
      CPU#0's local event device:
      
      Clock Event Device: lapic
       capabilities:   0000000e
       max_delta_ns:   807385544
       min_delta_ns:   1443
       mult:           44624025
       shift:          32
       set_next_event: lapic_next_event
       set_mode:       lapic_timer_setup
       event_handler:  hrtimer_interrupt
        .installed:  1
        .expires:    4246432689566 nsecs
      
      CPU#1's local event device:
      
      Clock Event Device: lapic
       capabilities:   0000000e
       max_delta_ns:   807385544
       min_delta_ns:   1443
       mult:           44624025
       shift:          32
       set_next_event: lapic_next_event
       set_mode:       lapic_timer_setup
       event_handler:  hrtimer_interrupt
        .installed:  1
        .expires:    4246050084568 nsecs
      
      Clock Event Device: hpet
       capabilities:   00000007
       max_delta_ns:   2147483647
       min_delta_ns:   3352
       mult:           61496110
       shift:          32
       set_next_event: hpet_next_event
       set_mode:       hpet_set_mode
       event_handler:  handle_nextevt_broadcast
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: john stultz <johnstul@us.ibm.com>
      Cc: Roman Zippel <zippel@linux-m68k.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      289f480a
    • T
      [PATCH] tick-management: dyntick / highres functionality · 79bf2bb3
      Thomas Gleixner 提交于
      With Ingo Molnar <mingo@elte.hu>
      
      Add functions to provide dynamic ticks and high resolution timers.  The code
      which keeps track of jiffies and handles the long idle periods is shared
      between tick based and high resolution timer based dynticks.  The dyntick
      functionality can be disabled on the kernel commandline.  Provide also the
      infrastructure to support high resolution timers.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Cc: john stultz <johnstul@us.ibm.com>
      Cc: Roman Zippel <zippel@linux-m68k.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      79bf2bb3
    • T
      [PATCH] tick-management: broadcast functionality · f8381cba
      Thomas Gleixner 提交于
      With Ingo Molnar <mingo@elte.hu>
      
      Add broadcast functionality, so per cpu clock event devices can be registered
      as dummy devices or switched from/to broadcast on demand.  The broadcast
      function distributes the events via the broadcast function of the clock event
      device.  This is primarily designed to replace the switch apic timer to / from
      IPI in power states, where the apic stops.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Cc: john stultz <johnstul@us.ibm.com>
      Cc: Roman Zippel <zippel@linux-m68k.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f8381cba