mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Congjie Zhou" <zcjie0802@qq.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: netdev <netdev@vger.kernel.org>,
	jasowangio <jasowangio@gmail.com>, eperezma <eperezma@redhat.com>,
	xuanzhuo <xuanzhuo@linux.alibaba.com>,
	andrew+netdev <andrew+netdev@lunn.ch>,
	davem <davem@davemloft.net>, edumazet <edumazet@kernel.org>,
	kuba <kuba@kernel.org>, pabeni <pabeni@redhat.com>,
	horms <horms@kernel.org>,
	virtualization <virtualization@lists.linux.dev>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [BUG] virtio_net: RX stall caused by masking callbacks after NAPI ownership release
Date: Fri, 20 Nov 2026 00:32:44 +0800	[thread overview]
Message-ID: <tencent_3F7F39BC8117D4E15C286B951C22BDF71907@qq.com> (raw)
In-Reply-To: <20261119064843-mutt-send-email-mst@kernel.org>

> Right. So I came up with this then. Pls note i could not repro the
> problem so I am merely reasoning based on theoretical understanding
> of it.
> 
> --->
> 
> virtio_net: mask callbacks before handing off NAPI ownership
> 
> Virtio is special in that enabling or disabling callbacks (interrupts)
> accesses shared virtqueue state and must be serialized with polling. It
> therefore enables callbacks before completing NAPI, and disables them
> again if completion returns false.
> 
> With napi_complete_done(), that false return can come after ownership has
> passed to another poll. The first poll can then disable callbacks after
> its successor has enabled them, leaving RX stalled. Virtio therefore
> needs to disable callbacks before handing off NAPI ownership.
> 
> Add a prepare/finish NAPI completion API so virtio-net can mask interrupts
> before handing ownership off.
> 
> This preserves interrupt suppression without a callback or an additional
> data-path barrier. Ordinary napi_complete_done() compiles identically in
> the tested configuration.
> 
> Tested on x86-64 KVM with lock debugging, including IRQ deferral, concurrent
> scheduling, busy polling, netpoll, and threaded NAPI. Split and packed
> virtqueue TCP RX tests with IRQ deferral and busy polling also passed.
> 
> Reported-by: Congjie Zhou <zcjie0802@qq.com>
> Closes: https://lore.kernel.org/netdev/tencent_D0650F8CA2AAE4C258BFE5BCE805CDB4CA0A@qq.com/
> Fixes: 6f8b12d661d0 ("net: napi: add hard irqs deferral feature")
> Assisted-by: LLM

I've tested this patch locally , and everything looks good now, the issue is gone.

      reply	other threads:[~2026-11-19 16:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11 13:36 Congjie Zhou
2026-11-11 13:50 ` [PATCH net 1/2] net: napi: add completion with an ordered IRQ mask callback Congjie Zhou
2026-11-11 13:56   ` netdev-bot+sinfo
2026-11-11 15:08     ` zcj
2026-11-11 13:50 ` [PATCH net 2/2] virtio_net: mask callbacks before releasing NAPI ownership Congjie Zhou
2026-11-15  7:12 ` [PATCH net v2 1/2] net: napi: add completion with an ordered IRQ mask callback Congjie Zhou
2026-11-15 18:26   ` Jakub Kicinski
2026-11-15  7:12 ` [PATCH net v2 2/2] virtio_net: mask callbacks before releasing NAPI ownership Congjie Zhou
2026-11-15 20:09 ` [BUG] virtio_net: RX stall caused by masking callbacks after NAPI ownership release Michael S. Tsirkin
2026-11-15 23:07 ` Michael S. Tsirkin
2026-11-16  8:47   ` Congjie Zhou
2026-11-16  9:52     ` Michael S. Tsirkin
2026-11-16 16:05       ` Congjie Zhou
2026-11-19 11:50         ` Michael S. Tsirkin
2026-11-19 16:32           ` Congjie Zhou [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=tencent_3F7F39BC8117D4E15C286B951C22BDF71907@qq.com \
    --to=zcjie0802@qq.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=eperezma@redhat.com \
    --cc=horms@kernel.org \
    --cc=jasowangio@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=virtualization@lists.linux.dev \
    --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

all inboxes | Powered by JetHome®