Re: [PATCH v6 virtio 11/11] pds_vdpa: pds_vdps.rst and Kconfig

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/16/23 7:24 PM, kernel test robot wrote:

Hi Shannon,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.4-rc2 next-20230516]
[cannot apply to mst-vhost/linux-next]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Shannon-Nelson/virtio-allow-caller-to-override-device-id-in-vp_modern/20230516-110049
base:   linus/master
patch link:    https://lore.kernel.org/r/20230516025521.43352-12-shannon.nelson%40amd.com
patch subject: [PATCH v6 virtio 11/11] pds_vdpa: pds_vdps.rst and Kconfig
config: arm64-allmodconfig
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project b0fb98227c90adf2536c9ad644a74d5e92961111)
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
         # install arm64 cross compiling tool for clang build
         # apt-get install binutils-aarch64-linux-gnu
         # https://github.com/intel-lab-lkp/linux/commit/4942556344e0c7cdf4719dfbd0e17c0f2b620b30
         git remote add linux-review https://github.com/intel-lab-lkp/linux
         git fetch --no-tags linux-review Shannon-Nelson/virtio-allow-caller-to-override-device-id-in-vp_modern/20230516-110049
         git checkout 4942556344e0c7cdf4719dfbd0e17c0f2b620b30
         # save the config file
         mkdir build_dir && cp config build_dir/.config
         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 olddefconfig
         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/acpi/ drivers/infiniband/sw/rxe/ drivers/staging/media/deprecated/atmel/ drivers/vdpa/pds/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202305171042.aJUkaxnH-lkp@xxxxxxxxx/

Thank you, Mr. Kernel Test Robot, I have this on my list.

sln


All warnings (new ones prefixed by >>):

drivers/vdpa/pds/vdpa_dev.c:568:7: warning: variable 'err' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
                    if (unsupp_features) {
                        ^~~~~~~~~~~~~~~
    drivers/vdpa/pds/vdpa_dev.c:669:9: note: uninitialized use occurs here
            return err;
                   ^~~
    drivers/vdpa/pds/vdpa_dev.c:568:3: note: remove the 'if' if its condition is always false
                    if (unsupp_features) {
                    ^~~~~~~~~~~~~~~~~~~~~~
    drivers/vdpa/pds/vdpa_dev.c:536:9: note: initialize the variable 'err' to silence this warning
            int err;
                   ^
                    = 0
    1 warning generated.


vim +568 drivers/vdpa/pds/vdpa_dev.c

8b05d813374db7 Shannon Nelson 2023-05-15  524
8b05d813374db7 Shannon Nelson 2023-05-15  525  static int pds_vdpa_dev_add(struct vdpa_mgmt_dev *mdev, const char *name,
8b05d813374db7 Shannon Nelson 2023-05-15  526                       const struct vdpa_dev_set_config *add_config)
8b05d813374db7 Shannon Nelson 2023-05-15  527  {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  528   struct pds_vdpa_aux *vdpa_aux;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  529   struct pds_vdpa_device *pdsv;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  530   struct vdpa_mgmt_dev *mgmt;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  531   u16 fw_max_vqs, vq_pairs;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  532   struct device *dma_dev;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  533   struct pci_dev *pdev;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  534   struct device *dev;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  535   u8 mac[ETH_ALEN];
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  536   int err;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  537   int i;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  538
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  539   vdpa_aux = container_of(mdev, struct pds_vdpa_aux, vdpa_mdev);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  540   dev = &vdpa_aux->padev->aux_dev.dev;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  541   mgmt = &vdpa_aux->vdpa_mdev;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  542
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  543   if (vdpa_aux->pdsv) {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  544           dev_warn(dev, "Multiple vDPA devices on a VF is not supported.\n");
8b05d813374db7 Shannon Nelson 2023-05-15  545           return -EOPNOTSUPP;
8b05d813374db7 Shannon Nelson 2023-05-15  546   }
8b05d813374db7 Shannon Nelson 2023-05-15  547
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  548   pdsv = vdpa_alloc_device(struct pds_vdpa_device, vdpa_dev,
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  549                            dev, &pds_vdpa_ops, 1, 1, name, false);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  550   if (IS_ERR(pdsv)) {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  551           dev_err(dev, "Failed to allocate vDPA structure: %pe\n", pdsv);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  552           return PTR_ERR(pdsv);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  553   }
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  554
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  555   vdpa_aux->pdsv = pdsv;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  556   pdsv->vdpa_aux = vdpa_aux;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  557
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  558   pdev = vdpa_aux->padev->vf_pdev;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  559   dma_dev = &pdev->dev;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  560   pdsv->vdpa_dev.dma_dev = dma_dev;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  561
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  562   pdsv->supported_features = mgmt->supported_features;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  563
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  564   if (add_config->mask & BIT_ULL(VDPA_ATTR_DEV_FEATURES)) {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  565           u64 unsupp_features =
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  566                   add_config->device_features & ~mgmt->supported_features;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  567
c4cc9ee57a0c5b Shannon Nelson 2023-05-15 @568           if (unsupp_features) {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  569                   dev_err(dev, "Unsupported features: %#llx\n", unsupp_features);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  570                   goto err_unmap;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  571           }
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  572
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  573           pdsv->supported_features = add_config->device_features;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  574   }
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  575
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  576   err = pds_vdpa_cmd_reset(pdsv);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  577   if (err) {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  578           dev_err(dev, "Failed to reset hw: %pe\n", ERR_PTR(err));
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  579           goto err_unmap;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  580   }
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  581
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  582   err = pds_vdpa_init_hw(pdsv);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  583   if (err) {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  584           dev_err(dev, "Failed to init hw: %pe\n", ERR_PTR(err));
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  585           goto err_unmap;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  586   }
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  587
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  588   fw_max_vqs = le16_to_cpu(pdsv->vdpa_aux->ident.max_vqs);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  589   vq_pairs = fw_max_vqs / 2;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  590
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  591   /* Make sure we have the queues being requested */
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  592   if (add_config->mask & (1 << VDPA_ATTR_DEV_NET_CFG_MAX_VQP))
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  593           vq_pairs = add_config->net.max_vq_pairs;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  594
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  595   pdsv->num_vqs = 2 * vq_pairs;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  596   if (pdsv->supported_features & BIT_ULL(VIRTIO_NET_F_CTRL_VQ))
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  597           pdsv->num_vqs++;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  598
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  599   if (pdsv->num_vqs > fw_max_vqs) {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  600           dev_err(dev, "%s: queue count requested %u greater than max %u\n",
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  601                   __func__, pdsv->num_vqs, fw_max_vqs);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  602           err = -ENOSPC;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  603           goto err_unmap;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  604   }
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  605
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  606   if (pdsv->num_vqs != fw_max_vqs) {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  607           err = pds_vdpa_cmd_set_max_vq_pairs(pdsv, vq_pairs);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  608           if (err) {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  609                   dev_err(dev, "Failed to set max_vq_pairs: %pe\n",
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  610                           ERR_PTR(err));
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  611                   goto err_unmap;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  612           }
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  613   }
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  614
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  615   /* Set a mac, either from the user config if provided
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  616    * or set a random mac if default is 00:..:00
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  617    */
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  618   if (add_config->mask & BIT_ULL(VDPA_ATTR_DEV_NET_CFG_MACADDR)) {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  619           ether_addr_copy(mac, add_config->net.mac);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  620           pds_vdpa_cmd_set_mac(pdsv, mac);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  621   } else {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  622           struct virtio_net_config __iomem *vc;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  623
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  624           vc = pdsv->vdpa_aux->vd_mdev.device;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  625           memcpy_fromio(mac, vc->mac, sizeof(mac));
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  626           if (is_zero_ether_addr(mac)) {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  627                   eth_random_addr(mac);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  628                   dev_info(dev, "setting random mac %pM\n", mac);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  629                   pds_vdpa_cmd_set_mac(pdsv, mac);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  630           }
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  631   }
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  632
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  633   for (i = 0; i < pdsv->num_vqs; i++) {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  634           pdsv->vqs[i].qid = i;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  635           pdsv->vqs[i].pdsv = pdsv;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  636           pdsv->vqs[i].irq = VIRTIO_MSI_NO_VECTOR;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  637           pdsv->vqs[i].notify = vp_modern_map_vq_notify(&pdsv->vdpa_aux->vd_mdev,
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  638                                                         i, &pdsv->vqs[i].notify_pa);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  639   }
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  640
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  641   pdsv->vdpa_dev.mdev = &vdpa_aux->vdpa_mdev;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  642
10cd19d8803330 Shannon Nelson 2023-05-15  643   err = pds_vdpa_register_event_handler(pdsv);
10cd19d8803330 Shannon Nelson 2023-05-15  644   if (err) {
10cd19d8803330 Shannon Nelson 2023-05-15  645           dev_err(dev, "Failed to register for PDS events: %pe\n", ERR_PTR(err));
10cd19d8803330 Shannon Nelson 2023-05-15  646           goto err_unmap;
10cd19d8803330 Shannon Nelson 2023-05-15  647   }
10cd19d8803330 Shannon Nelson 2023-05-15  648
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  649   /* We use the _vdpa_register_device() call rather than the
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  650    * vdpa_register_device() to avoid a deadlock because our
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  651    * dev_add() is called with the vdpa_dev_lock already set
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  652    * by vdpa_nl_cmd_dev_add_set_doit()
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  653    */
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  654   err = _vdpa_register_device(&pdsv->vdpa_dev, pdsv->num_vqs);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  655   if (err) {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  656           dev_err(dev, "Failed to register to vDPA bus: %pe\n", ERR_PTR(err));
10cd19d8803330 Shannon Nelson 2023-05-15  657           goto err_unevent;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  658   }
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  659
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  660   pds_vdpa_debugfs_add_vdpadev(vdpa_aux);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  661
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  662   return 0;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  663
10cd19d8803330 Shannon Nelson 2023-05-15  664  err_unevent:
10cd19d8803330 Shannon Nelson 2023-05-15  665   pds_vdpa_unregister_event_handler(pdsv);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  666  err_unmap:
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  667   put_device(&pdsv->vdpa_dev.dev);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  668   vdpa_aux->pdsv = NULL;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  669   return err;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  670  }
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  671

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/virtualization



[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux