[PATCH V4 06/10] xen/arm: introduce PGC_reserved

Penny Zheng posted 10 patches 4 years, 6 months ago
There is a newer version of this series
[PATCH V4 06/10] xen/arm: introduce PGC_reserved
Posted by Penny Zheng 4 years, 6 months ago
This patch introduces a new page flag PGC_reserved in order to differentiate
pages of static memory from those allocated from heap.

Mark pages of static memory PGC_reserved when initializing them.

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
---
 xen/common/page_alloc.c  | 3 +++
 xen/include/asm-arm/mm.h | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 2acb73e323..f51e406401 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -1536,6 +1536,9 @@ void __init free_staticmem_pages(struct page_info *pg, unsigned long nr_mfns,
             /* TODO: asynchronous scrubbing for pages of static memory. */
             scrub_one_page(pg);
         }
+
+        /* In case initializing page of static memory, mark it PGC_reserved. */
+        pg[i].count_info |= PGC_reserved;
     }
 }
 #endif
diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h
index ded74d29da..7b5e7b7f69 100644
--- a/xen/include/asm-arm/mm.h
+++ b/xen/include/asm-arm/mm.h
@@ -108,6 +108,9 @@ struct page_info
   /* Page is Xen heap? */
 #define _PGC_xen_heap     PG_shift(2)
 #define PGC_xen_heap      PG_mask(1, 2)
+  /* Page is reserved */
+#define _PGC_reserved     PG_shift(3)
+#define PGC_reserved      PG_mask(1, 3)
 /* ... */
 /* Page is broken? */
 #define _PGC_broken       PG_shift(7)
-- 
2.25.1


Re: [PATCH V4 06/10] xen/arm: introduce PGC_reserved
Posted by Julien Grall 4 years, 6 months ago
Hi Penny,

On 28/07/2021 11:27, Penny Zheng wrote:
> This patch introduces a new page flag PGC_reserved in order to differentiate
> pages of static memory from those allocated from heap.
> 
> Mark pages of static memory PGC_reserved when initializing them.
> 
> Signed-off-by: Penny Zheng <penny.zheng@arm.com>

I think this want to be folded in patch #7.

Cheers,

-- 
Julien Grall

RE: [PATCH V4 06/10] xen/arm: introduce PGC_reserved
Posted by Penny Zheng 4 years, 5 months ago
Hi Julien

> -----Original Message-----
> From: Julien Grall <julien@xen.org>
> Sent: Friday, August 13, 2021 8:22 PM
> To: Penny Zheng <Penny.Zheng@arm.com>; xen-devel@lists.xenproject.org;
> sstabellini@kernel.org
> Cc: Bertrand Marquis <Bertrand.Marquis@arm.com>; Wei Chen
> <Wei.Chen@arm.com>; nd <nd@arm.com>
> Subject: Re: [PATCH V4 06/10] xen/arm: introduce PGC_reserved
> 
> Hi Penny,
> 
> On 28/07/2021 11:27, Penny Zheng wrote:
> > This patch introduces a new page flag PGC_reserved in order to
> > differentiate pages of static memory from those allocated from heap.
> >
> > Mark pages of static memory PGC_reserved when initializing them.
> >
> > Signed-off-by: Penny Zheng <penny.zheng@arm.com>
> 
> I think this want to be folded in patch #7.
> 

Ok. Will do.

> Cheers,
> 
> --

Cheers,

--
Penny Zheng

> Julien Grall