Re: [PATCH net-next v3 3/3] net: add netmem_ref to skb_frag_t

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Mina,

kernel test robot noticed the following build errors:

[auto build test ERROR on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Mina-Almasry/vsock-virtio-use-skb_frag_-helpers/20231222-164637
base:   net-next/main
patch link:    https://lore.kernel.org/r/20231220214505.2303297-4-almasrymina%40google.com
patch subject: [PATCH net-next v3 3/3] net: add netmem_ref to skb_frag_t
config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/20231223/202312230340.iCf8sOop-lkp@xxxxxxxxx/config)
compiler: clang version 18.0.0git (https://github.com/llvm/llvm-project d3ef86708241a3bee902615c190dead1638c4e09)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231223/202312230340.iCf8sOop-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312230340.iCf8sOop-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

>> net/kcm/kcmsock.c:637:39: error: no member named 'bv_len' in 'struct skb_frag'
     637 |                         msize += skb_shinfo(skb)->frags[i].bv_len;
         |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~ ^
   1 error generated.


vim +637 net/kcm/kcmsock.c

cd6e111bf5be5c Tom Herbert       2016-03-07  578  
ab7ac4eb9832e3 Tom Herbert       2016-03-07  579  /* Write any messages ready on the kcm socket.  Called with kcm sock lock
ab7ac4eb9832e3 Tom Herbert       2016-03-07  580   * held.  Return bytes actually sent or error.
ab7ac4eb9832e3 Tom Herbert       2016-03-07  581   */
ab7ac4eb9832e3 Tom Herbert       2016-03-07  582  static int kcm_write_msgs(struct kcm_sock *kcm)
ab7ac4eb9832e3 Tom Herbert       2016-03-07  583  {
c31a25e1db486f David Howells     2023-06-09  584  	unsigned int total_sent = 0;
ab7ac4eb9832e3 Tom Herbert       2016-03-07  585  	struct sock *sk = &kcm->sk;
ab7ac4eb9832e3 Tom Herbert       2016-03-07  586  	struct kcm_psock *psock;
c31a25e1db486f David Howells     2023-06-09  587  	struct sk_buff *head;
ab7ac4eb9832e3 Tom Herbert       2016-03-07  588  	int ret = 0;
ab7ac4eb9832e3 Tom Herbert       2016-03-07  589  
ab7ac4eb9832e3 Tom Herbert       2016-03-07  590  	kcm->tx_wait_more = false;
ab7ac4eb9832e3 Tom Herbert       2016-03-07  591  	psock = kcm->tx_psock;
ab7ac4eb9832e3 Tom Herbert       2016-03-07  592  	if (unlikely(psock && psock->tx_stopped)) {
ab7ac4eb9832e3 Tom Herbert       2016-03-07  593  		/* A reserved psock was aborted asynchronously. Unreserve
ab7ac4eb9832e3 Tom Herbert       2016-03-07  594  		 * it and we'll retry the message.
ab7ac4eb9832e3 Tom Herbert       2016-03-07  595  		 */
ab7ac4eb9832e3 Tom Herbert       2016-03-07  596  		unreserve_psock(kcm);
cd6e111bf5be5c Tom Herbert       2016-03-07  597  		kcm_report_tx_retry(kcm);
ab7ac4eb9832e3 Tom Herbert       2016-03-07  598  		if (skb_queue_empty(&sk->sk_write_queue))
ab7ac4eb9832e3 Tom Herbert       2016-03-07  599  			return 0;
ab7ac4eb9832e3 Tom Herbert       2016-03-07  600  
c31a25e1db486f David Howells     2023-06-09  601  		kcm_tx_msg(skb_peek(&sk->sk_write_queue))->started_tx = false;
ab7ac4eb9832e3 Tom Herbert       2016-03-07  602  	}
ab7ac4eb9832e3 Tom Herbert       2016-03-07  603  
c31a25e1db486f David Howells     2023-06-09  604  retry:
c31a25e1db486f David Howells     2023-06-09  605  	while ((head = skb_peek(&sk->sk_write_queue))) {
c31a25e1db486f David Howells     2023-06-09  606  		struct msghdr msg = {
c31a25e1db486f David Howells     2023-06-09  607  			.msg_flags = MSG_DONTWAIT | MSG_SPLICE_PAGES,
c31a25e1db486f David Howells     2023-06-09  608  		};
c31a25e1db486f David Howells     2023-06-09  609  		struct kcm_tx_msg *txm = kcm_tx_msg(head);
c31a25e1db486f David Howells     2023-06-09  610  		struct sk_buff *skb;
c31a25e1db486f David Howells     2023-06-09  611  		unsigned int msize;
c31a25e1db486f David Howells     2023-06-09  612  		int i;
ab7ac4eb9832e3 Tom Herbert       2016-03-07  613  
c31a25e1db486f David Howells     2023-06-09  614  		if (!txm->started_tx) {
c31a25e1db486f David Howells     2023-06-09  615  			psock = reserve_psock(kcm);
c31a25e1db486f David Howells     2023-06-09  616  			if (!psock)
c31a25e1db486f David Howells     2023-06-09  617  				goto out;
c31a25e1db486f David Howells     2023-06-09  618  			skb = head;
c31a25e1db486f David Howells     2023-06-09  619  			txm->frag_offset = 0;
c31a25e1db486f David Howells     2023-06-09  620  			txm->sent = 0;
c31a25e1db486f David Howells     2023-06-09  621  			txm->started_tx = true;
c31a25e1db486f David Howells     2023-06-09  622  		} else {
ab7ac4eb9832e3 Tom Herbert       2016-03-07  623  			if (WARN_ON(!psock)) {
ab7ac4eb9832e3 Tom Herbert       2016-03-07  624  				ret = -EINVAL;
ab7ac4eb9832e3 Tom Herbert       2016-03-07  625  				goto out;
ab7ac4eb9832e3 Tom Herbert       2016-03-07  626  			}
ab7ac4eb9832e3 Tom Herbert       2016-03-07  627  			skb = txm->frag_skb;
ab7ac4eb9832e3 Tom Herbert       2016-03-07  628  		}
ab7ac4eb9832e3 Tom Herbert       2016-03-07  629  
ab7ac4eb9832e3 Tom Herbert       2016-03-07  630  		if (WARN_ON(!skb_shinfo(skb)->nr_frags)) {
ab7ac4eb9832e3 Tom Herbert       2016-03-07  631  			ret = -EINVAL;
ab7ac4eb9832e3 Tom Herbert       2016-03-07  632  			goto out;
ab7ac4eb9832e3 Tom Herbert       2016-03-07  633  		}
ab7ac4eb9832e3 Tom Herbert       2016-03-07  634  
c31a25e1db486f David Howells     2023-06-09  635  		msize = 0;
c31a25e1db486f David Howells     2023-06-09  636  		for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
c31a25e1db486f David Howells     2023-06-09 @637  			msize += skb_shinfo(skb)->frags[i].bv_len;
ab7ac4eb9832e3 Tom Herbert       2016-03-07  638  
b2e5852793b6eb Mina Almasry      2023-12-20  639  		/* The cast to struct bio_vec* here assumes the frags are
b2e5852793b6eb Mina Almasry      2023-12-20  640  		 * struct page based. WARN if there is no page in this skb.
b2e5852793b6eb Mina Almasry      2023-12-20  641  		 */
b2e5852793b6eb Mina Almasry      2023-12-20  642  		DEBUG_NET_WARN_ON_ONCE(
b2e5852793b6eb Mina Almasry      2023-12-20  643  			!skb_frag_page(&skb_shinfo(skb)->frags[0]));
b2e5852793b6eb Mina Almasry      2023-12-20  644  
c31a25e1db486f David Howells     2023-06-09  645  		iov_iter_bvec(&msg.msg_iter, ITER_SOURCE,
b2e5852793b6eb Mina Almasry      2023-12-20  646  			      (const struct bio_vec *)skb_shinfo(skb)->frags,
b2e5852793b6eb Mina Almasry      2023-12-20  647  			      skb_shinfo(skb)->nr_frags, msize);
c31a25e1db486f David Howells     2023-06-09  648  		iov_iter_advance(&msg.msg_iter, txm->frag_offset);
ab7ac4eb9832e3 Tom Herbert       2016-03-07  649  
c31a25e1db486f David Howells     2023-06-09  650  		do {
264ba53fac79b0 David Howells     2023-06-09  651  			ret = sock_sendmsg(psock->sk->sk_socket, &msg);
ab7ac4eb9832e3 Tom Herbert       2016-03-07  652  			if (ret <= 0) {
ab7ac4eb9832e3 Tom Herbert       2016-03-07  653  				if (ret == -EAGAIN) {
ab7ac4eb9832e3 Tom Herbert       2016-03-07  654  					/* Save state to try again when there's
ab7ac4eb9832e3 Tom Herbert       2016-03-07  655  					 * write space on the socket
ab7ac4eb9832e3 Tom Herbert       2016-03-07  656  					 */
ab7ac4eb9832e3 Tom Herbert       2016-03-07  657  					txm->frag_skb = skb;
ab7ac4eb9832e3 Tom Herbert       2016-03-07  658  					ret = 0;
ab7ac4eb9832e3 Tom Herbert       2016-03-07  659  					goto out;
ab7ac4eb9832e3 Tom Herbert       2016-03-07  660  				}
ab7ac4eb9832e3 Tom Herbert       2016-03-07  661  
ab7ac4eb9832e3 Tom Herbert       2016-03-07  662  				/* Hard failure in sending message, abort this
ab7ac4eb9832e3 Tom Herbert       2016-03-07  663  				 * psock since it has lost framing
71a2fae50895b3 Bhaskar Chowdhury 2021-03-27  664  				 * synchronization and retry sending the
ab7ac4eb9832e3 Tom Herbert       2016-03-07  665  				 * message from the beginning.
ab7ac4eb9832e3 Tom Herbert       2016-03-07  666  				 */
ab7ac4eb9832e3 Tom Herbert       2016-03-07  667  				kcm_abort_tx_psock(psock, ret ? -ret : EPIPE,
ab7ac4eb9832e3 Tom Herbert       2016-03-07  668  						   true);
ab7ac4eb9832e3 Tom Herbert       2016-03-07  669  				unreserve_psock(kcm);
9f8d0dc0ec4a4b David Howells     2023-06-15  670  				psock = NULL;
ab7ac4eb9832e3 Tom Herbert       2016-03-07  671  
c31a25e1db486f David Howells     2023-06-09  672  				txm->started_tx = false;
cd6e111bf5be5c Tom Herbert       2016-03-07  673  				kcm_report_tx_retry(kcm);
ab7ac4eb9832e3 Tom Herbert       2016-03-07  674  				ret = 0;
c31a25e1db486f David Howells     2023-06-09  675  				goto retry;
ab7ac4eb9832e3 Tom Herbert       2016-03-07  676  			}
ab7ac4eb9832e3 Tom Herbert       2016-03-07  677  
c31a25e1db486f David Howells     2023-06-09  678  			txm->sent += ret;
c31a25e1db486f David Howells     2023-06-09  679  			txm->frag_offset += ret;
cd6e111bf5be5c Tom Herbert       2016-03-07  680  			KCM_STATS_ADD(psock->stats.tx_bytes, ret);
c31a25e1db486f David Howells     2023-06-09  681  		} while (msg.msg_iter.count > 0);
ab7ac4eb9832e3 Tom Herbert       2016-03-07  682  
ab7ac4eb9832e3 Tom Herbert       2016-03-07  683  		if (skb == head) {
ab7ac4eb9832e3 Tom Herbert       2016-03-07  684  			if (skb_has_frag_list(skb)) {
c31a25e1db486f David Howells     2023-06-09  685  				txm->frag_skb = skb_shinfo(skb)->frag_list;
c31a25e1db486f David Howells     2023-06-09  686  				txm->frag_offset = 0;
c31a25e1db486f David Howells     2023-06-09  687  				continue;
ab7ac4eb9832e3 Tom Herbert       2016-03-07  688  			}
ab7ac4eb9832e3 Tom Herbert       2016-03-07  689  		} else if (skb->next) {
c31a25e1db486f David Howells     2023-06-09  690  			txm->frag_skb = skb->next;
c31a25e1db486f David Howells     2023-06-09  691  			txm->frag_offset = 0;
c31a25e1db486f David Howells     2023-06-09  692  			continue;
ab7ac4eb9832e3 Tom Herbert       2016-03-07  693  		}
ab7ac4eb9832e3 Tom Herbert       2016-03-07  694  
ab7ac4eb9832e3 Tom Herbert       2016-03-07  695  		/* Successfully sent the whole packet, account for it. */
c31a25e1db486f David Howells     2023-06-09  696  		sk->sk_wmem_queued -= txm->sent;
c31a25e1db486f David Howells     2023-06-09  697  		total_sent += txm->sent;
ab7ac4eb9832e3 Tom Herbert       2016-03-07  698  		skb_dequeue(&sk->sk_write_queue);
ab7ac4eb9832e3 Tom Herbert       2016-03-07  699  		kfree_skb(head);
cd6e111bf5be5c Tom Herbert       2016-03-07  700  		KCM_STATS_INCR(psock->stats.tx_msgs);
c31a25e1db486f David Howells     2023-06-09  701  	}
ab7ac4eb9832e3 Tom Herbert       2016-03-07  702  out:
ab7ac4eb9832e3 Tom Herbert       2016-03-07  703  	if (!head) {
ab7ac4eb9832e3 Tom Herbert       2016-03-07  704  		/* Done with all queued messages. */
ab7ac4eb9832e3 Tom Herbert       2016-03-07  705  		WARN_ON(!skb_queue_empty(&sk->sk_write_queue));
9f8d0dc0ec4a4b David Howells     2023-06-15  706  		if (psock)
ab7ac4eb9832e3 Tom Herbert       2016-03-07  707  			unreserve_psock(kcm);
ab7ac4eb9832e3 Tom Herbert       2016-03-07  708  	}
ab7ac4eb9832e3 Tom Herbert       2016-03-07  709  
ab7ac4eb9832e3 Tom Herbert       2016-03-07  710  	/* Check if write space is available */
ab7ac4eb9832e3 Tom Herbert       2016-03-07  711  	sk->sk_write_space(sk);
ab7ac4eb9832e3 Tom Herbert       2016-03-07  712  
ab7ac4eb9832e3 Tom Herbert       2016-03-07  713  	return total_sent ? : ret;
ab7ac4eb9832e3 Tom Herbert       2016-03-07  714  }
ab7ac4eb9832e3 Tom Herbert       2016-03-07  715  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux