|
|
|
|
|
|
|
|
|
|
xen-changelog
[Xen-changelog] Add locking for gnttab_free_callback_list.
# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID af9e3ae3a9b1e342514305399fe5dcdfa5639385
# Parent d13f5c7daddfe41bcb8565d707eb76270a8a6671
Add locking for gnttab_free_callback_list.
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>
diff -r d13f5c7daddf -r af9e3ae3a9b1
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:41:18 2005
+++ b/linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c Tue Aug 23 08:45:13 2005
@@ -51,6 +51,7 @@
static grant_entry_t *shared;
static struct gnttab_free_callback *gnttab_free_callback_list = NULL;
+static spinlock_t gnttab_free_callback_list_lock = SPIN_LOCK_UNLOCKED;
/*
* Lock-free grant-entry allocator
@@ -69,8 +70,11 @@
static void do_free_callbacks(void)
{
- struct gnttab_free_callback *callback = gnttab_free_callback_list, *next;
+ struct gnttab_free_callback *callback, *next;
+ spin_lock_irq(&gnttab_free_callback_list_lock);
+ callback = gnttab_free_callback_list;
gnttab_free_callback_list = NULL;
+ spin_unlock_irq(&gnttab_free_callback_list_lock);
while (callback) {
next = callback->next;
callback->next = NULL;
@@ -86,8 +90,10 @@
grant_ref_t fh, nfh = gnttab_free_head;
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);
if ( unlikely(gnttab_free_callback_list) )
do_free_callbacks();
+ spin_unlock_irq(&gnttab_free_callback_list_lock);
}
/*
@@ -274,8 +280,10 @@
return;
callback->fn = fn;
callback->arg = arg;
+ spin_lock_irq(&gnttab_free_callback_list_lock);
callback->next = gnttab_free_callback_list;
gnttab_free_callback_list = callback;
+ spin_unlock_irq(&gnttab_free_callback_list_lock);
}
/*
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
<Prev in Thread] |
Current Thread |
[Next in Thread> |
- [Xen-changelog] Add locking for gnttab_free_callback_list.,
Xen patchbot -unstable <=
|
|
|
|
|