linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Marc Zyngier <maz@kernel.org>
Cc: kbuild-all@lists.01.org,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: [linux-next:master 13419/13550] tools/testing/selftests/kvm/x86_64/mmu_role_test.c:74: undefined reference to `vm_handle_exception'
Date: Sat, 26 Jun 2021 12:25:55 +0800	[thread overview]
Message-ID: <202106261243.agXRheql-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 8372 bytes --]

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@intel.com>

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@google.com>
:::::: CC: Paolo Bonzini <pbonzini@redhat.com>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 42049 bytes --]

                 reply	other threads:[~2021-06-26  4:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202106261243.agXRheql-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-mm@kvack.org \
    --cc=maz@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).