Hi Eric, [auto build test ERROR on net-next/master]
url: https://github.com/0day-ci/linux/commits/Eric-Dumazet/net-ubuf_info-refcnt-conversion/20170903-043506 config: x86_64-acpi-redef (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All errors (new ones prefixed by >>): drivers//vhost/net.c: In function 'handle_tx': >> drivers//vhost/net.c:536:15: error: passing argument 1 of 'atomic_set' from >> incompatible pointer type [-Werror=incompatible-pointer-types] atomic_set(&ubuf->refcnt, 1); ^ In file included from include/linux/atomic.h:4:0, from include/linux/jump_label.h:183, from arch/x86/include/asm/string_64.h:5, from arch/x86/include/asm/string.h:4, from include/linux/string.h:18, from include/linux/bitmap.h:8, from include/linux/cpumask.h:11, from arch/x86/include/asm/cpumask.h:4, from arch/x86/include/asm/msr.h:10, from arch/x86/include/asm/processor.h:20, from arch/x86/include/asm/cpufeature.h:4, from arch/x86/include/asm/thread_info.h:52, from include/linux/thread_info.h:37, from arch/x86/include/asm/preempt.h:6, from include/linux/preempt.h:80, from include/linux/spinlock.h:50, from include/linux/seqlock.h:35, from include/linux/time.h:5, from include/linux/stat.h:18, from include/linux/compat.h:12, from drivers//vhost/net.c:9: arch/x86/include/asm/atomic.h:36:29: note: expected 'atomic_t * {aka struct <anonymous> *}' but argument is of type 'refcount_t * {aka struct refcount_struct *}' static __always_inline void atomic_set(atomic_t *v, int i) ^~~~~~~~~~ cc1: some warnings being treated as errors vim +/atomic_set +536 drivers//vhost/net.c 0ed005ce0 Jason Wang 2017-01-18 442 3a4d5c94e Michael S. Tsirkin 2010-01-14 443 /* Expects to be always run from workqueue - which acts as 3a4d5c94e Michael S. Tsirkin 2010-01-14 444 * read-size critical section for our kind of RCU. */ 3a4d5c94e Michael S. Tsirkin 2010-01-14 445 static void handle_tx(struct vhost_net *net) 3a4d5c94e Michael S. Tsirkin 2010-01-14 446 { 2839400f8 Asias He 2013-04-27 447 struct vhost_net_virtqueue *nvq = &net->vqs[VHOST_NET_VQ_TX]; 81f95a558 Michael S. Tsirkin 2013-04-28 448 struct vhost_virtqueue *vq = &nvq->vq; 98a527aac Al Viro 2014-12-10 449 unsigned out, in; d5675bd20 Michael S. Tsirkin 2010-06-24 450 int head; 3a4d5c94e Michael S. Tsirkin 2010-01-14 451 struct msghdr msg = { 3a4d5c94e Michael S. Tsirkin 2010-01-14 452 .msg_name = NULL, 3a4d5c94e Michael S. Tsirkin 2010-01-14 453 .msg_namelen = 0, 3a4d5c94e Michael S. Tsirkin 2010-01-14 454 .msg_control = NULL, 3a4d5c94e Michael S. Tsirkin 2010-01-14 455 .msg_controllen = 0, 3a4d5c94e Michael S. Tsirkin 2010-01-14 456 .msg_flags = MSG_DONTWAIT, 3a4d5c94e Michael S. Tsirkin 2010-01-14 457 }; 3a4d5c94e Michael S. Tsirkin 2010-01-14 458 size_t len, total_len = 0; 70181d512 Jason Wang 2013-04-10 459 int err; 3a4d5c94e Michael S. Tsirkin 2010-01-14 460 size_t hdr_size; 28457ee69 Arnd Bergmann 2010-03-09 461 struct socket *sock; fe729a57c Asias He 2013-05-06 462 struct vhost_net_ubuf_ref *uninitialized_var(ubufs); cedb9bdce Michael S. Tsirkin 2012-12-06 463 bool zcopy, zcopy_used; 28457ee69 Arnd Bergmann 2010-03-09 464 2e26af79b Asias He 2013-05-07 465 mutex_lock(&vq->mutex); 2e26af79b Asias He 2013-05-07 466 sock = vq->private_data; 3a4d5c94e Michael S. Tsirkin 2010-01-14 467 if (!sock) 2e26af79b Asias He 2013-05-07 468 goto out; 3a4d5c94e Michael S. Tsirkin 2010-01-14 469 6b1e6cc78 Jason Wang 2016-06-23 470 if (!vq_iotlb_prefetch(vq)) 6b1e6cc78 Jason Wang 2016-06-23 471 goto out; 6b1e6cc78 Jason Wang 2016-06-23 472 8ea8cf89e Michael S. Tsirkin 2011-05-20 473 vhost_disable_notify(&net->dev, vq); 3a4d5c94e Michael S. Tsirkin 2010-01-14 474 81f95a558 Michael S. Tsirkin 2013-04-28 475 hdr_size = nvq->vhost_hlen; 2839400f8 Asias He 2013-04-27 476 zcopy = nvq->ubufs; 3a4d5c94e Michael S. Tsirkin 2010-01-14 477 3a4d5c94e Michael S. Tsirkin 2010-01-14 478 for (;;) { bab632d69 Michael S. Tsirkin 2011-07-18 479 /* Release DMAs done buffers first */ bab632d69 Michael S. Tsirkin 2011-07-18 480 if (zcopy) eaae8132e Michael S. Tsirkin 2012-11-01 481 vhost_zerocopy_signal_used(net, vq); bab632d69 Michael S. Tsirkin 2011-07-18 482 f7c6be404 Jason Wang 2013-09-02 483 /* If more outstanding DMAs, queue the work. f7c6be404 Jason Wang 2013-09-02 484 * Handle upend_idx wrap around f7c6be404 Jason Wang 2013-09-02 485 */ 0ed005ce0 Jason Wang 2017-01-18 486 if (unlikely(vhost_exceeds_maxpend(net))) f7c6be404 Jason Wang 2013-09-02 487 break; f7c6be404 Jason Wang 2013-09-02 488 030881372 Jason Wang 2016-03-04 489 head = vhost_net_tx_get_vq_desc(net, vq, vq->iov, 3a4d5c94e Michael S. Tsirkin 2010-01-14 490 ARRAY_SIZE(vq->iov), 030881372 Jason Wang 2016-03-04 491 &out, &in); d5675bd20 Michael S. Tsirkin 2010-06-24 492 /* On error, stop handling until the next kick. */ 7b3384fc3 Michael S. Tsirkin 2010-07-01 493 if (unlikely(head < 0)) d5675bd20 Michael S. Tsirkin 2010-06-24 494 break; 3a4d5c94e Michael S. Tsirkin 2010-01-14 495 /* Nothing new? Wait for eventfd to tell us they refilled. */ 3a4d5c94e Michael S. Tsirkin 2010-01-14 496 if (head == vq->num) { 8ea8cf89e Michael S. Tsirkin 2011-05-20 497 if (unlikely(vhost_enable_notify(&net->dev, vq))) { 8ea8cf89e Michael S. Tsirkin 2011-05-20 498 vhost_disable_notify(&net->dev, vq); 3a4d5c94e Michael S. Tsirkin 2010-01-14 499 continue; 3a4d5c94e Michael S. Tsirkin 2010-01-14 500 } 3a4d5c94e Michael S. Tsirkin 2010-01-14 501 break; 3a4d5c94e Michael S. Tsirkin 2010-01-14 502 } 3a4d5c94e Michael S. Tsirkin 2010-01-14 503 if (in) { 3a4d5c94e Michael S. Tsirkin 2010-01-14 504 vq_err(vq, "Unexpected descriptor format for TX: " 3a4d5c94e Michael S. Tsirkin 2010-01-14 505 "out %d, int %d\n", out, in); 3a4d5c94e Michael S. Tsirkin 2010-01-14 506 break; 3a4d5c94e Michael S. Tsirkin 2010-01-14 507 } 3a4d5c94e Michael S. Tsirkin 2010-01-14 508 /* Skip header. TODO: support TSO. */ 3a4d5c94e Michael S. Tsirkin 2010-01-14 509 len = iov_length(vq->iov, out); c0371da60 Al Viro 2014-11-24 510 iov_iter_init(&msg.msg_iter, WRITE, vq->iov, out, len); 98a527aac Al Viro 2014-12-10 511 iov_iter_advance(&msg.msg_iter, hdr_size); 3a4d5c94e Michael S. Tsirkin 2010-01-14 512 /* Sanity check */ 01e97e651 Al Viro 2014-12-15 513 if (!msg_data_left(&msg)) { 3a4d5c94e Michael S. Tsirkin 2010-01-14 514 vq_err(vq, "Unexpected header len for TX: " 3a4d5c94e Michael S. Tsirkin 2010-01-14 515 "%zd expected %zd\n", 98a527aac Al Viro 2014-12-10 516 len, hdr_size); 3a4d5c94e Michael S. Tsirkin 2010-01-14 517 break; 3a4d5c94e Michael S. Tsirkin 2010-01-14 518 } 01e97e651 Al Viro 2014-12-15 519 len = msg_data_left(&msg); ce21a0291 Jason Wang 2013-09-02 520 ce21a0291 Jason Wang 2013-09-02 521 zcopy_used = zcopy && len >= VHOST_GOODCOPY_LEN ce21a0291 Jason Wang 2013-09-02 522 && (nvq->upend_idx + 1) % UIO_MAXIOV != ce21a0291 Jason Wang 2013-09-02 523 nvq->done_idx ce21a0291 Jason Wang 2013-09-02 524 && vhost_net_tx_select_zcopy(net); cedb9bdce Michael S. Tsirkin 2012-12-06 525 bab632d69 Michael S. Tsirkin 2011-07-18 526 /* use msg_control to pass vhost zerocopy ubuf info to skb */ cedb9bdce Michael S. Tsirkin 2012-12-06 527 if (zcopy_used) { 46aa92d1b Michael S. Tsirkin 2013-03-17 528 struct ubuf_info *ubuf; 2839400f8 Asias He 2013-04-27 529 ubuf = nvq->ubuf_info + nvq->upend_idx; bab632d69 Michael S. Tsirkin 2011-07-18 530 8b38694a2 Michael S. Tsirkin 2014-10-24 531 vq->heads[nvq->upend_idx].id = cpu_to_vhost32(vq, head); ce21a0291 Jason Wang 2013-09-02 532 vq->heads[nvq->upend_idx].len = VHOST_DMA_IN_PROGRESS; bab632d69 Michael S. Tsirkin 2011-07-18 533 ubuf->callback = vhost_zerocopy_callback; 2839400f8 Asias He 2013-04-27 534 ubuf->ctx = nvq->ubufs; 2839400f8 Asias He 2013-04-27 535 ubuf->desc = nvq->upend_idx; 1f8b977ab Willem de Bruijn 2017-08-03 @536 atomic_set(&ubuf->refcnt, 1); bab632d69 Michael S. Tsirkin 2011-07-18 537 msg.msg_control = ubuf; bab632d69 Michael S. Tsirkin 2011-07-18 538 msg.msg_controllen = sizeof(ubuf); 2839400f8 Asias He 2013-04-27 539 ubufs = nvq->ubufs; 0ad8b480d Michael S. Tsirkin 2014-02-13 540 atomic_inc(&ubufs->refcount); 2839400f8 Asias He 2013-04-27 541 nvq->upend_idx = (nvq->upend_idx + 1) % UIO_MAXIOV; ce21a0291 Jason Wang 2013-09-02 542 } else { 4364d5f96 Jason Wang 2013-06-05 543 msg.msg_control = NULL; ce21a0291 Jason Wang 2013-09-02 544 ubufs = NULL; ce21a0291 Jason Wang 2013-09-02 545 } 0ed005ce0 Jason Wang 2017-01-18 546 0ed005ce0 Jason Wang 2017-01-18 547 total_len += len; 0ed005ce0 Jason Wang 2017-01-18 548 if (total_len < VHOST_NET_WEIGHT && 0ed005ce0 Jason Wang 2017-01-18 549 !vhost_vq_avail_empty(&net->dev, vq) && 0ed005ce0 Jason Wang 2017-01-18 550 likely(!vhost_exceeds_maxpend(net))) { 0ed005ce0 Jason Wang 2017-01-18 551 msg.msg_flags |= MSG_MORE; 0ed005ce0 Jason Wang 2017-01-18 552 } else { 0ed005ce0 Jason Wang 2017-01-18 553 msg.msg_flags &= ~MSG_MORE; 0ed005ce0 Jason Wang 2017-01-18 554 } 0ed005ce0 Jason Wang 2017-01-18 555 3a4d5c94e Michael S. Tsirkin 2010-01-14 556 /* TODO: Check specific error and bomb out unless ENOBUFS? */ 1b7841404 Ying Xue 2015-03-02 557 err = sock->ops->sendmsg(sock, &msg, len); 3a4d5c94e Michael S. Tsirkin 2010-01-14 558 if (unlikely(err < 0)) { cedb9bdce Michael S. Tsirkin 2012-12-06 559 if (zcopy_used) { fe729a57c Asias He 2013-05-06 560 vhost_net_ubuf_put(ubufs); 2839400f8 Asias He 2013-04-27 561 nvq->upend_idx = ((unsigned)nvq->upend_idx - 1) 2839400f8 Asias He 2013-04-27 562 % UIO_MAXIOV; bab632d69 Michael S. Tsirkin 2011-07-18 563 } 8dd014adf David Stevens 2010-07-27 564 vhost_discard_vq_desc(vq, 1); 3a4d5c94e Michael S. Tsirkin 2010-01-14 565 break; 3a4d5c94e Michael S. Tsirkin 2010-01-14 566 } 3a4d5c94e Michael S. Tsirkin 2010-01-14 567 if (err != len) 95c0ec6a9 Michael S. Tsirkin 2010-06-24 568 pr_debug("Truncated TX packet: " 3a4d5c94e Michael S. Tsirkin 2010-01-14 569 " len %d != %zd\n", err, len); cedb9bdce Michael S. Tsirkin 2012-12-06 570 if (!zcopy_used) 3a4d5c94e Michael S. Tsirkin 2010-01-14 571 vhost_add_used_and_signal(&net->dev, vq, head, 0); c8fb217af Jason Wang 2012-05-02 572 else eaae8132e Michael S. Tsirkin 2012-11-01 573 vhost_zerocopy_signal_used(net, vq); eaae8132e Michael S. Tsirkin 2012-11-01 574 vhost_net_tx_packet(net); 3a4d5c94e Michael S. Tsirkin 2010-01-14 575 if (unlikely(total_len >= VHOST_NET_WEIGHT)) { 3a4d5c94e Michael S. Tsirkin 2010-01-14 576 vhost_poll_queue(&vq->poll); 3a4d5c94e Michael S. Tsirkin 2010-01-14 577 break; 3a4d5c94e Michael S. Tsirkin 2010-01-14 578 } 3a4d5c94e Michael S. Tsirkin 2010-01-14 579 } 2e26af79b Asias He 2013-05-07 580 out: 3a4d5c94e Michael S. Tsirkin 2010-01-14 581 mutex_unlock(&vq->mutex); 3a4d5c94e Michael S. Tsirkin 2010-01-14 582 } 3a4d5c94e Michael S. Tsirkin 2010-01-14 583 :::::: The code at line 536 was first introduced by commit :::::: 1f8b977ab32dc5d148f103326e80d9097f1cefb5 sock: enable MSG_ZEROCOPY :::::: TO: Willem de Bruijn <will...@google.com> :::::: CC: David S. Miller <da...@davemloft.net> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
.config.gz
Description: application/gzip