netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH next] loopback: fix lockdep splat
@ 2019-07-03  6:16 Mahesh Bandewar
  2019-07-03  8:45 ` Geert Uytterhoeven
  2019-07-03 18:24 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Mahesh Bandewar @ 2019-07-03  6:16 UTC (permalink / raw)
  To: Netdev
  Cc: Eric Dumazet, David Miller, Mahesh Bandewar, Mahesh Bandewar,
	Geert Uytterhoeven

dev_init_scheduler() and dev_activate() expect the caller to
hold RTNL. Since we don't want blackhole device to be initialized
per ns, we are initializing at init.

[    3.855027] Call Trace:
[    3.855034]  dump_stack+0x67/0x95
[    3.855037]  lockdep_rcu_suspicious+0xd5/0x110
[    3.855044]  dev_init_scheduler+0xe3/0x120
[    3.855048]  ? net_olddevs_init+0x60/0x60
[    3.855050]  blackhole_netdev_init+0x45/0x6e
[    3.855052]  do_one_initcall+0x6c/0x2fa
[    3.855058]  ? rcu_read_lock_sched_held+0x8c/0xa0
[    3.855066]  kernel_init_freeable+0x1e5/0x288
[    3.855071]  ? rest_init+0x260/0x260
[    3.855074]  kernel_init+0xf/0x180
[    3.855076]  ? rest_init+0x260/0x260
[    3.855078]  ret_from_fork+0x24/0x30

Fixes: 4de83b88c66 ("loopback: create blackhole net device similar to loopack.")
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: Mahesh Bandewar <maheshb@google.com>
---
 drivers/net/loopback.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 3b39def5471e..14545a8797a8 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -261,8 +261,10 @@ static int __init blackhole_netdev_init(void)
 	if (!blackhole_netdev)
 		return -ENOMEM;
 
+	rtnl_lock();
 	dev_init_scheduler(blackhole_netdev);
 	dev_activate(blackhole_netdev);
+	rtnl_unlock();
 
 	blackhole_netdev->flags |= IFF_UP | IFF_RUNNING;
 	dev_net_set(blackhole_netdev, &init_net);
-- 
2.22.0.410.gd8fdbe21b5-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH next] loopback: fix lockdep splat
  2019-07-03  6:16 [PATCH next] loopback: fix lockdep splat Mahesh Bandewar
@ 2019-07-03  8:45 ` Geert Uytterhoeven
  2019-07-03 18:24 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2019-07-03  8:45 UTC (permalink / raw)
  To: Mahesh Bandewar
  Cc: Netdev, Eric Dumazet, David Miller, Mahesh Bandewar, Linux-Renesas

Hi Mahesh,

s/lockdep/rcu/ in the subject.

On Wed, Jul 3, 2019 at 8:16 AM Mahesh Bandewar <maheshb@google.com> wrote:
> dev_init_scheduler() and dev_activate() expect the caller to
> hold RTNL. Since we don't want blackhole device to be initialized
> per ns, we are initializing at init.
>
> [    3.855027] Call Trace:
> [    3.855034]  dump_stack+0x67/0x95
> [    3.855037]  lockdep_rcu_suspicious+0xd5/0x110
> [    3.855044]  dev_init_scheduler+0xe3/0x120
> [    3.855048]  ? net_olddevs_init+0x60/0x60
> [    3.855050]  blackhole_netdev_init+0x45/0x6e
> [    3.855052]  do_one_initcall+0x6c/0x2fa
> [    3.855058]  ? rcu_read_lock_sched_held+0x8c/0xa0
> [    3.855066]  kernel_init_freeable+0x1e5/0x288
> [    3.855071]  ? rest_init+0x260/0x260
> [    3.855074]  kernel_init+0xf/0x180
> [    3.855076]  ? rest_init+0x260/0x260
> [    3.855078]  ret_from_fork+0x24/0x30
>
> Fixes: 4de83b88c66 ("loopback: create blackhole net device similar to loopack.")
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Mahesh Bandewar <maheshb@google.com>

Thanks, that got rid of the rcu splat.

Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH next] loopback: fix lockdep splat
  2019-07-03  6:16 [PATCH next] loopback: fix lockdep splat Mahesh Bandewar
  2019-07-03  8:45 ` Geert Uytterhoeven
@ 2019-07-03 18:24 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-07-03 18:24 UTC (permalink / raw)
  To: maheshb; +Cc: netdev, edumazet, mahesh, geert

From: Mahesh Bandewar <maheshb@google.com>
Date: Tue,  2 Jul 2019 23:16:31 -0700

> dev_init_scheduler() and dev_activate() expect the caller to
> hold RTNL. Since we don't want blackhole device to be initialized
> per ns, we are initializing at init.
> 
> [    3.855027] Call Trace:
> [    3.855034]  dump_stack+0x67/0x95
> [    3.855037]  lockdep_rcu_suspicious+0xd5/0x110
> [    3.855044]  dev_init_scheduler+0xe3/0x120
> [    3.855048]  ? net_olddevs_init+0x60/0x60
> [    3.855050]  blackhole_netdev_init+0x45/0x6e
> [    3.855052]  do_one_initcall+0x6c/0x2fa
> [    3.855058]  ? rcu_read_lock_sched_held+0x8c/0xa0
> [    3.855066]  kernel_init_freeable+0x1e5/0x288
> [    3.855071]  ? rest_init+0x260/0x260
> [    3.855074]  kernel_init+0xf/0x180
> [    3.855076]  ? rest_init+0x260/0x260
> [    3.855078]  ret_from_fork+0x24/0x30
> 
> Fixes: 4de83b88c66 ("loopback: create blackhole net device similar to loopack.")
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Mahesh Bandewar <maheshb@google.com>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-03 18:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-03  6:16 [PATCH next] loopback: fix lockdep splat Mahesh Bandewar
2019-07-03  8:45 ` Geert Uytterhoeven
2019-07-03 18:24 ` David Miller

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).