From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:1670 kvm_commit_memory_region() error: we previously assumed 'old' could be null (see line 1663)
Date: Tue, 5 Mar 2024 20:03:25 +0800 [thread overview]
Message-ID: <202403051900.zARrmffQ-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Tianrui Zhao <zhaotianrui@loongson.cn>
CC: Huacai Chen <chenhuacai@kernel.org>
CC: Bibo Mao <maobibo@loongson.cn>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 90d35da658da8cff0d4ecbb5113f5fac9d00eb72
commit: c1fc48aad14dbe7654f5986afb906332b528d54b LoongArch: KVM: Enable kvm config and add the makefile
date: 5 months ago
:::::: branch date: 2 days ago
:::::: commit date: 5 months ago
config: loongarch-randconfig-r081-20240225 (https://download.01.org/0day-ci/archive/20240305/202403051900.zARrmffQ-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 13.2.0
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202403051900.zARrmffQ-lkp@intel.com/
New smatch warnings:
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:1670 kvm_commit_memory_region() error: we previously assumed 'old' could be null (see line 1663)
arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:1672 kvm_commit_memory_region() error: we previously assumed 'new' could be null (see line 1664)
arch/loongarch/kvm/mmu.c:867 kvm_map_page() warn: if statement not indented
Old smatch warnings:
arch/loongarch/include/asm/atomic.h:109 arch_atomic_fetch_add_unless() warn: inconsistent indenting
vim +/old +1670 arch/loongarch/kvm/../../../virt/kvm/kvm_main.c
36947254e5f981 Sean Christopherson 2020-02-18 1657
07921665a65191 Sean Christopherson 2021-12-06 1658 static void kvm_commit_memory_region(struct kvm *kvm,
07921665a65191 Sean Christopherson 2021-12-06 1659 struct kvm_memory_slot *old,
07921665a65191 Sean Christopherson 2021-12-06 1660 const struct kvm_memory_slot *new,
cf47f50b5c2e24 Sean Christopherson 2020-02-18 1661 enum kvm_mr_change change)
cf47f50b5c2e24 Sean Christopherson 2020-02-18 1662 {
6c7b2202e4d115 Paolo Bonzini 2022-11-17 @1663 int old_flags = old ? old->flags : 0;
6c7b2202e4d115 Paolo Bonzini 2022-11-17 @1664 int new_flags = new ? new->flags : 0;
07921665a65191 Sean Christopherson 2021-12-06 1665 /*
07921665a65191 Sean Christopherson 2021-12-06 1666 * Update the total number of memslot pages before calling the arch
07921665a65191 Sean Christopherson 2021-12-06 1667 * hook so that architectures can consume the result directly.
07921665a65191 Sean Christopherson 2021-12-06 1668 */
07921665a65191 Sean Christopherson 2021-12-06 1669 if (change == KVM_MR_DELETE)
07921665a65191 Sean Christopherson 2021-12-06 @1670 kvm->nr_memslot_pages -= old->npages;
07921665a65191 Sean Christopherson 2021-12-06 1671 else if (change == KVM_MR_CREATE)
07921665a65191 Sean Christopherson 2021-12-06 @1672 kvm->nr_memslot_pages += new->npages;
cf47f50b5c2e24 Sean Christopherson 2020-02-18 1673
6c7b2202e4d115 Paolo Bonzini 2022-11-17 1674 if ((old_flags ^ new_flags) & KVM_MEM_LOG_DIRTY_PAGES) {
6c7b2202e4d115 Paolo Bonzini 2022-11-17 1675 int change = (new_flags & KVM_MEM_LOG_DIRTY_PAGES) ? 1 : -1;
6c7b2202e4d115 Paolo Bonzini 2022-11-17 1676 atomic_set(&kvm->nr_memslots_dirty_logging,
6c7b2202e4d115 Paolo Bonzini 2022-11-17 1677 atomic_read(&kvm->nr_memslots_dirty_logging) + change);
6c7b2202e4d115 Paolo Bonzini 2022-11-17 1678 }
6c7b2202e4d115 Paolo Bonzini 2022-11-17 1679
07921665a65191 Sean Christopherson 2021-12-06 1680 kvm_arch_commit_memory_region(kvm, old, new, change);
07921665a65191 Sean Christopherson 2021-12-06 1681
a54d806688fe1e Maciej S. Szmigiero 2021-12-06 1682 switch (change) {
a54d806688fe1e Maciej S. Szmigiero 2021-12-06 1683 case KVM_MR_CREATE:
a54d806688fe1e Maciej S. Szmigiero 2021-12-06 1684 /* Nothing more to do. */
a54d806688fe1e Maciej S. Szmigiero 2021-12-06 1685 break;
a54d806688fe1e Maciej S. Szmigiero 2021-12-06 1686 case KVM_MR_DELETE:
a54d806688fe1e Maciej S. Szmigiero 2021-12-06 1687 /* Free the old memslot and all its metadata. */
a54d806688fe1e Maciej S. Szmigiero 2021-12-06 1688 kvm_free_memslot(kvm, old);
a54d806688fe1e Maciej S. Szmigiero 2021-12-06 1689 break;
a54d806688fe1e Maciej S. Szmigiero 2021-12-06 1690 case KVM_MR_MOVE:
a54d806688fe1e Maciej S. Szmigiero 2021-12-06 1691 case KVM_MR_FLAGS_ONLY:
b10a038e84d188 Ben Gardon 2021-05-18 1692 /*
a54d806688fe1e Maciej S. Szmigiero 2021-12-06 1693 * Free the dirty bitmap as needed; the below check encompasses
a54d806688fe1e Maciej S. Szmigiero 2021-12-06 1694 * both the flags and whether a ring buffer is being used)
07921665a65191 Sean Christopherson 2021-12-06 1695 */
a54d806688fe1e Maciej S. Szmigiero 2021-12-06 1696 if (old->dirty_bitmap && !new->dirty_bitmap)
07921665a65191 Sean Christopherson 2021-12-06 1697 kvm_destroy_dirty_bitmap(old);
07921665a65191 Sean Christopherson 2021-12-06 1698
a54d806688fe1e Maciej S. Szmigiero 2021-12-06 1699 /*
a54d806688fe1e Maciej S. Szmigiero 2021-12-06 1700 * The final quirk. Free the detached, old slot, but only its
a54d806688fe1e Maciej S. Szmigiero 2021-12-06 1701 * memory, not any metadata. Metadata, including arch specific
a54d806688fe1e Maciej S. Szmigiero 2021-12-06 1702 * data, may be reused by @new.
a54d806688fe1e Maciej S. Szmigiero 2021-12-06 1703 */
a54d806688fe1e Maciej S. Szmigiero 2021-12-06 1704 kfree(old);
a54d806688fe1e Maciej S. Szmigiero 2021-12-06 1705 break;
a54d806688fe1e Maciej S. Szmigiero 2021-12-06 1706 default:
a54d806688fe1e Maciej S. Szmigiero 2021-12-06 1707 BUG();
a54d806688fe1e Maciej S. Szmigiero 2021-12-06 1708 }
a54d806688fe1e Maciej S. Szmigiero 2021-12-06 1709 }
cf47f50b5c2e24 Sean Christopherson 2020-02-18 1710
:::::: The code at line 1670 was first introduced by commit
:::::: 07921665a651918350bc6653d4ca8a516a867b4b KVM: Use prepare/commit hooks to handle generic memslot metadata updates
:::::: TO: Sean Christopherson <seanjc@google.com>
:::::: CC: Paolo Bonzini <pbonzini@redhat.com>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2024-03-05 12:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-05 12:03 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-03-03 15:20 arch/loongarch/kvm/../../../virt/kvm/kvm_main.c:1670 kvm_commit_memory_region() error: we previously assumed 'old' could be null (see line 1663) kernel test robot
2024-03-01 8:44 kernel test robot
2024-02-26 4:39 kernel test robot
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=202403051900.zARrmffQ-lkp@intel.com \
--to=lkp@intel.com \
--cc=error27@gmail.com \
--cc=oe-kbuild@lists.linux.dev \
/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 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.