From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: large page support for kvm Date: Tue, 29 Jan 2008 19:20:12 +0200 Message-ID: <479F604C.20107@qumranet.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: kvm-devel Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org The npt patches started me thinking on large page support (2MB/4MB pages), and I think we can implement them even when npt/ept are not available. Here's a rough sketch of my proposal: - For every memory slot, allocate an array containing one int for every potential large page included within that memory slot. Each entry in the array contains the number of write-protected 4KB pages within the large page frame corresponding to that entry. For example, if we have a memory slot for gpas 1MB-1GB, we'd have an array of size 511, corresponding to the 511 2MB pages from 2MB upwards. If we shadow a pagetable at address 4MB+8KB, we'd increment the entry corresponding to the large page at 4MB. When we unshadow that page, decrement the entry. - If we attempt to shadow a large page (either a guest pse pte, or a real-mode pseudo pte), we check if the host page is a large page. If so, we also check the write-protect count array. If the result is zero, we create a shadow pse pte. - Whenever we write-protect a page, also zap any large-page mappings for that page. This means rmap will need some extension to handle pde rmaps in addition to pte rmaps. - qemu is extended to have a command-line option to use large pages to back guest memory. Large pages should improve performance significantly, both with traditional shadow and npt/ept. Hopefully we will have transparent Linux support for them one day. -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/