From: Dan Carpenter <dan.carpenter@oracle.com> To: kbuild@lists.01.org Subject: Re: [RFC v4 05/11] vdpa: Support transferring virtual addressing during DMA mapping Date: Wed, 24 Feb 2021 10:37:26 +0300 [thread overview] Message-ID: <20210224073726.GQ2087@kadam> (raw) In-Reply-To: <20210223115048.435-6-xieyongji@bytedance.com> [-- Attachment #1: Type: text/plain, Size: 4395 bytes --] Hi Xie, url: https://github.com/0day-ci/linux/commits/Xie-Yongji/Introduce-VDUSE-vDPA-Device-in-Userspace/20210223-200222 base: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next config: i386-randconfig-m021-20210223 (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: Dan Carpenter <dan.carpenter@oracle.com> New smatch warnings: drivers/vhost/vdpa.c:660 vhost_vdpa_va_map() warn: inconsistent returns '&dev->mm->mmap_lock'. vim +660 drivers/vhost/vdpa.c d8433d0f11798a Xie Yongji 2021-02-23 614 static int vhost_vdpa_va_map(struct vhost_vdpa *v, d8433d0f11798a Xie Yongji 2021-02-23 615 u64 iova, u64 size, u64 uaddr, u32 perm) d8433d0f11798a Xie Yongji 2021-02-23 616 { d8433d0f11798a Xie Yongji 2021-02-23 617 struct vhost_dev *dev = &v->vdev; d8433d0f11798a Xie Yongji 2021-02-23 618 u64 offset, map_size, map_iova = iova; d8433d0f11798a Xie Yongji 2021-02-23 619 struct vdpa_map_file *map_file; d8433d0f11798a Xie Yongji 2021-02-23 620 struct vm_area_struct *vma; d8433d0f11798a Xie Yongji 2021-02-23 621 int ret; d8433d0f11798a Xie Yongji 2021-02-23 622 d8433d0f11798a Xie Yongji 2021-02-23 623 mmap_read_lock(dev->mm); d8433d0f11798a Xie Yongji 2021-02-23 624 d8433d0f11798a Xie Yongji 2021-02-23 625 while (size) { d8433d0f11798a Xie Yongji 2021-02-23 626 vma = find_vma(dev->mm, uaddr); d8433d0f11798a Xie Yongji 2021-02-23 627 if (!vma) { d8433d0f11798a Xie Yongji 2021-02-23 628 ret = -EINVAL; d8433d0f11798a Xie Yongji 2021-02-23 629 goto err; d8433d0f11798a Xie Yongji 2021-02-23 630 } d8433d0f11798a Xie Yongji 2021-02-23 631 map_size = min(size, vma->vm_end - uaddr); d8433d0f11798a Xie Yongji 2021-02-23 632 offset = (vma->vm_pgoff << PAGE_SHIFT) + uaddr - vma->vm_start; d8433d0f11798a Xie Yongji 2021-02-23 633 map_file = kzalloc(sizeof(*map_file), GFP_KERNEL); d8433d0f11798a Xie Yongji 2021-02-23 634 if (!map_file) { d8433d0f11798a Xie Yongji 2021-02-23 635 ret = -ENOMEM; d8433d0f11798a Xie Yongji 2021-02-23 636 goto err; d8433d0f11798a Xie Yongji 2021-02-23 637 } d8433d0f11798a Xie Yongji 2021-02-23 638 if (vma->vm_file && (vma->vm_flags & VM_SHARED) && d8433d0f11798a Xie Yongji 2021-02-23 639 !(vma->vm_flags & (VM_IO | VM_PFNMAP))) { d8433d0f11798a Xie Yongji 2021-02-23 640 map_file->file = get_file(vma->vm_file); d8433d0f11798a Xie Yongji 2021-02-23 641 map_file->offset = offset; d8433d0f11798a Xie Yongji 2021-02-23 642 } d8433d0f11798a Xie Yongji 2021-02-23 643 ret = vhost_vdpa_map(v, map_iova, map_size, uaddr, d8433d0f11798a Xie Yongji 2021-02-23 644 perm, map_file); d8433d0f11798a Xie Yongji 2021-02-23 645 if (ret) { d8433d0f11798a Xie Yongji 2021-02-23 646 if (map_file->file) d8433d0f11798a Xie Yongji 2021-02-23 647 fput(map_file->file); d8433d0f11798a Xie Yongji 2021-02-23 648 kfree(map_file); d8433d0f11798a Xie Yongji 2021-02-23 649 goto err; d8433d0f11798a Xie Yongji 2021-02-23 650 } d8433d0f11798a Xie Yongji 2021-02-23 651 size -= map_size; d8433d0f11798a Xie Yongji 2021-02-23 652 uaddr += map_size; d8433d0f11798a Xie Yongji 2021-02-23 653 map_iova += map_size; d8433d0f11798a Xie Yongji 2021-02-23 654 } d8433d0f11798a Xie Yongji 2021-02-23 655 mmap_read_unlock(dev->mm); ^^^^^^^^^^^^^^^^^^^^^^^^^ The success path unlocks. d8433d0f11798a Xie Yongji 2021-02-23 656 d8433d0f11798a Xie Yongji 2021-02-23 657 return 0; d8433d0f11798a Xie Yongji 2021-02-23 658 err: d8433d0f11798a Xie Yongji 2021-02-23 659 vhost_vdpa_unmap(v, iova, map_iova - iova); d8433d0f11798a Xie Yongji 2021-02-23 @660 return ret; The error path doesn't seem to unlock. I did look at vhost_vdpa_unmap() briefly, but I didn't see any reason that we don't need to unlock but I may have missed it. The point of sending these bug reports as soon as possible is that hopefully you know the answer off the top of your head. :) d8433d0f11798a Xie Yongji 2021-02-23 661 } --- 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: 37926 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com> To: kbuild-all@lists.01.org Subject: Re: [RFC v4 05/11] vdpa: Support transferring virtual addressing during DMA mapping Date: Wed, 24 Feb 2021 10:37:26 +0300 [thread overview] Message-ID: <20210224073726.GQ2087@kadam> (raw) In-Reply-To: <20210223115048.435-6-xieyongji@bytedance.com> [-- Attachment #1: Type: text/plain, Size: 4395 bytes --] Hi Xie, url: https://github.com/0day-ci/linux/commits/Xie-Yongji/Introduce-VDUSE-vDPA-Device-in-Userspace/20210223-200222 base: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next config: i386-randconfig-m021-20210223 (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: Dan Carpenter <dan.carpenter@oracle.com> New smatch warnings: drivers/vhost/vdpa.c:660 vhost_vdpa_va_map() warn: inconsistent returns '&dev->mm->mmap_lock'. vim +660 drivers/vhost/vdpa.c d8433d0f11798a Xie Yongji 2021-02-23 614 static int vhost_vdpa_va_map(struct vhost_vdpa *v, d8433d0f11798a Xie Yongji 2021-02-23 615 u64 iova, u64 size, u64 uaddr, u32 perm) d8433d0f11798a Xie Yongji 2021-02-23 616 { d8433d0f11798a Xie Yongji 2021-02-23 617 struct vhost_dev *dev = &v->vdev; d8433d0f11798a Xie Yongji 2021-02-23 618 u64 offset, map_size, map_iova = iova; d8433d0f11798a Xie Yongji 2021-02-23 619 struct vdpa_map_file *map_file; d8433d0f11798a Xie Yongji 2021-02-23 620 struct vm_area_struct *vma; d8433d0f11798a Xie Yongji 2021-02-23 621 int ret; d8433d0f11798a Xie Yongji 2021-02-23 622 d8433d0f11798a Xie Yongji 2021-02-23 623 mmap_read_lock(dev->mm); d8433d0f11798a Xie Yongji 2021-02-23 624 d8433d0f11798a Xie Yongji 2021-02-23 625 while (size) { d8433d0f11798a Xie Yongji 2021-02-23 626 vma = find_vma(dev->mm, uaddr); d8433d0f11798a Xie Yongji 2021-02-23 627 if (!vma) { d8433d0f11798a Xie Yongji 2021-02-23 628 ret = -EINVAL; d8433d0f11798a Xie Yongji 2021-02-23 629 goto err; d8433d0f11798a Xie Yongji 2021-02-23 630 } d8433d0f11798a Xie Yongji 2021-02-23 631 map_size = min(size, vma->vm_end - uaddr); d8433d0f11798a Xie Yongji 2021-02-23 632 offset = (vma->vm_pgoff << PAGE_SHIFT) + uaddr - vma->vm_start; d8433d0f11798a Xie Yongji 2021-02-23 633 map_file = kzalloc(sizeof(*map_file), GFP_KERNEL); d8433d0f11798a Xie Yongji 2021-02-23 634 if (!map_file) { d8433d0f11798a Xie Yongji 2021-02-23 635 ret = -ENOMEM; d8433d0f11798a Xie Yongji 2021-02-23 636 goto err; d8433d0f11798a Xie Yongji 2021-02-23 637 } d8433d0f11798a Xie Yongji 2021-02-23 638 if (vma->vm_file && (vma->vm_flags & VM_SHARED) && d8433d0f11798a Xie Yongji 2021-02-23 639 !(vma->vm_flags & (VM_IO | VM_PFNMAP))) { d8433d0f11798a Xie Yongji 2021-02-23 640 map_file->file = get_file(vma->vm_file); d8433d0f11798a Xie Yongji 2021-02-23 641 map_file->offset = offset; d8433d0f11798a Xie Yongji 2021-02-23 642 } d8433d0f11798a Xie Yongji 2021-02-23 643 ret = vhost_vdpa_map(v, map_iova, map_size, uaddr, d8433d0f11798a Xie Yongji 2021-02-23 644 perm, map_file); d8433d0f11798a Xie Yongji 2021-02-23 645 if (ret) { d8433d0f11798a Xie Yongji 2021-02-23 646 if (map_file->file) d8433d0f11798a Xie Yongji 2021-02-23 647 fput(map_file->file); d8433d0f11798a Xie Yongji 2021-02-23 648 kfree(map_file); d8433d0f11798a Xie Yongji 2021-02-23 649 goto err; d8433d0f11798a Xie Yongji 2021-02-23 650 } d8433d0f11798a Xie Yongji 2021-02-23 651 size -= map_size; d8433d0f11798a Xie Yongji 2021-02-23 652 uaddr += map_size; d8433d0f11798a Xie Yongji 2021-02-23 653 map_iova += map_size; d8433d0f11798a Xie Yongji 2021-02-23 654 } d8433d0f11798a Xie Yongji 2021-02-23 655 mmap_read_unlock(dev->mm); ^^^^^^^^^^^^^^^^^^^^^^^^^ The success path unlocks. d8433d0f11798a Xie Yongji 2021-02-23 656 d8433d0f11798a Xie Yongji 2021-02-23 657 return 0; d8433d0f11798a Xie Yongji 2021-02-23 658 err: d8433d0f11798a Xie Yongji 2021-02-23 659 vhost_vdpa_unmap(v, iova, map_iova - iova); d8433d0f11798a Xie Yongji 2021-02-23 @660 return ret; The error path doesn't seem to unlock. I did look at vhost_vdpa_unmap() briefly, but I didn't see any reason that we don't need to unlock but I may have missed it. The point of sending these bug reports as soon as possible is that hopefully you know the answer off the top of your head. :) d8433d0f11798a Xie Yongji 2021-02-23 661 } --- 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: 37926 bytes --]
next prev parent reply other threads:[~2021-02-24 7:37 UTC|newest] Thread overview: 97+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-02-23 11:50 [RFC v4 00/11] Introduce VDUSE - vDPA Device in Userspace Xie Yongji 2021-02-23 11:50 ` [RFC v4 01/11] eventfd: Increase the recursion depth of eventfd_signal() Xie Yongji 2021-03-02 6:44 ` Jason Wang 2021-03-02 6:44 ` Jason Wang 2021-03-02 10:32 ` Yongji Xie 2021-02-23 11:50 ` [RFC v4 02/11] vhost-vdpa: protect concurrent access to vhost device iotlb Xie Yongji 2021-03-02 6:47 ` Jason Wang 2021-03-02 6:47 ` Jason Wang 2021-03-02 10:20 ` Yongji Xie 2021-02-23 11:50 ` [RFC v4 03/11] vhost-iotlb: Add an opaque pointer for vhost IOTLB Xie Yongji 2021-03-02 6:49 ` Jason Wang 2021-03-02 6:49 ` Jason Wang 2021-02-23 11:50 ` [RFC v4 04/11] vdpa: Add an opaque pointer for vdpa_config_ops.dma_map() Xie Yongji 2021-03-02 6:50 ` Jason Wang 2021-03-02 6:50 ` Jason Wang 2021-02-23 11:50 ` [RFC v4 05/11] vdpa: Support transferring virtual addressing during DMA mapping Xie Yongji 2021-02-24 7:37 ` Dan Carpenter [this message] 2021-02-24 7:37 ` Dan Carpenter 2021-03-03 10:52 ` Mika Penttilä 2021-03-03 12:45 ` Yongji Xie 2021-03-03 13:38 ` Mika Penttilä 2021-03-04 3:07 ` Jason Wang 2021-03-04 3:07 ` Jason Wang 2021-03-04 5:40 ` Yongji Xie 2021-02-23 11:50 ` [RFC v4 06/11] vduse: Implement an MMU-based IOMMU driver Xie Yongji 2021-03-04 4:20 ` Jason Wang 2021-03-04 4:20 ` Jason Wang 2021-03-04 5:12 ` Yongji Xie 2021-03-05 3:35 ` Jason Wang 2021-03-05 3:35 ` Jason Wang 2021-03-05 6:15 ` Yongji Xie 2021-03-05 6:51 ` Jason Wang 2021-03-05 7:13 ` Yongji Xie 2021-03-05 7:27 ` Jason Wang 2021-03-05 7:27 ` Jason Wang 2021-03-05 7:59 ` Yongji Xie 2021-03-08 3:17 ` Jason Wang 2021-03-08 3:17 ` Jason Wang 2021-03-08 3:45 ` Yongji Xie 2021-03-08 3:52 ` Jason Wang 2021-03-08 3:52 ` Jason Wang 2021-03-08 5:05 ` Yongji Xie 2021-03-08 7:04 ` Jason Wang 2021-03-08 7:04 ` Jason Wang 2021-03-08 7:08 ` Yongji Xie 2021-02-23 11:50 ` [RFC v4 07/11] vduse: Introduce VDUSE - vDPA Device in Userspace Xie Yongji 2021-02-23 15:44 ` kernel test robot 2021-02-23 20:24 ` kernel test robot 2021-03-04 6:27 ` Jason Wang 2021-03-04 6:27 ` Jason Wang 2021-03-04 8:05 ` Yongji Xie 2021-03-05 3:20 ` Jason Wang 2021-03-05 3:20 ` Jason Wang 2021-03-05 3:49 ` Yongji Xie 2021-03-10 12:58 ` Jason Wang 2021-03-10 12:58 ` Jason Wang 2021-03-11 2:28 ` Yongji Xie 2021-02-23 11:50 ` [RFC v4 08/11] vduse: Add config interrupt support Xie Yongji 2021-02-23 11:50 ` [RFC v4 09/11] Documentation: Add documentation for VDUSE Xie Yongji 2021-03-04 6:39 ` Jason Wang 2021-03-04 6:39 ` Jason Wang 2021-03-04 10:35 ` Yongji Xie 2021-02-23 11:50 ` [RFC v4 10/11] vduse: Introduce a workqueue for irq injection Xie Yongji 2021-03-04 6:59 ` Jason Wang 2021-03-04 6:59 ` Jason Wang 2021-03-04 8:58 ` Yongji Xie 2021-03-05 3:04 ` Jason Wang 2021-03-05 3:04 ` Jason Wang 2021-03-05 3:30 ` Yongji Xie 2021-03-05 3:42 ` Jason Wang 2021-03-05 3:42 ` Jason Wang 2021-03-05 6:36 ` Yongji Xie 2021-03-05 7:01 ` Jason Wang 2021-03-05 7:01 ` Jason Wang 2021-03-05 7:27 ` Yongji Xie 2021-03-05 7:36 ` Jason Wang 2021-03-05 7:36 ` Jason Wang 2021-03-05 8:12 ` Yongji Xie 2021-03-08 3:04 ` Jason Wang 2021-03-08 3:04 ` Jason Wang 2021-03-08 4:50 ` Yongji Xie 2021-03-08 7:01 ` Jason Wang 2021-03-08 7:01 ` Jason Wang 2021-03-08 7:16 ` Yongji Xie 2021-03-08 7:29 ` Jason Wang 2021-03-08 7:29 ` Jason Wang 2021-02-23 11:50 ` [RFC v4 11/11] vduse: Support binding irq to the specified cpu Xie Yongji 2021-03-04 7:30 ` Jason Wang 2021-03-04 7:30 ` Jason Wang 2021-03-04 8:19 ` Yongji Xie 2021-03-05 3:11 ` Jason Wang 2021-03-05 3:11 ` Jason Wang 2021-03-05 3:37 ` Yongji Xie 2021-03-05 3:44 ` Jason Wang 2021-03-05 3:44 ` Jason Wang 2021-03-05 6:40 ` Yongji Xie 2021-02-23 19:16 [RFC v4 05/11] vdpa: Support transferring virtual addressing during DMA mapping 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=20210224073726.GQ2087@kadam \ --to=dan.carpenter@oracle.com \ --cc=kbuild@lists.01.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: linkBe 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.