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

[Xen-devel] [RFC][PATCH] 1/9 Populate-on-demand memory: p2m query type

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [RFC][PATCH] 1/9 Populate-on-demand memory: p2m query type
From: "George Dunlap" <George.Dunlap@xxxxxxxxxxxxx>
Date: Tue, 23 Dec 2008 13:36:32 +0000
Delivery-date: Tue, 23 Dec 2008 05:36:56 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:mime-version:content-type:content-transfer-encoding :content-disposition:x-google-sender-auth; bh=6qcV/KI2dfLiPsMwjcMt00xxQL8enNYMJx7Ju3dnwZ4=; b=mQooXMYxbirI+N6hA8Cydi5rP9Z9FiFPyp2Nr6ZksvsuL5sNaXUSLJC5Ws3CcSR9L8 A2wk3WFNXJxUD+cIhqoeYLbT8eGmrZ70jc2kOO8zthZTjmfz0PachtSCx2vhUI8+QE3S 6oL81Ieo18Fee4jqH5Poh3Hjiu5+ViozLScHs=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition:x-google-sender-auth; b=fjJ+8SaWmNlaCdh9x3Zz3+Qu+6pe4YH0zaNlmyS4JKzwXvqaNxMmr/mfx1DaP2kBGp ec0rj/zyhdfdL5ErGGL3L+CD3oT34QNLKMDezpfBoe0SQoa7rGP9VseKjXHmgE1EqV4B ydjazMeBqeAgMSK/Yq2J2rRZtgQrIYGwNnSFQ=
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Add a p2m query type.

Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>

diff -r e9c8cd6c3de7 xen/arch/x86/mm/hap/p2m-ept.c
--- a/xen/arch/x86/mm/hap/p2m-ept.c     Wed Nov 19 15:49:55 2008 +0000
+++ b/xen/arch/x86/mm/hap/p2m-ept.c     Wed Nov 19 16:00:04 2008 +0000
@@ -274,7 +274,8 @@
 }

 /* Read ept p2m entries */
-static mfn_t ept_get_entry(struct domain *d, unsigned long gfn, p2m_type_t *t)
+static mfn_t ept_get_entry(struct domain *d, unsigned long gfn, p2m_type_t *t,
+    p2m_query_t q)
 {
     ept_entry_t *table =
         map_domain_page(mfn_x(pagetable_get_mfn(d->arch.phys_table)));
@@ -359,9 +360,10 @@
     return content;
 }

-static mfn_t ept_get_entry_current(unsigned long gfn, p2m_type_t *t)
+static mfn_t ept_get_entry_current(unsigned long gfn, p2m_type_t *t,
+                                   p2m_query_t q)
 {
-    return ept_get_entry(current->domain, gfn, t);
+    return ept_get_entry(current->domain, gfn, t, q);
 }

 void ept_change_entry_emt_with_range(struct domain *d, unsigned long start_gfn,
diff -r e9c8cd6c3de7 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c     Wed Nov 19 15:49:55 2008 +0000
+++ b/xen/arch/x86/mm/p2m.c     Wed Nov 19 16:00:04 2008 +0000
@@ -345,7 +345,8 @@
 }

 static mfn_t
-p2m_gfn_to_mfn(struct domain *d, unsigned long gfn, p2m_type_t *t)
+p2m_gfn_to_mfn(struct domain *d, unsigned long gfn, p2m_type_t *t,
+               p2m_query_t q)
 {
     mfn_t mfn;
     paddr_t addr = ((paddr_t)gfn) << PAGE_SHIFT;
@@ -436,7 +437,8 @@
 }

 /* Read the current domain's p2m table (through the linear mapping). */
-static mfn_t p2m_gfn_to_mfn_current(unsigned long gfn, p2m_type_t *t)
+static mfn_t p2m_gfn_to_mfn_current(unsigned long gfn, p2m_type_t *t,
+                                    p2m_query_t q)
 {
     mfn_t mfn = _mfn(INVALID_MFN);
     p2m_type_t p2mt = p2m_mmio_dm;
diff -r e9c8cd6c3de7 xen/include/asm-x86/guest_pt.h
--- a/xen/include/asm-x86/guest_pt.h    Wed Nov 19 15:49:55 2008 +0000
+++ b/xen/include/asm-x86/guest_pt.h    Wed Nov 19 16:00:04 2008 +0000
@@ -49,7 +49,7 @@

 /* Override gfn_to_mfn to work with gfn_t */
 #undef gfn_to_mfn
-#define gfn_to_mfn(d, g, t) _gfn_to_mfn((d), gfn_x(g), (t))
+#define gfn_to_mfn(d, g, t) _gfn_to_mfn_type((d), gfn_x(g), (t), p2m_alloc)


 /* Types of the guest's page tables and access functions for them */
diff -r e9c8cd6c3de7 xen/include/asm-x86/p2m.h
--- a/xen/include/asm-x86/p2m.h Wed Nov 19 15:49:55 2008 +0000
+++ b/xen/include/asm-x86/p2m.h Wed Nov 19 16:00:04 2008 +0000
@@ -66,6 +66,12 @@
     p2m_mmio_direct = 5,        /* Read/write mapping of genuine MMIO area */
 } p2m_type_t;

+typedef enum {
+    p2m_query = 0,              /* Do not populate a PoD entries      */
+    p2m_alloc = 1,              /* Automatically populate PoD entries */
+    p2m_guest = 2,              /* Guest demand-fault; implies alloc  */
+} p2m_query_t;
+
 /* We use bitmaps and maks to handle groups of types */
 #define p2m_to_mask(_t) (1UL << (_t))

@@ -105,9 +111,11 @@
                                        mfn_t mfn, unsigned int page_order,
                                        p2m_type_t p2mt);
     mfn_t              (*get_entry   )(struct domain *d, unsigned long gfn,
-                                       p2m_type_t *p2mt);
+                                       p2m_type_t *p2mt,
+                                       p2m_query_t q);
     mfn_t              (*get_entry_current)(unsigned long gfn,
-                                            p2m_type_t *p2mt);
+                                            p2m_type_t *p2mt,
+                                            p2m_query_t q);
     void               (*change_entry_type_global)(struct domain *d,
                                                    p2m_type_t ot,
                                                    p2m_type_t nt);
@@ -123,23 +131,26 @@
     return (flags >> 9) & 0x7;
 }

-/* Read the current domain's p2m table. */
-static inline mfn_t gfn_to_mfn_current(unsigned long gfn, p2m_type_t *t)
+/* Read the current domain's p2m table.  Do not populate PoD pages. */
+static inline mfn_t gfn_to_mfn_type_current(unsigned long gfn, p2m_type_t *t,
+                                            p2m_query_t q)
 {
-    return current->domain->arch.p2m->get_entry_current(gfn, t);
+    return current->domain->arch.p2m->get_entry_current(gfn, t, q);
 }

-/* Read another domain's P2M table, mapping pages as we go */
+/* Read another domain's P2M table, mapping pages as we go.
+ * Do not populate PoD pages. */
 static inline
-mfn_t gfn_to_mfn_foreign(struct domain *d, unsigned long gfn, p2m_type_t *t)
+mfn_t gfn_to_mfn_type_foreign(struct domain *d, unsigned long gfn,
p2m_type_t *t,
+                              p2m_query_t q)
 {
-    return d->arch.p2m->get_entry(d, gfn, t);
+    return d->arch.p2m->get_entry(d, gfn, t, q);
 }

 /* General conversion function from gfn to mfn */
-#define gfn_to_mfn(d, g, t) _gfn_to_mfn((d), (g), (t))
-static inline mfn_t _gfn_to_mfn(struct domain *d,
-                                unsigned long gfn, p2m_type_t *t)
+static inline mfn_t _gfn_to_mfn_type(struct domain *d,
+                                     unsigned long gfn, p2m_type_t *t,
+                                     p2m_query_t q)
 {
     if ( !paging_mode_translate(d) )
     {
@@ -149,10 +160,17 @@
         return _mfn(gfn);
     }
     if ( likely(current->domain == d) )
-        return gfn_to_mfn_current(gfn, t);
+        return gfn_to_mfn_type_current(gfn, t, q);
     else
-        return gfn_to_mfn_foreign(d, gfn, t);
+        return gfn_to_mfn_type_foreign(d, gfn, t, q);
 }
+
+#define gfn_to_mfn(d, g, t) _gfn_to_mfn_type((d), (g), (t), p2m_alloc)
+#define gfn_to_mfn_query(d, g, t) _gfn_to_mfn_type((d), (g), (t), p2m_query)
+#define gfn_to_mfn_guest(d, g, t) _gfn_to_mfn_type((d), (g), (t), p2m_guest)
+
+#define gfn_to_mfn_current(g, t) gfn_to_mfn_type_current((g), (t), p2m_alloc)
+#define gfn_to_mfn_foreign(d, g, t) gfn_to_mfn_type_foreign((d), (g),
(t), p2m_alloc)

 /* Compatibility function exporting the old untyped interface */
 static inline unsigned long gmfn_to_mfn(struct domain *d, unsigned long gpfn)

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [RFC][PATCH] 1/9 Populate-on-demand memory: p2m query type, George Dunlap <=