# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID 96f1f6c710891448318a6287a10e004297fb8563
# Parent af9e3ae3a9b1e342514305399fe5dcdfa5639385
Update gnttab_free_callback_list locking.
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>
diff -r af9e3ae3a9b1 -r 96f1f6c71089
linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c
--- a/linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c Tue Aug 23 08:45:13 2005
+++ b/linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c Tue Aug 23 09:24:46 2005
@@ -68,13 +68,11 @@
return fh;
}
-static void do_free_callbacks(void)
-{
- struct gnttab_free_callback *callback, *next;
- spin_lock_irq(&gnttab_free_callback_list_lock);
- callback = gnttab_free_callback_list;
+static void do_free_callbacks(unsigned long flags)
+{
+ struct gnttab_free_callback *callback = gnttab_free_callback_list, *next;
gnttab_free_callback_list = NULL;
- spin_unlock_irq(&gnttab_free_callback_list_lock);
+ spin_unlock_irqrestore(&gnttab_free_callback_list_lock, flags);
while (callback) {
next = callback->next;
callback->next = NULL;
@@ -88,12 +86,14 @@
grant_ref_t ref)
{
grant_ref_t fh, nfh = gnttab_free_head;
+ unsigned long flags;
do { gnttab_free_list[ref] = fh = nfh; wmb(); }
while ( unlikely((nfh = cmpxchg(&gnttab_free_head, fh, ref)) != fh) );
- spin_lock_irq(&gnttab_free_callback_list_lock);
+ spin_lock_irqsave(&gnttab_free_callback_list_lock, flags);
if ( unlikely(gnttab_free_callback_list) )
- do_free_callbacks();
- spin_unlock_irq(&gnttab_free_callback_list_lock);
+ do_free_callbacks(flags);
+ else
+ spin_unlock_irqrestore(&gnttab_free_callback_list_lock, flags);
}
/*
@@ -276,14 +276,15 @@
gnttab_request_free_callback(struct gnttab_free_callback *callback,
void (*fn)(void *), void *arg)
{
+ unsigned long flags;
if (callback->next)
return;
callback->fn = fn;
callback->arg = arg;
- spin_lock_irq(&gnttab_free_callback_list_lock);
+ spin_lock_irqsave(&gnttab_free_callback_list_lock, flags);
callback->next = gnttab_free_callback_list;
gnttab_free_callback_list = callback;
- spin_unlock_irq(&gnttab_free_callback_list_lock);
+ spin_unlock_irqrestore(&gnttab_free_callback_list_lock, flags);
}
/*
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|