From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 4/4] KVM: MMU: lower the aduit frequency Date: Sun, 29 Aug 2010 12:19:59 +0300 Message-ID: <4C7A263F.1060407@redhat.com> References: <4C78FA00.8090606@cn.fujitsu.com> <4C78FAF4.4070302@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , LKML , KVM To: Xiao Guangrong Return-path: In-Reply-To: <4C78FAF4.4070302@cn.fujitsu.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 08/28/2010 03:03 PM, Xiao Guangrong wrote: > The audit is very high overhead, so we need lower the frequency to assure the guest running > > > */ > > #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); This means we see a bug long after it happened, so we can't correlate it to the cause. It's fine as an option (even the default) but I'd like to be able to audit after every operation. Perhaps a partial audit that only looks at the gfns and vaddrs that were affected in the last operation? I have to admit, it's been a very long time since I last used audit. -- error compiling committee.c: too many arguments to function