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] Allow __gpfn_to_mfn() to automatically deal with transla

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Allow __gpfn_to_mfn() to automatically deal with translated domains != current.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 28 Nov 2005 16:32:07 +0000
Delivery-date: Mon, 28 Nov 2005 16:32: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 Michael.Fetterman@xxxxxxxxxxxx
# Node ID 9971d8d1f63166db069bb3f45924bc3cc7ccbbf8
# Parent  af3e4a594e4c35fd0a65740f10cc54173d1928b9
Allow __gpfn_to_mfn() to automatically deal with translated domains != current.

Renamed gpfn_to_mfn_foreign() to get_mfn_from_pfn_foreign(), making it more
consistent with get_mfn_from_pfn().

diff -r af3e4a594e4c -r 9971d8d1f631 xen/arch/x86/shadow32.c
--- a/xen/arch/x86/shadow32.c   Wed Nov 23 13:56:43 2005
+++ b/xen/arch/x86/shadow32.c   Mon Nov 28 14:09:44 2005
@@ -1423,7 +1423,7 @@
 }
 
 unsigned long
-gpfn_to_mfn_foreign(struct domain *d, unsigned long gpfn)
+get_mfn_from_pfn_foreign(struct domain *d, unsigned long gpfn)
 {
     unsigned long va, tabpfn;
     l1_pgentry_t *l1, l1e;
@@ -1431,7 +1431,7 @@
 
     ASSERT(shadow_mode_translate(d));
 
-    perfc_incrc(gpfn_to_mfn_foreign);
+    perfc_incrc(get_mfn_from_pfn_foreign);
 
     va = gpfn << PAGE_SHIFT;
     tabpfn = pagetable_get_pfn(d->arch.phys_table);
diff -r af3e4a594e4c -r 9971d8d1f631 xen/arch/x86/shadow_public.c
--- a/xen/arch/x86/shadow_public.c      Wed Nov 23 13:56:43 2005
+++ b/xen/arch/x86/shadow_public.c      Mon Nov 28 14:09:44 2005
@@ -1607,7 +1607,7 @@
 }
 
 unsigned long
-gpfn_to_mfn_foreign(struct domain *d, unsigned long gpfn)
+get_mfn_from_pfn_foreign(struct domain *d, unsigned long gpfn)
 {
     unsigned long va, tabpfn;
     l1_pgentry_t *l1, l1e;
@@ -1615,7 +1615,7 @@
 
     ASSERT(shadow_mode_translate(d));
 
-    perfc_incrc(gpfn_to_mfn_foreign);
+    perfc_incrc(get_mfn_from_pfn_foreign);
 
     va = gpfn << PAGE_SHIFT;
     tabpfn = pagetable_get_pfn(d->arch.phys_table);
diff -r af3e4a594e4c -r 9971d8d1f631 xen/common/grant_table.c
--- a/xen/common/grant_table.c  Wed Nov 23 13:56:43 2005
+++ b/xen/common/grant_table.c  Mon Nov 28 14:09:44 2005
@@ -234,7 +234,7 @@
 
         /* rmb(); */ /* not on x86 */
 
-        frame = __gpfn_to_mfn_foreign(rd, sha->frame);
+        frame = __gpfn_to_mfn(rd, sha->frame);
 
         if ( unlikely(!pfn_valid(frame)) ||
              unlikely(!((dev_hst_ro_flags & GNTMAP_readonly) ?
diff -r af3e4a594e4c -r 9971d8d1f631 xen/include/asm-x86/shadow.h
--- a/xen/include/asm-x86/shadow.h      Wed Nov 23 13:56:43 2005
+++ b/xen/include/asm-x86/shadow.h      Mon Nov 28 14:09:44 2005
@@ -285,22 +285,19 @@
 
 #define __mfn_to_gpfn(_d, mfn)                         \
     ( (shadow_mode_translate(_d))                      \
-      ? get_pfn_from_mfn(mfn)                                   \
+      ? get_pfn_from_mfn(mfn)                          \
       : (mfn) )
 
 #define __gpfn_to_mfn(_d, gpfn)                        \
     ({                                                 \
-        (shadow_mode_translate(_d))                    \
-        ? get_mfn_from_pfn(gpfn)                \
+        unlikely(shadow_mode_translate(_d))            \
+        ? (likely(current->domain == (_d))             \
+           ? get_mfn_from_pfn(gpfn)                    \
+           : get_mfn_from_pfn_foreign(_d, gpfn))       \
         : (gpfn);                                      \
     })
 
-#define __gpfn_to_mfn_foreign(_d, gpfn)                \
-    ( (shadow_mode_translate(_d))                      \
-      ? gpfn_to_mfn_foreign(_d, gpfn)                  \
-      : (gpfn) )
-
-extern unsigned long gpfn_to_mfn_foreign(
+extern unsigned long get_mfn_from_pfn_foreign(
     struct domain *d, unsigned long gpfn);
 
 /************************************************************************/
@@ -871,18 +868,7 @@
 
     if ( l2e_get_flags(gpde) & _PAGE_PRESENT )
     {
-        if ( unlikely((current->domain != d) && !shadow_mode_external(d)) )
-        {
-            // Can't use __gpfn_to_mfn() if we don't have one of this domain's
-            // page tables currently installed.
-            // This isn't common -- it only happens during shadow mode setup
-            // and mode changes.
-            //
-            mfn = gpfn_to_mfn_foreign(d, pfn);
-        }
-        else
-            mfn = __gpfn_to_mfn(d, pfn);
-
+        mfn = __gpfn_to_mfn(d, pfn);
         if ( VALID_MFN(mfn) && (mfn < max_page) )
             hl2e = l1e_from_pfn(mfn, __PAGE_HYPERVISOR);
     }
diff -r af3e4a594e4c -r 9971d8d1f631 xen/include/xen/perfc_defn.h
--- a/xen/include/xen/perfc_defn.h      Wed Nov 23 13:56:43 2005
+++ b/xen/include/xen/perfc_defn.h      Mon Nov 28 14:09:44 2005
@@ -114,7 +114,7 @@
 PERFCOUNTER_CPU(validate_hl2e_calls,    "calls to validate_hl2e_change")
 PERFCOUNTER_CPU(validate_hl2e_changes,  "validate_hl2e makes changes")
 PERFCOUNTER_CPU(exception_fixed,        "pre-exception fixed")
-PERFCOUNTER_CPU(gpfn_to_mfn_foreign,    "calls to gpfn_to_mfn_foreign")
+PERFCOUNTER_CPU(get_mfn_from_pfn_foreign, "calls to get_mfn_from_pfn_foreign")
 PERFCOUNTER_CPU(remove_all_access,      "calls to remove_all_access")
 PERFCOUNTER_CPU(remove_write_access,    "calls to remove_write_access")
 PERFCOUNTER_CPU(remove_write_access_easy, "easy outs of remove_write_access")

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Allow __gpfn_to_mfn() to automatically deal with translated domains != current., Xen patchbot -unstable <=