Re: [PATCH vhost next 09/10] vdpa/mlx5: Add shared memory registration code

From: kernel test robot
Date: Thu Jul 16 2020 - 10:20:23 EST


Hi Eli,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on next-20200715]

url: https://github.com/0day-ci/linux/commits/Eli-Cohen/VDPA-support-for-Mellanox-ConnectX-devices/20200716-155039
base: ca0e494af5edb59002665bf12871e94b4163a257
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.0
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
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=ia64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

120 | __fswab32(x))
| ^
include/linux/byteorder/generic.h:94:21: note: in expansion of macro '__cpu_to_be32'
94 | #define cpu_to_be32 __cpu_to_be32
| ^~~~~~~~~~~~~
include/linux/stddef.h:17:32: note: in expansion of macro '__compiler_offsetof'
17 | #define offsetof(TYPE, MEMBER) __compiler_offsetof(TYPE, MEMBER)
| ^~~~~~~~~~~~~~~~~~~
include/linux/mlx5/device.h:51:35: note: in expansion of macro 'offsetof'
51 | #define __mlx5_bit_off(typ, fld) (offsetof(struct mlx5_ifc_##typ##_bits, fld))
| ^~~~~~~~
include/linux/mlx5/device.h:56:70: note: in expansion of macro '__mlx5_bit_off'
56 | #define __mlx5_dw_bit_off(typ, fld) (32 - __mlx5_bit_sz(typ, fld) - (__mlx5_bit_off(typ, fld) & 0x1f))
| ^~~~~~~~~~~~~~
include/linux/mlx5/device.h:58:60: note: in expansion of macro '__mlx5_dw_bit_off'
58 | #define __mlx5_dw_mask(typ, fld) (__mlx5_mask(typ, fld) << __mlx5_dw_bit_off(typ, fld))
| ^~~~~~~~~~~~~~~~~
include/linux/mlx5/device.h:78:10: note: in expansion of macro '__mlx5_dw_mask'
78 | (~__mlx5_dw_mask(typ, fld))) | (((_v) & __mlx5_mask(typ, fld)) \
| ^~~~~~~~~~~~~~
drivers/vdpa/mlx5/core/mr.c:194:2: note: in expansion of macro 'MLX5_SET'
194 | MLX5_SET(create_mkey_in, in, uid, mvdev->res.uid);
| ^~~~~~~~
include/linux/mlx5/device.h:50:57: error: 'struct mlx5_ifc_create_mkey_in_bits' has no member named 'uid'
50 | #define __mlx5_bit_sz(typ, fld) sizeof(__mlx5_nullp(typ)->fld)
| ^~
include/uapi/linux/swab.h:120:12: note: in definition of macro '__swab32'
120 | __fswab32(x))
| ^
include/linux/byteorder/generic.h:94:21: note: in expansion of macro '__cpu_to_be32'
94 | #define cpu_to_be32 __cpu_to_be32
| ^~~~~~~~~~~~~
include/linux/mlx5/device.h:57:47: note: in expansion of macro '__mlx5_bit_sz'
57 | #define __mlx5_mask(typ, fld) ((u32)((1ull << __mlx5_bit_sz(typ, fld)) - 1))
| ^~~~~~~~~~~~~
include/linux/mlx5/device.h:78:48: note: in expansion of macro '__mlx5_mask'
78 | (~__mlx5_dw_mask(typ, fld))) | (((_v) & __mlx5_mask(typ, fld)) \
| ^~~~~~~~~~~
drivers/vdpa/mlx5/core/mr.c:194:2: note: in expansion of macro 'MLX5_SET'
194 | MLX5_SET(create_mkey_in, in, uid, mvdev->res.uid);
| ^~~~~~~~
include/linux/mlx5/device.h:50:57: error: 'struct mlx5_ifc_create_mkey_in_bits' has no member named 'uid'
50 | #define __mlx5_bit_sz(typ, fld) sizeof(__mlx5_nullp(typ)->fld)
| ^~
include/uapi/linux/swab.h:120:12: note: in definition of macro '__swab32'
120 | __fswab32(x))
| ^
include/linux/byteorder/generic.h:94:21: note: in expansion of macro '__cpu_to_be32'
94 | #define cpu_to_be32 __cpu_to_be32
| ^~~~~~~~~~~~~
include/linux/mlx5/device.h:56:43: note: in expansion of macro '__mlx5_bit_sz'
56 | #define __mlx5_dw_bit_off(typ, fld) (32 - __mlx5_bit_sz(typ, fld) - (__mlx5_bit_off(typ, fld) & 0x1f))
| ^~~~~~~~~~~~~
include/linux/mlx5/device.h:79:11: note: in expansion of macro '__mlx5_dw_bit_off'
79 | << __mlx5_dw_bit_off(typ, fld))); \
| ^~~~~~~~~~~~~~~~~
drivers/vdpa/mlx5/core/mr.c:194:2: note: in expansion of macro 'MLX5_SET'
194 | MLX5_SET(create_mkey_in, in, uid, mvdev->res.uid);
| ^~~~~~~~
include/linux/compiler_types.h:135:35: error: 'struct mlx5_ifc_create_mkey_in_bits' has no member named 'uid'
135 | #define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
| ^~~~~~~~~~~~~~~~~~
include/uapi/linux/swab.h:120:12: note: in definition of macro '__swab32'
120 | __fswab32(x))
| ^
include/linux/byteorder/generic.h:94:21: note: in expansion of macro '__cpu_to_be32'
94 | #define cpu_to_be32 __cpu_to_be32
| ^~~~~~~~~~~~~
include/linux/stddef.h:17:32: note: in expansion of macro '__compiler_offsetof'
17 | #define offsetof(TYPE, MEMBER) __compiler_offsetof(TYPE, MEMBER)
| ^~~~~~~~~~~~~~~~~~~
include/linux/mlx5/device.h:51:35: note: in expansion of macro 'offsetof'
51 | #define __mlx5_bit_off(typ, fld) (offsetof(struct mlx5_ifc_##typ##_bits, fld))
| ^~~~~~~~
include/linux/mlx5/device.h:56:70: note: in expansion of macro '__mlx5_bit_off'
56 | #define __mlx5_dw_bit_off(typ, fld) (32 - __mlx5_bit_sz(typ, fld) - (__mlx5_bit_off(typ, fld) & 0x1f))
| ^~~~~~~~~~~~~~
include/linux/mlx5/device.h:79:11: note: in expansion of macro '__mlx5_dw_bit_off'
79 | << __mlx5_dw_bit_off(typ, fld))); \
| ^~~~~~~~~~~~~~~~~
drivers/vdpa/mlx5/core/mr.c:194:2: note: in expansion of macro 'MLX5_SET'
194 | MLX5_SET(create_mkey_in, in, uid, mvdev->res.uid);
| ^~~~~~~~
In file included from arch/ia64/include/asm/ptrace.h:46,
from arch/ia64/include/asm/processor.h:20,
from arch/ia64/include/asm/thread_info.h:12,
from include/linux/thread_info.h:38,
from include/asm-generic/preempt.h:5,
from ./arch/ia64/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:78,
from include/linux/rcupdate.h:27,
from include/linux/rculist.h:11,
from include/linux/pid.h:5,
from include/linux/sched.h:14,
from include/linux/ratelimit.h:6,
from include/linux/dev_printk.h:16,
from include/linux/device.h:15,
from include/linux/vdpa.h:6,
from drivers/vdpa/mlx5/core/mr.c:4:
drivers/vdpa/mlx5/core/mr.c: In function 'map_direct_mr':
>> drivers/vdpa/mlx5/core/mr.c:254:21: error: implicit declaration of function '__phys_to_pfn'; did you mean 'page_to_pfn'? [-Werror=implicit-function-declaration]
254 | pg = pfn_to_page(__phys_to_pfn(pa));
| ^~~~~~~~~~~~~
arch/ia64/include/asm/page.h:108:40: note: in definition of macro 'pfn_to_page'
108 | # define pfn_to_page(pfn) (vmem_map + (pfn))
| ^~~
drivers/vdpa/mlx5/core/mr.c: At top level:
drivers/vdpa/mlx5/core/mr.c:414:5: warning: no previous prototype for 'mlx5_vdpa_create_mr' [-Wmissing-prototypes]
414 | int mlx5_vdpa_create_mr(struct mlx5_vdpa_dev *mvdev, struct vhost_iotlb *iotlb)
| ^~~~~~~~~~~~~~~~~~~
drivers/vdpa/mlx5/core/mr.c:425:6: warning: no previous prototype for 'mlx5_vdpa_destroy_mr' [-Wmissing-prototypes]
425 | void mlx5_vdpa_destroy_mr(struct mlx5_vdpa_dev *mvdev)
| ^~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +254 drivers/vdpa/mlx5/core/mr.c

215
216 static int map_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct_mr *mr,
217 struct vhost_iotlb *iotlb)
218 {
219 struct vhost_iotlb_map *map;
220 unsigned long lgcd = 0;
221 int log_entity_size;
222 unsigned long size;
223 u64 start = 0;
224 int err;
225 struct page *pg;
226 unsigned int nsg;
227 int sglen;
228 u64 pa;
229 u64 paend;
230 struct scatterlist *sg;
231 struct device *dma = mvdev->mdev->device;
232 int ret;
233
234 for (map = vhost_iotlb_itree_first(iotlb, mr->start, mr->end - 1);
235 map; map = vhost_iotlb_itree_next(map, start, mr->end - 1)) {
236 size = maplen(map, mr);
237 lgcd = gcd(lgcd, size);
238 start += size;
239 }
240 log_entity_size = ilog2(lgcd);
241
242 sglen = 1 << log_entity_size;
243 nsg = DIV_ROUND_UP(mr->end - mr->start, sglen);
244
245 err = sg_alloc_table(&mr->sg_head, nsg, GFP_KERNEL);
246 if (err)
247 return err;
248
249 sg = mr->sg_head.sgl;
250 for (map = vhost_iotlb_itree_first(iotlb, mr->start, mr->end - 1);
251 map; map = vhost_iotlb_itree_next(map, mr->start, mr->end - 1)) {
252 paend = map->addr + maplen(map, mr);
253 for (pa = map->addr; pa < paend; pa += sglen) {
> 254 pg = pfn_to_page(__phys_to_pfn(pa));
255 if (!sg) {
256 mlx5_vdpa_warn(mvdev, "sg null. start 0x%llx, end 0x%llx\n",
257 map->start, map->last + 1);
258 err = -ENOMEM;
259 goto err_map;
260 }
261 sg_set_page(sg, pg, sglen, 0);
262 sg = sg_next(sg);
263 if (!sg)
264 goto done;
265 }
266 }
267 done:
268 mr->log_size = log_entity_size;
269 mr->nsg = nsg;
270 ret = dma_map_sg_attrs(dma, mr->sg_head.sgl, mr->nsg, DMA_BIDIRECTIONAL, 0);
271 if (!ret)
272 goto err_map;
273
274 err = create_direct_mr(mvdev, mr);
275 if (err)
276 goto err_direct;
277
278 return 0;
279
280 err_direct:
281 dma_unmap_sg_attrs(dma, mr->sg_head.sgl, mr->nsg, DMA_BIDIRECTIONAL, 0);
282 err_map:
283 sg_free_table(&mr->sg_head);
284 return err;
285 }
286

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip