[linux-next:master 13419/13550] tools/testing/selftests/kvm/x86_64/mmu_role_test.c:74: undefined reference to `vm_handle_exception'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Stephen,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   8702f95941c215501826ea8743a8b64b83479209
commit: 1c361420b90f5935ad2de627454b53bfa3ea71bf [13419/13550] Merge remote-tracking branch 'kvm-arm/next'
config: x86_64-rhel-8.3-kselftests (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=1c361420b90f5935ad2de627454b53bfa3ea71bf
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout 1c361420b90f5935ad2de627454b53bfa3ea71bf
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All error/warnings (new ones prefixed by >>):

   x86_64/mmu_role_test.c: In function 'mmu_role_test':
>> x86_64/mmu_role_test.c:74:2: warning: implicit declaration of function 'vm_handle_exception' [-Wimplicit-function-declaration]
      74 |  vm_handle_exception(vm, PF_VECTOR, guest_pf_handler);
         |  ^~~~~~~~~~~~~~~~~~~
   /usr/bin/ld: /tmp/ccIC0OPt.o: in function `mmu_role_test':
>> tools/testing/selftests/kvm/x86_64/mmu_role_test.c:74: undefined reference to `vm_handle_exception'
   collect2: error: ld returned 1 exit status
--
   x86_64/mmu_role_test.c: In function 'mmu_role_test':
>> x86_64/mmu_role_test.c:74:2: warning: implicit declaration of function 'vm_handle_exception' [-Wimplicit-function-declaration]
      74 |  vm_handle_exception(vm, PF_VECTOR, guest_pf_handler);
         |  ^~~~~~~~~~~~~~~~~~~
   /usr/bin/ld: /tmp/ccEPV15q.o: in function `mmu_role_test':
>> tools/testing/selftests/kvm/x86_64/mmu_role_test.c:74: undefined reference to `vm_handle_exception'
   collect2: error: ld returned 1 exit status


vim +74 tools/testing/selftests/kvm/x86_64/mmu_role_test.c

ef6a74b2e55e97 Sean Christopherson 2021-06-22  24  
ef6a74b2e55e97 Sean Christopherson 2021-06-22  25  static void mmu_role_test(u32 *cpuid_reg, u32 evil_cpuid_val)
ef6a74b2e55e97 Sean Christopherson 2021-06-22  26  {
ef6a74b2e55e97 Sean Christopherson 2021-06-22  27  	u32 good_cpuid_val = *cpuid_reg;
ef6a74b2e55e97 Sean Christopherson 2021-06-22  28  	struct kvm_run *run;
ef6a74b2e55e97 Sean Christopherson 2021-06-22  29  	struct kvm_vm *vm;
ef6a74b2e55e97 Sean Christopherson 2021-06-22  30  	uint64_t cmd;
ef6a74b2e55e97 Sean Christopherson 2021-06-22  31  	int r;
ef6a74b2e55e97 Sean Christopherson 2021-06-22  32  
ef6a74b2e55e97 Sean Christopherson 2021-06-22  33  	/* Create VM */
ef6a74b2e55e97 Sean Christopherson 2021-06-22  34  	vm = vm_create_default(VCPU_ID, 0, guest_code);
ef6a74b2e55e97 Sean Christopherson 2021-06-22  35  	run = vcpu_state(vm, VCPU_ID);
ef6a74b2e55e97 Sean Christopherson 2021-06-22  36  
ef6a74b2e55e97 Sean Christopherson 2021-06-22  37  	/* Map 1gb page without a backing memlot. */
ef6a74b2e55e97 Sean Christopherson 2021-06-22  38  	__virt_pg_map(vm, MMIO_GPA, MMIO_GPA, X86_PAGE_SIZE_1G);
ef6a74b2e55e97 Sean Christopherson 2021-06-22  39  
ef6a74b2e55e97 Sean Christopherson 2021-06-22  40  	r = _vcpu_run(vm, VCPU_ID);
ef6a74b2e55e97 Sean Christopherson 2021-06-22  41  
ef6a74b2e55e97 Sean Christopherson 2021-06-22  42  	/* Guest access to the 1gb page should trigger MMIO. */
ef6a74b2e55e97 Sean Christopherson 2021-06-22  43  	TEST_ASSERT(r == 0, "vcpu_run failed: %d\n", r);
ef6a74b2e55e97 Sean Christopherson 2021-06-22  44  	TEST_ASSERT(run->exit_reason == KVM_EXIT_MMIO,
ef6a74b2e55e97 Sean Christopherson 2021-06-22  45  		    "Unexpected exit reason: %u (%s), expected MMIO exit (1gb page w/o memslot)\n",
ef6a74b2e55e97 Sean Christopherson 2021-06-22  46  		    run->exit_reason, exit_reason_str(run->exit_reason));
ef6a74b2e55e97 Sean Christopherson 2021-06-22  47  
ef6a74b2e55e97 Sean Christopherson 2021-06-22  48  	TEST_ASSERT(run->mmio.len == 8, "Unexpected exit mmio size = %u", run->mmio.len);
ef6a74b2e55e97 Sean Christopherson 2021-06-22  49  
ef6a74b2e55e97 Sean Christopherson 2021-06-22  50  	TEST_ASSERT(run->mmio.phys_addr == MMIO_GPA,
ef6a74b2e55e97 Sean Christopherson 2021-06-22  51  		    "Unexpected exit mmio address = 0x%llx", run->mmio.phys_addr);
ef6a74b2e55e97 Sean Christopherson 2021-06-22  52  
ef6a74b2e55e97 Sean Christopherson 2021-06-22  53  	/*
ef6a74b2e55e97 Sean Christopherson 2021-06-22  54  	 * Effect the CPUID change for the guest and re-enter the guest.  Its
ef6a74b2e55e97 Sean Christopherson 2021-06-22  55  	 * access should now #PF due to the PAGE_SIZE bit being reserved or
ef6a74b2e55e97 Sean Christopherson 2021-06-22  56  	 * the resulting GPA being invalid.  Note, kvm_get_supported_cpuid()
ef6a74b2e55e97 Sean Christopherson 2021-06-22  57  	 * returns the struct that contains the entry being modified.  Eww.
ef6a74b2e55e97 Sean Christopherson 2021-06-22  58  	 */
ef6a74b2e55e97 Sean Christopherson 2021-06-22  59  	*cpuid_reg = evil_cpuid_val;
ef6a74b2e55e97 Sean Christopherson 2021-06-22  60  	vcpu_set_cpuid(vm, VCPU_ID, kvm_get_supported_cpuid());
ef6a74b2e55e97 Sean Christopherson 2021-06-22  61  
ef6a74b2e55e97 Sean Christopherson 2021-06-22  62  	/*
ef6a74b2e55e97 Sean Christopherson 2021-06-22  63  	 * Add a dummy memslot to coerce KVM into bumping the MMIO generation.
ef6a74b2e55e97 Sean Christopherson 2021-06-22  64  	 * KVM does not "officially" support mucking with CPUID after KVM_RUN,
ef6a74b2e55e97 Sean Christopherson 2021-06-22  65  	 * and will incorrectly reuse MMIO SPTEs.  Don't delete the memslot!
ef6a74b2e55e97 Sean Christopherson 2021-06-22  66  	 * KVM x86 zaps all shadow pages on memslot deletion.
ef6a74b2e55e97 Sean Christopherson 2021-06-22  67  	 */
ef6a74b2e55e97 Sean Christopherson 2021-06-22  68  	vm_userspace_mem_region_add(vm, VM_MEM_SRC_ANONYMOUS,
ef6a74b2e55e97 Sean Christopherson 2021-06-22  69  				    MMIO_GPA << 1, 10, 1, 0);
ef6a74b2e55e97 Sean Christopherson 2021-06-22  70  
ef6a74b2e55e97 Sean Christopherson 2021-06-22  71  	/* Set up a #PF handler to eat the RSVD #PF and signal all done! */
ef6a74b2e55e97 Sean Christopherson 2021-06-22  72  	vm_init_descriptor_tables(vm);
ef6a74b2e55e97 Sean Christopherson 2021-06-22  73  	vcpu_init_descriptor_tables(vm, VCPU_ID);
ef6a74b2e55e97 Sean Christopherson 2021-06-22 @74  	vm_handle_exception(vm, PF_VECTOR, guest_pf_handler);
ef6a74b2e55e97 Sean Christopherson 2021-06-22  75  
ef6a74b2e55e97 Sean Christopherson 2021-06-22  76  	r = _vcpu_run(vm, VCPU_ID);
ef6a74b2e55e97 Sean Christopherson 2021-06-22  77  	TEST_ASSERT(r == 0, "vcpu_run failed: %d\n", r);
ef6a74b2e55e97 Sean Christopherson 2021-06-22  78  
ef6a74b2e55e97 Sean Christopherson 2021-06-22  79  	cmd = get_ucall(vm, VCPU_ID, NULL);
ef6a74b2e55e97 Sean Christopherson 2021-06-22  80  	TEST_ASSERT(cmd == UCALL_DONE,
ef6a74b2e55e97 Sean Christopherson 2021-06-22  81  		    "Unexpected guest exit, exit_reason=%s, ucall.cmd = %lu\n",
ef6a74b2e55e97 Sean Christopherson 2021-06-22  82  		    exit_reason_str(run->exit_reason), cmd);
ef6a74b2e55e97 Sean Christopherson 2021-06-22  83  
ef6a74b2e55e97 Sean Christopherson 2021-06-22  84  	/*
ef6a74b2e55e97 Sean Christopherson 2021-06-22  85  	 * Restore the happy CPUID value for the next test.  Yes, changes are
ef6a74b2e55e97 Sean Christopherson 2021-06-22  86  	 * indeed persistent across VM destruction.
ef6a74b2e55e97 Sean Christopherson 2021-06-22  87  	 */
ef6a74b2e55e97 Sean Christopherson 2021-06-22  88  	*cpuid_reg = good_cpuid_val;
ef6a74b2e55e97 Sean Christopherson 2021-06-22  89  
ef6a74b2e55e97 Sean Christopherson 2021-06-22  90  	kvm_vm_free(vm);
ef6a74b2e55e97 Sean Christopherson 2021-06-22  91  }
ef6a74b2e55e97 Sean Christopherson 2021-06-22  92  

:::::: The code at line 74 was first introduced by commit
:::::: ef6a74b2e55e97daf4c7ba2d287878dc3f693b41 KVM: sefltests: Add x86-64 test to verify MMU reacts to CPUID updates

:::::: TO: Sean Christopherson <seanjc@xxxxxxxxxx>
:::::: CC: Paolo Bonzini <pbonzini@xxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux