* arch/mips/kvm/../../../virt/kvm/kvm_main.c:541:25: sparse: sparse: context imbalance in 'kvm_mmu_notifier_change_pte' - different lock contexts for basic block
@ 2021-06-10 13:24 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-06-10 13:24 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 9838 bytes --]
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Sean Christopherson <seanjc@google.com>
CC: Paolo Bonzini <pbonzini@redhat.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: cd1245d75ce93b8fd206f4b34eb58bcfe156d5e9
commit: 8931a454aea03bab21b3b8fcdc94f674eebd1c5d KVM: Take mmu_lock when handling MMU notifier iff the hva hits a memslot
date: 8 weeks ago
:::::: branch date: 15 hours ago
:::::: commit date: 8 weeks ago
config: mips-randconfig-s031-20210610 (attached as .config)
compiler: mipsel-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-341-g8af24329-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8931a454aea03bab21b3b8fcdc94f674eebd1c5d
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 8931a454aea03bab21b3b8fcdc94f674eebd1c5d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=mips
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
command-line: note: in included file:
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQUIRE redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_SEQ_CST redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQ_REL redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_RELEASE redefined
builtin:0:0: sparse: this was the original definition
>> arch/mips/kvm/../../../virt/kvm/kvm_main.c:541:25: sparse: sparse: context imbalance in 'kvm_mmu_notifier_change_pte' - different lock contexts for basic block
>> arch/mips/kvm/../../../virt/kvm/kvm_main.c:541:25: sparse: sparse: context imbalance in 'kvm_mmu_notifier_invalidate_range_start' - different lock contexts for basic block
>> arch/mips/kvm/../../../virt/kvm/kvm_main.c:541:25: sparse: sparse: context imbalance in 'kvm_mmu_notifier_invalidate_range_end' - different lock contexts for basic block
>> arch/mips/kvm/../../../virt/kvm/kvm_main.c:541:25: sparse: sparse: context imbalance in 'kvm_mmu_notifier_clear_flush_young' - different lock contexts for basic block
>> arch/mips/kvm/../../../virt/kvm/kvm_main.c:541:25: sparse: sparse: context imbalance in 'kvm_mmu_notifier_clear_young' - different lock contexts for basic block
>> arch/mips/kvm/../../../virt/kvm/kvm_main.c:541:25: sparse: sparse: context imbalance in 'kvm_mmu_notifier_test_young' - different lock contexts for basic block
arch/mips/kvm/../../../virt/kvm/kvm_main.c:2110:9: sparse: sparse: context imbalance in 'hva_to_pfn_remapped' - unexpected unlock
vim +/kvm_mmu_notifier_change_pte +541 arch/mips/kvm/../../../virt/kvm/kvm_main.c
f922bd9bf33bd5 Sean Christopherson 2021-04-01 481
3039bcc744980a Sean Christopherson 2021-04-01 482 static __always_inline int __kvm_handle_hva_range(struct kvm *kvm,
3039bcc744980a Sean Christopherson 2021-04-01 483 const struct kvm_hva_range *range)
3039bcc744980a Sean Christopherson 2021-04-01 484 {
8931a454aea03b Sean Christopherson 2021-04-01 485 bool ret = false, locked = false;
f922bd9bf33bd5 Sean Christopherson 2021-04-01 486 struct kvm_gfn_range gfn_range;
3039bcc744980a Sean Christopherson 2021-04-01 487 struct kvm_memory_slot *slot;
3039bcc744980a Sean Christopherson 2021-04-01 488 struct kvm_memslots *slots;
3039bcc744980a Sean Christopherson 2021-04-01 489 int i, idx;
3039bcc744980a Sean Christopherson 2021-04-01 490
f922bd9bf33bd5 Sean Christopherson 2021-04-01 491 /* A null handler is allowed if and only if on_lock() is provided. */
f922bd9bf33bd5 Sean Christopherson 2021-04-01 492 if (WARN_ON_ONCE(IS_KVM_NULL_FN(range->on_lock) &&
f922bd9bf33bd5 Sean Christopherson 2021-04-01 493 IS_KVM_NULL_FN(range->handler)))
f922bd9bf33bd5 Sean Christopherson 2021-04-01 494 return 0;
f922bd9bf33bd5 Sean Christopherson 2021-04-01 495
3039bcc744980a Sean Christopherson 2021-04-01 496 idx = srcu_read_lock(&kvm->srcu);
3039bcc744980a Sean Christopherson 2021-04-01 497
8931a454aea03b Sean Christopherson 2021-04-01 498 /* The on_lock() path does not yet support lock elision. */
f922bd9bf33bd5 Sean Christopherson 2021-04-01 499 if (!IS_KVM_NULL_FN(range->on_lock)) {
8931a454aea03b Sean Christopherson 2021-04-01 500 locked = true;
8931a454aea03b Sean Christopherson 2021-04-01 501 KVM_MMU_LOCK(kvm);
8931a454aea03b Sean Christopherson 2021-04-01 502
f922bd9bf33bd5 Sean Christopherson 2021-04-01 503 range->on_lock(kvm, range->start, range->end);
f922bd9bf33bd5 Sean Christopherson 2021-04-01 504
f922bd9bf33bd5 Sean Christopherson 2021-04-01 505 if (IS_KVM_NULL_FN(range->handler))
f922bd9bf33bd5 Sean Christopherson 2021-04-01 506 goto out_unlock;
f922bd9bf33bd5 Sean Christopherson 2021-04-01 507 }
f922bd9bf33bd5 Sean Christopherson 2021-04-01 508
3039bcc744980a Sean Christopherson 2021-04-01 509 for (i = 0; i < KVM_ADDRESS_SPACE_NUM; i++) {
3039bcc744980a Sean Christopherson 2021-04-01 510 slots = __kvm_memslots(kvm, i);
3039bcc744980a Sean Christopherson 2021-04-01 511 kvm_for_each_memslot(slot, slots) {
3039bcc744980a Sean Christopherson 2021-04-01 512 unsigned long hva_start, hva_end;
3039bcc744980a Sean Christopherson 2021-04-01 513
3039bcc744980a Sean Christopherson 2021-04-01 514 hva_start = max(range->start, slot->userspace_addr);
3039bcc744980a Sean Christopherson 2021-04-01 515 hva_end = min(range->end, slot->userspace_addr +
3039bcc744980a Sean Christopherson 2021-04-01 516 (slot->npages << PAGE_SHIFT));
3039bcc744980a Sean Christopherson 2021-04-01 517 if (hva_start >= hva_end)
3039bcc744980a Sean Christopherson 2021-04-01 518 continue;
3039bcc744980a Sean Christopherson 2021-04-01 519
3039bcc744980a Sean Christopherson 2021-04-01 520 /*
3039bcc744980a Sean Christopherson 2021-04-01 521 * To optimize for the likely case where the address
3039bcc744980a Sean Christopherson 2021-04-01 522 * range is covered by zero or one memslots, don't
3039bcc744980a Sean Christopherson 2021-04-01 523 * bother making these conditional (to avoid writes on
3039bcc744980a Sean Christopherson 2021-04-01 524 * the second or later invocation of the handler).
3039bcc744980a Sean Christopherson 2021-04-01 525 */
3039bcc744980a Sean Christopherson 2021-04-01 526 gfn_range.pte = range->pte;
3039bcc744980a Sean Christopherson 2021-04-01 527 gfn_range.may_block = range->may_block;
3039bcc744980a Sean Christopherson 2021-04-01 528
3039bcc744980a Sean Christopherson 2021-04-01 529 /*
3039bcc744980a Sean Christopherson 2021-04-01 530 * {gfn(page) | page intersects with [hva_start, hva_end)} =
3039bcc744980a Sean Christopherson 2021-04-01 531 * {gfn_start, gfn_start+1, ..., gfn_end-1}.
3039bcc744980a Sean Christopherson 2021-04-01 532 */
3039bcc744980a Sean Christopherson 2021-04-01 533 gfn_range.start = hva_to_gfn_memslot(hva_start, slot);
3039bcc744980a Sean Christopherson 2021-04-01 534 gfn_range.end = hva_to_gfn_memslot(hva_end + PAGE_SIZE - 1, slot);
3039bcc744980a Sean Christopherson 2021-04-01 535 gfn_range.slot = slot;
3039bcc744980a Sean Christopherson 2021-04-01 536
8931a454aea03b Sean Christopherson 2021-04-01 537 if (!locked) {
8931a454aea03b Sean Christopherson 2021-04-01 538 locked = true;
8931a454aea03b Sean Christopherson 2021-04-01 539 KVM_MMU_LOCK(kvm);
8931a454aea03b Sean Christopherson 2021-04-01 540 }
3039bcc744980a Sean Christopherson 2021-04-01 @541 ret |= range->handler(kvm, &gfn_range);
3039bcc744980a Sean Christopherson 2021-04-01 542 }
3039bcc744980a Sean Christopherson 2021-04-01 543 }
3039bcc744980a Sean Christopherson 2021-04-01 544
3039bcc744980a Sean Christopherson 2021-04-01 545 if (range->flush_on_ret && (ret || kvm->tlbs_dirty))
3039bcc744980a Sean Christopherson 2021-04-01 546 kvm_flush_remote_tlbs(kvm);
3039bcc744980a Sean Christopherson 2021-04-01 547
f922bd9bf33bd5 Sean Christopherson 2021-04-01 548 out_unlock:
8931a454aea03b Sean Christopherson 2021-04-01 549 if (locked)
f922bd9bf33bd5 Sean Christopherson 2021-04-01 550 KVM_MMU_UNLOCK(kvm);
f922bd9bf33bd5 Sean Christopherson 2021-04-01 551
3039bcc744980a Sean Christopherson 2021-04-01 552 srcu_read_unlock(&kvm->srcu, idx);
3039bcc744980a Sean Christopherson 2021-04-01 553
3039bcc744980a Sean Christopherson 2021-04-01 554 /* The notifiers are averse to booleans. :-( */
3039bcc744980a Sean Christopherson 2021-04-01 555 return (int)ret;
3039bcc744980a Sean Christopherson 2021-04-01 556 }
3039bcc744980a Sean Christopherson 2021-04-01 557
:::::: The code at line 541 was first introduced by commit
:::::: 3039bcc744980afe87c612122e47a27306483bc2 KVM: Move x86's MMU notifier memslot walkers to generic code
:::::: 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(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 29915 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-06-10 13:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-10 13:24 arch/mips/kvm/../../../virt/kvm/kvm_main.c:541:25: sparse: sparse: context imbalance in 'kvm_mmu_notifier_change_pte' - different lock contexts for basic block kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.