Commit d6c69ee9 authored by Yaozu Dong's avatar Yaozu Dong Committed by Avi Kivity

KVM: MMU: Avoid heavy ASSERT at non debug mode.

Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
parent 4d56c8a7
...@@ -52,11 +52,15 @@ static void kvm_mmu_audit(struct kvm_vcpu *vcpu, const char *msg) {} ...@@ -52,11 +52,15 @@ static void kvm_mmu_audit(struct kvm_vcpu *vcpu, const char *msg) {}
static int dbg = 1; static int dbg = 1;
#endif #endif
#ifndef MMU_DEBUG
#define ASSERT(x) do { } while (0)
#else
#define ASSERT(x) \ #define ASSERT(x) \
if (!(x)) { \ if (!(x)) { \
printk(KERN_WARNING "assertion failed %s:%d: %s\n", \ printk(KERN_WARNING "assertion failed %s:%d: %s\n", \
__FILE__, __LINE__, #x); \ __FILE__, __LINE__, #x); \
} }
#endif
#define PT64_PT_BITS 9 #define PT64_PT_BITS 9
#define PT64_ENT_PER_PAGE (1 << PT64_PT_BITS) #define PT64_ENT_PER_PAGE (1 << PT64_PT_BITS)
...@@ -434,6 +438,7 @@ static void rmap_write_protect(struct kvm_vcpu *vcpu, u64 gfn) ...@@ -434,6 +438,7 @@ static void rmap_write_protect(struct kvm_vcpu *vcpu, u64 gfn)
} }
} }
#ifdef MMU_DEBUG
static int is_empty_shadow_page(hpa_t page_hpa) static int is_empty_shadow_page(hpa_t page_hpa)
{ {
u64 *pos; u64 *pos;
...@@ -448,6 +453,7 @@ static int is_empty_shadow_page(hpa_t page_hpa) ...@@ -448,6 +453,7 @@ static int is_empty_shadow_page(hpa_t page_hpa)
} }
return 1; return 1;
} }
#endif
static void kvm_mmu_free_page(struct kvm_vcpu *vcpu, hpa_t page_hpa) static void kvm_mmu_free_page(struct kvm_vcpu *vcpu, hpa_t page_hpa)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment