From patchwork Sat Aug 28 12:03:00 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Guangrong X-Patchwork-Id: 139451 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o7SBxXaP014870 for ; Sat, 28 Aug 2010 11:59:33 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753179Ab0H1L7M (ORCPT ); Sat, 28 Aug 2010 07:59:12 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:49241 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1753118Ab0H1L7L (ORCPT ); Sat, 28 Aug 2010 07:59:11 -0400 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id E00C8170124; Sat, 28 Aug 2010 19:59:35 +0800 (CST) Received: from fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id o7SBtLLB023546; Sat, 28 Aug 2010 19:55:21 +0800 Received: from [10.167.141.99] (unknown [10.167.141.99]) by fnst.cn.fujitsu.com (Postfix) with ESMTPA id 8801E10C21C; Sat, 28 Aug 2010 19:59:57 +0800 (CST) Message-ID: <4C78FAF4.4070302@cn.fujitsu.com> Date: Sat, 28 Aug 2010 20:03:00 +0800 From: Xiao Guangrong User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6 MIME-Version: 1.0 To: Avi Kivity CC: Marcelo Tosatti , LKML , KVM Subject: [PATCH 4/4] KVM: MMU: lower the aduit frequency References: <4C78FA00.8090606@cn.fujitsu.com> In-Reply-To: <4C78FA00.8090606@cn.fujitsu.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Sat, 28 Aug 2010 11:59:34 +0000 (UTC) diff --git a/arch/x86/kvm/mmu_debug.c b/arch/x86/kvm/mmu_debug.c index c4ebe6a..bc61b3d 100644 --- a/arch/x86/kvm/mmu_debug.c +++ b/arch/x86/kvm/mmu_debug.c @@ -18,6 +18,7 @@ */ #include +#include static struct dentry *debugfs_file; static bool mmu_debug; @@ -233,6 +234,11 @@ static void audit_vcpu_spte(struct kvm_vcpu *vcpu) static void kvm_mmu_audit(void *ignore, struct kvm_vcpu *vcpu, const char *msg) { + static DEFINE_RATELIMIT_STATE(ratelimit_state, 5 * HZ, 10); + + if (!__ratelimit(&ratelimit_state)) + return; + audit_msg = msg; audit_all_active_sps(vcpu->kvm); audit_vcpu_spte(vcpu);