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] Grant table updates for block device changes.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Grant table updates for block device changes.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 23 Aug 2005 18:36:12 +0000
Delivery-date: Wed, 24 Aug 2005 09:06:30 +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 1d86fcb11b599ea950472a6428ec71ff62888c65
# Parent  317db130cbbfc1d2ff20b5a7943bbdd22cf08d9c
Grant table updates for block device changes.
- add gnttab_free_grant_reference
- make gnttab_free_grant_references interface consistent with other gnttab
  functions
- add support for callback when references are freed
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>

diff -r 317db130cbbf -r 1d86fcb11b59 
linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c
--- a/linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c     Mon Aug 22 14:22:59 2005
+++ b/linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c     Mon Aug 22 20:52:38 2005
@@ -50,6 +50,8 @@
 
 static grant_entry_t *shared;
 
+static struct gnttab_free_callback *gnttab_free_callback_list = NULL;
+
 /*
  * Lock-free grant-entry allocator
  */
@@ -65,6 +67,16 @@
     return fh;
 }
 
+static void do_free_callbacks(void)
+{
+    struct gnttab_free_callback *callback = gnttab_free_callback_list;
+    gnttab_free_callback_list = NULL;
+    while (callback) {
+       schedule_work(callback->work);
+       callback = callback->next;
+    }
+}
+
 static inline void
 put_free_entry(
     grant_ref_t ref)
@@ -72,6 +84,8 @@
     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) );
+    if ( unlikely(gnttab_free_callback_list) )
+       do_free_callbacks();
 }
 
 /*
@@ -189,17 +203,23 @@
 }
 
 void
-gnttab_free_grant_references( u16 count, grant_ref_t head )
+gnttab_free_grant_reference( grant_ref_t ref )
+{
+
+    put_free_entry(ref);
+}
+
+void
+gnttab_free_grant_references( grant_ref_t *head,
+                              grant_ref_t terminal )
 {
     /* TODO: O(N)...? */
-    grant_ref_t to_die = 0, next = head;
-    int i;
-
-    for ( i = 0; i < count; i++ )
-    {
-        to_die = next;
-        next = gnttab_free_list[next];
-        put_free_entry( to_die );
+    grant_ref_t ref;
+
+    while (*head != terminal) {
+       ref = *head;
+       *head = gnttab_free_list[*head];
+       put_free_entry(ref);
     }
 }
 
@@ -242,6 +262,15 @@
 {
     gnttab_free_list[release] = *private_head;
     *private_head = release;
+}
+
+void
+gnttab_request_free_callback(struct gnttab_free_callback *callback,
+                            struct work_struct *work)
+{
+    callback->work = work;
+    callback->next = gnttab_free_callback_list;
+    gnttab_free_callback_list = callback;
 }
 
 /*
diff -r 317db130cbbf -r 1d86fcb11b59 
linux-2.6-xen-sparse/include/asm-xen/gnttab.h
--- a/linux-2.6-xen-sparse/include/asm-xen/gnttab.h     Mon Aug 22 14:22:59 2005
+++ b/linux-2.6-xen-sparse/include/asm-xen/gnttab.h     Mon Aug 22 20:52:38 2005
@@ -20,6 +20,13 @@
 /* NR_GRANT_FRAMES must be less than or equal to that configured in Xen */
 #define NR_GRANT_FRAMES 4
 #define NR_GRANT_ENTRIES (NR_GRANT_FRAMES * PAGE_SIZE / sizeof(grant_entry_t))
+
+struct work_struct;
+
+struct gnttab_free_callback {
+    struct gnttab_free_callback *next;
+    struct work_struct *work;
+};
 
 int
 gnttab_grant_foreign_access(
@@ -49,8 +56,12 @@
     u16 count, grant_ref_t *pprivate_head, grant_ref_t *private_terminal );
 
 void
+gnttab_free_grant_reference(
+    grant_ref_t ref );
+
+void
 gnttab_free_grant_references(
-    u16 count, grant_ref_t private_head );
+    grant_ref_t *head, grant_ref_t terminal );
 
 int
 gnttab_claim_grant_reference( grant_ref_t *pprivate_head, grant_ref_t terminal
@@ -59,6 +70,10 @@
 void
 gnttab_release_grant_reference(
     grant_ref_t *private_head, grant_ref_t release );
+
+void
+gnttab_request_free_callback(
+    struct gnttab_free_callback *callback, struct work_struct *work );
 
 void
 gnttab_grant_foreign_access_ref(

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Grant table updates for block device changes., Xen patchbot -unstable <=