Message ID | 85808fae77da535b2997bede8965d22d5c80c5d3.1590750232.git.hongyxia@amazon.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | switch to domheap for Xen page tables | expand |
On 29.05.2020 13:11, Hongyan Xia wrote: > From: Hongyan Xia <hongyxia@amazon.com> > > Signed-off-by: Wei Liu <wei.liu2@citrix.com> > Signed-off-by: Hongyan Xia <hongyxia@amazon.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> with a sufficiently minor remark: > --- a/xen/arch/x86/mm.c > +++ b/xen/arch/x86/mm.c > @@ -4918,10 +4918,11 @@ mfn_t alloc_xen_pagetable_new(void) > { > if ( system_state != SYS_STATE_early_boot ) > { > - void *ptr = alloc_xenheap_page(); > > - BUG_ON(!hardware_domain && !ptr); > - return ptr ? virt_to_mfn(ptr) : INVALID_MFN; > + struct page_info *pg = alloc_domheap_page(NULL, 0); > + > + BUG_ON(!hardware_domain && !pg); > + return pg ? page_to_mfn(pg) : INVALID_MFN; pg doesn't even get de-referenced, let alone modified. Hence it would better be pointer-to-const, despite this possibly feeling a little odd to some of us given this is a freshly allocated page. Jan
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 38cfa3ce25..16f1aa3344 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -4918,10 +4918,11 @@ mfn_t alloc_xen_pagetable_new(void) { if ( system_state != SYS_STATE_early_boot ) { - void *ptr = alloc_xenheap_page(); - BUG_ON(!hardware_domain && !ptr); - return ptr ? virt_to_mfn(ptr) : INVALID_MFN; + struct page_info *pg = alloc_domheap_page(NULL, 0); + + BUG_ON(!hardware_domain && !pg); + return pg ? page_to_mfn(pg) : INVALID_MFN; } return alloc_boot_pages(1, 1); @@ -4931,7 +4932,7 @@ mfn_t alloc_xen_pagetable_new(void) void free_xen_pagetable_new(mfn_t mfn) { if ( system_state != SYS_STATE_early_boot && !mfn_eq(mfn, INVALID_MFN) ) - free_xenheap_page(mfn_to_virt(mfn_x(mfn))); + free_domheap_page(mfn_to_page(mfn)); } void *alloc_map_clear_xen_pt(mfn_t *pmfn)