From: Paul Durrant <pdurr...@amazon.com> This patch modifies several places walking the domain's page_list to make them ignore PGC_extra pages:
- dump_pageframe_info() should ignore PGC_extra pages in its dump as it determines whether to dump using domain_tot_pages() which also ignores PGC_extra pages. - arch_set_info_guest() is looking for an L4 page table which will definitely not be in a PGC_extra page. - audit_p2m() should ignore PGC_extra pages as it is perfectly legitimate for them not to be present in the P2M. - dump_nama() should ignore PGC_extra pages as they are essentially uninteresting in that context. - dom0_construct_pv() should ignore PGC_extra pages when setting up the physmap as they are only created for special purposes and, if they need to be mapped, will be mapped explicitly for whatever purpose is relevant. - tboot_gen_domain_integrity() should ignore PGC_extra pages as they should not form part of the measurement. Signed-off-by: Paul Durrant <p...@xen.org> --- Cc: Jan Beulich <jbeul...@suse.com> Cc: Andrew Cooper <andrew.coop...@citrix.com> Cc: Wei Liu <w...@xen.org> Cc: "Roger Pau Monné" <roger....@citrix.com> v4: - Expand to cover more than just dom0_construct_pv() v2: - New in v2 --- xen/arch/x86/domain.c | 6 +++++- xen/arch/x86/mm/p2m.c | 3 +++ xen/arch/x86/numa.c | 3 +++ xen/arch/x86/pv/dom0_build.c | 4 ++++ xen/arch/x86/tboot.c | 7 ++++++- 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index bdcc0d972a..f6ed25e8ee 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -231,6 +231,9 @@ void dump_pageframe_info(struct domain *d) unsigned int index = MASK_EXTR(page->u.inuse.type_info, PGT_type_mask); + if ( page->count_info & PGC_extra ) + continue; + if ( ++total[index] > 16 ) { switch ( page->u.inuse.type_info & PGT_type_mask ) @@ -1044,7 +1047,8 @@ int arch_set_info_guest( { struct page_info *page = page_list_remove_head(&d->page_list); - if ( page_lock(page) ) + if ( !(page->count_info & PGC_extra) && + page_lock(page) ) { if ( (page->u.inuse.type_info & PGT_type_mask) == PGT_l4_page_table ) diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index 9f51370327..71d2fb9bbc 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -2843,6 +2843,9 @@ void audit_p2m(struct domain *d, spin_lock(&d->page_alloc_lock); page_list_for_each ( page, &d->page_list ) { + if ( page->count_info & PGC_extra ) + continue; + mfn = mfn_x(page_to_mfn(page)); P2M_PRINTK("auditing guest page, mfn=%#lx\n", mfn); diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c index f1066c59c7..7e5aa8dc95 100644 --- a/xen/arch/x86/numa.c +++ b/xen/arch/x86/numa.c @@ -428,6 +428,9 @@ static void dump_numa(unsigned char key) spin_lock(&d->page_alloc_lock); page_list_for_each(page, &d->page_list) { + if ( page->count_info & PGC_extra ) + break; + i = phys_to_nid(page_to_maddr(page)); page_num_node[i]++; } diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c index dc16ef2e79..f8f1bbe2f4 100644 --- a/xen/arch/x86/pv/dom0_build.c +++ b/xen/arch/x86/pv/dom0_build.c @@ -792,6 +792,10 @@ int __init dom0_construct_pv(struct domain *d, { mfn = mfn_x(page_to_mfn(page)); BUG_ON(SHARED_M2P(get_gpfn_from_mfn(mfn))); + + if ( page->count_info & PGC_extra ) + continue; + if ( get_gpfn_from_mfn(mfn) >= count ) { BUG_ON(is_pv_32bit_domain(d)); diff --git a/xen/arch/x86/tboot.c b/xen/arch/x86/tboot.c index 8c232270b4..6cc020cb71 100644 --- a/xen/arch/x86/tboot.c +++ b/xen/arch/x86/tboot.c @@ -220,7 +220,12 @@ static void tboot_gen_domain_integrity(const uint8_t key[TB_KEY_SIZE], spin_lock(&d->page_alloc_lock); page_list_for_each(page, &d->page_list) { - void *pg = __map_domain_page(page); + void *pg; + + if ( page->count_info & PGC_extra ) + continue; + + pg = __map_domain_page(page); vmac_update(pg, PAGE_SIZE, &ctx); unmap_domain_page(pg); } -- 2.20.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel