All of lore.kernel.org
 help / color / mirror / Atom feed
* [kvm:queue 24/39] virt/kvm/kvm_main.c:3060:29-35: WARNING: Consider using vma_pages helper on vma
@ 2020-11-15 22:52 kernel test robot
  2020-11-15 22:52 ` [PATCH] KVM: X86: fix vma_pages.cocci warnings kernel test robot
  2020-11-15 22:52 ` [PATCH] KVM: X86: fix zalloc-simple.cocci warnings kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: kernel test robot @ 2020-11-15 22:52 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
CC: kvm(a)vger.kernel.org
CC: Robert Hu <robert.hu@intel.com>
CC: Farrah Chen <farrah.chen@intel.com>
CC: Danmei Wei <danmei.wei@intel.com>
TO: Peter Xu <peterx@redhat.com>
CC: Paolo Bonzini <pbonzini@redhat.com>
CC: Lei Cao <lei.cao@stratus.com>

tree:   https://git.kernel.org/pub/scm/virt/kvm/kvm.git queue
head:   0a59d24b139a98ad0a2d778205fca6619014633f
commit: fb04a1eddb1a65b6588a021bdc132270d5ae48bb [24/39] KVM: X86: Implement ring-based dirty memory tracking
:::::: branch date: 8 hours ago
:::::: commit date: 8 hours ago
config: i386-randconfig-c001-20201115 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>


"coccinelle warnings: (new ones prefixed by >>)"
>> virt/kvm/kvm_main.c:3060:29-35: WARNING: Consider using vma_pages helper on vma
--
>> virt/kvm/dirty_ring.c:70:20-27: WARNING: vzalloc should be used for ring -> dirty_gfns, instead of vmalloc/memset

Please review and possibly fold the followup patch.

---
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: 36389 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] KVM: X86: fix vma_pages.cocci warnings
  2020-11-15 22:52 [kvm:queue 24/39] virt/kvm/kvm_main.c:3060:29-35: WARNING: Consider using vma_pages helper on vma kernel test robot
@ 2020-11-15 22:52 ` kernel test robot
  2020-11-15 22:52 ` [PATCH] KVM: X86: fix zalloc-simple.cocci warnings kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2020-11-15 22:52 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
CC: kvm(a)vger.kernel.org
CC: Robert Hu <robert.hu@intel.com>
CC: Farrah Chen <farrah.chen@intel.com>
CC: Danmei Wei <danmei.wei@intel.com>
TO: Peter Xu <peterx@redhat.com>
CC: Paolo Bonzini <pbonzini@redhat.com>
CC: Lei Cao <lei.cao@stratus.com>
CC: kvm(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org

From: kernel test robot <lkp@intel.com>

virt/kvm/kvm_main.c:3060:29-35: WARNING: Consider using vma_pages helper on vma


 Use vma_pages function on vma object instead of explicit computation.

Generated by: scripts/coccinelle/api/vma_pages.cocci

Fixes: fb04a1eddb1a ("KVM: X86: Implement ring-based dirty memory tracking")
CC: Peter Xu <peterx@redhat.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
---

tree:   https://git.kernel.org/pub/scm/virt/kvm/kvm.git queue
head:   0a59d24b139a98ad0a2d778205fca6619014633f
commit: fb04a1eddb1a65b6588a021bdc132270d5ae48bb [24/39] KVM: X86: Implement ring-based dirty memory tracking
:::::: branch date: 8 hours ago
:::::: commit date: 8 hours ago

Please take the patch only if it's a positive warning. Thanks!

 kvm_main.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -3057,7 +3057,7 @@ static const struct vm_operations_struct
 static int kvm_vcpu_mmap(struct file *file, struct vm_area_struct *vma)
 {
 	struct kvm_vcpu *vcpu = file->private_data;
-	unsigned long pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
+	unsigned long pages = vma_pages(vma);
 
 	if ((kvm_page_in_dirty_ring(vcpu->kvm, vma->vm_pgoff) ||
 	     kvm_page_in_dirty_ring(vcpu->kvm, vma->vm_pgoff + pages - 1)) &&

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] KVM: X86: fix zalloc-simple.cocci warnings
  2020-11-15 22:52 [kvm:queue 24/39] virt/kvm/kvm_main.c:3060:29-35: WARNING: Consider using vma_pages helper on vma kernel test robot
  2020-11-15 22:52 ` [PATCH] KVM: X86: fix vma_pages.cocci warnings kernel test robot
@ 2020-11-15 22:52 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2020-11-15 22:52 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
CC: kvm(a)vger.kernel.org
CC: Robert Hu <robert.hu@intel.com>
CC: Farrah Chen <farrah.chen@intel.com>
CC: Danmei Wei <danmei.wei@intel.com>
TO: Peter Xu <peterx@redhat.com>
CC: Paolo Bonzini <pbonzini@redhat.com>
CC: Lei Cao <lei.cao@stratus.com>
CC: kvm(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org

From: kernel test robot <lkp@intel.com>

virt/kvm/dirty_ring.c:70:20-27: WARNING: vzalloc should be used for ring -> dirty_gfns, instead of vmalloc/memset


 Use zeroing allocator rather than allocator followed by memset with 0

 This considers some simple cases that are common and easy to validate
 Note in particular that there are no ...s in the rule, so all of the
 matched code has to be contiguous

Generated by: scripts/coccinelle/api/alloc/zalloc-simple.cocci

Fixes: fb04a1eddb1a ("KVM: X86: Implement ring-based dirty memory tracking")
CC: Peter Xu <peterx@redhat.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
---

tree:   https://git.kernel.org/pub/scm/virt/kvm/kvm.git queue
head:   0a59d24b139a98ad0a2d778205fca6619014633f
commit: fb04a1eddb1a65b6588a021bdc132270d5ae48bb [24/39] KVM: X86: Implement ring-based dirty memory tracking
:::::: branch date: 8 hours ago
:::::: commit date: 8 hours ago

Please take the patch only if it's a positive warning. Thanks!

 dirty_ring.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/virt/kvm/dirty_ring.c
+++ b/virt/kvm/dirty_ring.c
@@ -67,10 +67,9 @@ static void kvm_reset_dirty_gfn(struct k
 
 int kvm_dirty_ring_alloc(struct kvm_dirty_ring *ring, int index, u32 size)
 {
-	ring->dirty_gfns = vmalloc(size);
+	ring->dirty_gfns = vzalloc(size);
 	if (!ring->dirty_gfns)
 		return -ENOMEM;
-	memset(ring->dirty_gfns, 0, size);
 
 	ring->size = size / sizeof(struct kvm_dirty_gfn);
 	ring->soft_limit = ring->size - kvm_dirty_ring_get_rsvd_entries();

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-15 22:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-15 22:52 [kvm:queue 24/39] virt/kvm/kvm_main.c:3060:29-35: WARNING: Consider using vma_pages helper on vma kernel test robot
2020-11-15 22:52 ` [PATCH] KVM: X86: fix vma_pages.cocci warnings kernel test robot
2020-11-15 22:52 ` [PATCH] KVM: X86: fix zalloc-simple.cocci warnings 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.