From: Tim Deegan Subject: [PATCH] Shadow dirty-VRAM: avoid multiple remove_all_mappings calls. Date: Fri, 23 Oct 2009 11:19:07 +0100 Message-ID: <20091023101907.GL20579@whitby.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="jho1yZJdad60DJr+" Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --jho1yZJdad60DJr+ Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline sh_remove_all_mappings() will walk roughly half of the shadow L1 tables for each MFN it's called with; calling it for every MFN in a guest's framebuffer can be _very_ expensive, especially with the shadow lock held across the whole operation. Avoid that by just blowing away all the shadows. Signed-off-by: Tim Deegan --jho1yZJdad60DJr+ Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: attachment; filename="dirty-vram-timing" diff -r 8ca4e32583b6 xen/arch/x86/mm/shadow/common.c --- a/xen/arch/x86/mm/shadow/common.c Fri Oct 23 10:15:17 2009 +0100 +++ b/xen/arch/x86/mm/shadow/common.c Fri Oct 23 11:13:35 2009 +0100 @@ -3637,12 +3637,9 @@ * no need to be careful. */ if ( !dirty_vram ) { - /* Just recount from start. */ - for ( i = begin_pfn; i < end_pfn; i++ ) { - mfn_t mfn = gfn_to_mfn(d, i, &t); - if (mfn_x(mfn) != INVALID_MFN) - flush_tlb |= sh_remove_all_mappings(d->vcpu[0], mfn); - } + /* Throw away all the shadows rather than walking through them + * up to nr times getting rid of mappings of each pfn */ + shadow_blow_tables(d); gdprintk(XENLOG_INFO, "tracking VRAM %lx - %lx\n", begin_pfn, end_pfn); --jho1yZJdad60DJr+ Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --jho1yZJdad60DJr+--