Content-Type: multipart/mixed; boundary="===============0894262349225104300==" MIME-Version: 1.0 From: kernel test robot To: kbuild-all@lists.01.org Subject: Re: [PATCH V3 4/4] vDPA/ifcvf: implement shared IRQ feature Date: Mon, 31 Jan 2022 14:40:00 +0800 Message-ID: <202201311421.yRzlUeOz-lkp@intel.com> In-Reply-To: <20220126124912.90205-5-lingshan.zhu@intel.com> List-Id: --===============0894262349225104300== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Zhu, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on mst-vhost/linux-next] [also build test WARNING on horms-ipvs/master linus/master v5.17-rc2 next-2= 0220128] [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/Zhu-Lingshan/vDPA-ifcvf-im= plement-shared-IRQ-feature/20220126-205804 base: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux= -next config: i386-randconfig-m021-20220131 (https://download.01.org/0day-ci/arch= ive/20220131/202201311421.yRzlUeOz-lkp(a)intel.com/config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot smatch warnings: drivers/vdpa/ifcvf/ifcvf_main.c:89 ifcvf_free_vq_irq() warn: inconsistent i= ndenting drivers/vdpa/ifcvf/ifcvf_main.c:265 ifcvf_request_config_irq() error: unini= tialized symbol 'config_vector'. drivers/vdpa/ifcvf/ifcvf_main.c:274 ifcvf_request_config_irq() warn: incons= istent indenting vim +89 drivers/vdpa/ifcvf/ifcvf_main.c 75 = 76 static void ifcvf_free_vq_irq(struct ifcvf_adapter *adapter, int que= ues) 77 { 78 struct pci_dev *pdev =3D adapter->pdev; 79 struct ifcvf_hw *vf =3D &adapter->vf; 80 int i; 81 = 82 if (vf->msix_vector_status =3D=3D MSIX_VECTOR_PER_VQ_AND_CONFIG) { 83 for (i =3D 0; i < queues; i++) { 84 devm_free_irq(&pdev->dev, vf->vring[i].irq, &vf->vring[i]); 85 vf->vring[i].irq =3D -EINVAL; 86 } 87 } else { 88 devm_free_irq(&pdev->dev, vf->vqs_shared_irq, vf); > 89 } vf->vqs_shared_irq =3D -EINVAL; 90 } 91 = 92 static void ifcvf_free_config_irq(struct ifcvf_adapter *adapter) 93 { 94 struct pci_dev *pdev =3D adapter->pdev; 95 struct ifcvf_hw *vf =3D &adapter->vf; 96 = 97 /* If the irq is shared by all vqs and the config interrupt, 98 * it is already freed in ifcvf_free_vq_irq, so here only 99 * need to free config irq when msix_vector_status !=3D MSIX_VECTOR= _DEV_SHARED 100 */ 101 if (vf->msix_vector_status !=3D MSIX_VECTOR_DEV_SHARED) { 102 devm_free_irq(&pdev->dev, vf->config_irq, vf); 103 vf->config_irq =3D -EINVAL; 104 } 105 } 106 = 107 static void ifcvf_free_irq(struct ifcvf_adapter *adapter, int queues) 108 { 109 struct pci_dev *pdev =3D adapter->pdev; 110 = 111 ifcvf_free_vq_irq(adapter, queues); 112 ifcvf_free_config_irq(adapter); 113 ifcvf_free_irq_vectors(pdev); 114 } 115 = 116 /* ifcvf MSIX vectors allocator, this helper tries to allocate 117 * vectors for all virtqueues and the config interrupt. 118 * It returns the number of allocated vectors, negative 119 * return value when fails. 120 */ 121 static int ifcvf_alloc_vectors(struct ifcvf_adapter *adapter) 122 { 123 struct pci_dev *pdev =3D adapter->pdev; 124 struct ifcvf_hw *vf =3D &adapter->vf; 125 int max_intr, ret; 126 = 127 /* all queues and config interrupt */ 128 max_intr =3D vf->nr_vring + 1; 129 ret =3D pci_alloc_irq_vectors(pdev, 1, max_intr, PCI_IRQ_MSIX | PCI= _IRQ_AFFINITY); 130 = 131 if (ret < 0) { 132 IFCVF_ERR(pdev, "Failed to alloc IRQ vectors\n"); 133 return ret; 134 } 135 = 136 if (ret < max_intr) 137 IFCVF_INFO(pdev, 138 "Requested %u vectors, however only %u allocated, lower perfor= mance\n", 139 max_intr, ret); 140 = 141 return ret; 142 } 143 = 144 static int ifcvf_request_per_vq_irq(struct ifcvf_adapter *adapter) 145 { 146 struct pci_dev *pdev =3D adapter->pdev; 147 struct ifcvf_hw *vf =3D &adapter->vf; 148 int i, vector, ret, irq; 149 = 150 for (i =3D 0; i < vf->nr_vring; i++) { 151 snprintf(vf->vring[i].msix_name, 256, "ifcvf[%s]-%d\n", pci_name(p= dev), i); 152 vector =3D i; 153 irq =3D pci_irq_vector(pdev, vector); 154 ret =3D devm_request_irq(&pdev->dev, irq, 155 ifcvf_intr_handler, 0, 156 vf->vring[i].msix_name, 157 &vf->vring[i]); 158 if (ret) { 159 IFCVF_ERR(pdev, "Failed to request irq for vq %d\n", i); 160 ifcvf_free_vq_irq(adapter, i); 161 } else { 162 vf->vring[i].irq =3D irq; 163 ifcvf_set_vq_vector(vf, i, vector); 164 } 165 } 166 = 167 vf->vqs_shared_irq =3D -EINVAL; 168 = 169 return 0; 170 } 171 = 172 static int ifcvf_request_shared_vq_irq(struct ifcvf_adapter *adapter) 173 { 174 struct pci_dev *pdev =3D adapter->pdev; 175 struct ifcvf_hw *vf =3D &adapter->vf; 176 int i, vector, ret, irq; 177 = 178 vector =3D 0; 179 /* reuse msix_name[256] space of vring0 to store shared vqs interru= pt name */ 180 snprintf(vf->vring[0].msix_name, 256, "ifcvf[%s]-vqs-shared-irq\n",= pci_name(pdev)); 181 irq =3D pci_irq_vector(pdev, vector); 182 ret =3D devm_request_irq(&pdev->dev, irq, 183 ifcvf_vq_shared_intr_handler, 0, 184 vf->vring[0].msix_name, vf); 185 if (ret) { 186 IFCVF_ERR(pdev, "Failed to request shared irq for vf\n"); 187 = 188 return ret; 189 } 190 = 191 vf->vqs_shared_irq =3D irq; 192 for (i =3D 0; i < vf->nr_vring; i++) { 193 vf->vring[i].irq =3D -EINVAL; 194 ifcvf_set_vq_vector(vf, i, vector); 195 } 196 = 197 return 0; 198 = 199 } 200 = 201 static int ifcvf_request_dev_shared_irq(struct ifcvf_adapter *adapte= r) 202 { 203 struct pci_dev *pdev =3D adapter->pdev; 204 struct ifcvf_hw *vf =3D &adapter->vf; 205 int i, vector, ret, irq; 206 = 207 vector =3D 0; 208 /* reuse msix_name[256] space of vring0 to store shared device inte= rrupt name */ 209 snprintf(vf->vring[0].msix_name, 256, "ifcvf[%s]-dev-shared-irq\n",= pci_name(pdev)); 210 irq =3D pci_irq_vector(pdev, vector); 211 ret =3D devm_request_irq(&pdev->dev, irq, 212 ifcvf_dev_shared_intr_handler, 0, 213 vf->vring[0].msix_name, vf); 214 if (ret) { 215 IFCVF_ERR(pdev, "Failed to request shared irq for vf\n"); 216 = 217 return ret; 218 } 219 = 220 vf->vqs_shared_irq =3D irq; 221 for (i =3D 0; i < vf->nr_vring; i++) { 222 vf->vring[i].irq =3D -EINVAL; 223 ifcvf_set_vq_vector(vf, i, vector); 224 } 225 = 226 vf->config_irq =3D irq; 227 ifcvf_set_config_vector(vf, vector); 228 = 229 return 0; 230 = 231 } 232 = 233 static int ifcvf_request_vq_irq(struct ifcvf_adapter *adapter) 234 { 235 struct ifcvf_hw *vf =3D &adapter->vf; 236 int ret; 237 = 238 if (vf->msix_vector_status =3D=3D MSIX_VECTOR_PER_VQ_AND_CONFIG) 239 ret =3D ifcvf_request_per_vq_irq(adapter); 240 else 241 ret =3D ifcvf_request_shared_vq_irq(adapter); 242 = 243 return ret; 244 } 245 = 246 static int ifcvf_request_config_irq(struct ifcvf_adapter *adapter) 247 { 248 struct pci_dev *pdev =3D adapter->pdev; 249 struct ifcvf_hw *vf =3D &adapter->vf; 250 int config_vector, ret; 251 = 252 if (vf->msix_vector_status =3D=3D MSIX_VECTOR_DEV_SHARED) 253 return 0; 254 = 255 if (vf->msix_vector_status =3D=3D MSIX_VECTOR_PER_VQ_AND_CONFIG) 256 /* vector 0 ~ vf->nr_vring for vqs, num vf->nr_vring vector for co= nfig interrupt */ 257 config_vector =3D vf->nr_vring; 258 = 259 if (vf->msix_vector_status =3D=3D MSIX_VECTOR_SHARED_VQ_AND_CONFIG) 260 /* vector 0 for vqs and 1 for config interrupt */ 261 config_vector =3D 1; 262 = 263 snprintf(vf->config_msix_name, 256, "ifcvf[%s]-config\n", 264 pci_name(pdev)); > 265 vf->config_irq =3D pci_irq_vector(pdev, config_vector); 266 ret =3D devm_request_irq(&pdev->dev, vf->config_irq, 267 ifcvf_config_changed, 0, 268 vf->config_msix_name, vf); 269 if (ret) { 270 IFCVF_ERR(pdev, "Failed to request config irq\n"); 271 ifcvf_free_vq_irq(adapter, vf->nr_vring); 272 return ret; 273 } > 274 ifcvf_set_config_vector(vf, config_vector); 275 = 276 return 0; 277 } 278 = --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org --===============0894262349225104300==--