WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Add locking for gnttab_free_callback_list.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Add locking for gnttab_free_callback_list.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 23 Aug 2005 18:36:19 +0000
Delivery-date: Wed, 24 Aug 2005 09:06:55 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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 <=