Netdev List
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Mengyuan Lou <mengyuanlou@net-swift.com>
Cc: netdev@vger.kernel.org, jiawenwu@trustnetic.com,
	duanqiangwen@net-swift.com, linglingzhang@net-swift.com,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, hramamurthy@google.com,
	jacob.e.keller@intel.com, przemyslaw.kitszel@intel.com
Subject: Re: [PATCH net v8 2/2] net: wangxun: access queue counts consistently
Date: Tue, 24 Nov 2026 11:24:14 +0000	[thread overview]
Message-ID: <20261124112414.GJ31322@horms.kernel.org> (raw)
In-Reply-To: <20261118081329.39551-3-mengyuanlou@net-swift.com>

On Wed, Nov 18, 2026 at 04:13:29PM +0800, Mengyuan Lou wrote:
> Queue-vector teardown clears wx->num_tx_queues and
> wx->num_rx_queues while the netdev can remain registered. Lockless
> readers may use these counts as ring-array loop bounds while teardown
> is clearing the ring slots. wx_xmit_frame() also uses the Tx count to
> select a ring and must not divide by zero during teardown.
> 
> Use READ_ONCE() to take a single count snapshot in the lockless readers,
> and use WRITE_ONCE() for queue-count updates during scheme setup,
> teardown, and allocation-error handling, including the VF queue setup
> callbacks. Keep the existing NULL checks so a reader that observed an
> old non-zero count can safely skip ring slots that have since been
> cleared. wx_xmit_frame() retains its zero-count guard before
> queue-index modulo.
> 
> Fixes: 3f703186113f ("net: libwx: Add irq flow functions")
> Signed-off-by: Mengyuan Lou <mengyuanlou@net-swift.com>

This patch feels more like hardening for net-next than a fix for net.
But regardless the code changes look good to me.

Reviewed-by: Simon Horman <horms@kernel.org>

...

  reply	other threads:[~2026-11-24 11:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18  8:13 [PATCH net v8 0/2] net: wangxun: protect ring accesses with RCU Mengyuan Lou
2026-11-18  8:13 ` [PATCH net v8 1/2] " Mengyuan Lou
2026-11-22  8:33   ` netdev-bot+sashiko
2026-11-23  6:21     ` mengyuanlou
2026-11-24 11:23   ` Simon Horman
2026-11-18  8:13 ` [PATCH net v8 2/2] net: wangxun: access queue counts consistently Mengyuan Lou
2026-11-24 11:24   ` Simon Horman [this message]
2026-11-18  8:18 ` [PATCH net v8 0/2] net: wangxun: protect ring accesses with RCU netdev-bot+sinfo
2026-11-18  9:29   ` mengyuanlou

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=20261124112414.GJ31322@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=duanqiangwen@net-swift.com \
    --cc=edumazet@google.com \
    --cc=hramamurthy@google.com \
    --cc=jacob.e.keller@intel.com \
    --cc=jiawenwu@trustnetic.com \
    --cc=kuba@kernel.org \
    --cc=linglingzhang@net-swift.com \
    --cc=mengyuanlou@net-swift.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.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