From: Jeff Layton <jlayton@kernel.org>
To: Andrew Lunn <andrew@lunn.ch>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] net: add debugfs files for showing netns refcount tracking info
Date: Mon, 14 Apr 2025 08:48:26 -0400 [thread overview]
Message-ID: <cc695a916d9abd79fa1cd9725c767c7e294a3b39.camel@kernel.org> (raw)
In-Reply-To: <1bc3164b-0e41-49e1-9ed2-cf37997ab53e@lunn.ch>
On Mon, 2025-04-14 at 14:46 +0200, Andrew Lunn wrote:
> > > > We'll need some input from the i915 folks then.
> > >
> > > That is why i think it would be better to add a warning, give the i915
> > > folks a heads up, and leave them to fix it how they want. We want the
> > > warning anyway to cover new refcount instances being added.
> > >
> >
> > There will definitely be a pr_warn() if creation fails. I was hoping to
> > send a suggested change alongside the patchset, but I may have to just
> > leave it up to them.
> >
> > I threw together a draft patchset that auto-registers a debugfs file
> > for every call to ref_tracker_dir_init(). The problem I've hit now
> > though is that at least in the networking cases, the kernel calls
> > ref_tracker_dir_init() very early in the process of creating a new
> > objects, so we're not getting good names here:
> >
> > The "name" in alloc_netdev_mqs is actually a format string, so we end
> > up with a name like "eth%d" here:
> >
> > net/core/dev.c: ref_tracker_dir_init(&dev->refcnt_tracker, 128, name);
>
>
>
>
> Oh, yes, never thought about that...
>
> It also seems like it might be a common problem, the subsystem defined
> name has not been given yet, although the core dev_name(dev) should
> work. But in netdev drivers, alloc_netdev_mqs() does not have access
> to that.
>
> > At the point that we call these (preinit), net->ns.inum hasn't been
> > assigned yet, so we can't incorporate it properly into the dentry name:
> >
> > net/core/net_namespace.c: ref_tracker_dir_init(&net->refcnt_tracker, 128, "net refcnt");
> > net/core/net_namespace.c: ref_tracker_dir_init(&net->notrefcnt_tracker, 128, "net notrefcnt");
> >
> > We could do the ref_tracker_dir_init() calls later, but we may end up
> > missing some references that way (or end up crashing because the "dir"
> > isn't initialized.
> >
> > My current thinking is to add a new ref_tracker_dir_finalize() function
> > that we could use to finalize the name and register the debugfs files
> > after we have the requisite info. It's an extra manual step, but I like
> > that better than moving around the ref_tracker_dir_init() calls.
>
> Agree. Although, bike shedding, i don't really like the _finalize in
> ref_tracker_dir_finalize(). Ideally this should be optional and
> populate debugfs. _finalize does not sound particularly optional. So
> maybe ref_tracker_dir_debugfs()?
>
I'm terrible at naming, so we can go with that. That last step will
definitely be optional.
> This also has the advantage of we need to worry less about GPU
> drivers. They see no change in behaviour, but we can give them a heads
> up the new call exists if they want to use it to populate debugfs.
>
+1
--
Jeff Layton <jlayton@kernel.org>
prev parent reply other threads:[~2025-04-14 12:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-08 13:36 [PATCH v2 0/2] " Jeff Layton
2025-04-08 13:36 ` [PATCH v2 1/2] ref_tracker: add a top level debugfs directory for ref_tracker Jeff Layton
2025-04-10 4:27 ` Kuniyuki Iwashima
2025-04-10 12:05 ` Andrew Lunn
2025-04-08 13:36 ` [PATCH v2 2/2] net: add debugfs files for showing netns refcount tracking info Jeff Layton
2025-04-10 4:24 ` Kuniyuki Iwashima
2025-04-10 12:36 ` Andrew Lunn
2025-04-10 13:08 ` Jeff Layton
2025-04-10 13:23 ` Jeff Layton
2025-04-10 14:12 ` Andrew Lunn
2025-04-10 14:41 ` Jeff Layton
2025-04-13 11:40 ` Jeff Layton
2025-04-13 19:32 ` Andrew Lunn
2025-04-14 12:20 ` Jeff Layton
2025-04-14 12:46 ` Andrew Lunn
2025-04-14 12:48 ` Jeff Layton [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=cc695a916d9abd79fa1cd9725c767c7e294a3b39.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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
Powered by JetHome