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-devel

RE; [Xen-devel] more than 3 nics in a domU

To: johnny@xxxxxxxxxx, james.harper@xxxxxxxxxxxxxxxx, molle.bestefich@xxxxxxxxx
Subject: RE; [Xen-devel] more than 3 nics in a domU
From: Christopher Clark <christopher.clark@xxxxxxxxxxxx>
Date: Mon, 30 Jan 2006 22:57:48 +0000
Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Mon, 30 Jan 2006 23:07:32 +0000
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:cc:mime-version:content-type; b=W+gZe6CWxfnh6shHQVYhSLwBYVzu7yCk3JVciTUcoErTeCw1VwQFDCSglcNUhOfB+p5hEYjTrehsNYE5D2EFo/lYw4k77/Qxwea1q/ggZqgPc3BLlxa/X6cwM61Q7vFnIChEsrANCF+g1lIUEAEn67gjruKwO+T33wry0xJr/vE=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx

Apply this patch.
I'll push it into unstable soon with some more work to make it grow dynamically.

c.

---------- Forwarded message ----------
From: Christopher Clark <christopher.clark@xxxxxxxxxxxx>
Date: Jan 11, 2006 4:35 PM
Subject: [PATCH] Increase NR_GRANT_FRAMES, more NICs per domU.
To: xen-devel < xen-devel@xxxxxxxxxxxxxxxxxxx>
Cc: Birger Tödtmann <btoedtmann@xxxxxxxxxxxxxx>, Ian Pratt < Ian.Pratt@xxxxxxxxxxxx>, Keir Fraser <keir.fraser@xxxxxxxxxxxx>

Hello

This patch increases the number of grant frames from 4 to 16, which then increases the maximum number of NICs per domU to 15.

The maximum number of grant frames (NR_GRANT_FRAMES), should you wish to increase this further, is now 128 though this untested.

The first patch is against testing-3.0, boots domU fine, NICs come up and has had limited testing.
The second patch is exactly the same set of changes against unstable, which is not testable at the moment.

Christopher

Signed-off-by: Christopher Clark

Unstable patch inline here:

diff -r c886f74b54a4 linux-2.6-xen-sparse/include/asm-xen/gnttab.h
--- a/linux-2.6-xen-sparse/include/asm-xen/gnttab.h Wed Jan 11 12:02:54 2006
+++ b/linux-2.6-xen-sparse/include/asm-xen/gnttab.h Wed Jan 11 16:21:56 2006
@@ -21,7 +21,7 @@
 #ifdef __ia64__
 #define NR_GRANT_FRAMES 1
 #else
-#define NR_GRANT_FRAMES 4
+#define NR_GRANT_FRAMES 16
 #endif

 struct gnttab_free_callback {
diff -r c886f74b54a4 xen/common/grant_table.c
--- a/xen/common/grant_table.c  Wed Jan 11 12:02:54 2006
+++ b/xen/common/grant_table.c  Wed Jan 11 16:21:56 2006
@@ -45,7 +45,7 @@
     unsigned int h;
     if ( unlikely((h = t->maptrack_head) == (t->maptrack_limit - 1)) )
         return -1;
-    t->maptrack_head = t->maptrack[h].ref_and_flags >> MAPTRACK_REF_SHIFT;
+    t->maptrack_head = t->maptrack[h].ref;
     t->map_count++;
     return h;
 }
@@ -54,7 +54,8 @@
 put_maptrack_handle(
     grant_table_t *t, int handle)
 {
-    t->maptrack[handle].ref_and_flags = t->maptrack_head << MAPTRACK_REF_SHIFT;
+    t->maptrack[handle].ref   = t->maptrack_head;
+    t->maptrack[handle].flags = 0;
     t->maptrack_head = handle;
     t->map_count--;
 }
@@ -161,7 +162,10 @@

         memcpy(new_mt, lgt->maptrack, PAGE_SIZE << lgt->maptrack_order);
         for ( i = lgt->maptrack_limit; i < (lgt->maptrack_limit << 1); i++ )
-            new_mt[i].ref_and_flags = (i+1) << MAPTRACK_REF_SHIFT;
+        {
+            new_mt[i].ref   = (i+1);
+            new_mt[i].flags = 0;
+        }

         free_xenheap_pages(lgt->maptrack, lgt->maptrack_order);
         lgt->maptrack          = new_mt;
@@ -283,10 +287,9 @@

     TRACE_1D(TRC_MEM_PAGE_GRANT_MAP, dom);

-    ld->grant_table->maptrack[handle].domid         = dom;
-    ld->grant_table->maptrack[handle].ref_and_flags =
-        (ref << MAPTRACK_REF_SHIFT) |
-        (dev_hst_ro_flags & MAPTRACK_GNTMAP_MASK);
+    ld->grant_table->maptrack[handle].domid = dom;
+    ld->grant_table->maptrack[handle].ref   = ref;
+    ld->grant_table->maptrack[handle].flags = (u8) dev_hst_ro_flags;

     (void)__put_user((u64)frame << PAGE_SHIFT, &uop->dev_bus_addr);
     (void)__put_user(handle, &uop->handle);
@@ -363,7 +366,7 @@
     map = &ld->grant_table->maptrack[handle];

     if ( unlikely(handle >= ld->grant_table->maptrack_limit) ||
-         unlikely(!(map->ref_and_flags & MAPTRACK_GNTMAP_MASK)) )
+         unlikely(!(map->flags)) )
     {
         DPRINTK("Bad handle (%d).\n", handle);
         (void)__put_user(GNTST_bad_handle, &uop->status);
@@ -371,8 +374,8 @@
     }

     dom   = map->domid;
-    ref   = map->ref_and_flags >> MAPTRACK_REF_SHIFT;
-    flags = map->ref_and_flags & MAPTRACK_GNTMAP_MASK;
+    ref   = map->ref;
+    flags = map->flags;

     if ( unlikely((rd = find_domain_by_id(dom)) == NULL) ||
          unlikely(ld == rd) )
@@ -403,7 +406,7 @@
         if ( flags & GNTMAP_device_map )
         {
             ASSERT(act->pin & (GNTPIN_devw_mask | GNTPIN_devr_mask));
-            map->ref_and_flags &= ~GNTMAP_device_map;
+            map->flags &= ~GNTMAP_device_map;
             if ( flags & GNTMAP_readonly )
             {
                 act->pin -= GNTPIN_devr_inc;
@@ -423,7 +426,7 @@
             goto unmap_out;

         ASSERT(act->pin & (GNTPIN_hstw_mask | GNTPIN_hstr_mask));
-        map->ref_and_flags &= ~GNTMAP_host_map;
+        map->flags &= ~GNTMAP_host_map;
         if ( flags & GNTMAP_readonly )
         {
             act->pin -= GNTPIN_hstr_inc;
@@ -436,9 +439,10 @@
         }
     }

-    if ( (map->ref_and_flags & (GNTMAP_device_map|GNTMAP_host_map)) == 0 )
-    {
-        map->ref_and_flags = 0;
+    if ( (map->flags & (GNTMAP_device_map|GNTMAP_host_map)) == 0 )
+    {
+        map->ref   = 0;
+        map->flags = 0;
         put_maptrack_handle(ld->grant_table, handle);
     }

@@ -597,12 +601,12 @@
     for ( i = 0; i < gt->maptrack_limit; i++ )
     {
         maptrack = &gt->maptrack[i];
-        if ( maptrack->ref_and_flags & MAPTRACK_GNTMAP_MASK )
-            DPRINTK("Grant: dom (%hu) MAP (%d) ref:(%hu) flags:(%x) "
+        if ( maptrack->flags )
+            DPRINTK("Grant: dom (%hu) MAP (%d) ref:(%hu) flags:(%c) "
                     "dom:(%hu)\n",
                     op.dom, i,
-                    maptrack->ref_and_flags >> MAPTRACK_REF_SHIFT,
-                    maptrack->ref_and_flags & MAPTRACK_GNTMAP_MASK,
+                    maptrack->ref,
+                    maptrack->flags,
                     maptrack->domid);
     }

@@ -872,7 +876,10 @@
     t->maptrack_limit = PAGE_SIZE / sizeof(grant_mapping_t);
     memset(t->maptrack, 0, PAGE_SIZE);
     for ( i = 0; i < t->maptrack_limit; i++ )
-        t->maptrack[i].ref_and_flags = (i+1) << MAPTRACK_REF_SHIFT;
+    {
+        t->maptrack[i].ref   = (i+1);
+        t->maptrack[i].flags = 0;
+    }

     /* Shared grant table. */
     t->shared = alloc_xenheap_pages(ORDER_GRANT_FRAMES);
@@ -915,13 +922,13 @@
     for ( handle = 0; handle < gt->maptrack_limit; handle++ )
     {
         map = &gt->maptrack[handle];
-        if ( !(map->ref_and_flags & (GNTMAP_device_map|GNTMAP_host_map)) )
+        if ( !(map->flags & (GNTMAP_device_map|GNTMAP_host_map)) )
             continue;

-        ref = map->ref_and_flags >> MAPTRACK_REF_SHIFT;
-
-        DPRINTK("Grant release (%hu) ref:(%hu) flags:(%x) dom:(%hu)\n",
-                handle, ref, map->ref_and_flags & MAPTRACK_GNTMAP_MASK,
+        ref = map->ref;
+
+        DPRINTK("Grant release (%hu) ref:(%hu) flags:(%c) dom:(%hu)\n",
+                handle, ref, map->flags,
                 map->domid);

         rd = find_domain_by_id(map->domid);
@@ -932,16 +939,16 @@
         act = &rd->grant_table->active[ref];
         sha = &rd->grant_table->shared[ref];

-        if ( map->ref_and_flags & GNTMAP_readonly )
-        {
-            if ( map->ref_and_flags & GNTMAP_device_map )
+        if ( map->flags & GNTMAP_readonly )
+        {
+            if ( map->flags & GNTMAP_device_map )
             {
                 BUG_ON(!(act->pin & GNTPIN_devr_mask));
                 act->pin -= GNTPIN_devr_inc;
                 put_page(pfn_to_page(act->frame));
             }

-            if ( map->ref_and_flags & GNTMAP_host_map )
+            if ( map->flags & GNTMAP_host_map )
             {
                 BUG_ON(!(act->pin & GNTPIN_hstr_mask));
                 act->pin -= GNTPIN_hstr_inc;
@@ -951,14 +958,14 @@
         }
         else
         {
-            if ( map->ref_and_flags & GNTMAP_device_map )
+            if ( map->flags & GNTMAP_device_map )
             {
                 BUG_ON(!(act->pin & GNTPIN_devw_mask));
                 act->pin -= GNTPIN_devw_inc;
                 put_page_and_type(pfn_to_page(act->frame));
             }

-            if ( map->ref_and_flags & GNTMAP_host_map )
+            if ( map->flags & GNTMAP_host_map )
             {
                 BUG_ON(!(act->pin & GNTPIN_hstw_mask));
                 act->pin -= GNTPIN_hstw_inc;
@@ -977,7 +984,8 @@

         put_domain(rd);

-        map->ref_and_flags = 0;
+        map->ref = 0;
+        map->flags = 0;
     }
 }

diff -r c886f74b54a4 xen/include/asm-x86/grant_table.h
--- a/xen/include/asm-x86/grant_table.h Wed Jan 11 12:02:54 2006
+++ b/xen/include/asm-x86/grant_table.h Wed Jan 11 16:21:56 2006
@@ -7,7 +7,7 @@
 #ifndef __ASM_GRANT_TABLE_H__
 #define __ASM_GRANT_TABLE_H__

-#define ORDER_GRANT_FRAMES 2
+#define ORDER_GRANT_FRAMES 4

 /*
  * Caller must own caller's BIGLOCK, is responsible for flushing the TLB, and
diff -r c886f74b54a4 xen/include/xen/grant_table.h
--- a/xen/include/xen/grant_table.h Wed Jan 11 12:02:54 2006
+++ b/xen/include/xen/grant_table.h Wed Jan 11 16:21:56 2006
@@ -61,12 +61,11 @@
  * table of these, indexes into which are returned as a 'mapping handle'.
  */
 typedef struct {
-    u16      ref_and_flags; /* 0-4: GNTMAP_* ; 5-15: grant ref */
-    domid_t  domid;         /* granting domain */
+    u16      ref;   /* grant reference */
+    u8       flags; /* 0-4: GNTMAP_*   */
+    domid_t  domid; /* granting domain */
 } grant_mapping_t;
-#define MAPTRACK_GNTMAP_MASK  0x1f
-#define MAPTRACK_REF_SHIFT    5
-#define MAPTRACK_MAX_ENTRIES  (1 << (16 - MAPTRACK_REF_SHIFT))
+#define MAPTRACK_MAX_ENTRIES  (1 << 16) /* limit is sizeof(grant_ref_t) */

 /* Per-domain grant information. */
 typedef struct {


Attachment: testing-moregrants.patch
Description: Text Data

Attachment: unstable-moregrants.patch
Description: Text Data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • RE; [Xen-devel] more than 3 nics in a domU, Christopher Clark <=