12 Nov, 2008

1 commit


11 Nov, 2008

1 commit

  • Impact: fix incorrect locking triggered during hotplug-intense stress-tests

    While migrating the the CB_IRQSAFE_UNLOCKED timers during a cpu-offline,
    we queue them on the cb_pending list, so that they won't go
    stale.

    Thus, when the callbacks of the timers run from the softirq context,
    they could run into potential deadlocks, since these callbacks
    assume that they're running with irq's disabled, thereby annoying
    lockdep!

    Fix this by emulating hardirq context while running these callbacks from
    the hrtimer softirq.

    =================================
    [ INFO: inconsistent lock state ]
    2.6.27 #2
    --------------------------------
    inconsistent {in-hardirq-W} -> {hardirq-on-W} usage.
    ksoftirqd/0/4 [HC0[0]:SC1[1]:HE1:SE0] takes:
    (&rq->lock){++..}, at: [] sched_rt_period_timer+0x9e/0x1fc
    {in-hardirq-W} state was registered at:
    [] __lock_acquire+0x549/0x121e
    [] native_sched_clock+0x88/0x99
    [] clocksource_get_next+0x39/0x3f
    [] update_wall_time+0x616/0x7df
    [] lock_acquire+0x5a/0x74
    [] scheduler_tick+0x3a/0x18d
    [] _spin_lock+0x1c/0x45
    [] scheduler_tick+0x3a/0x18d
    [] scheduler_tick+0x3a/0x18d
    [] update_process_times+0x3a/0x44
    [] tick_periodic+0x63/0x6d
    [] tick_handle_periodic+0x14/0x5e
    [] timer_interrupt+0x44/0x4a
    [] handle_IRQ_event+0x13/0x3d
    [] handle_level_irq+0x79/0xbd
    [] do_IRQ+0x69/0x7d
    [] common_interrupt+0x28/0x30
    [] aac_probe_one+0x1a3/0x3f3
    [] _spin_unlock_irqrestore+0x36/0x39
    [] setup_irq+0x1be/0x1f9
    [] start_kernel+0x259/0x2c5
    [] 0xffffffff
    irq event stamp: 50102
    hardirqs last enabled at (50102): [] _spin_unlock_irq+0x20/0x23
    hardirqs last disabled at (50101): [] _spin_lock_irq+0xa/0x4b
    softirqs last enabled at (50088): [] do_softirq+0x37/0x4d
    softirqs last disabled at (50099): [] do_softirq+0x37/0x4d

    other info that might help us debug this:
    no locks held by ksoftirqd/0/4.

    stack backtrace:
    Pid: 4, comm: ksoftirqd/0 Not tainted 2.6.27 #2
    [] print_usage_bug+0x13e/0x147
    [] mark_lock+0x493/0x797
    [] __lock_acquire+0x5be/0x121e
    [] lock_acquire+0x5a/0x74
    [] sched_rt_period_timer+0x9e/0x1fc
    [] _spin_lock+0x1c/0x45
    [] sched_rt_period_timer+0x9e/0x1fc
    [] sched_rt_period_timer+0x9e/0x1fc
    [] finish_task_switch+0x41/0xbd
    [] native_sched_clock+0x88/0x99
    [] sched_rt_period_timer+0x0/0x1fc
    [] run_hrtimer_pending+0x54/0xe5
    [] sched_rt_period_timer+0x0/0x1fc
    [] __do_softirq+0x7b/0xef
    [] do_softirq+0x37/0x4d
    [] ksoftirqd+0x56/0xc5
    [] ksoftirqd+0x0/0xc5
    [] kthread+0x38/0x5d
    [] kthread+0x0/0x5d
    [] kernel_thread_helper+0x7/0x10
    =======================

    Signed-off-by: Gautham R Shenoy
    Acked-by: Peter Zijlstra
    Acked-by: "Paul E. McKenney"
    Signed-off-by: Ingo Molnar

    Gautham R Shenoy
     

22 Oct, 2008

1 commit


20 Oct, 2008

3 commits


18 Oct, 2008

1 commit


13 Oct, 2008

1 commit


12 Oct, 2008

1 commit


29 Sep, 2008

4 commits

  • Impact: per CPU hrtimers can be migrated from a dead CPU

    The hrtimer code has no knowledge about per CPU timers, but we need to
    prevent the migration of such timers and warn when such a timer is
    active at migration time.

    Explicitely mark the timers as per CPU and use a more understandable
    mode descriptor for the interrupts safe unlocked callback mode, which
    is used by hrtimer_sleeper and the scheduler code.

    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     
  • Impact: during migration active hrtimers can be seen as inactive

    The migration code removes the hrtimers from the queues of the dead
    CPU and sets the state temporary to INACTIVE. The enqueue code sets it
    to ACTIVE/PENDING again.

    Prevent that the wrong state can be seen by using a separate migration
    state bit.

    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     
  • Impact: Stale timers after a CPU went offline.

    commit 37bb6cb4097e29ffee970065b74499cbf10603a3
    hrtimer: unlock hrtimer_wakeup

    changed the hrtimer sleeper callback mode to CB_IRQSAFE_NO_SOFTIRQ due
    to locking problems. A result of this change is that when enqueue is
    called for an already expired hrtimer the callback function is not
    longer called directly from the enqueue code. The normal callers have
    been fixed in the code, but the migration code which moves hrtimers
    from a dead CPU to a live CPU was not made aware of this.

    This can be fixed by checking the timer state after the call to
    enqueue in the migration code.

    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     
  • Impact: hrtimers which are on the pending list are not migrated at cpu
    offline and can be stale forever

    Add the pending list migration when CONFIG_HIGH_RES_TIMERS is enabled

    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     

22 Sep, 2008

1 commit


11 Sep, 2008

2 commits


08 Sep, 2008

1 commit


06 Sep, 2008

3 commits

  • this patch turns hrtimers into range timers; they have 2 expire points
    1) the soft expire point
    2) the hard expire point

    the kernel will do it's regular best effort attempt to get the timer run
    at the hard expire point. However, if some other time fires after the soft
    expire point, the kernel now has the freedom to fire this timer at this point,
    and thus grouping the events and preventing a power-expensive wakeup in the
    future.

    Signed-off-by: Arjan van de Ven

    Arjan van de Ven
     
  • In order to be able to do range hrtimers we need to use accessor functions
    to the "expire" member of the hrtimer struct.
    This patch converts kernel/* to these accessors.

    Signed-off-by: Arjan van de Ven

    Arjan van de Ven
     
  • This patch adds a schedule_hrtimeout() function, to be used by select() and
    poll() in a later patch. This function works similar to schedule_timeout()
    in most ways, but takes a timespec rather than jiffies.

    With a lot of contributions/fixes from Thomas

    Signed-off-by: Arjan van de Ven
    Signed-off-by: Thomas Gleixner

    Arjan van de Ven
     

21 Aug, 2008

1 commit

  • Add the comment to explain why the double lock in migrate_timers()
    can't deadlock.

    Change the code to use spinlock_irq() instead of local_irq_disable()
    + spin_lock().

    Signed-off-by: Oleg Nesterov
    Acked-by: Steven Rostedt
    Signed-off-by: Andrew Morton
    Signed-off-by: Ingo Molnar

    Oleg Nesterov
     

16 Jul, 2008

2 commits

  • Conflicts:

    arch/powerpc/Kconfig
    arch/s390/kernel/time.c
    arch/x86/kernel/apic_32.c
    arch/x86/kernel/cpu/perfctr-watchdog.c
    arch/x86/kernel/i8259_64.c
    arch/x86/kernel/ldt.c
    arch/x86/kernel/nmi_64.c
    arch/x86/kernel/smpboot.c
    arch/x86/xen/smp.c
    include/asm-x86/hw_irq_32.h
    include/asm-x86/hw_irq_64.h
    include/asm-x86/mach-default/irq_vectors.h
    include/asm-x86/mach-voyager/irq_vectors.h
    include/asm-x86/smp.h
    kernel/Makefile

    Signed-off-by: Ingo Molnar

    Ingo Molnar
     
  • * 'timers/for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
    x86: add PCI ID for 6300ESB force hpet
    x86: add another PCI ID for ICH6 force-hpet
    kernel-paramaters: document pmtmr= command line option
    acpi_pm clccksource: fix printk format warning
    nohz: don't stop idle tick if softirqs are pending.
    pmtmr: allow command line override of ioport
    nohz: reduce jiffies polling overhead
    hrtimer: Remove unused variables in ktime_divns()
    hrtimer: remove warning in hres_timers_resume
    posix-timers: print RT watchdog message

    Linus Torvalds
     

15 Jul, 2008

3 commits

  • * 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm: (241 commits)
    [ARM] 5171/1: ep93xx: fix compilation of modules using clocks
    [ARM] 5133/2: at91sam9g20 defconfig file
    [ARM] 5130/4: Support for the at91sam9g20
    [ARM] 5160/1: IOP3XX: gpio/gpiolib support
    [ARM] at91: Fix NAND FLASH timings for at91sam9x evaluation kits.
    [ARM] 5084/1: zylonite: Register AC97 device
    [ARM] 5085/2: PXA: Move AC97 over to the new central device declaration model
    [ARM] 5120/1: pxa: correct platform driver names for PXA25x and PXA27x UDC drivers
    [ARM] 5147/1: pxaficp_ir: drop pxa_gpio_mode calls, as pin setting
    [ARM] 5145/1: PXA2xx: provide api to control IrDA pins state
    [ARM] 5144/1: pxaficp_ir: cleanup includes
    [ARM] pxa: remove pxa_set_cken()
    [ARM] pxa: allow clk aliases
    [ARM] Feroceon: don't disable BPU on boot
    [ARM] Orion: LED support for HP mv2120
    [ARM] Orion: add RD88F5181L-FXO support
    [ARM] Orion: add RD88F5181L-GE support
    [ARM] Orion: add Netgear WNR854T support
    [ARM] s3c2410_defconfig: update for current build
    [ARM] Acer n30: Minor style and indentation fixes.
    ...

    Linus Torvalds
     
  • * 'core/softirq' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
    softirq: remove irqs_disabled warning from local_bh_enable
    softirq: remove initialization of static per-cpu variable
    Remove argument from open_softirq which is always NULL

    Linus Torvalds
     
  • … 'timers/clocksource' and 'timers/posixtimers' into timers/for-linus

    Thomas Gleixner
     

10 Jul, 2008

1 commit


04 Jul, 2008

1 commit

  • Due to a possible deadlock, the waking of the softirq was pushed outside
    of the hrtimer base locks. See commit 0c96c5979a522c3323c30a078a70120e29b5bdbc

    Unfortunately this allows the task to migrate after setting up the softirq
    and raising it. Since softirqs run a queue that is per-cpu we may raise the
    softirq on the wrong CPU and this will keep the queued softirq task from
    running.

    To solve this issue, this patch disables preemption around the releasing
    of the hrtimer lock and raising of the softirq.

    Signed-off-by: Steven Rostedt
    Signed-off-by: Linus Torvalds

    Steven Rostedt
     

26 Jun, 2008

1 commit


27 May, 2008

2 commits

  • The variables dns and inc are not used, remove them.

    Signed-off-by: Carlos R. Mafra
    Cc: tglx@linutronix.de
    Signed-off-by: Thomas Gleixner

    Carlos R. Mafra
     
  • hres_timers_resume() warns if there appears to be more than one cpu
    online. This warning makes sense when the suspend/resume mechanism
    offlines all cpus but one during the suspend/resume process.

    However, Xen suspend does not need to offline the other cpus; it
    merely keeps them tied up in stop_machine() while the virtual machine
    is suspended. The warning hres_timers_resume issues is therefore
    spurious.

    Signed-off-by: Jeremy Fitzhardinge
    Cc: xen-devel
    Cc: "Rafael J. Wysocki"
    Signed-off-by: Thomas Gleixner

    Jeremy Fitzhardinge
     

25 May, 2008

1 commit

  • As git-grep shows, open_softirq() is always called with the last argument
    being NULL

    block/blk-core.c: open_softirq(BLOCK_SOFTIRQ, blk_done_softirq, NULL);
    kernel/hrtimer.c: open_softirq(HRTIMER_SOFTIRQ, run_hrtimer_softirq, NULL);
    kernel/rcuclassic.c: open_softirq(RCU_SOFTIRQ, rcu_process_callbacks, NULL);
    kernel/rcupreempt.c: open_softirq(RCU_SOFTIRQ, rcu_process_callbacks, NULL);
    kernel/sched.c: open_softirq(SCHED_SOFTIRQ, run_rebalance_domains, NULL);
    kernel/softirq.c: open_softirq(TASKLET_SOFTIRQ, tasklet_action, NULL);
    kernel/softirq.c: open_softirq(HI_SOFTIRQ, tasklet_hi_action, NULL);
    kernel/timer.c: open_softirq(TIMER_SOFTIRQ, run_timer_softirq, NULL);
    net/core/dev.c: open_softirq(NET_TX_SOFTIRQ, net_tx_action, NULL);
    net/core/dev.c: open_softirq(NET_RX_SOFTIRQ, net_rx_action, NULL);

    This observation has already been made by Matthew Wilcox in June 2002
    (http://www.cs.helsinki.fi/linux/linux-kernel/2002-25/0687.html)

    "I notice that none of the current softirq routines use the data element
    passed to them."

    and the situation hasn't changed since them. So it appears we can safely
    remove that extra argument to save 128 (54) bytes of kernel data (text).

    Signed-off-by: Carlos R. Mafra
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Carlos R. Mafra
     

13 May, 2008

1 commit


04 May, 2008

1 commit

  • The helper function hrtimer_callback_running() is used in
    kernel/hrtimer.c as well as in the updated net/can/bcm.c which now
    supports hrtimers. Moving the helper function to hrtimer.h removes the
    duplicate definition in the C-files.

    Signed-off-by: Oliver Hartkopp
    Cc: David Miller
    Signed-off-by: Thomas Gleixner

    Oliver Hartkopp
     

30 Apr, 2008

1 commit

  • hrtimers have now dynamic users in the network code. Put them under
    debugobjects surveillance as well.

    Add calls to the generic object debugging infrastructure and provide fixup
    functions which allow to keep the system alive when recoverable problems have
    been detected by the object debugging core code.

    Signed-off-by: Thomas Gleixner
    Cc: Greg KH
    Cc: Randy Dunlap
    Cc: Kay Sievers
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Thomas Gleixner
     

29 Apr, 2008

1 commit

  • The scheduler hrtimer bits in 2.6.25 introduced a circular lock
    dependency in a rare code path:

    =======================================================
    [ INFO: possible circular locking dependency detected ]
    2.6.25-sched-devel.git-x86-latest.git #19
    -------------------------------------------------------
    X/2980 is trying to acquire lock:
    (&rq->rq_lock_key#2){++..}, at: [] task_rq_lock+0x56/0xa0

    but task is already holding lock:
    (&cpu_base->lock){++..}, at: [] lock_hrtimer_base+0x31/0x60

    which lock already depends on the new lock.

    The scenario which leads to this is:

    posix-timer signal is delivered
    -> posix-timer is rearmed
    timer is already expired in hrtimer_enqueue()
    -> softirq is raised

    To prevent this we need to move the raise of the softirq out of the
    base->lock protected code path.

    Signed-off-by: Thomas Gleixner
    Cc: stable@kernel.org
    Acked-by: Peter Zijlstra

    Thomas Gleixner
     

28 Apr, 2008

1 commit

  • When using hrtimer with timer->cb_mode == HRTIMER_CB_SOFTIRQ
    in some cases the clockevent is not programmed.
    This happens, if:
    - a timer is rearmed while it's state is HRTIMER_STATE_CALLBACK
    - hrtimer_reprogram() returns -ETIME, when it is called after
    CALLBACK is finished. This occurs if the new timer->expires
    is in the past when CALLBACK is done.
    In this case, the timer needs to be removed from the tree and put
    onto the pending list again.

    The patch is against 2.6.22.5, but AFAICS, it is relevant
    for 2.6.25 also (in run_hrtimer_pending()).

    Signed-off-by: Bodo Stroesser
    Cc: stable@kernel.org
    Signed-off-by: Thomas Gleixner

    Bodo Stroesser
     

21 Apr, 2008

2 commits

  • The previous optimization did not take the case into account where a
    clock provides its own softirq_get_time() function.

    Check for the availablitiy of the clock get time function first and
    then check if we need to retrieve the time for both clocks via
    hrtimer_softirq_gettime() to avoid a double evaluation of time in that
    case as well.

    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     
  • It seems that hrtimer_run_queues() is calling hrtimer_get_softirq_time() more
    often than it needs to. This can cause frequent contention on systems with
    large numbers of processors/cores.

    With this patch, hrtimer_run_queues only calls hrtimer_get_softirq_time() if
    there is a pending timer in one of the hrtimer bases, and only once.

    This also combines hrtimer_run_queues() and the inline run_hrtimer_queue()
    into one function.

    [ tglx@linutronix.de: coding style ]

    Signed-off-by: Dimitri Sivanich
    Cc: Peter Zijlstra
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Thomas Gleixner

    Dimitri Sivanich
     

17 Apr, 2008

1 commit

  • In order to avoid the false positive from lockdep, each per-cpu base->lock has
    the separate lock class and migrate_hrtimers() uses double_spin_lock().

    This is overcomplicated: except for migrate_hrtimers() we never take 2 locks
    at once, and migrate_hrtimers() can use spin_lock_nested().

    Signed-off-by: Oleg Nesterov
    Cc: Arjan van de Ven
    Cc: Heiko Carstens
    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Signed-off-by: Andrew Morton
    Signed-off-by: Thomas Gleixner

    Oleg Nesterov