From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Olszewski Subject: Shadow page table questions Date: Tue, 09 Mar 2010 23:57:11 -0500 Message-ID: <4B9726A7.7000800@csail.mit.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit To: kvm@vger.kernel.org Return-path: Received: from DMZ-MAILSEC-SCANNER-5.MIT.EDU ([18.7.68.34]:48432 "EHLO dmz-mailsec-scanner-5.mit.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750835Ab0CJFCO (ORCPT ); Wed, 10 Mar 2010 00:02:14 -0500 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id o2A4vC8O020369 for ; Tue, 9 Mar 2010 23:57:12 -0500 Received: from deadlock.csail.mit.edu (deadlock.csail.mit.edu [128.30.64.23]) (authenticated bits=0) (User authenticated as mareko@CSAIL.MIT.EDU@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id o2A4vBqN009714 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Tue, 9 Mar 2010 23:57:12 -0500 (EST) Sender: kvm-owner@vger.kernel.org List-ID: Hello, I was wondering if someone could point me to some documentation that explains the basic non-nested-paging shadow page table algorithm/strategy used by KVM. I understand that KVM caches shadow page tables across context switches and that there is a reverse mapping and page protection to help zap shadow page tables when the guest page tables change. However, I'm not entirely sure how the actual caching is done. At first I assumed that KVM would change the host CR3 on every guest context switch such that it would point to a cached shadow page table for the currently running guest user thread, however, as far as I can tell, the host CR3 does not change so I'm a little lost. If indeed it doesn't change the CR3, how does KVM solve the problem that arises when two processes in the guest OS share the same guest logical addresses? I'm also interested in figuring out what KVM does when running with multiple virtual CPUs. Looking at the code, I can see that each VCPU has its own root pointer to a shadow page table graph, but I have yet to figure out if this graph has node's shared between VCPUs, or whether they are all private. Any help would be greatly appreciated. Thanks! Marek