From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xiao Guangrong Subject: Re: [PATCH 08/13] KVM: MMU: fask check whether page is writable Date: Fri, 30 Mar 2012 13:10:55 +0800 Message-ID: <4F75405F.3050803@linux.vnet.ibm.com> References: <4F742951.7080003@linux.vnet.ibm.com> <4F742A74.1050304@linux.vnet.ibm.com> <4F74847A.1030809@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , LKML , KVM To: Avi Kivity Return-path: Received: from e23smtp04.au.ibm.com ([202.81.31.146]:35833 "EHLO e23smtp04.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751559Ab2C3FLB (ORCPT ); Fri, 30 Mar 2012 01:11:01 -0400 Received: from /spool/local by e23smtp04.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 30 Mar 2012 04:53:31 +1000 In-Reply-To: <4F74847A.1030809@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 03/29/2012 11:49 PM, Avi Kivity wrote: > On 03/29/2012 11:25 AM, Xiao Guangrong wrote: >> Using PTE_LIST_WRITE_PROTECT bit in rmap store the write-protect status to >> avoid unnecessary shadow page walking > > Does kvm_set_pte_rmapp() need adjustment? > Yes, in kvm_set_pte_rmapp(), if the page is host write-protected, it will set this bit: static void host_page_write_protect(u64 *spte, unsigned long *rmapp) { if (!(*spte & SPTE_HOST_WRITEABLE) && !(*rmapp & PTE_LIST_WRITE_PROTECT)) *rmapp |= PTE_LIST_WRITE_PROTECT; } It is very useful for fast page fault path to avoid useless shadow page table waling if KSM is enabled. >> Also if no shadow page is indirect, the page is write-free >> >> >> + if (!vcpu->kvm->arch.indirect_shadow_pages) >> + return 0; >> + > Best in its own little patch. > Okay, will split it into a little patch.