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

Re: [Xen-devel] [PATCH v5 10/16] xen/mm: Switch map_pages_to_xen to use MFN typesafe



Hi George,

On 15/03/18 16:50, George Dunlap wrote:
On 03/14/2018 06:20 PM, julien.grall@xxxxxxx wrote:
diff --git a/xen/common/vmap.c b/xen/common/vmap.c
index 11785ffb0a..04f5db386d 100644
--- a/xen/common/vmap.c
+++ b/xen/common/vmap.c
@@ -9,6 +9,10 @@
  #include <xen/vmap.h>
  #include <asm/page.h>
+/* Override macros from asm/page.h to make them work with mfn_t */
+#undef page_to_mfn
+#define page_to_mfn(pg) _mfn(__page_to_mfn(pg))
+
  static DEFINE_SPINLOCK(vm_lock);
  static void *__read_mostly vm_base[VMAP_REGION_NR];
  #define vm_bitmap(x) ((unsigned long *)vm_base[x])
@@ -208,7 +212,7 @@ void *__vmap(const mfn_t *mfn, unsigned int granularity,
for ( ; va && nr--; ++mfn, cur += PAGE_SIZE * granularity )
      {
-        if ( map_pages_to_xen(cur, mfn_x(*mfn), granularity, flags) )
+        if ( map_pages_to_xen(cur, *mfn, granularity, flags) )
          {
              vunmap(va);
              va = NULL;
@@ -234,7 +238,7 @@ void vunmap(const void *va)
  #ifndef _PAGE_NONE
      destroy_xen_mappings(addr, addr + PAGE_SIZE * pages);
  #else /* Avoid tearing down intermediate page tables. */
-    map_pages_to_xen(addr, 0, pages, _PAGE_NONE);
+    map_pages_to_xen(addr, INVALID_MFN, pages, _PAGE_NONE);

This is a bit of a nit-pick, but shouldn't something like this have gone
in patch 8?

patch #8 is about removing a parameter of populate_pt_range. At the same time, 0 is replaced by mfn_x(INVALID_MFN) for that specific use case.

It was not intended to replace all the user of map_pages_to_xen with 0 to mfn_x(INVALID_MFN). This is done here as the caller is modified.

Cheers,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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