All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/iommu/iommufd/hw_pagetable.c:226:1-7: preceding lock on line 197
@ 2023-12-06  1:31 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2023-12-06  1:31 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Julia Lawall

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Nicolin Chen <nicolinc@nvidia.com>
CC: Jason Gunthorpe <jgg@ziepe.ca>
CC: Yi Liu <yi.l.liu@intel.com>
CC: Kevin Tian <kevin.tian@intel.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   bee0e7762ad2c6025b9f5245c040fcc36ef2bde8
commit: b5021cb264e67baf051569a41debe277c279952b iommufd: Share iommufd_hwpt_alloc with IOMMUFD_OBJ_HWPT_NESTED
date:   6 weeks ago
:::::: branch date: 28 hours ago
:::::: commit date: 6 weeks ago
config: x86_64-randconfig-103-20231202 (https://download.01.org/0day-ci/archive/20231206/202312060947.C52WRrtX-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce: (https://download.01.org/0day-ci/archive/20231206/202312060947.C52WRrtX-lkp@intel.com/reproduce)

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: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202312060947.C52WRrtX-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> drivers/iommu/iommufd/hw_pagetable.c:226:1-7: preceding lock on line 197

vim +226 drivers/iommu/iommufd/hw_pagetable.c

7074d7bd67d495 Jason Gunthorpe 2023-07-17  170  
7074d7bd67d495 Jason Gunthorpe 2023-07-17  171  int iommufd_hwpt_alloc(struct iommufd_ucmd *ucmd)
7074d7bd67d495 Jason Gunthorpe 2023-07-17  172  {
7074d7bd67d495 Jason Gunthorpe 2023-07-17  173  	struct iommu_hwpt_alloc *cmd = ucmd->cmd;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  174  	struct iommufd_hw_pagetable *hwpt;
b5021cb264e67b Nicolin Chen    2023-10-25  175  	struct iommufd_ioas *ioas = NULL;
b5021cb264e67b Nicolin Chen    2023-10-25  176  	struct iommufd_object *pt_obj;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  177  	struct iommufd_device *idev;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  178  	int rc;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  179  
b5021cb264e67b Nicolin Chen    2023-10-25  180  	if (cmd->__reserved)
7074d7bd67d495 Jason Gunthorpe 2023-07-17  181  		return -EOPNOTSUPP;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  182  
7074d7bd67d495 Jason Gunthorpe 2023-07-17  183  	idev = iommufd_get_device(ucmd, cmd->dev_id);
7074d7bd67d495 Jason Gunthorpe 2023-07-17  184  	if (IS_ERR(idev))
7074d7bd67d495 Jason Gunthorpe 2023-07-17  185  		return PTR_ERR(idev);
7074d7bd67d495 Jason Gunthorpe 2023-07-17  186  
b5021cb264e67b Nicolin Chen    2023-10-25  187  	pt_obj = iommufd_get_object(ucmd->ictx, cmd->pt_id, IOMMUFD_OBJ_ANY);
b5021cb264e67b Nicolin Chen    2023-10-25  188  	if (IS_ERR(pt_obj)) {
b5021cb264e67b Nicolin Chen    2023-10-25  189  		rc = -EINVAL;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  190  		goto out_put_idev;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  191  	}
7074d7bd67d495 Jason Gunthorpe 2023-07-17  192  
b5021cb264e67b Nicolin Chen    2023-10-25  193  	if (pt_obj->type == IOMMUFD_OBJ_IOAS) {
b5021cb264e67b Nicolin Chen    2023-10-25  194  		struct iommufd_hwpt_paging *hwpt_paging;
b5021cb264e67b Nicolin Chen    2023-10-25  195  
b5021cb264e67b Nicolin Chen    2023-10-25  196  		ioas = container_of(pt_obj, struct iommufd_ioas, obj);
7074d7bd67d495 Jason Gunthorpe 2023-07-17 @197  		mutex_lock(&ioas->mutex);
89db31635c87a7 Nicolin Chen    2023-10-25  198  		hwpt_paging = iommufd_hwpt_paging_alloc(ucmd->ictx, ioas, idev,
89db31635c87a7 Nicolin Chen    2023-10-25  199  							cmd->flags, false);
89db31635c87a7 Nicolin Chen    2023-10-25  200  		if (IS_ERR(hwpt_paging)) {
89db31635c87a7 Nicolin Chen    2023-10-25  201  			rc = PTR_ERR(hwpt_paging);
7074d7bd67d495 Jason Gunthorpe 2023-07-17  202  			goto out_unlock;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  203  		}
89db31635c87a7 Nicolin Chen    2023-10-25  204  		hwpt = &hwpt_paging->common;
b5021cb264e67b Nicolin Chen    2023-10-25  205  	} else {
b5021cb264e67b Nicolin Chen    2023-10-25  206  		rc = -EINVAL;
b5021cb264e67b Nicolin Chen    2023-10-25  207  		goto out_put_pt;
b5021cb264e67b Nicolin Chen    2023-10-25  208  	}
7074d7bd67d495 Jason Gunthorpe 2023-07-17  209  
7074d7bd67d495 Jason Gunthorpe 2023-07-17  210  	cmd->out_hwpt_id = hwpt->obj.id;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  211  	rc = iommufd_ucmd_respond(ucmd, sizeof(*cmd));
7074d7bd67d495 Jason Gunthorpe 2023-07-17  212  	if (rc)
7074d7bd67d495 Jason Gunthorpe 2023-07-17  213  		goto out_hwpt;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  214  	iommufd_object_finalize(ucmd->ictx, &hwpt->obj);
7074d7bd67d495 Jason Gunthorpe 2023-07-17  215  	goto out_unlock;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  216  
7074d7bd67d495 Jason Gunthorpe 2023-07-17  217  out_hwpt:
7074d7bd67d495 Jason Gunthorpe 2023-07-17  218  	iommufd_object_abort_and_destroy(ucmd->ictx, &hwpt->obj);
7074d7bd67d495 Jason Gunthorpe 2023-07-17  219  out_unlock:
b5021cb264e67b Nicolin Chen    2023-10-25  220  	if (ioas)
7074d7bd67d495 Jason Gunthorpe 2023-07-17  221  		mutex_unlock(&ioas->mutex);
b5021cb264e67b Nicolin Chen    2023-10-25  222  out_put_pt:
b5021cb264e67b Nicolin Chen    2023-10-25  223  	iommufd_put_object(pt_obj);
7074d7bd67d495 Jason Gunthorpe 2023-07-17  224  out_put_idev:
7074d7bd67d495 Jason Gunthorpe 2023-07-17  225  	iommufd_put_object(&idev->obj);
7074d7bd67d495 Jason Gunthorpe 2023-07-17 @226  	return rc;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  227  }
e2a4b294784957 Joao Martins    2023-10-24  228  

:::::: The code at line 226 was first introduced by commit
:::::: 7074d7bd67d495cb3f6fe7c7c96b357a3b9d4ec2 iommufd: Add IOMMU_HWPT_ALLOC

:::::: TO: Jason Gunthorpe <jgg@nvidia.com>
:::::: CC: Jason Gunthorpe <jgg@nvidia.com>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 2+ messages in thread
* drivers/iommu/iommufd/hw_pagetable.c:226:1-7: preceding lock on line 197
@ 2024-10-22  2:07 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2024-10-22  2:07 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Julia Lawall

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Nicolin Chen <nicolinc@nvidia.com>
CC: Jason Gunthorpe <jgg@ziepe.ca>
CC: Yi Liu <yi.l.liu@intel.com>
CC: Kevin Tian <kevin.tian@intel.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   c2ee9f594da826bea183ed14f2cc029c719bf4da
commit: b5021cb264e67baf051569a41debe277c279952b iommufd: Share iommufd_hwpt_alloc with IOMMUFD_OBJ_HWPT_NESTED
date:   12 months ago
:::::: branch date: 3 hours ago
:::::: commit date: 12 months ago
config: s390-randconfig-r062-20241022 (https://download.01.org/0day-ci/archive/20241022/202410221009.PVaONXAs-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project bfe84f7085d82d06d61c632a7bad1e692fd159e4)

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: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202410221009.PVaONXAs-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> drivers/iommu/iommufd/hw_pagetable.c:226:1-7: preceding lock on line 197

vim +226 drivers/iommu/iommufd/hw_pagetable.c

7074d7bd67d495 Jason Gunthorpe 2023-07-17  170  
7074d7bd67d495 Jason Gunthorpe 2023-07-17  171  int iommufd_hwpt_alloc(struct iommufd_ucmd *ucmd)
7074d7bd67d495 Jason Gunthorpe 2023-07-17  172  {
7074d7bd67d495 Jason Gunthorpe 2023-07-17  173  	struct iommu_hwpt_alloc *cmd = ucmd->cmd;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  174  	struct iommufd_hw_pagetable *hwpt;
b5021cb264e67b Nicolin Chen    2023-10-25  175  	struct iommufd_ioas *ioas = NULL;
b5021cb264e67b Nicolin Chen    2023-10-25  176  	struct iommufd_object *pt_obj;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  177  	struct iommufd_device *idev;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  178  	int rc;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  179  
b5021cb264e67b Nicolin Chen    2023-10-25  180  	if (cmd->__reserved)
7074d7bd67d495 Jason Gunthorpe 2023-07-17  181  		return -EOPNOTSUPP;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  182  
7074d7bd67d495 Jason Gunthorpe 2023-07-17  183  	idev = iommufd_get_device(ucmd, cmd->dev_id);
7074d7bd67d495 Jason Gunthorpe 2023-07-17  184  	if (IS_ERR(idev))
7074d7bd67d495 Jason Gunthorpe 2023-07-17  185  		return PTR_ERR(idev);
7074d7bd67d495 Jason Gunthorpe 2023-07-17  186  
b5021cb264e67b Nicolin Chen    2023-10-25  187  	pt_obj = iommufd_get_object(ucmd->ictx, cmd->pt_id, IOMMUFD_OBJ_ANY);
b5021cb264e67b Nicolin Chen    2023-10-25  188  	if (IS_ERR(pt_obj)) {
b5021cb264e67b Nicolin Chen    2023-10-25  189  		rc = -EINVAL;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  190  		goto out_put_idev;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  191  	}
7074d7bd67d495 Jason Gunthorpe 2023-07-17  192  
b5021cb264e67b Nicolin Chen    2023-10-25  193  	if (pt_obj->type == IOMMUFD_OBJ_IOAS) {
b5021cb264e67b Nicolin Chen    2023-10-25  194  		struct iommufd_hwpt_paging *hwpt_paging;
b5021cb264e67b Nicolin Chen    2023-10-25  195  
b5021cb264e67b Nicolin Chen    2023-10-25  196  		ioas = container_of(pt_obj, struct iommufd_ioas, obj);
7074d7bd67d495 Jason Gunthorpe 2023-07-17 @197  		mutex_lock(&ioas->mutex);
89db31635c87a7 Nicolin Chen    2023-10-25  198  		hwpt_paging = iommufd_hwpt_paging_alloc(ucmd->ictx, ioas, idev,
89db31635c87a7 Nicolin Chen    2023-10-25  199  							cmd->flags, false);
89db31635c87a7 Nicolin Chen    2023-10-25  200  		if (IS_ERR(hwpt_paging)) {
89db31635c87a7 Nicolin Chen    2023-10-25  201  			rc = PTR_ERR(hwpt_paging);
7074d7bd67d495 Jason Gunthorpe 2023-07-17  202  			goto out_unlock;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  203  		}
89db31635c87a7 Nicolin Chen    2023-10-25  204  		hwpt = &hwpt_paging->common;
b5021cb264e67b Nicolin Chen    2023-10-25  205  	} else {
b5021cb264e67b Nicolin Chen    2023-10-25  206  		rc = -EINVAL;
b5021cb264e67b Nicolin Chen    2023-10-25  207  		goto out_put_pt;
b5021cb264e67b Nicolin Chen    2023-10-25  208  	}
7074d7bd67d495 Jason Gunthorpe 2023-07-17  209  
7074d7bd67d495 Jason Gunthorpe 2023-07-17  210  	cmd->out_hwpt_id = hwpt->obj.id;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  211  	rc = iommufd_ucmd_respond(ucmd, sizeof(*cmd));
7074d7bd67d495 Jason Gunthorpe 2023-07-17  212  	if (rc)
7074d7bd67d495 Jason Gunthorpe 2023-07-17  213  		goto out_hwpt;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  214  	iommufd_object_finalize(ucmd->ictx, &hwpt->obj);
7074d7bd67d495 Jason Gunthorpe 2023-07-17  215  	goto out_unlock;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  216  
7074d7bd67d495 Jason Gunthorpe 2023-07-17  217  out_hwpt:
7074d7bd67d495 Jason Gunthorpe 2023-07-17  218  	iommufd_object_abort_and_destroy(ucmd->ictx, &hwpt->obj);
7074d7bd67d495 Jason Gunthorpe 2023-07-17  219  out_unlock:
b5021cb264e67b Nicolin Chen    2023-10-25  220  	if (ioas)
7074d7bd67d495 Jason Gunthorpe 2023-07-17  221  		mutex_unlock(&ioas->mutex);
b5021cb264e67b Nicolin Chen    2023-10-25  222  out_put_pt:
b5021cb264e67b Nicolin Chen    2023-10-25  223  	iommufd_put_object(pt_obj);
7074d7bd67d495 Jason Gunthorpe 2023-07-17  224  out_put_idev:
7074d7bd67d495 Jason Gunthorpe 2023-07-17  225  	iommufd_put_object(&idev->obj);
7074d7bd67d495 Jason Gunthorpe 2023-07-17 @226  	return rc;
7074d7bd67d495 Jason Gunthorpe 2023-07-17  227  }
e2a4b294784957 Joao Martins    2023-10-24  228  

:::::: The code at line 226 was first introduced by commit
:::::: 7074d7bd67d495cb3f6fe7c7c96b357a3b9d4ec2 iommufd: Add IOMMU_HWPT_ALLOC

:::::: TO: Jason Gunthorpe <jgg@nvidia.com>
:::::: CC: Jason Gunthorpe <jgg@nvidia.com>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

end of thread, other threads:[~2024-10-22  2:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-06  1:31 drivers/iommu/iommufd/hw_pagetable.c:226:1-7: preceding lock on line 197 kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2024-10-22  2:07 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.