aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/mmu.c
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>2011-11-28 07:41:00 -0500
committerAvi Kivity <avi@redhat.com>2011-12-27 04:22:05 -0500
commit0375f7fad904b59502341ccecfc8faea70b34c91 (patch)
tree23de875b6c9d4cb267738860dc27db1289bee1fa /arch/x86/kvm/mmu.c
parenta65cf5181aa608addcb2873c8ed90413a9f539cb (diff)
KVM: MMU: audit: replace mmu audit tracepoint with jump-label
The tracepoint is only used to audit mmu code, it should not be exposed to user, let us replace it with jump-label. Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/mmu.c')
-rw-r--r--arch/x86/kvm/mmu.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index d737443cdfdb..62f69dbf6b52 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -68,6 +68,12 @@ char *audit_point_name[] = {
68 "post sync" 68 "post sync"
69}; 69};
70 70
71#ifdef CONFIG_KVM_MMU_AUDIT
72static void kvm_mmu_audit(struct kvm_vcpu *vcpu, int point);
73#else
74static void kvm_mmu_audit(struct kvm_vcpu *vcpu, int point) { }
75#endif
76
71#undef MMU_DEBUG 77#undef MMU_DEBUG
72 78
73#ifdef MMU_DEBUG 79#ifdef MMU_DEBUG
@@ -2852,12 +2858,12 @@ static void mmu_sync_roots(struct kvm_vcpu *vcpu)
2852 return; 2858 return;
2853 2859
2854 vcpu_clear_mmio_info(vcpu, ~0ul); 2860 vcpu_clear_mmio_info(vcpu, ~0ul);
2855 trace_kvm_mmu_audit(vcpu, AUDIT_PRE_SYNC); 2861 kvm_mmu_audit(vcpu, AUDIT_PRE_SYNC);
2856 if (vcpu->arch.mmu.root_level == PT64_ROOT_LEVEL) { 2862 if (vcpu->arch.mmu.root_level == PT64_ROOT_LEVEL) {
2857 hpa_t root = vcpu->arch.mmu.root_hpa; 2863 hpa_t root = vcpu->arch.mmu.root_hpa;
2858 sp = page_header(root); 2864 sp = page_header(root);
2859 mmu_sync_children(vcpu, sp); 2865 mmu_sync_children(vcpu, sp);
2860 trace_kvm_mmu_audit(vcpu, AUDIT_POST_SYNC); 2866 kvm_mmu_audit(vcpu, AUDIT_POST_SYNC);
2861 return; 2867 return;
2862 } 2868 }
2863 for (i = 0; i < 4; ++i) { 2869 for (i = 0; i < 4; ++i) {
@@ -2869,7 +2875,7 @@ static void mmu_sync_roots(struct kvm_vcpu *vcpu)
2869 mmu_sync_children(vcpu, sp); 2875 mmu_sync_children(vcpu, sp);
2870 } 2876 }
2871 } 2877 }
2872 trace_kvm_mmu_audit(vcpu, AUDIT_POST_SYNC); 2878 kvm_mmu_audit(vcpu, AUDIT_POST_SYNC);
2873} 2879}
2874 2880
2875void kvm_mmu_sync_roots(struct kvm_vcpu *vcpu) 2881void kvm_mmu_sync_roots(struct kvm_vcpu *vcpu)
@@ -3667,7 +3673,7 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
3667 3673
3668 spin_lock(&vcpu->kvm->mmu_lock); 3674 spin_lock(&vcpu->kvm->mmu_lock);
3669 ++vcpu->kvm->stat.mmu_pte_write; 3675 ++vcpu->kvm->stat.mmu_pte_write;
3670 trace_kvm_mmu_audit(vcpu, AUDIT_PRE_PTE_WRITE); 3676 kvm_mmu_audit(vcpu, AUDIT_PRE_PTE_WRITE);
3671 3677
3672 mask.cr0_wp = mask.cr4_pae = mask.nxe = 1; 3678 mask.cr0_wp = mask.cr4_pae = mask.nxe = 1;
3673 for_each_gfn_indirect_valid_sp(vcpu->kvm, sp, gfn, node) { 3679 for_each_gfn_indirect_valid_sp(vcpu->kvm, sp, gfn, node) {
@@ -3700,7 +3706,7 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
3700 } 3706 }
3701 mmu_pte_write_flush_tlb(vcpu, zap_page, remote_flush, local_flush); 3707 mmu_pte_write_flush_tlb(vcpu, zap_page, remote_flush, local_flush);
3702 kvm_mmu_commit_zap_page(vcpu->kvm, &invalid_list); 3708 kvm_mmu_commit_zap_page(vcpu->kvm, &invalid_list);
3703 trace_kvm_mmu_audit(vcpu, AUDIT_POST_PTE_WRITE); 3709 kvm_mmu_audit(vcpu, AUDIT_POST_PTE_WRITE);
3704 spin_unlock(&vcpu->kvm->mmu_lock); 3710 spin_unlock(&vcpu->kvm->mmu_lock);
3705} 3711}
3706 3712