From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: Re: [PATCHv4 04/14] xen: remove scratch frames for ballooned pages and m2p override Date: Tue, 27 Jan 2015 11:00:39 +0000 Message-ID: <54C76FD7.6070701@citrix.com> References: <1422291687-7398-1-git-send-email-david.vrabel@citrix.com> <1422291687-7398-5-git-send-email-david.vrabel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YG3sy-0004aI-Qr for xen-devel@lists.xenproject.org; Tue, 27 Jan 2015 11:00:44 +0000 In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini Cc: xen-devel@lists.xenproject.org, Boris Ostrovsky List-Id: xen-devel@lists.xenproject.org On 27/01/15 10:57, Stefano Stabellini wrote: > On Mon, 26 Jan 2015, David Vrabel wrote: >> The scratch frame mappings for ballooned pages and the m2p override >> are broken. Remove them in preparation for replacing them with >> simpler mechanisms that works. >> >> The scratch pages did not ensure that the page was not in use. In >> particular, the foreign page could still be in use by hardware. If >> the guest reused the frame the hardware could read or write that >> frame. >> >> The m2p override did not handle the same frame being granted by two >> different grant references. Trying an M2P override lookup in this >> case is impossible. >> >> Signed-off-by: David Vrabel > > [...] > >> int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops, >> struct gnttab_map_grant_ref *kmap_ops, >> struct page **pages, unsigned int count) >> { >> int i, ret = 0; >> - bool lazy = false; >> pte_t *pte; >> >> if (xen_feature(XENFEAT_auto_translated_physmap)) >> return 0; >> >> - if (kmap_ops && >> - !in_interrupt() && >> - paravirt_get_lazy_mode() == PARAVIRT_LAZY_NONE) { >> - arch_enter_lazy_mmu_mode(); >> - lazy = true; >> + if (kmap_ops) { >> + ret = HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, >> + kmap_ops, count); >> + if (ret) >> + goto out; >> } > > I think that you should explain why you are adding one more grant table > mapping to a function meant to work on the p2m/m2p. Everything else is > clear. I'm not. This function has always done this. David