Message ID | 81a6066c0f0d6dfa06f41c016abfb7152064e33e.1680038771.git.reinette.chatre@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | vfio/pci: Support dynamic allocation of MSI-X interrupts | expand |
Hi Reinette, I love your patch! Yet something to improve: [auto build test ERROR on 197b6b60ae7bc51dd0814953c562833143b292aa] url: https://github.com/intel-lab-lkp/linux/commits/Reinette-Chatre/vfio-pci-Consolidate-irq-cleanup-on-MSI-MSI-X-disable/20230329-055735 base: 197b6b60ae7bc51dd0814953c562833143b292aa patch link: https://lore.kernel.org/r/81a6066c0f0d6dfa06f41c016abfb7152064e33e.1680038771.git.reinette.chatre%40intel.com patch subject: [PATCH V2 8/8] vfio/pci: Clear VFIO_IRQ_INFO_NORESIZE for MSI-X config: i386-randconfig-a001-20230327 (https://download.01.org/0day-ci/archive/20230329/202303291114.8inU0hbN-lkp@intel.com/config) compiler: gcc-11 (Debian 11.3.0-8) 11.3.0 reproduce (this is a W=1 build): # https://github.com/intel-lab-lkp/linux/commit/39bc54993b029037b12b4a7e947d6cd500065c6b git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Reinette-Chatre/vfio-pci-Consolidate-irq-cleanup-on-MSI-MSI-X-disable/20230329-055735 git checkout 39bc54993b029037b12b4a7e947d6cd500065c6b # save the config file mkdir build_dir && cp config build_dir/.config make W=1 O=build_dir ARCH=i386 olddefconfig make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/vfio/pci/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Link: https://lore.kernel.org/oe-kbuild-all/202303291114.8inU0hbN-lkp@intel.com/ All errors (new ones prefixed by >>): drivers/vfio/pci/vfio_pci_core.c: In function 'vfio_pci_ioctl_get_irq_info': >> drivers/vfio/pci/vfio_pci_core.c:1116:20: error: implicit declaration of function 'pci_msix_can_alloc_dyn' [-Werror=implicit-function-declaration] 1116 | !pci_msix_can_alloc_dyn(vdev->pdev))) | ^~~~~~~~~~~~~~~~~~~~~~ cc1: some warnings being treated as errors vim +/pci_msix_can_alloc_dyn +1116 drivers/vfio/pci/vfio_pci_core.c 1082 1083 static int vfio_pci_ioctl_get_irq_info(struct vfio_pci_core_device *vdev, 1084 struct vfio_irq_info __user *arg) 1085 { 1086 unsigned long minsz = offsetofend(struct vfio_irq_info, count); 1087 struct vfio_irq_info info; 1088 1089 if (copy_from_user(&info, arg, minsz)) 1090 return -EFAULT; 1091 1092 if (info.argsz < minsz || info.index >= VFIO_PCI_NUM_IRQS) 1093 return -EINVAL; 1094 1095 switch (info.index) { 1096 case VFIO_PCI_INTX_IRQ_INDEX ... VFIO_PCI_MSIX_IRQ_INDEX: 1097 case VFIO_PCI_REQ_IRQ_INDEX: 1098 break; 1099 case VFIO_PCI_ERR_IRQ_INDEX: 1100 if (pci_is_pcie(vdev->pdev)) 1101 break; 1102 fallthrough; 1103 default: 1104 return -EINVAL; 1105 } 1106 1107 info.flags = VFIO_IRQ_INFO_EVENTFD; 1108 1109 info.count = vfio_pci_get_irq_count(vdev, info.index); 1110 1111 if (info.index == VFIO_PCI_INTX_IRQ_INDEX) 1112 info.flags |= 1113 (VFIO_IRQ_INFO_MASKABLE | VFIO_IRQ_INFO_AUTOMASKED); 1114 else if ((info.index != VFIO_PCI_MSIX_IRQ_INDEX) || 1115 (info.index == VFIO_PCI_MSIX_IRQ_INDEX && > 1116 !pci_msix_can_alloc_dyn(vdev->pdev))) 1117 info.flags |= VFIO_IRQ_INFO_NORESIZE; 1118 1119 return copy_to_user(arg, &info, minsz) ? -EFAULT : 0; 1120 } 1121
Hi Reinette, I love your patch! Yet something to improve: [auto build test ERROR on 197b6b60ae7bc51dd0814953c562833143b292aa] url: https://github.com/intel-lab-lkp/linux/commits/Reinette-Chatre/vfio-pci-Consolidate-irq-cleanup-on-MSI-MSI-X-disable/20230329-055735 base: 197b6b60ae7bc51dd0814953c562833143b292aa patch link: https://lore.kernel.org/r/81a6066c0f0d6dfa06f41c016abfb7152064e33e.1680038771.git.reinette.chatre%40intel.com patch subject: [PATCH V2 8/8] vfio/pci: Clear VFIO_IRQ_INFO_NORESIZE for MSI-X config: i386-randconfig-a014-20230327 (https://download.01.org/0day-ci/archive/20230329/202303291158.UlMhtYCO-lkp@intel.com/config) compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1) 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/intel-lab-lkp/linux/commit/39bc54993b029037b12b4a7e947d6cd500065c6b git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Reinette-Chatre/vfio-pci-Consolidate-irq-cleanup-on-MSI-MSI-X-disable/20230329-055735 git checkout 39bc54993b029037b12b4a7e947d6cd500065c6b # 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=i386 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/vfio/pci/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Link: https://lore.kernel.org/oe-kbuild-all/202303291158.UlMhtYCO-lkp@intel.com/ All errors (new ones prefixed by >>): >> drivers/vfio/pci/vfio_pci_core.c:1116:6: error: implicit declaration of function 'pci_msix_can_alloc_dyn' is invalid in C99 [-Werror,-Wimplicit-function-declaration] !pci_msix_can_alloc_dyn(vdev->pdev))) ^ 1 error generated. vim +/pci_msix_can_alloc_dyn +1116 drivers/vfio/pci/vfio_pci_core.c 1082 1083 static int vfio_pci_ioctl_get_irq_info(struct vfio_pci_core_device *vdev, 1084 struct vfio_irq_info __user *arg) 1085 { 1086 unsigned long minsz = offsetofend(struct vfio_irq_info, count); 1087 struct vfio_irq_info info; 1088 1089 if (copy_from_user(&info, arg, minsz)) 1090 return -EFAULT; 1091 1092 if (info.argsz < minsz || info.index >= VFIO_PCI_NUM_IRQS) 1093 return -EINVAL; 1094 1095 switch (info.index) { 1096 case VFIO_PCI_INTX_IRQ_INDEX ... VFIO_PCI_MSIX_IRQ_INDEX: 1097 case VFIO_PCI_REQ_IRQ_INDEX: 1098 break; 1099 case VFIO_PCI_ERR_IRQ_INDEX: 1100 if (pci_is_pcie(vdev->pdev)) 1101 break; 1102 fallthrough; 1103 default: 1104 return -EINVAL; 1105 } 1106 1107 info.flags = VFIO_IRQ_INFO_EVENTFD; 1108 1109 info.count = vfio_pci_get_irq_count(vdev, info.index); 1110 1111 if (info.index == VFIO_PCI_INTX_IRQ_INDEX) 1112 info.flags |= 1113 (VFIO_IRQ_INFO_MASKABLE | VFIO_IRQ_INFO_AUTOMASKED); 1114 else if ((info.index != VFIO_PCI_MSIX_IRQ_INDEX) || 1115 (info.index == VFIO_PCI_MSIX_IRQ_INDEX && > 1116 !pci_msix_can_alloc_dyn(vdev->pdev))) 1117 info.flags |= VFIO_IRQ_INFO_NORESIZE; 1118 1119 return copy_to_user(arg, &info, minsz) ? -EFAULT : 0; 1120 } 1121
diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c index ae0e161c7fc9..c679d7b59f9b 100644 --- a/drivers/vfio/pci/vfio_pci_core.c +++ b/drivers/vfio/pci/vfio_pci_core.c @@ -1111,7 +1111,9 @@ static int vfio_pci_ioctl_get_irq_info(struct vfio_pci_core_device *vdev, if (info.index == VFIO_PCI_INTX_IRQ_INDEX) info.flags |= (VFIO_IRQ_INFO_MASKABLE | VFIO_IRQ_INFO_AUTOMASKED); - else + else if ((info.index != VFIO_PCI_MSIX_IRQ_INDEX) || + (info.index == VFIO_PCI_MSIX_IRQ_INDEX && + !pci_msix_can_alloc_dyn(vdev->pdev))) info.flags |= VFIO_IRQ_INFO_NORESIZE; return copy_to_user(arg, &info, minsz) ? -EFAULT : 0; diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h index 0552e8dcf0cb..1a36134cae5c 100644 --- a/include/uapi/linux/vfio.h +++ b/include/uapi/linux/vfio.h @@ -511,6 +511,9 @@ struct vfio_region_info_cap_nvlink2_lnkspd { * then add and unmask vectors, it's up to userspace to make the decision * whether to allocate the maximum supported number of vectors or tear * down setup and incrementally increase the vectors as each is enabled. + * Absence of the NORESIZE flag indicates that vectors can be enabled + * and disabled dynamically without impacting other vectors within the + * index. */ struct vfio_irq_info { __u32 argsz;
Dynamic MSI-X is supported. Clear VFIO_IRQ_INFO_NORESIZE to provide guidance to user space. Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> --- Changes since RFC V1: - Only advertise VFIO_IRQ_INFO_NORESIZE for MSI-X devices that can actually support dynamic allocation. (Alex) drivers/vfio/pci/vfio_pci_core.c | 4 +++- include/uapi/linux/vfio.h | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-)