linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, David Wei <dw@davidwei.uk>,
	Shuah Khan <shuah@kernel.org>, Simon Horman <horms@kernel.org>,
	joe@dama.to, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	kernel-team@meta.com
Subject: Re: [PATCH net-next v2 4/4] netdevsim: account dropped packet length in stats on queue free
Date: Fri, 13 Jun 2025 08:55:52 -0700	[thread overview]
Message-ID: <aExKCMX4SLM772xi@gmail.com> (raw)
In-Reply-To: <20250613075507.2b857743@kernel.org>

On Fri, Jun 13, 2025 at 07:55:07AM -0700, Jakub Kicinski wrote:
> On Fri, 13 Jun 2025 07:47:11 -0700 Breno Leitao wrote:
> > >  static void nsim_queue_free(struct nsim_rq *rq)
> > >  {
> > > +	struct net_device *dev = rq->napi.dev;
> > > +
> > >  	hrtimer_cancel(&rq->napi_timer);
> > > +	dev_dstats_rx_dropped_add(dev, rq->skb_queue.qlen);  
> > 
> > This is wrong and it will cause the kernel to crash in some cases, given
> > we can get here with dev == NULL, in the following path:
> 
> It's probably because NAPI wasn't registered yet in some paths.
> You can pass dev in from the callers, it always exists, and all 
> callers have it.

Right, that is a better approach.

I will update and send another version soon,
--breno

      reply	other threads:[~2025-06-13 15:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-13 10:39 [PATCH net-next v2 0/4] netdevsim: implement RX statistics using NETDEV_PCPU_STAT_DSTATS Breno Leitao
2025-06-13 10:39 ` [PATCH net-next v2 1/4] netdevsim: migrate to dstats stats collection Breno Leitao
2025-06-13 10:39 ` [PATCH net-next v2 2/4] netdevsim: collect statistics at RX side Breno Leitao
2025-06-13 10:40 ` [PATCH net-next v2 3/4] net: add dev_dstats_rx_dropped_add() helper Breno Leitao
2025-06-13 10:40 ` [PATCH net-next v2 4/4] netdevsim: account dropped packet length in stats on queue free Breno Leitao
2025-06-13 14:47   ` Breno Leitao
2025-06-13 14:55     ` Jakub Kicinski
2025-06-13 15:55       ` Breno Leitao [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=aExKCMX4SLM772xi@gmail.com \
    --to=leitao@debian.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dw@davidwei.uk \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=joe@dama.to \
    --cc=kernel-team@meta.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    /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).