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] [xen-unstable] minios: fix add_id_to_freelist(0)

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] minios: fix add_id_to_freelist(0)
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 28 Jun 2008 16:00:09 -0700
Delivery-date: Sat, 28 Jun 2008 16:00:00 -0700
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/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/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 Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1213980323 -3600
# Node ID 8fa124ab2e71867fb73acaa251a28e6314d68a4d
# Parent  2483923066dd28a7e90d1940e4b65a307fd49684
minios: fix add_id_to_freelist(0)

add_id_to_freelist(0) would make get_id_from_freelist() always return 0.

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
---
 extras/mini-os/fs-front.c |   10 +++++-----
 extras/mini-os/netfront.c |    6 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)

diff -r 2483923066dd -r 8fa124ab2e71 extras/mini-os/fs-front.c
--- a/extras/mini-os/fs-front.c Fri Jun 20 17:44:50 2008 +0100
+++ b/extras/mini-os/fs-front.c Fri Jun 20 17:45:23 2008 +0100
@@ -136,8 +136,8 @@ again:
 again:    
     old_id = freelist[0];
     /* Note: temporal inconsistency, since freelist[0] can be changed by 
someone
-     * else, but we are a sole owner of freelist[id], it's OK. */
-    freelist[id] = old_id;
+     * else, but we are a sole owner of freelist[id + 1], it's OK. */
+    freelist[id + 1] = old_id;
     new_id = id;
     if(cmpxchg(&freelist[0], old_id, new_id) != old_id)
     {
@@ -154,7 +154,7 @@ static inline unsigned short get_id_from
 
 again:    
     old_id = freelist[0];
-    new_id = freelist[old_id];
+    new_id = freelist[old_id + 1];
     if(cmpxchg(&freelist[0], old_id, new_id) != old_id)
     {
         printk("Cmpxchg on freelist remove failed.\n");
@@ -785,8 +785,8 @@ static void alloc_request_table(struct f
     printk("Allocating request array for import %d, nr_entries = %d.\n",
             import->import_id, import->nr_entries);
     requests = xmalloc_array(struct fs_request, import->nr_entries);
-    import->freelist = xmalloc_array(unsigned short, import->nr_entries);
-    memset(import->freelist, 0, sizeof(unsigned short) * import->nr_entries);
+    import->freelist = xmalloc_array(unsigned short, import->nr_entries + 1);
+    memset(import->freelist, 0, sizeof(unsigned short) * (import->nr_entries + 
1));
     for(i=0; i<import->nr_entries; i++)
     {
        /* TODO: that's a lot of memory */
diff -r 2483923066dd -r 8fa124ab2e71 extras/mini-os/netfront.c
--- a/extras/mini-os/netfront.c Fri Jun 20 17:44:50 2008 +0100
+++ b/extras/mini-os/netfront.c Fri Jun 20 17:45:23 2008 +0100
@@ -38,7 +38,7 @@ struct netfront_dev {
 struct netfront_dev {
     domid_t dom;
 
-    unsigned short tx_freelist[NET_TX_RING_SIZE];
+    unsigned short tx_freelist[NET_TX_RING_SIZE + 1];
     struct semaphore tx_sem;
 
     struct net_buffer rx_buffers[NET_RX_RING_SIZE];
@@ -70,14 +70,14 @@ void init_rx_buffers(struct netfront_dev
 
 static inline void add_id_to_freelist(unsigned int id,unsigned short* freelist)
 {
-    freelist[id] = freelist[0];
+    freelist[id + 1] = freelist[0];
     freelist[0]  = id;
 }
 
 static inline unsigned short get_id_from_freelist(unsigned short* freelist)
 {
     unsigned int id = freelist[0];
-    freelist[0] = freelist[id];
+    freelist[0] = freelist[id + 1];
     return id;
 }
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] minios: fix add_id_to_freelist(0), Xen patchbot-unstable <=