vhost: drop vring dependency on iotlb
Subsystems (5)
Michael S. Tsirkin
maintainerPATCH 1/1 vhost: drop vring dependency on iotlb
vringh can now be built without IOTLB.
Select IOTLB directly where it's used.
---
This is on top of my previous patch (in vhost tree now).
drivers/vdpa/Kconfig | 1 + drivers/vhost/Kconfig | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)
drivers/vdpa/Kconfig +1 -0
@@ -17,6 +17,7 @@ config VDPA_SIM depends on RUNTIME_TESTING_MENU select VDPA select VHOST_RING + select VHOST_IOTLB default n help vDPA networking device simulator which loop TX traffic back
drivers/vhost/Kconfig +0 -1
@@ -6,7 +6,6 @@ config VHOST_IOTLB config VHOST_RING tristate - select VHOST_IOTLB help This option is selected by any driver which needs to access the host side of a virtio ring.
Signature · 1 line
MST
Quoted 29 lines · Michael S. Tsirkin
vringh can now be built without IOTLB.
Select IOTLB directly where it's used.Signed-off-by Michael S. Tsirkin <[email protected]>---
This is on top of my previous patch (in vhost tree now).
drivers/vdpa/Kconfig | 1 + drivers/vhost/Kconfig | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)drivers/vdpa/Kconfig +1
-0@@ -17,6 +17,7 @@ config VDPA_SIM depends on RUNTIME_TESTING_MENU select VDPA select VHOST_RING + select VHOST_IOTLB default n help vDPA networking device simulator which loop TX traffic backdrivers/vhost/Kconfig +0
-0
drivers/vhost/Kconfig config VHOST_IOTLB · line 11
Quoted 7 lines
drivers/vhost/Kconfig +0
-1@@ -6,7 +6,6 @@ config VHOST_IOTLB config VHOST_RING tristate - select VHOST_IOTLB help This option is selected by any driver which needs to access the host side of a virtio ring.
Do we need to mention driver need to select VHOST_IOTLB by itself here?
Thanks
Michael S. Tsirkin
maintainerQuoted 41 lines · Jason Wang
Quoted 29 lines · Michael S. Tsirkin
vringh can now be built without IOTLB.
Select IOTLB directly where it's used.Signed-off-by Michael S. Tsirkin <[email protected]>---
This is on top of my previous patch (in vhost tree now).
drivers/vdpa/Kconfig | 1 + drivers/vhost/Kconfig | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)drivers/vdpa/Kconfig +1
-0@@ -17,6 +17,7 @@ config VDPA_SIM depends on RUNTIME_TESTING_MENU select VDPA select VHOST_RING + select VHOST_IOTLB default n help vDPA networking device simulator which loop TX traffic backdrivers/vhost/Kconfig +0
-0drivers/vhost/Kconfig config VHOST_IOTLB · line 10
Quoted 6 lines
drivers/vhost/Kconfig +0
-1@@ -6,7 +6,6 @@ config VHOST_IOTLB config VHOST_RING tristate - select VHOST_IOTLB help This option is selected by any driver which needs to access the host side of a virtio ring.Do we need to mention driver need to select
VHOST_IOTLBby itself here?
Quoted 2 lines
Thanks
OK but I guess it's best to do it near where VHOST_IOTLB is defined. Like this?
drivers/vhost/Kconfig +2 -0
@@ -3,6 +3,8 @@ config VHOST_IOTLB tristate help Generic IOTLB implementation for vhost and vringh. + This option is selected by any driver which needs to support + an IOMMU in software. config VHOST_RING tristate
Quoted 52 lines · Michael S. Tsirkin
Quoted 39 lines · Jason Wang
Quoted 29 lines · Michael S. Tsirkin
vringh can now be built without IOTLB.
Select IOTLB directly where it's used.Signed-off-by Michael S. Tsirkin <[email protected]>---
This is on top of my previous patch (in vhost tree now).
drivers/vdpa/Kconfig | 1 + drivers/vhost/Kconfig | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)drivers/vdpa/Kconfig +1
-0@@ -17,6 +17,7 @@ config VDPA_SIM depends on RUNTIME_TESTING_MENU select VDPA select VHOST_RING + select VHOST_IOTLB default n help vDPA networking device simulator which loop TX traffic backdrivers/vhost/Kconfig +0
-0drivers/vhost/Kconfig config VHOST_IOTLB · line 10
Quoted 6 lines
drivers/vhost/Kconfig +0
-1@@ -6,7 +6,6 @@ config VHOST_IOTLB config VHOST_RING tristate - select VHOST_IOTLB help This option is selected by any driver which needs to access the host side of a virtio ring.Do we need to mention driver need to select
VHOST_IOTLBby itself here?Quoted 2 lines
Thanks
OK but I guess it's best to do it near where
VHOST_IOTLBis defined. Like this?drivers/vhost/Kconfig +0
-0
drivers/vhost/Kconfig config VHOST_IOTLB · line 10
Quoted 8 lines
drivers/vhost/Kconfig +2
-0@@ -3,6 +3,8 @@ config VHOST_IOTLB tristate help Generic IOTLB implementation for vhost and vringh. + This option is selected by any driver which needs to support + an IOMMU in software. config VHOST_RING tristate
Yes, probably.
Thanks
kbuild test robot
build botI love your patch! Yet something to improve:
Hi "Michael,
I love your patch! Yet something to improve:
[auto build test ERROR on vhost/linux-next]
[also build test ERROR on next-20200403]
[cannot apply to linus/master linux/master v5.6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Michael-S-Tsirkin/vhost-drop-vring-dependency-on-iotlb/20200403-203000 base: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next config: s390-randconfig-a001-20200403 (attached as .config) compiler: s390-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=9.3.0 make.cross ARCH=s390
If you fix the issue, kindly add following tag
All errors (new ones prefixed by >>):
s390-linux-ld: drivers/vhost/vringh.o: in function `iotlb_translate':
>> drivers/vhost/vringh.c:1079: undefined reference to `vhost_iotlb_itree_first'
vim +1079 drivers/vhost/vringh.c
f558a845c3a043d Dave Jones 2013-05-03 1061
9ad9c49cfe970b0 Jason Wang 2020-03-26 1062 static int iotlb_translate(const struct vringh *vrh,
9ad9c49cfe970b0 Jason Wang 2020-03-26 1063 u64 addr, u64 len, struct bio_vec iov[],
9ad9c49cfe970b0 Jason Wang 2020-03-26 1064 int iov_size, u32 perm)
9ad9c49cfe970b0 Jason Wang 2020-03-26 1065 {
9ad9c49cfe970b0 Jason Wang 2020-03-26 1066 struct vhost_iotlb_map *map;
9ad9c49cfe970b0 Jason Wang 2020-03-26 1067 struct vhost_iotlb *iotlb = vrh->iotlb;
9ad9c49cfe970b0 Jason Wang 2020-03-26 1068 int ret = 0;
9ad9c49cfe970b0 Jason Wang 2020-03-26 1069 u64 s = 0;
9ad9c49cfe970b0 Jason Wang 2020-03-26 1070
9ad9c49cfe970b0 Jason Wang 2020-03-26 1071 while (len > s) {
9ad9c49cfe970b0 Jason Wang 2020-03-26 1072 u64 size, pa, pfn;
9ad9c49cfe970b0 Jason Wang 2020-03-26 1073
9ad9c49cfe970b0 Jason Wang 2020-03-26 1074 if (unlikely(ret >= iov_size)) {
9ad9c49cfe970b0 Jason Wang 2020-03-26 1075 ret = -ENOBUFS;
9ad9c49cfe970b0 Jason Wang 2020-03-26 1076 break;
9ad9c49cfe970b0 Jason Wang 2020-03-26 1077 }
9ad9c49cfe970b0 Jason Wang 2020-03-26 1078
9ad9c49cfe970b0 Jason Wang 2020-03-26 @1079 map = vhost_iotlb_itree_first(iotlb, addr,
9ad9c49cfe970b0 Jason Wang 2020-03-26 1080 addr + len - 1);
9ad9c49cfe970b0 Jason Wang 2020-03-26 1081 if (!map || map->start > addr) {
9ad9c49cfe970b0 Jason Wang 2020-03-26 1082 ret = -EINVAL;
9ad9c49cfe970b0 Jason Wang 2020-03-26 1083 break;
9ad9c49cfe970b0 Jason Wang 2020-03-26 1084 } else if (!(map->perm & perm)) {
9ad9c49cfe970b0 Jason Wang 2020-03-26 1085 ret = -EPERM;
9ad9c49cfe970b0 Jason Wang 2020-03-26 1086 break;
9ad9c49cfe970b0 Jason Wang 2020-03-26 1087 }
9ad9c49cfe970b0 Jason Wang 2020-03-26 1088
9ad9c49cfe970b0 Jason Wang 2020-03-26 1089 size = map->size - addr + map->start;
9ad9c49cfe970b0 Jason Wang 2020-03-26 1090 pa = map->addr + addr - map->start;
9ad9c49cfe970b0 Jason Wang 2020-03-26 1091 pfn = pa >> PAGE_SHIFT;
9ad9c49cfe970b0 Jason Wang 2020-03-26 1092 iov[ret].bv_page = pfn_to_page(pfn);
9ad9c49cfe970b0 Jason Wang 2020-03-26 1093 iov[ret].bv_len = min(len - s, size);
9ad9c49cfe970b0 Jason Wang 2020-03-26 1094 iov[ret].bv_offset = pa & (PAGE_SIZE - 1);
9ad9c49cfe970b0 Jason Wang 2020-03-26 1095 s += size;
9ad9c49cfe970b0 Jason Wang 2020-03-26 1096 addr += size;
9ad9c49cfe970b0 Jason Wang 2020-03-26 1097 ++ret;
9ad9c49cfe970b0 Jason Wang 2020-03-26 1098 }
9ad9c49cfe970b0 Jason Wang 2020-03-26 1099
9ad9c49cfe970b0 Jason Wang 2020-03-26 1100 return ret;
9ad9c49cfe970b0 Jason Wang 2020-03-26 1101 }
9ad9c49cfe970b0 Jason Wang 2020-03-26 1102 :::::: The code at line 1079 was first introduced by commit :::::: 9ad9c49cfe970b053bb0ef323b682dd1b4d4f8a0 vringh: IOTLB support
:::::: TO: Jason Wang <[email protected]>
:::::: CC: Michael S. Tsirkin <[email protected]>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org