From patchwork Wed Jun 19 09:09:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Guangrong X-Patchwork-Id: 2748171 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1CEA19F39E for ; Wed, 19 Jun 2013 09:13:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 078DF202F7 for ; Wed, 19 Jun 2013 09:13:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C7A45202FB for ; Wed, 19 Jun 2013 09:13:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934578Ab3FSJNG (ORCPT ); Wed, 19 Jun 2013 05:13:06 -0400 Received: from e28smtp02.in.ibm.com ([122.248.162.2]:39675 "EHLO e28smtp02.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934315Ab3FSJJo (ORCPT ); Wed, 19 Jun 2013 05:09:44 -0400 Received: from /spool/local by e28smtp02.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 19 Jun 2013 14:32:00 +0530 Received: from d28dlp03.in.ibm.com (9.184.220.128) by e28smtp02.in.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 19 Jun 2013 14:31:58 +0530 Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id B81841258052; Wed, 19 Jun 2013 14:38:37 +0530 (IST) Received: from d28av01.in.ibm.com (d28av01.in.ibm.com [9.184.220.63]) by d28relay03.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r5J99j3R28049562; Wed, 19 Jun 2013 14:39:45 +0530 Received: from d28av01.in.ibm.com (loopback [127.0.0.1]) by d28av01.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r5J99ccG028156; Wed, 19 Jun 2013 09:09:39 GMT Received: from localhost (ericxiao.cn.ibm.com [9.111.29.143]) by d28av01.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r5J99aeS028078; Wed, 19 Jun 2013 09:09:37 GMT From: Xiao Guangrong To: gleb@redhat.com Cc: avi.kivity@gmail.com, mtosatti@redhat.com, pbonzini@redhat.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Xiao Guangrong Subject: [PATCH 3/7] KVM: MMU: document write_flooding_count Date: Wed, 19 Jun 2013 17:09:21 +0800 Message-Id: <1371632965-20077-4-git-send-email-xiaoguangrong@linux.vnet.ibm.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1371632965-20077-1-git-send-email-xiaoguangrong@linux.vnet.ibm.com> References: <1371632965-20077-1-git-send-email-xiaoguangrong@linux.vnet.ibm.com> X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13061909-5816-0000-0000-00000884150F Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Document write_flooding_count to Documentation/virtual/kvm/mmu.txt Signed-off-by: Xiao Guangrong --- Documentation/virtual/kvm/mmu.txt | 8 ++++++++ arch/x86/include/asm/kvm_host.h | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/Documentation/virtual/kvm/mmu.txt b/Documentation/virtual/kvm/mmu.txt index ce6df51..5a6b2e2 100644 --- a/Documentation/virtual/kvm/mmu.txt +++ b/Documentation/virtual/kvm/mmu.txt @@ -214,6 +214,14 @@ Shadow pages contain the following information: It is only used on 32bit host which helps us to detect whether updating the 64bit spte is complete so that we can avoid reading the truncated value out of mmu-lock. + write_flooding_count: + In order to sync the page table between guest and host, the page sometimes + needs to be write-protected (see "Synchronized and unsynchronized pages" + below), any write to the page can cause write emulation. If the emulation + on the page is too frequent we'd better unmap the page to avoid the + future emulation. write_flooding_count aims at this optimization which is + increased when the page needs to be write emulated and cleared when the + page is actually used. Reverse map =========== diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 1dac2c1..5eb5382 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -234,6 +234,11 @@ struct kvm_mmu_page { int clear_spte_count; #endif + /* + * Increased when the page needs to be write emulated, cleared + * when the page is actually used as page table to avoid frequent + * emulation on the page. + */ int write_flooding_count; };