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

Re: [PATCH v12 6/6] xen: retrieve reserved pages on populate_physmap



Hi Penny,

On 06/09/2022 08:39, Penny Zheng wrote:
When a static domain populates memory through populate_physmap at runtime,
it shall retrieve reserved pages from resv_page_list to make sure that
guest RAM is still restricted in statically configured memory regions.
This commit also introduces a new helper acquire_reserved_page to make it work.

Signed-off-by: Penny Zheng <penny.zheng@xxxxxxx>

With one remark below:

Reviewed-by: Julien Grall <jgrall@xxxxxxxxxx>

[...]

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 18d34d1b69..215f4c234b 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -2755,9 +2755,8 @@ void free_domstatic_page(struct page_info *page)
          put_domain(d);
  }
-static bool __init prepare_staticmem_pages(struct page_info *pg,
-                                           unsigned long nr_mfns,
-                                           unsigned int memflags)
+static bool prepare_staticmem_pages(struct page_info *pg, unsigned long 
nr_mfns,
+                                    unsigned int memflags)
  {
      bool need_tlbflush = false;
      uint32_t tlbflush_timestamp = 0;
@@ -2838,6 +2837,25 @@ static struct page_info * __init 
acquire_staticmem_pages(mfn_t smfn,
      return pg;
  }
+static int assign_domstatic_pages(struct domain *d, struct page_info *pg,
+                                  unsigned int nr_mfns, unsigned int memflags)
+{
+    if ( !d || (memflags & (MEMF_no_owner | MEMF_no_refcount)) )
+    {
+        /*
+         * Respective handling omitted here because right now
+         * acquired static memory is only for guest RAM.

"guest" commonly refers to any domain other than dom0. However, I can't see why this code couldn't be used by dom0. So it should be s/guest/domain/.

I will modify it on commit.

+         */
+        ASSERT_UNREACHABLE();
+        return -EINVAL;
+    }
+
+    if ( assign_pages(pg, nr_mfns, d, memflags) )
+        return -EINVAL;
+
+    return 0;
+}
+

Cheers,

--
Julien Grall



 


Rackspace

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