From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: [PATCH 07/14] xen: balloon: do not update stage 1 pagetable for autotranslated guests Date: Thu, 4 Oct 2012 16:11:48 +0100 Message-ID: <1349363515-26190-7-git-send-email-ian.campbell@citrix.com> References: <1349363496.866.49.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1349363496.866.49.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Konrad Rzeszutek Wilk , Stefano Stabellini , Mukesh Rathor Cc: Ian Campbell , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org This is unnecessary (since the page will be removed from the p2m) and can be tricky if the page is in the middle of a superpage, as it is on ARM. Signed-off-by: Ian Campbell --- Also effects PVH but in a benign way I think. --- drivers/xen/balloon.c | 23 +++-------------------- 1 files changed, 3 insertions(+), 20 deletions(-) diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 7885a19..1b56ae0 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c @@ -357,15 +357,7 @@ static enum bp_state increase_reservation(unsigned long nr_pages) BUG_ON(!xen_feature(XENFEAT_auto_translated_physmap) && phys_to_machine_mapping_valid(pfn)); - if (xen_pv_domain() && - xen_feature(XENFEAT_auto_translated_physmap)) { - /* PVH: we just need to update native page table */ - pte_t *ptep; - unsigned int level; - void *addr = __va(pfn << PAGE_SHIFT); - ptep = lookup_address((unsigned long)addr, &level); - set_pte(ptep, pfn_pte(pfn, PAGE_KERNEL)); - } else + if (!xen_feature(XENFEAT_auto_translated_physmap)) set_phys_to_machine(pfn, frame_list[i]); /* Link back into the page tables if not highmem. */ @@ -427,21 +419,12 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) scrub_page(page); - if (xen_pv_domain() && !PageHighMem(page)) { - if (xen_feature(XENFEAT_auto_translated_physmap)) { - unsigned int level; - pte_t *ptep; - void *addr = __va(pfn << PAGE_SHIFT); - ptep = lookup_address((unsigned long)addr, - &level); - set_pte(ptep, __pte(0)); - - } else { + if (xen_pv_domain() && !PageHighMem(page) && + !xen_feature(XENFEAT_auto_translated_physmap)) { ret = HYPERVISOR_update_va_mapping( (unsigned long)__va(pfn << PAGE_SHIFT), __pte_ma(0), 0); BUG_ON(ret); - } } } -- 1.7.2.5