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>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org, gustavold@gmail.com
Subject: Re: [PATCH net-next v3 4/4] netdevsim: account dropped packet length in stats on queue free
Date: Tue, 17 Jun 2025 06:24:23 -0700	[thread overview]
Message-ID: <aFFsh6kFOkhGOO7Q@gmail.com> (raw)
In-Reply-To: <20250617055934.3fd9d322@kernel.org>

On Tue, Jun 17, 2025 at 05:59:34AM -0700, Jakub Kicinski wrote:
> On Tue, 17 Jun 2025 01:19:00 -0700 Breno Leitao wrote:
> > -static void nsim_queue_free(struct nsim_rq *rq)
> > +static void nsim_queue_free(struct net_device *dev, struct nsim_rq *rq)
> >  {
> >  	hrtimer_cancel(&rq->napi_timer);
> > +	dev_dstats_rx_dropped_add(dev, rq->skb_queue.qlen);
> 
> here we are in process context and debug checks complain about the use
> of this_cpu_ptr(). Let's wrap this in local_bh_disable() / enable() ?

Thanks. I was able to reproduce it. Your suggestion avoids the complain.
I suppose we should just wrap dev_dstats_rx_dropped_add(), right?

	diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
	index 5d0b801e81129..07171cf8b07ee 100644
	--- a/drivers/net/netdevsim/netdev.c
	+++ b/drivers/net/netdevsim/netdev.c
	@@ -635,7 +635,9 @@ static struct nsim_rq *nsim_queue_alloc(void)
	static void nsim_queue_free(struct net_device *dev, struct nsim_rq *rq)
	{
		hrtimer_cancel(&rq->napi_timer);
	+	local_bh_disable();
		dev_dstats_rx_dropped_add(dev, rq->skb_queue.qlen);
	+	local_bh_enable();
		skb_queue_purge_reason(&rq->skb_queue, SKB_DROP_REASON_QUEUE_PURGE);
		kfree(rq);
	}


  reply	other threads:[~2025-06-17 13:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-17  8:18 [PATCH net-next v3 0/4] netdevsim: implement RX statistics using NETDEV_PCPU_STAT_DSTATS Breno Leitao
2025-06-17  8:18 ` [PATCH net-next v3 1/4] netdevsim: migrate to dstats stats collection Breno Leitao
2025-06-17  8:18 ` [PATCH net-next v3 2/4] netdevsim: collect statistics at RX side Breno Leitao
2025-06-17 19:32   ` Joe Damato
2025-06-17  8:18 ` [PATCH net-next v3 3/4] net: add dev_dstats_rx_dropped_add() helper Breno Leitao
2025-06-17 19:33   ` Joe Damato
2025-06-17  8:19 ` [PATCH net-next v3 4/4] netdevsim: account dropped packet length in stats on queue free Breno Leitao
2025-06-17 12:59   ` Jakub Kicinski
2025-06-17 13:24     ` Breno Leitao [this message]
2025-06-17 13:48       ` Jakub Kicinski

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=aFFsh6kFOkhGOO7Q@gmail.com \
    --to=leitao@debian.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dw@davidwei.uk \
    --cc=edumazet@google.com \
    --cc=gustavold@gmail.com \
    --cc=horms@kernel.org \
    --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).