From: Jakub Kicinski <kuba@kernel.org>
To: Breno Leitao <leitao@debian.org>
Cc: Jeff Johnson <quic_jjohnson@quicinc.com>,
Kalle Valo <kvalo@kernel.org>, Jeff Johnson <jjohnson@kernel.org>,
keescook@chromium.org,
"open list:NETWORKING DRIVERS (WIRELESS)"
<linux-wireless@vger.kernel.org>,
"open list:QUALCOMM ATHEROS ATH10K WIRELESS DRIVER"
<ath10k@lists.infradead.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ath10k: allocate dummy net_device dynamically
Date: Fri, 22 Mar 2024 08:23:36 -0700 [thread overview]
Message-ID: <20240322082336.49f110cc@kernel.org> (raw)
In-Reply-To: <Zf2ceu2O47lLbKU3@gmail.com>
On Fri, 22 Mar 2024 07:58:02 -0700 Breno Leitao wrote:
> > Looks like init_dummy_netdev wipes the netdev structure clean, so I
> > don't think we can use it directly as the setup function, Breno :(
>
> Before my patch, init_dummy_netdev was being also used. The patch was
> basically replacing the init_dummy_netdev by alloc_netdev() with will
> call "setup(dev);" later.
>
> - init_dummy_netdev(&irq_grp->napi_ndev);
> + irq_grp->napi_ndev = alloc_netdev(0, "dummy", NET_NAME_UNKNOWN,
> + init_dummy_netdev);
>
> I am wondering if alloc_netdev() is messing with something instead of
> init_dummy_netdev().
alloc_netdev() allocates some memory and initializes lists which
free_netdev() wants to free, basically. But init_dummy_netdev() does:
/* Clear everything. Note we don't initialize spinlocks
* are they aren't supposed to be taken by any of the
* NAPI code and this dummy netdev is supposed to be
* only ever used for NAPI polls
*/
memset(dev, 0, sizeof(struct net_device));
so all those pointers and init alloc_netdev() did before calling setup
will get wiped.
> Also, Kalle's crash is during rmmod, and not during initialization.
> getting NULL after free_netdev() is called.
>
> > Maybe we should add a new helper to "alloc dummy netdev" which can
> > call alloc_netdev() with right arguments and do necessary init?
>
> What are the right arguments in this case?
I'm not sure we have a noop setup() callback today. If you define a
wrapper to allocate a dummy netdev you can define a new empty function
next to it and pass that as init? Hope I got the question right.
next prev parent reply other threads:[~2024-03-22 15:23 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-19 10:47 [PATCH] ath10k: allocate dummy net_device dynamically Breno Leitao
2024-03-19 16:05 ` Jeff Johnson
2024-03-19 17:15 ` Breno Leitao
2024-03-19 18:46 ` Jeff Johnson
2024-03-20 15:12 ` Jeff Johnson
2024-03-20 15:25 ` Kalle Valo
2024-03-20 17:01 ` Breno Leitao
2024-03-21 14:28 ` Jakub Kicinski
2024-03-21 22:02 ` Jeff Johnson
2024-03-21 22:17 ` Jakub Kicinski
2024-03-22 14:58 ` Breno Leitao
2024-03-22 15:23 ` Jakub Kicinski [this message]
2024-03-27 14:38 ` Breno Leitao
2024-03-27 14:45 ` Jakub Kicinski
2024-03-27 15:42 ` Jeff Johnson
2024-03-27 16:17 ` Jakub Kicinski
2024-03-27 15:26 ` Kalle Valo
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=20240322082336.49f110cc@kernel.org \
--to=kuba@kernel.org \
--cc=ath10k@lists.infradead.org \
--cc=jjohnson@kernel.org \
--cc=keescook@chromium.org \
--cc=kvalo@kernel.org \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=quic_jjohnson@quicinc.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