From: Tim Deegan Subject: Re: [PATCH RFC 1/4] x86/mm: Shadow and p2m changes for PV mem_access Date: Thu, 8 May 2014 14:44:55 +0200 Message-ID: <20140508124455.GB13193@deinos.phlegethon.org> References: <1398746705-6658-1-git-send-email-aravindp@cisco.com> <1398746705-6658-2-git-send-email-aravindp@cisco.com> <535F83FE020000780000D397@nat28.tlf.novell.com> <97A500D504438F4ABC02EBA81613CC63317E7AC4@xmb-aln-x02.cisco.com> <5360B51D020000780000D9A2@g0-1-119.ukb-fw-asa.gns.novell.com> <97A500D504438F4ABC02EBA81613CC63317E9527@xmb-aln-x02.cisco.com> <20140501141835.GD77240@deinos.phlegethon.org> <97A500D504438F4ABC02EBA81613CC63317E9ACB@xmb-aln-x02.cisco.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 1WiNhG-0000B3-Ed for xen-devel@lists.xenproject.org; Thu, 08 May 2014 12:45:10 +0000 Content-Disposition: inline In-Reply-To: <97A500D504438F4ABC02EBA81613CC63317E9ACB@xmb-aln-x02.cisco.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: "Aravindh Puthiyaparambil (aravindp)" Cc: Keir Fraser , Ian Campbell , "Andres Lagar-Cavilla (andreslc@gridcentric.ca)" , Ian Jackson , Jan Beulich , "xen-devel@lists.xenproject.org" List-Id: xen-devel@lists.xenproject.org At 19:14 +0000 on 01 May (1398968076), Aravindh Puthiyaparambil (aravindp) wrote: > >> (XEN) sh error: sh_remove_all_mappings(): can't find all mappings of > >> mfn 33960: c=8000000000000002 t=7400000000000000 > >> (XEN) sh error: sh_remove_all_mappings(): can't find all mappings of > >> mfn 134b8: c=8000000000000038 t=7400000000000001 > > > >This is because you are not in shadow_mode_refcounts() (i.e. the page's > >refcount and typecount are based on the _guest_ pagetables rather than the > >_shadow_ ones). That means that sh_remove_all_mappings() can't use the > >refcounts to figure out when it's removed the last shadow mapping. > > I take it that I won't be able to run with shadow_mode_refcounts() for PV domains. Nope, that's not an option. :( The PV MM code uses typecounts in various places that aren't visible from just the pagetables, so we can't let the shadow pagetable code control them. > >That also means that sh_remove_all_mappings() will have had to search every > >sl1e in the system, which is expensive. If there will be a lot of these updates, > >you might consider batching them and using > >shadow_blow_tables() after each batch instead. > > Does this mean batching them in the hypervisor or in the mem_access > listener? Either, I suppose. > Typically one would want the effect of the new permissions > to kick in immediately. So I am afraid batching them will delay > this. Anyhow, at a minimum I will add a comment here as to why I am > adding the check here. Once the feature has gone in I will revisit > to see if I can add some performance improvements in this area. Righto. Tim.