Re: [patch] SMP races in the timer code, timer-fix-2.6.0-test7-A0

From: Ingo Molnar (mingo_at_elte.hu)
Date: 10/11/03

  • Next message: David Brownell: "Re: USB and DMA on Alpha with 2.6.0-test7"
    Date:	Sat, 11 Oct 2003 17:49:07 +0200 (CEST)
    To: Manfred Spraul <manfred@colorfullife.com>
    
    

    On Sat, 11 Oct 2003, Manfred Spraul wrote:

    > What about moving the "timer running" information into the timer_list,
    > instead of keeping it in the base? For example base=0 means neither
    > running nor pending. base=1 means running, but not pending, and pointers
    > mean pending on the given base.
    >
    > This would allow an atomic test without the brute force locking.

    it's not so simple. Firstly, it would burden some of the other timer
    codepaths with extra logic. (mod/add/del_timer) Secondly, the use of
    timer->base is closely controlled, and it's not that simple to clear the
    value of '1' from timer->base after the timer has run. [this could race
    with any other CPU.]

    it would be much cleaner to add another timer->running field, especially
    since this would be the 8th word-sized field in struct timer_list, making
    it a nice round structure size.

    btw., there's a third type of timer race we have. If a timer function is
    delayed by more than 1 timer tick [which could happen under eg. UML], then
    it's possible for the timer function to run on another CPU in parallel to
    the already executing timer function.

            Ingo
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: David Brownell: "Re: USB and DMA on Alpha with 2.6.0-test7"

    Relevant Pages

    • Re: [REV2: PATCH 1/2]: workqueue: Implement the kernel API
      ... calls cancel ... pending. ... set and the timer is not pending. ... Once again, the slow path is unlikely, and ...
      (Linux-Kernel)
    • Re: RCU question
      ... >>the nearest timer and turns off the time base interrupt source. ... >>qualifying the entry to this state I want to make sure there is no pending ... I had assumed that it required NO softirq pending as a pre condition. ...
      (Linux-Kernel)
    • Re: What exactly are the issues with 2.6.0-test10 preempt?
      ... could try to narrow it down to 1 CONFIG option. ... pending timer is "strange" to say the least. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH] usb ehci_iaa_watchdog fix
      ... ehci_bus_suspendforce the timer off all ... while things can still retrigger it. ... one or more async unlink is still pending. ... the timer when it needs to do another unlink. ...
      (Linux-Kernel)
    • Re: [REV2: PATCH 1/2]: workqueue: Implement the kernel API
      ... kill "int ret" and do ... Assuming the work is already pending (which is why both calls are in the ... Timer is pending - update_timer will break out ... struct delayed_work *dwork, unsigned long delay) ...
      (Linux-Kernel)