netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Liming Wu <liming.wu@jaguarmicro.com>
Cc: "Jason Wang" <jasowang@redhat.com>,
	"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
	"Eugenio Pérez" <eperezma@redhat.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"virtualization@lists.linux-foundation.org"
	<virtualization@lists.linux-foundation.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Angus Chen" <angus.chen@jaguarmicro.com>
Subject: Re: [PATCH] virtio_net: enhance wake/stop tx queue statistics accounting
Date: Wed, 19 Nov 2025 02:58:39 -0500	[thread overview]
Message-ID: <20251119025546-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <PSAPR06MB39429783A41F42FDD82477A2E1D7A@PSAPR06MB3942.apcprd06.prod.outlook.com>

On Wed, Nov 19, 2025 at 07:54:07AM +0000, Liming Wu wrote:
> > queue wake/stop events introduced by a previous patch.
> > 
> > It would be better to add commit id here.
> OK, thx.
> 
> > 
> eck. */
> > >                         free_old_xmit(sq, txq, false);
> > >                         if (sq->vq->num_free >= MAX_SKB_FRAGS + 2) {
> > > -                               netif_start_subqueue(dev, qnum);
> > > -
> > u64_stats_update_begin(&sq->stats.syncp);
> > > -                               u64_stats_inc(&sq->stats.wake);
> > > -
> > u64_stats_update_end(&sq->stats.syncp);
> > > +                               virtnet_tx_wake_queue(vi, sq);
> > 
> > This is suspicious, netif_tx_wake_queue() will schedule qdisc, or is this intended?
> Thanks for pointing this out.
> You're right — using netif_tx_wake_queue() here would indeed trigger qdisc scheduling, which is not intended in this specific path.
> My change tried to unify the wake/stop accounting paths, but replacing netif_start_subqueue() was not the right choice semantically.
> 
> I will restore netif_start_subqueue() at this site and keep only the statistic increment, so the behavior stays consistent with the original code while still improving the per-queue metrics.


Please do not send fluff comments like this to the list.

And with em-dashes too, for added flair.

If you can not bother writing email yourself why should
anyone bother reading it?




> > 
> > >                                 virtqueue_disable_cb(sq->vq);
> > >                         }
> > >                 }
> > > @@ -3068,13 +3080,8 @@ static void virtnet_poll_cleantx(struct
> > receive_queue *rq, int budget)
> > >                         free_old_xmit(sq, txq, !!budget);
> > >                 } while
> > > (unlikely(!virtqueue_enable_cb_delayed(sq->vq)));
> > >
> > > -               if (sq->vq->num_free >= MAX_SKB_FRAGS + 2 &&
> > > -                   netif_tx_queue_stopped(txq)) {
> > > -                       u64_stats_update_begin(&sq->stats.syncp);
> > > -                       u64_stats_inc(&sq->stats.wake);
> > > -                       u64_stats_update_end(&sq->stats.syncp);
> > > -                       netif_tx_wake_queue(txq);
> > > -               }
> > > +               if (sq->vq->num_free >= MAX_SKB_FRAGS + 2)
> > > +                       virtnet_tx_wake_queue(vi, sq);
> > >
> > >                 __netif_tx_unlock(txq);
> > >         }
> > > @@ -3264,13 +3271,8 @@ static int virtnet_poll_tx(struct napi_struct *napi,
> > int budget)
> > >         else
> > >                 free_old_xmit(sq, txq, !!budget);
> > >
> > > -       if (sq->vq->num_free >= MAX_SKB_FRAGS + 2 &&
> > > -           netif_tx_queue_stopped(txq)) {
> > > -               u64_stats_update_begin(&sq->stats.syncp);
> > > -               u64_stats_inc(&sq->stats.wake);
> > > -               u64_stats_update_end(&sq->stats.syncp);
> > > -               netif_tx_wake_queue(txq);
> > > -       }
> > > +       if (sq->vq->num_free >= MAX_SKB_FRAGS + 2)
> > > +               virtnet_tx_wake_queue(vi, sq);
> > >
> > >         if (xsk_done >= budget) {
> > >                 __netif_tx_unlock(txq); @@ -3521,6 +3523,9 @@ static
> > > void virtnet_tx_pause(struct virtnet_info *vi, struct send_queue *sq)
> > >
> > >         /* Prevent the upper layer from trying to send packets. */
> > >         netif_stop_subqueue(vi->dev, qindex);
> > > +       u64_stats_update_begin(&sq->stats.syncp);
> > > +       u64_stats_inc(&sq->stats.stop);
> > > +       u64_stats_update_end(&sq->stats.syncp);
> > >
> > >         __netif_tx_unlock_bh(txq);
> > >  }
> > > @@ -3537,7 +3542,7 @@ static void virtnet_tx_resume(struct
> > > virtnet_info *vi, struct send_queue *sq)
> > >
> > >         __netif_tx_lock_bh(txq);
> > >         sq->reset = false;
> > > -       netif_tx_wake_queue(txq);
> > > +       virtnet_tx_wake_queue(vi, sq);
> > >         __netif_tx_unlock_bh(txq);
> > >
> > >         if (running)
> > > --
> > > 2.34.1
> > >
> > 
> > Thanks
> 


      reply	other threads:[~2025-11-19  7:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-18  9:09 [PATCH] virtio_net: enhance wake/stop tx queue statistics accounting liming.wu
2025-11-19  2:56 ` Jason Wang
2025-11-19  7:54   ` Liming Wu
2025-11-19  7:58     ` Michael S. Tsirkin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251119025546-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=angus.chen@jaguarmicro.com \
    --cc=eperezma@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=liming.wu@jaguarmicro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xuanzhuo@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).