From: Samuel Thibault Subject: [PATCH] [Mini-OS] Make wake_up callback-safe Date: Fri, 23 Nov 2007 16:59:39 +0000 Message-ID: <20071123165939.GA12313@implementation.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org As it may compete with event handlers waking wait queues, wake_up needs to be callback-safe. Signed-off-by: Samuel Thibault diff -r f2711b7eae95 -r 36bf1e737b87 extras/mini-os/include/wait.h --- a/extras/mini-os/include/wait.h Thu Nov 22 19:55:42 2007 +0000 +++ b/extras/mini-os/include/wait.h Fri Nov 23 13:21:02 2007 +0000 @@ -57,13 +57,16 @@ static inline void wake_up(struct wait_queue_head *head) { + unsigned long flags; struct list_head *tmp, *next; + local_irq_save(flags); list_for_each_safe(tmp, next, &head->thread_list) { struct wait_queue *curr; curr = list_entry(tmp, struct wait_queue, thread_list); wake(curr->thread); } + local_irq_restore(flags); } #define add_waiter(w, wq) do { \