public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Bhargava Marreddy <bhargava.marreddy@broadcom.com>
Cc: davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
	andrew+netdev@lunn.ch, horms@kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, michael.chan@broadcom.com,
	pavan.chebbi@broadcom.com, vsrama-krishna.nemani@broadcom.com,
	vikas.gupta@broadcom.com,
	Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
Subject: Re: [PATCH net-next v2 8/8] bng_en: implement ndo_get_stats64
Date: Thu, 26 Feb 2026 17:22:07 -0800	[thread overview]
Message-ID: <20260226172207.6810e8ce@kernel.org> (raw)
In-Reply-To: <20260226182133.1566714-9-bhargava.marreddy@broadcom.com>

On Thu, 26 Feb 2026 23:51:33 +0530 Bhargava Marreddy wrote:
> +	set_bit(BNGE_STATE_READ_STATS, &bn->state);
> +	/* Make sure bnge_close_core() sees that we are reading stats before
> +	 * we check the BNGE_STATE_OPEN flag.
> +	 */
> +	smp_mb__after_atomic();
> +	if (!test_bit(BNGE_STATE_OPEN, &bd->state)) {
> +		clear_bit(BNGE_STATE_READ_STATS, &bn->state);
> +		*stats = bn->net_stats_prev;
> +		return;
> +	}

There can be multiple concurrent readers. Two enter, first one gets
stalled second one exits clearing the bit, close frees the memory,
second reader proceeds to hit the NULL pointers.

Again, please don't try to invent synchronization primitives.
You can probably use RCU here.
-- 
pw-bot: cr

  reply	other threads:[~2026-02-27  1:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-26 18:21 [PATCH net-next v2 0/8] bng_en: add link management and statistics support Bhargava Marreddy
2026-02-26 18:21 ` [PATCH net-next v2 1/8] bng_en: add per-PF workqueue, timer, and slow-path task Bhargava Marreddy
2026-02-26 18:21 ` [PATCH net-next v2 2/8] bng_en: query PHY capabilities and report link status Bhargava Marreddy
2026-02-26 21:04   ` Andrew Lunn
2026-02-27 17:39     ` Bhargava Chenna Marreddy
2026-02-26 18:21 ` [PATCH net-next v2 3/8] bng_en: add ethtool link settings, get_link, and nway_reset Bhargava Marreddy
2026-02-26 18:21 ` [PATCH net-next v2 4/8] bng_en: implement ethtool pauseparam operations Bhargava Marreddy
2026-02-26 18:21 ` [PATCH net-next v2 5/8] bng_en: add support for link async events Bhargava Marreddy
2026-02-26 18:21 ` [PATCH net-next v2 6/8] bng_en: add initial support for ethtool stats display Bhargava Marreddy
2026-02-26 18:21 ` [PATCH net-next v2 7/8] bng_en: periodically fetch and accumulate hardware statistics Bhargava Marreddy
2026-02-26 18:21 ` [PATCH net-next v2 8/8] bng_en: implement ndo_get_stats64 Bhargava Marreddy
2026-02-27  1:22   ` Jakub Kicinski [this message]
2026-02-27 19:04     ` Bhargava Chenna Marreddy

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=20260226172207.6810e8ce@kernel.org \
    --to=kuba@kernel.org \
    --cc=ajit.khaparde@broadcom.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=bhargava.marreddy@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pavan.chebbi@broadcom.com \
    --cc=vikas.gupta@broadcom.com \
    --cc=vsrama-krishna.nemani@broadcom.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