* Re: [RFC 08/20] vfio/pci: Add VFIO_DEVICE_BIND_IOMMUFD
[not found] <20210919063848.1476776-9-yi.l.liu@intel.com>
@ 2021-09-19 10:08 ` kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-09-19 10:08 UTC (permalink / raw)
To: Liu Yi L; +Cc: llvm, kbuild-all
[-- Attachment #1: Type: text/plain, Size: 8127 bytes --]
Hi Liu,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on hch-configfs/for-next]
[cannot apply to joro-iommu/next awilliam-vfio/next linus/master v5.15-rc1 next-20210917]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Liu-Yi-L/Introduce-dev-iommu-for-userspace-I-O-address-space-management/20210919-144631
base: git://git.infradead.org/users/hch/configfs.git for-next
config: i386-randconfig-a016-20210919 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c8b3d7d6d6de37af68b2f379d0e37304f78e115f)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/597d2cdca2b63c05ae9cb0c8bb8e3b9f53b82685
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Liu-Yi-L/Introduce-dev-iommu-for-userspace-I-O-address-space-management/20210919-144631
git checkout 597d2cdca2b63c05ae9cb0c8bb8e3b9f53b82685
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/iommu/iommufd/iommufd.c:181:7: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (idev->dev == dev || idev->dev_cookie == dev_cookie) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/iommu/iommufd/iommufd.c:221:17: note: uninitialized use occurs here
return ERR_PTR(ret);
^~~
drivers/iommu/iommufd/iommufd.c:181:3: note: remove the 'if' if its condition is always false
if (idev->dev == dev || idev->dev_cookie == dev_cookie) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/iommu/iommufd/iommufd.c:181:7: warning: variable 'ret' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized]
if (idev->dev == dev || idev->dev_cookie == dev_cookie) {
^~~~~~~~~~~~~~~~
drivers/iommu/iommufd/iommufd.c:221:17: note: uninitialized use occurs here
return ERR_PTR(ret);
^~~
drivers/iommu/iommufd/iommufd.c:181:7: note: remove the '||' if its condition is always false
if (idev->dev == dev || idev->dev_cookie == dev_cookie) {
^~~~~~~~~~~~~~~~~~~
drivers/iommu/iommufd/iommufd.c:171:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 0
2 warnings generated.
Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for IOMMUFD
Depends on IOMMU_SUPPORT
Selected by
- VFIO_PCI && VFIO && PCI && EVENTFD && MMU
vim +181 drivers/iommu/iommufd/iommufd.c
6a3d96f3199688 Liu Yi L 2021-09-19 151
09ba2a1b554c58 Liu Yi L 2021-09-19 152 /**
09ba2a1b554c58 Liu Yi L 2021-09-19 153 * iommufd_bind_device - Bind a physical device marked by a device
09ba2a1b554c58 Liu Yi L 2021-09-19 154 * cookie to an iommu fd.
09ba2a1b554c58 Liu Yi L 2021-09-19 155 * @fd: [in] iommufd file descriptor.
09ba2a1b554c58 Liu Yi L 2021-09-19 156 * @dev: [in] Pointer to a physical device struct.
09ba2a1b554c58 Liu Yi L 2021-09-19 157 * @dev_cookie: [in] A cookie to mark the device in /dev/iommu uAPI.
09ba2a1b554c58 Liu Yi L 2021-09-19 158 *
09ba2a1b554c58 Liu Yi L 2021-09-19 159 * A successful bind establishes a security context for the device
09ba2a1b554c58 Liu Yi L 2021-09-19 160 * and returns struct iommufd_device pointer. Otherwise returns
09ba2a1b554c58 Liu Yi L 2021-09-19 161 * error pointer.
09ba2a1b554c58 Liu Yi L 2021-09-19 162 *
09ba2a1b554c58 Liu Yi L 2021-09-19 163 */
09ba2a1b554c58 Liu Yi L 2021-09-19 164 struct iommufd_device *iommufd_bind_device(int fd, struct device *dev,
09ba2a1b554c58 Liu Yi L 2021-09-19 165 u64 dev_cookie)
09ba2a1b554c58 Liu Yi L 2021-09-19 166 {
09ba2a1b554c58 Liu Yi L 2021-09-19 167 struct iommufd_ctx *ictx;
09ba2a1b554c58 Liu Yi L 2021-09-19 168 struct iommufd_device *idev;
09ba2a1b554c58 Liu Yi L 2021-09-19 169 unsigned long index;
09ba2a1b554c58 Liu Yi L 2021-09-19 170 unsigned int id;
09ba2a1b554c58 Liu Yi L 2021-09-19 171 int ret;
09ba2a1b554c58 Liu Yi L 2021-09-19 172
09ba2a1b554c58 Liu Yi L 2021-09-19 173 ictx = iommufd_ctx_fdget(fd);
09ba2a1b554c58 Liu Yi L 2021-09-19 174 if (!ictx)
09ba2a1b554c58 Liu Yi L 2021-09-19 175 return ERR_PTR(-EINVAL);
09ba2a1b554c58 Liu Yi L 2021-09-19 176
09ba2a1b554c58 Liu Yi L 2021-09-19 177 mutex_lock(&ictx->lock);
09ba2a1b554c58 Liu Yi L 2021-09-19 178
09ba2a1b554c58 Liu Yi L 2021-09-19 179 /* check duplicate registration */
09ba2a1b554c58 Liu Yi L 2021-09-19 180 xa_for_each(&ictx->device_xa, index, idev) {
09ba2a1b554c58 Liu Yi L 2021-09-19 @181 if (idev->dev == dev || idev->dev_cookie == dev_cookie) {
09ba2a1b554c58 Liu Yi L 2021-09-19 182 idev = ERR_PTR(-EBUSY);
09ba2a1b554c58 Liu Yi L 2021-09-19 183 goto out_unlock;
09ba2a1b554c58 Liu Yi L 2021-09-19 184 }
09ba2a1b554c58 Liu Yi L 2021-09-19 185 }
09ba2a1b554c58 Liu Yi L 2021-09-19 186
09ba2a1b554c58 Liu Yi L 2021-09-19 187 idev = kzalloc(sizeof(*idev), GFP_KERNEL);
09ba2a1b554c58 Liu Yi L 2021-09-19 188 if (!idev) {
09ba2a1b554c58 Liu Yi L 2021-09-19 189 ret = -ENOMEM;
09ba2a1b554c58 Liu Yi L 2021-09-19 190 goto out_unlock;
09ba2a1b554c58 Liu Yi L 2021-09-19 191 }
09ba2a1b554c58 Liu Yi L 2021-09-19 192
09ba2a1b554c58 Liu Yi L 2021-09-19 193 /* Establish the security context */
09ba2a1b554c58 Liu Yi L 2021-09-19 194 ret = iommu_device_init_user_dma(dev, (unsigned long)ictx);
09ba2a1b554c58 Liu Yi L 2021-09-19 195 if (ret)
09ba2a1b554c58 Liu Yi L 2021-09-19 196 goto out_free;
09ba2a1b554c58 Liu Yi L 2021-09-19 197
09ba2a1b554c58 Liu Yi L 2021-09-19 198 ret = xa_alloc(&ictx->device_xa, &id, idev,
09ba2a1b554c58 Liu Yi L 2021-09-19 199 XA_LIMIT(IOMMUFD_DEVID_MIN, IOMMUFD_DEVID_MAX),
09ba2a1b554c58 Liu Yi L 2021-09-19 200 GFP_KERNEL);
09ba2a1b554c58 Liu Yi L 2021-09-19 201 if (ret) {
09ba2a1b554c58 Liu Yi L 2021-09-19 202 idev = ERR_PTR(ret);
09ba2a1b554c58 Liu Yi L 2021-09-19 203 goto out_user_dma;
09ba2a1b554c58 Liu Yi L 2021-09-19 204 }
09ba2a1b554c58 Liu Yi L 2021-09-19 205
09ba2a1b554c58 Liu Yi L 2021-09-19 206 idev->ictx = ictx;
09ba2a1b554c58 Liu Yi L 2021-09-19 207 idev->dev = dev;
09ba2a1b554c58 Liu Yi L 2021-09-19 208 idev->dev_cookie = dev_cookie;
09ba2a1b554c58 Liu Yi L 2021-09-19 209 idev->id = id;
09ba2a1b554c58 Liu Yi L 2021-09-19 210 mutex_unlock(&ictx->lock);
09ba2a1b554c58 Liu Yi L 2021-09-19 211
09ba2a1b554c58 Liu Yi L 2021-09-19 212 return idev;
09ba2a1b554c58 Liu Yi L 2021-09-19 213 out_user_dma:
09ba2a1b554c58 Liu Yi L 2021-09-19 214 iommu_device_exit_user_dma(idev->dev);
09ba2a1b554c58 Liu Yi L 2021-09-19 215 out_free:
09ba2a1b554c58 Liu Yi L 2021-09-19 216 kfree(idev);
09ba2a1b554c58 Liu Yi L 2021-09-19 217 out_unlock:
09ba2a1b554c58 Liu Yi L 2021-09-19 218 mutex_unlock(&ictx->lock);
09ba2a1b554c58 Liu Yi L 2021-09-19 219 iommufd_ctx_put(ictx);
09ba2a1b554c58 Liu Yi L 2021-09-19 220
09ba2a1b554c58 Liu Yi L 2021-09-19 221 return ERR_PTR(ret);
09ba2a1b554c58 Liu Yi L 2021-09-19 222 }
09ba2a1b554c58 Liu Yi L 2021-09-19 223 EXPORT_SYMBOL_GPL(iommufd_bind_device);
09ba2a1b554c58 Liu Yi L 2021-09-19 224
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 37648 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-09-19 10:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20210919063848.1476776-9-yi.l.liu@intel.com>
2021-09-19 10:08 ` [RFC 08/20] vfio/pci: Add VFIO_DEVICE_BIND_IOMMUFD kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).