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] [IA64] Follow dynamic grant_table for PV-

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [IA64] Follow dynamic grant_table for PV-on-HVM on IPF
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 23 Mar 2007 05:30:28 -0700
Delivery-date: Fri, 23 Mar 2007 05:30:40 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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 awilliam@xxxxxxxxxxxx
# Date 1173710636 21600
# Node ID 800f7904d6a4a3f5c0deaaa444289dff139ad610
# Parent  dc6fbe46ec914c526d091fa560c7d85942ff8e3d
[IA64] Follow dynamic grant_table for PV-on-HVM on IPF

Signed-off-by: Tsunehisa Doi <Doi.Tsunehisa@xxxxxxxxxxxxxx>
---
 xen/arch/ia64/xen/mm.c |   40 +++++++++++++++++++++++++++++++++++++---
 1 files changed, 37 insertions(+), 3 deletions(-)

diff -r dc6fbe46ec91 -r 800f7904d6a4 xen/arch/ia64/xen/mm.c
--- a/xen/arch/ia64/xen/mm.c    Mon Mar 12 08:42:11 2007 -0600
+++ b/xen/arch/ia64/xen/mm.c    Mon Mar 12 08:43:56 2007 -0600
@@ -2090,18 +2090,33 @@ arch_memory_op(int op, XEN_GUEST_HANDLE(
             break;
         case XENMAPSPACE_grant_table:
             spin_lock(&d->grant_table->lock);
+
+            if ((xatp.idx >= nr_grant_frames(d->grant_table)) &&
+                (xatp.idx < max_nr_grant_frames))
+                gnttab_grow_table(d, xatp.idx + 1);
+
             if (xatp.idx < nr_grant_frames(d->grant_table))
-                mfn = virt_to_mfn(d->grant_table->shared) + xatp.idx;
+                mfn = virt_to_mfn(d->grant_table->shared[xatp.idx]);
+
             spin_unlock(&d->grant_table->lock);
             break;
         default:
             break;
         }
 
+        if (mfn == 0) {
+            put_domain(d);
+            return -EINVAL;
+        }
+
         LOCK_BIGLOCK(d);
 
+        /* Check remapping necessity */
+        prev_mfn = gmfn_to_mfn(d, xatp.gpfn);
+        if (mfn == prev_mfn)
+            goto out;
+
         /* Remove previously mapped page if it was present. */
-        prev_mfn = gmfn_to_mfn(d, xatp.gpfn);
         if (prev_mfn && mfn_valid(prev_mfn)) {
             if (IS_XEN_HEAP_FRAME(mfn_to_page(prev_mfn)))
                 /* Xen heap frames are simply unhooked from this phys slot. */
@@ -2113,12 +2128,31 @@ arch_memory_op(int op, XEN_GUEST_HANDLE(
 
         /* Unmap from old location, if any. */
         gpfn = get_gpfn_from_mfn(mfn);
-        if (gpfn != INVALID_M2P_ENTRY)
+        if (gpfn != INVALID_M2P_ENTRY) {
+            /*
+             * guest_physmap_remove_page() (for IPF) descrements page
+             * counter and unset PGC_allocated flag,
+             * so pre-increment page counter and post-set flag inserted
+             */
+            /* pre-increment page counter */
+            if (!get_page(mfn_to_page(mfn), d))
+                goto out;
+
             guest_physmap_remove_page(d, gpfn, mfn);
+
+            /* post-set PGC_allocated flag */
+            if ((mfn_to_page(mfn)->count_info & PGC_count_mask) != 1) {
+                /* no one but us is using this page */
+                put_page(mfn_to_page(mfn));
+                goto out;
+            }
+            set_bit(_PGC_allocated, &mfn_to_page(mfn)->count_info);
+        }
 
         /* Map at new location. */
         guest_physmap_add_page(d, xatp.gpfn, mfn);
 
+    out:
         UNLOCK_BIGLOCK(d);
         
         put_domain(d);

_______________________________________________
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] [IA64] Follow dynamic grant_table for PV-on-HVM on IPF, Xen patchbot-unstable <=