On 08/29/2010 05:19 PM, Avi Kivity wrote:On 08/28/2010 03:03 PM, Xiao Guangrong wrote:Audit checks all the active shadow pages and all vcpu's page table, so theThe audit is very high overhead, so we need lower the frequency toThis means we see a bug long after it happened, so we can't correlate it
assure the guest running
*/
#include<linux/debugfs.h>
+#include<linux/ratelimit.h>
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);
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?
overload is very high :-)
During my test, if enable the aduit, the guest mostly hung, it means the guest
not do anything.
(Host: Intel(R) Xeon(R) X3430 @ 2.40GHz * 4 + 4G memory
GUest: x2VCPU + 1G memory
)
I'll set the 'ratelimit' as a module parameter, then if the user's machine is
fast enough, the ratelimit can be disabled.