From: Sergei Trofimovich <slyich@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Stephen Hemminger <stephen@networkplumber.org>, netdev@vger.kernel.org
Subject: Re: atl1c drivers run 'napi/eth%d-385' named threads with unsubstituted %d
Date: Sat, 22 Jan 2022 12:12:28 +0000 [thread overview]
Message-ID: <20220122121228.3b73db2a@nz> (raw)
In-Reply-To: <YetjpvBgQFApTRu0@lunn.ch>
On Sat, 22 Jan 2022 02:53:42 +0100
Andrew Lunn <andrew@lunn.ch> wrote:
> > > So please give this a try. I've not even compile tested it...
> > >
> > > iff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> > > index da595242bc13..983a52f77bda 100644
> > > --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> > > +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> > > @@ -2706,6 +2706,10 @@ static int atl1c_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> > > goto err_alloc_etherdev;
> > > }
> > >
> > > + err = dev_alloc_name(netdev, netdev->name);
> > > + if (err < 0)
> > > + goto err_init_netdev;
> > > +
> > > err = atl1c_init_netdev(netdev, pdev);
> > > if (err) {
> > > dev_err(&pdev->dev, "init netdevice failed\n");
> > >
> > > If this works, i can turn it into a real patch submission.
> > >
> > > Andrew
> >
> >
> > This may not work right because probe is not called with RTNL.
> > And the alloc_name is using RTNL to prevent two devices from
> > getting the same name.
>
> Oh, yes. I looked at some of the users. And some do take rtnl before
> calling it. And some don't!
>
> Looking at register_netdev(), it seems we need something like:
>
> if (rtnl_lock_killable()) {
> err = -EINTR;
> goto err_init_netdev;
> }
> err = dev_alloc_name(netdev, netdev->name);
> rtnl_unlock();
> if (err < 0)
> goto err_init_netdev;
>
>
> It might also be a good idea to put a ASSERT_RTNL() in
> __dev_alloc_name() to catch any driver doing this wrong.
Thank you Andrew! I used this second version of your patch
against 5.16.1 and it seems to work:
$ sudo ping -f 172.16.0.1
613 root 20 0 0 0 0 S 11.0 0.0 0:07.46 napi/eth0-385
614 root 20 0 0 0 0 R 5.3 0.0 0:03.96 napi/eth0-386
Posting used diff as is just in case:
Tested-by: Sergei Trofimovich <slyich@gmail.com>
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -2706,6 +2706,15 @@ static int atl1c_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
goto err_alloc_etherdev;
}
+ if (rtnl_lock_killable()) {
+ err = -EINTR;
+ goto err_init_netdev;
+ }
+ err = dev_alloc_name(netdev, netdev->name);
+ rtnl_unlock();
+ if (err < 0)
+ goto err_init_netdev;
+
err = atl1c_init_netdev(netdev, pdev);
if (err) {
dev_err(&pdev->dev, "init netdevice failed\n");
--
Sergei
next prev parent reply other threads:[~2022-01-22 12:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-21 21:57 atl1c drivers run 'napi/eth%d-385' named threads with unsubstituted %d Sergei Trofimovich
2022-01-21 23:45 ` Andrew Lunn
2022-01-22 1:03 ` Stephen Hemminger
2022-01-22 1:53 ` Andrew Lunn
2022-01-22 12:12 ` Sergei Trofimovich [this message]
2022-01-22 15:54 ` Andrew Lunn
2022-01-22 19:40 ` Andrew Lunn
2022-01-22 22:01 ` Sergei Trofimovich
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=20220122121228.3b73db2a@nz \
--to=slyich@gmail.com \
--cc=andrew@lunn.ch \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.