Commit 805a0f83 authored by Stephen Zhang's avatar Stephen Zhang Committed by Paolo Bonzini

KVM: x86/mmu: Add '__func__' in rmap_printk()

Given the common pattern:

rmap_printk("%s:"..., __func__,...)

we could improve this by adding '__func__' in rmap_printk().
Signed-off-by: default avatarStephen Zhang <stephenzhangzsd@gmail.com>
Message-Id: <1611713325-3591-1-git-send-email-stephenzhangzsd@gmail.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 04548ed0
...@@ -844,17 +844,17 @@ static int pte_list_add(struct kvm_vcpu *vcpu, u64 *spte, ...@@ -844,17 +844,17 @@ static int pte_list_add(struct kvm_vcpu *vcpu, u64 *spte,
int i, count = 0; int i, count = 0;
if (!rmap_head->val) { if (!rmap_head->val) {
rmap_printk("pte_list_add: %p %llx 0->1\n", spte, *spte); rmap_printk("%p %llx 0->1\n", spte, *spte);
rmap_head->val = (unsigned long)spte; rmap_head->val = (unsigned long)spte;
} else if (!(rmap_head->val & 1)) { } else if (!(rmap_head->val & 1)) {
rmap_printk("pte_list_add: %p %llx 1->many\n", spte, *spte); rmap_printk("%p %llx 1->many\n", spte, *spte);
desc = mmu_alloc_pte_list_desc(vcpu); desc = mmu_alloc_pte_list_desc(vcpu);
desc->sptes[0] = (u64 *)rmap_head->val; desc->sptes[0] = (u64 *)rmap_head->val;
desc->sptes[1] = spte; desc->sptes[1] = spte;
rmap_head->val = (unsigned long)desc | 1; rmap_head->val = (unsigned long)desc | 1;
++count; ++count;
} else { } else {
rmap_printk("pte_list_add: %p %llx many->many\n", spte, *spte); rmap_printk("%p %llx many->many\n", spte, *spte);
desc = (struct pte_list_desc *)(rmap_head->val & ~1ul); desc = (struct pte_list_desc *)(rmap_head->val & ~1ul);
while (desc->sptes[PTE_LIST_EXT-1]) { while (desc->sptes[PTE_LIST_EXT-1]) {
count += PTE_LIST_EXT; count += PTE_LIST_EXT;
...@@ -906,14 +906,14 @@ static void __pte_list_remove(u64 *spte, struct kvm_rmap_head *rmap_head) ...@@ -906,14 +906,14 @@ static void __pte_list_remove(u64 *spte, struct kvm_rmap_head *rmap_head)
pr_err("%s: %p 0->BUG\n", __func__, spte); pr_err("%s: %p 0->BUG\n", __func__, spte);
BUG(); BUG();
} else if (!(rmap_head->val & 1)) { } else if (!(rmap_head->val & 1)) {
rmap_printk("%s: %p 1->0\n", __func__, spte); rmap_printk("%p 1->0\n", spte);
if ((u64 *)rmap_head->val != spte) { if ((u64 *)rmap_head->val != spte) {
pr_err("%s: %p 1->BUG\n", __func__, spte); pr_err("%s: %p 1->BUG\n", __func__, spte);
BUG(); BUG();
} }
rmap_head->val = 0; rmap_head->val = 0;
} else { } else {
rmap_printk("%s: %p many->many\n", __func__, spte); rmap_printk("%p many->many\n", spte);
desc = (struct pte_list_desc *)(rmap_head->val & ~1ul); desc = (struct pte_list_desc *)(rmap_head->val & ~1ul);
prev_desc = NULL; prev_desc = NULL;
while (desc) { while (desc) {
...@@ -1115,7 +1115,7 @@ static bool spte_write_protect(u64 *sptep, bool pt_protect) ...@@ -1115,7 +1115,7 @@ static bool spte_write_protect(u64 *sptep, bool pt_protect)
!(pt_protect && spte_can_locklessly_be_made_writable(spte))) !(pt_protect && spte_can_locklessly_be_made_writable(spte)))
return false; return false;
rmap_printk("rmap_write_protect: spte %p %llx\n", sptep, *sptep); rmap_printk("spte %p %llx\n", sptep, *sptep);
if (pt_protect) if (pt_protect)
spte &= ~SPTE_MMU_WRITEABLE; spte &= ~SPTE_MMU_WRITEABLE;
...@@ -1142,7 +1142,7 @@ static bool spte_clear_dirty(u64 *sptep) ...@@ -1142,7 +1142,7 @@ static bool spte_clear_dirty(u64 *sptep)
{ {
u64 spte = *sptep; u64 spte = *sptep;
rmap_printk("rmap_clear_dirty: spte %p %llx\n", sptep, *sptep); rmap_printk("spte %p %llx\n", sptep, *sptep);
MMU_WARN_ON(!spte_ad_enabled(spte)); MMU_WARN_ON(!spte_ad_enabled(spte));
spte &= ~shadow_dirty_mask; spte &= ~shadow_dirty_mask;
...@@ -1184,7 +1184,7 @@ static bool spte_set_dirty(u64 *sptep) ...@@ -1184,7 +1184,7 @@ static bool spte_set_dirty(u64 *sptep)
{ {
u64 spte = *sptep; u64 spte = *sptep;
rmap_printk("rmap_set_dirty: spte %p %llx\n", sptep, *sptep); rmap_printk("spte %p %llx\n", sptep, *sptep);
/* /*
* Similar to the !kvm_x86_ops.slot_disable_log_dirty case, * Similar to the !kvm_x86_ops.slot_disable_log_dirty case,
...@@ -1332,7 +1332,7 @@ static bool kvm_zap_rmapp(struct kvm *kvm, struct kvm_rmap_head *rmap_head) ...@@ -1332,7 +1332,7 @@ static bool kvm_zap_rmapp(struct kvm *kvm, struct kvm_rmap_head *rmap_head)
bool flush = false; bool flush = false;
while ((sptep = rmap_get_first(rmap_head, &iter))) { while ((sptep = rmap_get_first(rmap_head, &iter))) {
rmap_printk("%s: spte %p %llx.\n", __func__, sptep, *sptep); rmap_printk("spte %p %llx.\n", sptep, *sptep);
pte_list_remove(rmap_head, sptep); pte_list_remove(rmap_head, sptep);
flush = true; flush = true;
...@@ -1364,7 +1364,7 @@ static int kvm_set_pte_rmapp(struct kvm *kvm, struct kvm_rmap_head *rmap_head, ...@@ -1364,7 +1364,7 @@ static int kvm_set_pte_rmapp(struct kvm *kvm, struct kvm_rmap_head *rmap_head,
restart: restart:
for_each_rmap_spte(rmap_head, &iter, sptep) { for_each_rmap_spte(rmap_head, &iter, sptep) {
rmap_printk("kvm_set_pte_rmapp: spte %p %llx gfn %llx (%d)\n", rmap_printk("spte %p %llx gfn %llx (%d)\n",
sptep, *sptep, gfn, level); sptep, *sptep, gfn, level);
need_flush = 1; need_flush = 1;
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
extern bool dbg; extern bool dbg;
#define pgprintk(x...) do { if (dbg) printk(x); } while (0) #define pgprintk(x...) do { if (dbg) printk(x); } while (0)
#define rmap_printk(x...) do { if (dbg) printk(x); } while (0) #define rmap_printk(fmt, args...) do { if (dbg) printk("%s: " fmt, __func__, ## args); } while (0)
#define MMU_WARN_ON(x) WARN_ON(x) #define MMU_WARN_ON(x) WARN_ON(x)
#else #else
#define pgprintk(x...) do { } while (0) #define pgprintk(x...) do { } while (0)
......
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