wait_event and preemption in 2.6

michael_soulier_at_mitel.com
Date: 10/08/04

  • Next message: Andrew Morton: "Re: [patch 1/1] dm: fix printk warnings about whether %lu/%Lu is right for sector_t"
    Date:	Fri, 8 Oct 2004 13:45:10 -0400
    To: linux-kernel@vger.kernel.org
    
    

    I am sending this on behalf of a coworker who is unfortunate enough to
    be using a crappy email client. We are not subscribed to the mailing
    list, so please include us in your replies.

    ---quote---
    Dear kernel folks,

    I'm writing a device driver for PPC Linux and I'm using wait_event. It
    seems to me that there is a potential race condition in wait_event when
    preemption is turned on (2.6 kernel).

    The scenario goes something like this: After the waiting process is
    woken up and returns from schedule it goes to the top of the loop and
    prepares to wait again (despite the condition being true). Then it will
    check the condition and break out of the loop. But what if in-kernel
    preemption occurs while it's doing that and another process is
    immediately scheduled to run? Does the process sleep forever? Assume
    that the event (say interrupt) that caused the original wakeup is a one
    shot.

    I'm probably missing something. I've googled for an answer and asked
    some of my Linux friends but it's not clear. Thanks for any replies.
    Please cc me.

    John
    ---end---

    Thank you,
    Mike

    --
    Michael P. Soulier <michael_soulier@mitel.com>
    6000/6010/60* Development, Mitel Networks Corporation
    "...the word HACK is used as a verb to indicate a massive amount of nerd-like
    effort." -Harley Hahn, A Student's Guide to Unix
    -
    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: Andrew Morton: "Re: [patch 1/1] dm: fix printk warnings about whether %lu/%Lu is right for sector_t"

    Relevant Pages

    • Re: wait_event and preemption in 2.6
      ... > I'm writing a device driver for PPC Linux and I'm using wait_event. ... > preemption is turned on. ... > check the condition and break out of the loop. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: wait_event and preemption in 2.6
      ... > preemption is turned on. ... > check the condition and break out of the loop. ... runqueue removal logic in schedule(). ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • [patch] preempt-smp.patch, 2.6.8-rc3-mm2
      ... > SMP issues in a sufficient way. ... It does the loop counting within ... the loop counter every time we disable preemption. ... this patch in essence recognizes the fact that the current preemption ...
      (Linux-Kernel)
    • Re: [PATCH][resubmit] x86: enable preemption in delay
      ... The difference is that in Steven's version the loop is running ... mainly with preemption disabled, except for: ... set the mask of allowed cpus to the current cpu only; ...
      (Linux-Kernel)
    • [PATCH] NULL pointer deref in tcp_do_twkill_work()
      ... Shouldn't the loop always restart from the beginning instead of using the ... The alternative is to not drop the lock, but I'm guessing we need to do ... Proposed patch is attached. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)