Re: virtio-net: locking in tx napi

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

 



On Tue, Apr 13, 2021 at 12:44 AM Michael S. Tsirkin <mst@xxxxxxxxxx> wrote:
>
> On Tue, Apr 13, 2021 at 10:29:03AM +0800, Jason Wang wrote:
> >
> > 在 2021/4/13 上午6:31, Michael S. Tsirkin 写道:
> > > On Mon, Apr 12, 2021 at 06:03:50PM -0400, Michael S. Tsirkin wrote:
> > > > I was working on the spurios interrupt problem and
> > > > I noticed something weird.
> > > >
> > > > static int virtnet_poll_tx(struct napi_struct *napi, int budget)
> > > > {
> > > >          struct send_queue *sq = container_of(napi, struct send_queue, napi);
> > > >          struct virtnet_info *vi = sq->vq->vdev->priv;
> > > >          unsigned int index = vq2txq(sq->vq);
> > > >          struct netdev_queue *txq;
> > > >
> > > >          if (unlikely(is_xdp_raw_buffer_queue(vi, index))) {
> > > >                  /* We don't need to enable cb for XDP */
> > > >                  napi_complete_done(napi, 0);
> > > >                  return 0;
> > > >          }
> > > >
> > > >          txq = netdev_get_tx_queue(vi->dev, index);
> > > >          __netif_tx_lock(txq, raw_smp_processor_id());
> > > >          free_old_xmit_skbs(sq, true);
> > > >          __netif_tx_unlock(txq);
> > > >          virtqueue_napi_complete(napi, sq->vq, 0);
> > > >          if (sq->vq->num_free >= 2 + MAX_SKB_FRAGS)
> > > >                  netif_tx_wake_queue(txq);
> > > >          return 0;
> > > > }
> > > >
> > > > So virtqueue_napi_complete is called when txq is not locked,
> > > > thinkably start_xmit can happen right?
> >
> >
> > Yes, I think so.

Agreed.

I see I'm quite a few emails behind already. Will respond in more
detail to the latest patch series.
_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/virtualization




[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