Hi Michael, [auto build test ERROR on: v4.4-rc3] [also build test ERROR on: next-20151127] url: https://github.com/0day-ci/linux/commits/Michael-S-Tsirkin/vhost-replace-with-on-data-path/20151130-163704 config: i386-randconfig-s1-201548 (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=i386 All error/warnings (new ones prefixed by >>): drivers/vhost/vhost.c: In function 'vhost_get_vq_desc': >> drivers/vhost/vhost.c:1345:6: warning: unused variable 'ret' [-Wunused-variable] int ret; ^ >> drivers/vhost/vhost.c:1344:13: warning: unused variable 'ring_head' [-Wunused-variable] __virtio16 ring_head; ^ >> drivers/vhost/vhost.c:1341:24: warning: unused variable 'found' [-Wunused-variable] unsigned int i, head, found = 0; ^ >> drivers/vhost/vhost.c:1341:18: warning: unused variable 'head' [-Wunused-variable] unsigned int i, head, found = 0; ^ >> drivers/vhost/vhost.c:1341:15: warning: unused variable 'i' [-Wunused-variable] unsigned int i, head, found = 0; ^ >> drivers/vhost/vhost.c:1340:20: warning: unused variable 'desc' [-Wunused-variable] struct vring_desc desc; ^ drivers/vhost/vhost.c: At top level: >> drivers/vhost/vhost.c:1373:2: error: expected identifier or '(' before 'if' if (unlikely(__get_user(ring_head, ^ In file included from include/uapi/linux/stddef.h:1:0, from include/linux/stddef.h:4, from include/uapi/linux/posix_types.h:4, from include/uapi/linux/types.h:13, from include/linux/types.h:5, from include/uapi/asm-generic/fcntl.h:4, from arch/x86/include/uapi/asm/fcntl.h:1, from include/uapi/linux/fcntl.h:4, from include/linux/fcntl.h:4, from include/linux/eventfd.h:11, from drivers/vhost/vhost.c:14: >> arch/x86/include/asm/uaccess.h:414:2: error: expected identifier or '(' before ')' token }) ^ include/linux/compiler.h:137:45: note: in definition of macro 'unlikely' # define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0)) ^ arch/x86/include/asm/uaccess.h:479:2: note: in expansion of macro '__get_user_nocheck' __get_user_nocheck((x), (ptr), sizeof(*(ptr))) ^ >> drivers/vhost/vhost.c:1373:15: note: in expansion of macro '__get_user' if (unlikely(__get_user(ring_head, ^ >> arch/x86/include/asm/uaccess.h:414:2: error: expected identifier or '(' before ')' token }) ^ include/linux/compiler.h:137:53: note: in definition of macro 'unlikely' # define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0)) ^ arch/x86/include/asm/uaccess.h:479:2: note: in expansion of macro '__get_user_nocheck' __get_user_nocheck((x), (ptr), sizeof(*(ptr))) ^ >> drivers/vhost/vhost.c:1373:15: note: in expansion of macro '__get_user' if (unlikely(__get_user(ring_head, ^ >> include/linux/compiler.h:126:4: error: expected identifier or '(' before ')' token }) ^ include/linux/compiler.h:137:58: note: in expansion of macro '__branch_check__' # define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0)) ^ >> drivers/vhost/vhost.c:1373:6: note: in expansion of macro 'unlikely' if (unlikely(__get_user(ring_head, ^ >> drivers/vhost/vhost.c:1381:2: warning: data definition has no type or storage class head = vhost16_to_cpu(vq, ring_head); ^ >> drivers/vhost/vhost.c:1381:2: error: type defaults to 'int' in declaration of 'head' [-Werror=implicit-int] >> drivers/vhost/vhost.c:1381:24: error: 'vq' undeclared here (not in a function) head = vhost16_to_cpu(vq, ring_head); ^ >> drivers/vhost/vhost.c:1381:28: error: 'ring_head' undeclared here (not in a function) head = vhost16_to_cpu(vq, ring_head); ^ drivers/vhost/vhost.c:1384:2: error: expected identifier or '(' before 'if' if (unlikely(head >= vq->num)) { ^ In file included from include/uapi/linux/stddef.h:1:0, from include/linux/stddef.h:4, from include/uapi/linux/posix_types.h:4, from include/uapi/linux/types.h:13, from include/linux/types.h:5, from include/uapi/asm-generic/fcntl.h:4, from arch/x86/include/uapi/asm/fcntl.h:1, from include/uapi/linux/fcntl.h:4, from include/linux/fcntl.h:4, from include/linux/eventfd.h:11, from drivers/vhost/vhost.c:14: >> include/linux/compiler.h:126:4: error: expected identifier or '(' before ')' token }) ^ include/linux/compiler.h:137:58: note: in expansion of macro '__branch_check__' # define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0)) ^ drivers/vhost/vhost.c:1384:6: note: in expansion of macro 'unlikely' if (unlikely(head >= vq->num)) { ^ drivers/vhost/vhost.c:1391:2: warning: data definition has no type or storage class *out_num = *in_num = 0; ^ >> drivers/vhost/vhost.c:1391:3: error: type defaults to 'int' in declaration of 'out_num' [-Werror=implicit-int] *out_num = *in_num = 0; ^ >> drivers/vhost/vhost.c:1391:14: error: 'in_num' undeclared here (not in a function) *out_num = *in_num = 0; ^ drivers/vhost/vhost.c:1392:2: error: expected identifier or '(' before 'if' if (unlikely(log)) ^ In file included from include/uapi/linux/stddef.h:1:0, from include/linux/stddef.h:4, from include/uapi/linux/posix_types.h:4, from include/uapi/linux/types.h:13, from include/linux/types.h:5, from include/uapi/asm-generic/fcntl.h:4, from arch/x86/include/uapi/asm/fcntl.h:1, from include/uapi/linux/fcntl.h:4, from include/linux/fcntl.h:4, from include/linux/eventfd.h:11, from drivers/vhost/vhost.c:14: vim +1373 drivers/vhost/vhost.c d5675bd2 Michael S. Tsirkin 2010-06-24 1334 * returned on error. */ 47283bef Michael S. Tsirkin 2014-06-05 1335 int vhost_get_vq_desc(struct vhost_virtqueue *vq, 3a4d5c94 Michael S. Tsirkin 2010-01-14 1336 struct iovec iov[], unsigned int iov_size, 3a4d5c94 Michael S. Tsirkin 2010-01-14 1337 unsigned int *out_num, unsigned int *in_num, 3a4d5c94 Michael S. Tsirkin 2010-01-14 1338 struct vhost_log *log, unsigned int *log_num) 3a4d5c94 Michael S. Tsirkin 2010-01-14 1339 { 3a4d5c94 Michael S. Tsirkin 2010-01-14 @1340 struct vring_desc desc; 3a4d5c94 Michael S. Tsirkin 2010-01-14 @1341 unsigned int i, head, found = 0; 3a4d5c94 Michael S. Tsirkin 2010-01-14 1342 u16 last_avail_idx; 3b1bbe89 Michael S. Tsirkin 2014-10-24 1343 __virtio16 avail_idx; 3b1bbe89 Michael S. Tsirkin 2014-10-24 @1344 __virtio16 ring_head; 3a4d5c94 Michael S. Tsirkin 2010-01-14 @1345 int ret; 3a4d5c94 Michael S. Tsirkin 2010-01-14 1346 3a4d5c94 Michael S. Tsirkin 2010-01-14 1347 /* Check it isn't doing very strange things with descriptor numbers. */ 3a4d5c94 Michael S. Tsirkin 2010-01-14 1348 last_avail_idx = vq->last_avail_idx; 3b1bbe89 Michael S. Tsirkin 2014-10-24 1349 if (unlikely(__get_user(avail_idx, &vq->avail->idx))) { 3a4d5c94 Michael S. Tsirkin 2010-01-14 1350 vq_err(vq, "Failed to access avail idx at %p\n", 3a4d5c94 Michael S. Tsirkin 2010-01-14 1351 &vq->avail->idx); d5675bd2 Michael S. Tsirkin 2010-06-24 1352 return -EFAULT; 3a4d5c94 Michael S. Tsirkin 2010-01-14 1353 } 3b1bbe89 Michael S. Tsirkin 2014-10-24 1354 vq->avail_idx = vhost16_to_cpu(vq, avail_idx); 3a4d5c94 Michael S. Tsirkin 2010-01-14 1355 7b3384fc Michael S. Tsirkin 2010-07-01 1356 if (unlikely((u16)(vq->avail_idx - last_avail_idx) > vq->num)) { 3a4d5c94 Michael S. Tsirkin 2010-01-14 1357 vq_err(vq, "Guest moved used index from %u to %u", 3a4d5c94 Michael S. Tsirkin 2010-01-14 1358 last_avail_idx, vq->avail_idx); d5675bd2 Michael S. Tsirkin 2010-06-24 1359 return -EFAULT; 3a4d5c94 Michael S. Tsirkin 2010-01-14 1360 } 3a4d5c94 Michael S. Tsirkin 2010-01-14 1361 3a4d5c94 Michael S. Tsirkin 2010-01-14 1362 /* If there's nothing new since last we looked, return invalid. */ 3a4d5c94 Michael S. Tsirkin 2010-01-14 1363 if (vq->avail_idx == last_avail_idx) 3a4d5c94 Michael S. Tsirkin 2010-01-14 1364 return vq->num; 3a4d5c94 Michael S. Tsirkin 2010-01-14 1365 3a4d5c94 Michael S. Tsirkin 2010-01-14 1366 /* Only get avail ring entries after they have been exposed by guest. */ 5659338c Michael S. Tsirkin 2010-02-01 1367 smp_rmb(); 3a4d5c94 Michael S. Tsirkin 2010-01-14 1368 07a08023 Michael S. Tsirkin 2015-11-30 @1369 } 07a08023 Michael S. Tsirkin 2015-11-30 1370 3a4d5c94 Michael S. Tsirkin 2010-01-14 1371 /* Grab the next descriptor number they're advertising, and increment 3a4d5c94 Michael S. Tsirkin 2010-01-14 1372 * the index we've seen. */ 3b1bbe89 Michael S. Tsirkin 2014-10-24 @1373 if (unlikely(__get_user(ring_head, 07a08023 Michael S. Tsirkin 2015-11-30 1374 &vq->avail->ring[last_avail_idx & (vq->num - 1)]))) { 3a4d5c94 Michael S. Tsirkin 2010-01-14 1375 vq_err(vq, "Failed to read head: idx %d address %p\n", 3a4d5c94 Michael S. Tsirkin 2010-01-14 1376 last_avail_idx, 3a4d5c94 Michael S. Tsirkin 2010-01-14 1377 &vq->avail->ring[last_avail_idx % vq->num]); d5675bd2 Michael S. Tsirkin 2010-06-24 1378 return -EFAULT; 3a4d5c94 Michael S. Tsirkin 2010-01-14 1379 } 3a4d5c94 Michael S. Tsirkin 2010-01-14 1380 3b1bbe89 Michael S. Tsirkin 2014-10-24 @1381 head = vhost16_to_cpu(vq, ring_head); 3b1bbe89 Michael S. Tsirkin 2014-10-24 1382 3a4d5c94 Michael S. Tsirkin 2010-01-14 1383 /* If their number is silly, that's an error. */ 7b3384fc Michael S. Tsirkin 2010-07-01 @1384 if (unlikely(head >= vq->num)) { 3a4d5c94 Michael S. Tsirkin 2010-01-14 1385 vq_err(vq, "Guest says index %u > %u is available", 3a4d5c94 Michael S. Tsirkin 2010-01-14 1386 head, vq->num); d5675bd2 Michael S. Tsirkin 2010-06-24 1387 return -EINVAL; 3a4d5c94 Michael S. Tsirkin 2010-01-14 1388 } 3a4d5c94 Michael S. Tsirkin 2010-01-14 1389 3a4d5c94 Michael S. Tsirkin 2010-01-14 1390 /* When we start there are none of either input nor output. */ 3a4d5c94 Michael S. Tsirkin 2010-01-14 @1391 *out_num = *in_num = 0; 3a4d5c94 Michael S. Tsirkin 2010-01-14 @1392 if (unlikely(log)) 3a4d5c94 Michael S. Tsirkin 2010-01-14 1393 *log_num = 0; 3a4d5c94 Michael S. Tsirkin 2010-01-14 1394 3a4d5c94 Michael S. Tsirkin 2010-01-14 @1395 i = head; 3a4d5c94 Michael S. Tsirkin 2010-01-14 @1396 do { 3a4d5c94 Michael S. Tsirkin 2010-01-14 1397 unsigned iov_count = *in_num + *out_num; 7b3384fc Michael S. Tsirkin 2010-07-01 1398 if (unlikely(i >= vq->num)) { 3a4d5c94 Michael S. Tsirkin 2010-01-14 1399 vq_err(vq, "Desc index is %u > %u, head = %u", 3a4d5c94 Michael S. Tsirkin 2010-01-14 1400 i, vq->num, head); d5675bd2 Michael S. Tsirkin 2010-06-24 1401 return -EINVAL; 3a4d5c94 Michael S. Tsirkin 2010-01-14 1402 } 7b3384fc Michael S. Tsirkin 2010-07-01 1403 if (unlikely(++found > vq->num)) { 3a4d5c94 Michael S. Tsirkin 2010-01-14 1404 vq_err(vq, "Loop detected: last one at %u " 3a4d5c94 Michael S. Tsirkin 2010-01-14 1405 "vq size %u head %u\n", 3a4d5c94 Michael S. Tsirkin 2010-01-14 1406 i, vq->num, head); d5675bd2 Michael S. Tsirkin 2010-06-24 1407 return -EINVAL; 3a4d5c94 Michael S. Tsirkin 2010-01-14 1408 } fcc042a2 Michael S. Tsirkin 2011-03-06 1409 ret = __copy_from_user(&desc, vq->desc + i, sizeof desc); 7b3384fc Michael S. Tsirkin 2010-07-01 1410 if (unlikely(ret)) { 3a4d5c94 Michael S. Tsirkin 2010-01-14 1411 vq_err(vq, "Failed to get descriptor: idx %d addr %p\n", 3a4d5c94 Michael S. Tsirkin 2010-01-14 1412 i, vq->desc + i); d5675bd2 Michael S. Tsirkin 2010-06-24 1413 return -EFAULT; 3a4d5c94 Michael S. Tsirkin 2010-01-14 1414 } 3b1bbe89 Michael S. Tsirkin 2014-10-24 1415 if (desc.flags & cpu_to_vhost16(vq, VRING_DESC_F_INDIRECT)) { 47283bef Michael S. Tsirkin 2014-06-05 1416 ret = get_indirect(vq, iov, iov_size, 3a4d5c94 Michael S. Tsirkin 2010-01-14 1417 out_num, in_num, 3a4d5c94 Michael S. Tsirkin 2010-01-14 1418 log, log_num, &desc); 7b3384fc Michael S. Tsirkin 2010-07-01 1419 if (unlikely(ret < 0)) { 3a4d5c94 Michael S. Tsirkin 2010-01-14 1420 vq_err(vq, "Failure detected " 3a4d5c94 Michael S. Tsirkin 2010-01-14 1421 "in indirect descriptor at idx %d\n", i); d5675bd2 Michael S. Tsirkin 2010-06-24 1422 return ret; 3a4d5c94 Michael S. Tsirkin 2010-01-14 1423 } 3a4d5c94 Michael S. Tsirkin 2010-01-14 1424 continue; 3a4d5c94 Michael S. Tsirkin 2010-01-14 1425 } 3a4d5c94 Michael S. Tsirkin 2010-01-14 1426 3b1bbe89 Michael S. Tsirkin 2014-10-24 1427 ret = translate_desc(vq, vhost64_to_cpu(vq, desc.addr), 3b1bbe89 Michael S. Tsirkin 2014-10-24 1428 vhost32_to_cpu(vq, desc.len), iov + iov_count, 3a4d5c94 Michael S. Tsirkin 2010-01-14 1429 iov_size - iov_count); 7b3384fc Michael S. Tsirkin 2010-07-01 1430 if (unlikely(ret < 0)) { 3a4d5c94 Michael S. Tsirkin 2010-01-14 1431 vq_err(vq, "Translation failure %d descriptor idx %d\n", 3a4d5c94 Michael S. Tsirkin 2010-01-14 1432 ret, i); d5675bd2 Michael S. Tsirkin 2010-06-24 1433 return ret; 3a4d5c94 Michael S. Tsirkin 2010-01-14 1434 } 3b1bbe89 Michael S. Tsirkin 2014-10-24 1435 if (desc.flags & cpu_to_vhost16(vq, VRING_DESC_F_WRITE)) { 3a4d5c94 Michael S. Tsirkin 2010-01-14 1436 /* If this is an input descriptor, 3a4d5c94 Michael S. Tsirkin 2010-01-14 1437 * increment that count. */ 3a4d5c94 Michael S. Tsirkin 2010-01-14 1438 *in_num += ret; 3a4d5c94 Michael S. Tsirkin 2010-01-14 1439 if (unlikely(log)) { 3b1bbe89 Michael S. Tsirkin 2014-10-24 1440 log[*log_num].addr = vhost64_to_cpu(vq, desc.addr); 3b1bbe89 Michael S. Tsirkin 2014-10-24 1441 log[*log_num].len = vhost32_to_cpu(vq, desc.len); 3a4d5c94 Michael S. Tsirkin 2010-01-14 1442 ++*log_num; 3a4d5c94 Michael S. Tsirkin 2010-01-14 1443 } 3a4d5c94 Michael S. Tsirkin 2010-01-14 1444 } else { 3a4d5c94 Michael S. Tsirkin 2010-01-14 1445 /* If it's an output descriptor, they're all supposed 3a4d5c94 Michael S. Tsirkin 2010-01-14 1446 * to come before any input descriptors. */ 7b3384fc Michael S. Tsirkin 2010-07-01 1447 if (unlikely(*in_num)) { 3a4d5c94 Michael S. Tsirkin 2010-01-14 1448 vq_err(vq, "Descriptor has out after in: " 3a4d5c94 Michael S. Tsirkin 2010-01-14 1449 "idx %d\n", i); d5675bd2 Michael S. Tsirkin 2010-06-24 1450 return -EINVAL; 3a4d5c94 Michael S. Tsirkin 2010-01-14 1451 } 3a4d5c94 Michael S. Tsirkin 2010-01-14 1452 *out_num += ret; 3a4d5c94 Michael S. Tsirkin 2010-01-14 1453 } 3b1bbe89 Michael S. Tsirkin 2014-10-24 @1454 } while ((i = next_desc(vq, &desc)) != -1); 3a4d5c94 Michael S. Tsirkin 2010-01-14 1455 3a4d5c94 Michael S. Tsirkin 2010-01-14 1456 /* On success, increment avail index. */ 3a4d5c94 Michael S. Tsirkin 2010-01-14 @1457 vq->last_avail_idx++; 8ea8cf89 Michael S. Tsirkin 2011-05-20 1458 8ea8cf89 Michael S. Tsirkin 2011-05-20 1459 /* Assume notifications from guest are disabled at this point, 8ea8cf89 Michael S. Tsirkin 2011-05-20 1460 * if they aren't we would need to update avail_event index. */ 8ea8cf89 Michael S. Tsirkin 2011-05-20 @1461 BUG_ON(!(vq->used_flags & VRING_USED_F_NO_NOTIFY)); 3a4d5c94 Michael S. Tsirkin 2010-01-14 @1462 return head; 3a4d5c94 Michael S. Tsirkin 2010-01-14 @1463 } 6ac1afbf Asias He 2013-05-06 1464 EXPORT_SYMBOL_GPL(vhost_get_vq_desc); 3a4d5c94 Michael S. Tsirkin 2010-01-14 1465 3a4d5c94 Michael S. Tsirkin 2010-01-14 1466 /* Reverse the effect of vhost_get_vq_desc. Useful for error handling. */ :::::: The code at line 1373 was first introduced by commit :::::: 3b1bbe89351a8003857aeb5cbef3595f5d0ee609 vhost: virtio 1.0 endian-ness support :::::: TO: Michael S. Tsirkin <mst@xxxxxxxxxx> :::::: CC: Michael S. Tsirkin <mst@xxxxxxxxxx> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: Binary data
_______________________________________________ Virtualization mailing list Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linuxfoundation.org/mailman/listinfo/virtualization