From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: Single memory slot Date: Fri, 16 Oct 2009 08:48:41 +0900 Message-ID: <4AD7B4D9.20907@redhat.com> References: <4AD6D037.3060301@redhat.com> <20091015194616.GA11656@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm-devel To: Marcelo Tosatti Return-path: Received: from mx1.redhat.com ([209.132.183.28]:27520 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935624AbZJOXtL (ORCPT ); Thu, 15 Oct 2009 19:49:11 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9FNmjJm017195 for ; Thu, 15 Oct 2009 19:48:45 -0400 In-Reply-To: <20091015194616.GA11656@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: On 10/16/2009 04:46 AM, Marcelo Tosatti wrote: > On Thu, Oct 15, 2009 at 04:33:11PM +0900, Avi Kivity wrote: > >> One way to improve the gfn_to_pfn() memslot search is to register just >> one slot. This can only work on 64-bit, since even the smallest guests >> need 4GB of physical address space. Apart from speeding up >> gfn_to_page(), it would also speed up mmio which must iterate over all >> slots, so a lookup cache cannot help. >> >> This would require quite a bunch of changes: >> - modify gfn_to_pfn() to fail gracefully if the page is in the slot but >> unmapped (hole handling) >> - modify qemu to reserve the guest physical address space >> - modify qemu memory allocation to use MAP_FIXED to allocate memory >> - some hack for the vga aliases (mmap an fd multiple times?) >> - some hack for the vmx-specific pages (e.g. APIC-access page) >> >> Not sure it's worthwhile, but something to keep in mind if a simple >> cache or sort by size is insufficient due to mmio. >> > Downside is you lose the ability to write protect a small slot only > (could mprotect(MAP_READ) the desired area but get_log+write_protect > must be atomic). > > Also if you enable dirty log for the large slot largepages are disabled. > I guess that shoots this idea down. We could perhaps only enable it if a vnc client is not connected and we don't track vga updates. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.