[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] merge?



# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID cedfbb032261b5eb6c2ba7f38abd4e2fb63990a5
# Parent  2dcfb85a95b920941a5236bb4b14658a62ecb460
# Parent  c21f47a032257427ad2a588d684440344b0b2de2
merge?

diff -r 2dcfb85a95b9 -r cedfbb032261 
linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c
--- a/linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c     Thu Sep 15 17:19:08 2005
+++ b/linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c     Thu Sep 15 17:40:16 2005
@@ -182,14 +182,14 @@
 }
 
 int
-gnttab_grant_foreign_transfer(domid_t domid, unsigned long pfn)
+gnttab_grant_foreign_transfer(domid_t domid)
 {
     int ref;
 
     if ( unlikely((ref = get_free_entry()) == -1) )
         return -ENOSPC;
 
-    shared[ref].frame = pfn;
+    shared[ref].frame = 0;
     shared[ref].domid = domid;
     wmb();
     shared[ref].flags = GTF_accept_transfer;
@@ -198,10 +198,9 @@
 }
 
 void
-gnttab_grant_foreign_transfer_ref(grant_ref_t ref, domid_t domid,
-                                 unsigned long pfn)
-{
-    shared[ref].frame = pfn;
+gnttab_grant_foreign_transfer_ref(grant_ref_t ref, domid_t domid)
+{
+    shared[ref].frame = 0;
     shared[ref].domid = domid;
     wmb();
     shared[ref].flags = GTF_accept_transfer;
diff -r 2dcfb85a95b9 -r cedfbb032261 
linux-2.6-xen-sparse/drivers/xen/netback/netback.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Thu Sep 15 
17:19:08 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c        Thu Sep 15 
17:40:16 2005
@@ -42,7 +42,7 @@
 static mmu_update_t rx_mmu[NETIF_RX_RING_SIZE];
 
 #ifdef CONFIG_XEN_NETDEV_GRANT
-static gnttab_donate_t grant_rx_op[MAX_PENDING_REQS];
+static gnttab_transfer_t grant_rx_op[MAX_PENDING_REQS];
 #else
 static struct mmuext_op rx_mmuext[NETIF_RX_RING_SIZE];
 #endif
@@ -233,7 +233,7 @@
     multicall_entry_t *mcl;
     mmu_update_t *mmu;
 #ifdef CONFIG_XEN_NETDEV_GRANT
-    gnttab_donate_t *gop;
+    gnttab_transfer_t *gop;
 #else
     struct mmuext_op *mmuext;
 #endif
@@ -281,7 +281,7 @@
 #ifdef CONFIG_XEN_NETDEV_GRANT
         gop->mfn = old_mfn;
         gop->domid = netif->domid;
-        gop->handle = netif->rx->ring[
+        gop->ref = netif->rx->ring[
         MASK_NETIF_RX_IDX(netif->rx_resp_prod_copy)].req.gref;
         netif->rx_resp_prod_copy++;
         gop++;
@@ -331,14 +331,14 @@
 
     mcl = rx_mcl;
 #ifdef CONFIG_XEN_NETDEV_GRANT
-    if(HYPERVISOR_grant_table_op(GNTTABOP_donate, grant_rx_op, 
+    if(HYPERVISOR_grant_table_op(GNTTABOP_transfer, grant_rx_op, 
                                  gop - grant_rx_op)) { 
         /* 
         ** The other side has given us a bad grant ref, or has no headroom, 
         ** or has gone away. Unfortunately the current grant table code 
         ** doesn't inform us which is the case, so not much we can do. 
         */
-        DPRINTK("net_rx: donate to DOM%u failed; dropping (up to) %d "
+        DPRINTK("net_rx: transfer to DOM%u failed; dropping (up to) %d "
                 "packets.\n", grant_rx_op[0].domid, gop - grant_rx_op); 
     }
     gop = grant_rx_op;
@@ -371,7 +371,7 @@
         status = NETIF_RSP_OKAY;
 #ifdef CONFIG_XEN_NETDEV_GRANT
         if(gop->status != 0) { 
-            DPRINTK("Bad status %d from grant donate to DOM%u\n", 
+            DPRINTK("Bad status %d from grant transfer to DOM%u\n", 
                     gop->status, netif->domid);
             /* XXX SMH: should free 'old_mfn' here */
             status = NETIF_RSP_ERROR; 
@@ -748,11 +748,6 @@
 
         /* Check the remap error code. */
 #ifdef CONFIG_XEN_NETDEV_GRANT
-        /* 
-           XXX SMH: error returns from grant operations are pretty poorly
-           specified/thought out, but the below at least conforms with 
-           what the rest of the code uses. 
-        */
         if ( unlikely(mop->handle < 0) )
         {
             printk(KERN_ALERT "#### netback grant fails\n");
diff -r 2dcfb85a95b9 -r cedfbb032261 
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Thu Sep 15 
17:19:08 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Thu Sep 15 
17:40:16 2005
@@ -378,8 +378,7 @@
             BUG();
         }
         grant_rx_ref[id] = ref;
-        gnttab_grant_foreign_transfer_ref(ref, np->backend_id,
-                                          virt_to_mfn(skb->head));
+        gnttab_grant_foreign_transfer_ref(ref, np->backend_id);
         np->rx->ring[MASK_NETIF_RX_IDX(req_prod + i)].req.gref = ref;
 #endif
         rx_pfn_array[i] = virt_to_mfn(skb->head);
@@ -825,10 +824,8 @@
     for (requeue_idx = 0, i = 1; i <= NETIF_RX_RING_SIZE; i++) { 
         if ((unsigned long)np->rx_skbs[i] >= __PAGE_OFFSET) {
 #ifdef CONFIG_XEN_NETDEV_GRANT 
-            /* Reinstate the grant ref so backend can 'donate' mfn to us. */
-            gnttab_grant_foreign_transfer_ref(grant_rx_ref[i], np->backend_id,
-                                              virt_to_mfn(np->rx_skbs[i]->head)
-                );
+            /* Reinstate the grant ref so backend can transfer mfn to us. */
+            gnttab_grant_foreign_transfer_ref(grant_rx_ref[i], np->backend_id);
             np->rx->ring[requeue_idx].req.gref = grant_rx_ref[i];
 #endif
             np->rx->ring[requeue_idx].req.id   = i;
diff -r 2dcfb85a95b9 -r cedfbb032261 
linux-2.6-xen-sparse/include/asm-xen/gnttab.h
--- a/linux-2.6-xen-sparse/include/asm-xen/gnttab.h     Thu Sep 15 17:19:08 2005
+++ b/linux-2.6-xen-sparse/include/asm-xen/gnttab.h     Thu Sep 15 17:40:16 2005
@@ -37,7 +37,7 @@
 void gnttab_end_foreign_access_ref(grant_ref_t ref, int readonly);
 void gnttab_end_foreign_access(grant_ref_t ref, int readonly);
 
-int gnttab_grant_foreign_transfer(domid_t domid, unsigned long pfn);
+int gnttab_grant_foreign_transfer(domid_t domid);
 
 unsigned long gnttab_end_foreign_transfer_ref(grant_ref_t ref);
 unsigned long gnttab_end_foreign_transfer(grant_ref_t ref);
@@ -64,8 +64,7 @@
 void gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid,
                                     unsigned long frame, int readonly);
 
-void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid,
-                                      unsigned long pfn);
+void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid);
 
 #ifdef __ia64__
 #define gnttab_map_vaddr(map) __va(map.dev_bus_addr)
diff -r 2dcfb85a95b9 -r cedfbb032261 xen/arch/ia64/xen/grant_table.c
--- a/xen/arch/ia64/xen/grant_table.c   Thu Sep 15 17:19:08 2005
+++ b/xen/arch/ia64/xen/grant_table.c   Thu Sep 15 17:40:16 2005
@@ -851,7 +851,7 @@
 #endif
 
 static long
-gnttab_donate(gnttab_donate_t *uop, unsigned int count)
+gnttab_transfer(gnttab_transfer_t *uop, unsigned int count)
 {
     struct domain *d = current->domain;
     struct domain *e;
@@ -865,27 +865,27 @@
     return GNTST_general_error;
 #else
     for (i = 0; i < count; i++) {
-        gnttab_donate_t *gop = &uop[i];
+        gnttab_transfer_t *gop = &uop[i];
 #if GRANT_DEBUG
-        printk("gnttab_donate: i=%d mfn=%lx domid=%d gref=%08x\n",
+        printk("gnttab_transfer: i=%d mfn=%lx domid=%d gref=%08x\n",
                i, gop->mfn, gop->domid, gop->handle);
 #endif
         page = &frame_table[gop->mfn];
         
         if (unlikely(IS_XEN_HEAP_FRAME(page))) { 
-            printk("gnttab_donate: xen heap frame mfn=%lx\n", 
+            printk("gnttab_transfer: xen heap frame mfn=%lx\n", 
                    (unsigned long) gop->mfn);
             gop->status = GNTST_bad_virt_addr;
             continue;
         }
         if (unlikely(!pfn_valid(page_to_pfn(page)))) {
-            printk("gnttab_donate: invalid pfn for mfn=%lx\n", 
+            printk("gnttab_transfer: invalid pfn for mfn=%lx\n", 
                    (unsigned long) gop->mfn);
             gop->status = GNTST_bad_virt_addr;
             continue;
         }
         if (unlikely((e = find_domain_by_id(gop->domid)) == NULL)) {
-            printk("gnttab_donate: can't find domain %d\n", gop->domid);
+            printk("gnttab_transfer: can't find domain %d\n", gop->domid);
             gop->status = GNTST_bad_domain;
             continue;
         }
@@ -905,7 +905,7 @@
             x = y;
             if (unlikely((x & (PGC_count_mask|PGC_allocated)) !=
                          (1 | PGC_allocated)) || unlikely(_nd != _d)) {
-                printk("gnttab_donate: Bad page values %p: ed=%p(%u), sd=%p,"
+                printk("gnttab_transfer: Bad page values %p: ed=%p(%u), sd=%p,"
                        " caf=%08x, taf=%" PRtype_info "\n", 
                        (void *) page_to_pfn(page),
                         d, d->domain_id, unpickle_domptr(_nd), x, 
@@ -948,14 +948,14 @@
             break;
         }
         if (unlikely(test_bit(DOMFLAGS_DYING, &e->domain_flags))) {
-            printk("gnttab_donate: target domain is dying\n");
+            printk("gnttab_transfer: target domain is dying\n");
             spin_unlock(&e->page_alloc_lock);
             put_domain(e);
             result = GNTST_general_error;
             break;
         }
-        if (unlikely(!gnttab_prepare_for_transfer(e, d, gop->handle))) {
-            printk("gnttab_donate: gnttab_prepare_for_transfer fails\n");
+        if (unlikely(!gnttab_prepare_for_transfer(e, d, gop->ref))) {
+            printk("gnttab_transfer: gnttab_prepare_for_transfer fails\n");
             spin_unlock(&e->page_alloc_lock);
             put_domain(e);
             result = GNTST_general_error;
@@ -965,10 +965,10 @@
         ASSERT(e->tot_pages <= e->max_pages);
         if (unlikely(test_bit(DOMFLAGS_DYING, &e->domain_flags)) ||
             unlikely(e->tot_pages == e->max_pages) ||
-            unlikely(!gnttab_prepare_for_transfer(e, d, gop->handle))) {
-            printk("gnttab_donate: Transferee has no reservation headroom (%d,"
+            unlikely(!gnttab_prepare_for_transfer(e, d, gop->ref))) {
+            printk("gnttab_transfer: Transferee has no reservation headroom 
(%d,"
                    "%d) or provided a bad grant ref (%08x) or is dying (%p)\n",
-                   e->tot_pages, e->max_pages, gop->handle, e->d_flags);
+                   e->tot_pages, e->max_pages, gop->ref, e->d_flags);
             spin_unlock(&e->page_alloc_lock);
             put_domain(e);
             result = GNTST_general_error;
@@ -988,7 +988,7 @@
          * Transfer is all done: tell the guest about its new page
          * frame.
          */
-        gnttab_notify_transfer(e, d, gop->handle, gop->mfn);
+        gnttab_notify_transfer(e, d, gop->ref, gop->mfn);
         
         put_domain(e);
         
@@ -1038,11 +1038,11 @@
             rc = gnttab_dump_table((gnttab_dump_table_t *)uop);
             break;
 #endif
-        case GNTTABOP_donate:
+        case GNTTABOP_transfer:
             if (unlikely(!array_access_ok(uop, count, 
-                                          sizeof(gnttab_donate_t))))
+                                          sizeof(gnttab_transfer_t))))
                 goto out;
-            rc = gnttab_donate(uop, count);
+            rc = gnttab_transfer(uop, count);
             break;
         default:
             rc = -ENOSYS;
diff -r 2dcfb85a95b9 -r cedfbb032261 xen/common/grant_table.c
--- a/xen/common/grant_table.c  Thu Sep 15 17:19:08 2005
+++ b/xen/common/grant_table.c  Thu Sep 15 17:40:16 2005
@@ -797,7 +797,7 @@
 #endif
 
 static long
-gnttab_donate(gnttab_donate_t *uop, unsigned int count)
+gnttab_transfer(gnttab_transfer_t *uop, unsigned int count)
 {
     struct domain *d = current->domain;
     struct domain *e;
@@ -805,19 +805,20 @@
     u32 _d, _nd, x, y;
     int i;
     int result = GNTST_okay;
+    grant_entry_t *sha;
 
     for ( i = 0; i < count; i++ )
     {
-        gnttab_donate_t *gop = &uop[i];
+        gnttab_transfer_t *gop = &uop[i];
 #if GRANT_DEBUG
-        printk("gnttab_donate: i=%d mfn=%lx domid=%d gref=%08x\n",
+        printk("gnttab_transfer: i=%d mfn=%lx domid=%d gref=%08x\n",
                i, gop->mfn, gop->domid, gop->handle);
 #endif
         page = &frame_table[gop->mfn];
         
         if ( unlikely(IS_XEN_HEAP_FRAME(page)))
         { 
-            printk("gnttab_donate: xen heap frame mfn=%lx\n", 
+            printk("gnttab_transfer: xen heap frame mfn=%lx\n", 
                    (unsigned long) gop->mfn);
             gop->status = GNTST_bad_virt_addr;
             continue;
@@ -825,7 +826,7 @@
         
         if ( unlikely(!pfn_valid(page_to_pfn(page))) )
         {
-            printk("gnttab_donate: invalid pfn for mfn=%lx\n", 
+            printk("gnttab_transfer: invalid pfn for mfn=%lx\n", 
                    (unsigned long) gop->mfn);
             gop->status = GNTST_bad_virt_addr;
             continue;
@@ -833,7 +834,7 @@
 
         if ( unlikely((e = find_domain_by_id(gop->domid)) == NULL) )
         {
-            printk("gnttab_donate: can't find domain %d\n", gop->domid);
+            printk("gnttab_transfer: can't find domain %d\n", gop->domid);
             gop->status = GNTST_bad_domain;
             continue;
         }
@@ -853,7 +854,7 @@
             x = y;
             if (unlikely((x & (PGC_count_mask|PGC_allocated)) !=
                          (1 | PGC_allocated)) || unlikely(_nd != _d)) {
-                printk("gnttab_donate: Bad page values %p: ed=%p(%u), sd=%p,"
+                printk("gnttab_transfer: Bad page values %p: ed=%p(%u), sd=%p,"
                        " caf=%08x, taf=%" PRtype_info "\n", 
                        (void *) page_to_pfn(page),
                         d, d->domain_id, unpickle_domptr(_nd), x, 
@@ -888,12 +889,12 @@
          */
         if ( unlikely(test_bit(DOMFLAGS_DYING, &e->domain_flags)) ||
              unlikely(e->tot_pages >= e->max_pages) ||
-             unlikely(!gnttab_prepare_for_transfer(e, d, gop->handle)) )
-        {
-            DPRINTK("gnttab_donate: Transferee has no reservation headroom "
+             unlikely(!gnttab_prepare_for_transfer(e, d, gop->ref)) )
+        {
+            DPRINTK("gnttab_transfer: Transferee has no reservation headroom "
                     "(%d,%d) or provided a bad grant ref (%08x) or "
                     "is dying (%lx)\n",
-                    e->tot_pages, e->max_pages, gop->handle, e->domain_flags);
+                    e->tot_pages, e->max_pages, gop->ref, e->domain_flags);
             spin_unlock(&e->page_alloc_lock);
             put_domain(e);
             gop->status = result = GNTST_general_error;
@@ -908,11 +909,11 @@
         
         spin_unlock(&e->page_alloc_lock);
         
-        /*
-         * Transfer is all done: tell the guest about its new page
-         * frame.
-         */
-        gnttab_notify_transfer(e, d, gop->handle, gop->mfn);
+        /* Tell the guest about its new page frame. */
+        sha = &e->grant_table->shared[gop->ref];
+        sha->frame = gop->mfn;
+        wmb();
+        sha->flags |= GTF_transfer_completed;
         
         put_domain(e);
         
@@ -960,11 +961,11 @@
         rc = gnttab_dump_table((gnttab_dump_table_t *)uop);
         break;
 #endif
-    case GNTTABOP_donate:
+    case GNTTABOP_transfer:
         if (unlikely(!array_access_ok(
-            uop, count, sizeof(gnttab_donate_t))))
+            uop, count, sizeof(gnttab_transfer_t))))
             goto out;
-        rc = gnttab_donate(uop, count);
+        rc = gnttab_transfer(uop, count);
         break;
     default:
         rc = -ENOSYS;
@@ -1171,46 +1172,6 @@
     return 0;
 }
 
-void 
-gnttab_notify_transfer(
-    struct domain *rd, struct domain *ld, grant_ref_t ref, unsigned long frame)
-{
-    grant_entry_t  *sha;
-    unsigned long   pfn;
-
-#if GRANT_DEBUG_VERBOSE
-    DPRINTK("gnttab_notify_transfer rd(%hu) ld(%hu) ref(%hu).\n",
-            rd->domain_id, ld->domain_id, ref);
-#endif
-
-    sha = &rd->grant_table->shared[ref];
-
-    spin_lock(&rd->grant_table->lock);
-
-    pfn = sha->frame;
-
-    if ( unlikely(pfn >= max_page ) )
-        DPRINTK("Bad pfn (%lx)\n", pfn);
-    else
-    {
-        set_pfn_from_mfn(frame, pfn);
-
-        if ( unlikely(shadow_mode_log_dirty(ld)))
-             mark_dirty(ld, frame);
-
-        if (shadow_mode_translate(ld))
-            set_mfn_from_pfn(pfn, frame);
-    }
-    sha->frame = __mfn_to_gpfn(rd, frame);
-    sha->domid = rd->domain_id;
-    wmb();
-    sha->flags = ( GTF_accept_transfer | GTF_transfer_completed );
-
-    spin_unlock(&rd->grant_table->lock);
-
-    return;
-}
-
 int 
 grant_table_create(
     struct domain *d)
diff -r 2dcfb85a95b9 -r cedfbb032261 xen/include/public/grant_table.h
--- a/xen/include/public/grant_table.h  Thu Sep 15 17:19:08 2005
+++ b/xen/include/public/grant_table.h  Thu Sep 15 17:40:16 2005
@@ -215,18 +215,19 @@
 } gnttab_dump_table_t;
 
 /*
- * GNTTABOP_donate_grant_ref: Donate <frame> to a foreign domain.  The
+ * GNTTABOP_transfer_grant_ref: Transfer <frame> to a foreign domain.  The
  * foreign domain has previously registered the details of the transfer.
  * These can be identified from <handle>, a grant reference.
  */
-#define GNTTABOP_donate                4
+#define GNTTABOP_transfer                4
 typedef struct {
-    unsigned long mfn;               /*  0 */
-    domid_t     domid;               /*  4 */
-    u16         handle;               /*  8 */
-    s16         status;               /*  10: GNTST_* */
-    u32         __pad;
-} gnttab_donate_t;           /*  14 bytes */
+    /* IN parameters. */
+    unsigned long mfn;
+    domid_t     domid;
+    grant_ref_t ref;
+    /* OUT parameters. */
+    s16         status;
+} gnttab_transfer_t;
 
 /*
  * Bitfield values for update_pin_status.flags.
diff -r 2dcfb85a95b9 -r cedfbb032261 xen/include/xen/grant_table.h
--- a/xen/include/xen/grant_table.h     Thu Sep 15 17:19:08 2005
+++ b/xen/include/xen/grant_table.h     Thu Sep 15 17:40:16 2005
@@ -106,12 +106,6 @@
 gnttab_prepare_for_transfer(
     struct domain *rd, struct domain *ld, grant_ref_t ref);
 
-/* Notify 'rd' of a completed transfer via an already-locked grant entry. */
-void 
-gnttab_notify_transfer(
-    struct domain *rd, struct domain *ld,
-    grant_ref_t ref, unsigned long frame);
-
 /* Domain death release of granted device mappings of other domains.*/
 void
 gnttab_release_dev_mappings(grant_table_t *gt);

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.