Fixes: 0ba436e56da7 ("KVM: X86: Introduce kvm_mmu_slot_lpages() helpers")
diff --git a/arch/x86/kvm/debugfs.c b/arch/x86/kvm/debugfs.c
index 62a61bfdd680..4fa519caaef7 100644
--- a/arch/x86/kvm/debugfs.c
+++ b/arch/x86/kvm/debugfs.c
@@ -7,6 +7,7 @@
#include <linux/kvm_host.h>
#include <linux/debugfs.h>
#include "lapic.h"
+#include "mmu.h"
#include "mmu/mmu_internal.h"
static int vcpu_get_timer_advance_ns(void *data, u64 *val)
On 4/8/2021 4:37 am, kernel test robot wrote:
tree: https://git.kernel.org/pub/scm/virt/kvm/kvm.git queue
head: 6cd974485e2574d94221268760d84c9c19d1c4ff
commit: 53c1304cfe8446c0bfbe2dcac1995bfa5907a1d2 [89/92] KVM: X86: Introduce mmu_rmaps_stat per-vm debugfs file
config: x86_64-randconfig-a011-20210803 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 4f71f59bf3d9914188a11d0c41bedbb339d36ff5)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/virt/kvm/kvm.git/commit/?id=53c1304cfe8446c0bfbe2dcac1995bfa5907a1d2
git remote add kvm https://git.kernel.org/pub/scm/virt/kvm/kvm.git
git fetch --no-tags kvm queue
git checkout 53c1304cfe8446c0bfbe2dcac1995bfa5907a1d2
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All errors (new ones prefixed by >>):
arch/x86/kvm/debugfs.c:115:18: error: implicit declaration of function 'kvm_mmu_slot_lpages' [-Werror,-Wimplicit-function-declaration]
lpage_size = kvm_mmu_slot_lpages(slot, k + 1);
^
1 error generated.
vim +/kvm_mmu_slot_lpages +115 arch/x86/kvm/debugfs.c
85
86 static int kvm_mmu_rmaps_stat_show(struct seq_file *m, void *v)
87 {
88 struct kvm_rmap_head *rmap;
89 struct kvm *kvm = m->private;
90 struct kvm_memory_slot *slot;
91 struct kvm_memslots *slots;
92 unsigned int lpage_size, index;
93 /* Still small enough to be on the stack */
94 unsigned int *log[KVM_NR_PAGE_SIZES], *cur;
95 int i, j, k, l, ret;
96
97 memset(log, 0, sizeof(log));
98
99 ret = -ENOMEM;
100 for (i = 0; i < KVM_NR_PAGE_SIZES; i++) {
101 log[i] = kzalloc(RMAP_LOG_SIZE * sizeof(unsigned int), GFP_KERNEL);
102 if (!log[i])
103 goto out;
104 }
105
106 mutex_lock(&kvm->slots_lock);
107 write_lock(&kvm->mmu_lock);
108
109 for (i = 0; i < KVM_ADDRESS_SPACE_NUM; i++) {
110 slots = __kvm_memslots(kvm, i);
111 for (j = 0; j < slots->used_slots; j++) {
112 slot = &slots->memslots[j];
113 for (k = 0; k < KVM_NR_PAGE_SIZES; k++) {
114 rmap = slot->arch.rmap[k];
> 115 lpage_size = kvm_mmu_slot_lpages(slot, k + 1);
116 cur = log[k];
117 for (l = 0; l < lpage_size; l++) {
118 index = ffs(pte_list_count(&rmap[l]));
119 if (WARN_ON_ONCE(index >= RMAP_LOG_SIZE))
120 index = RMAP_LOG_SIZE - 1;
121 cur[index]++;
122 }
123 }
124 }
125 }
126
127 write_unlock(&kvm->mmu_lock);
128 mutex_unlock(&kvm->slots_lock);
129
130 /* index=0 counts no rmap; index=1 counts 1 rmap */
131 seq_printf(m, "Rmap_Count:\t0\t1\t");
132 for (i = 2; i < RMAP_LOG_SIZE; i++) {
133 j = 1 << (i - 1);
134 k = (1 << i) - 1;
135 seq_printf(m, "%d-%d\t", j, k);
136 }
137 seq_printf(m, "\n");
138
139 for (i = 0; i < KVM_NR_PAGE_SIZES; i++) {
140 seq_printf(m, "Level=%s:\t", kvm_lpage_str[i]);
141 cur = log[i];
142 for (j = 0; j < RMAP_LOG_SIZE; j++)
143 seq_printf(m, "%d\t", cur[j]);
144 seq_printf(m, "\n");
145 }
146
147 ret = 0;
148 out:
149 for (i = 0; i < KVM_NR_PAGE_SIZES; i++)
150 if (log[i])
151 kfree(log[i]);
152
153 return ret;
154 }
155
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx