On Fri, Jan 13, 2017, Patrick Welche wrote: ...
> NetBSD 7.99.58 (RUMP-ROAST) > ... > audio0 at pad0: half duplex, playback, capture > mutex error: lockdebug_alloc: already initialized > > lock address : 0x00007f7ff6604300 type : sleep/adaptive > initialized : 0x00007f7ff640294a > shared holds : 0 exclusive: 0 > shares wanted: 0 exclusive: 0 > current cpu : 0 last held: 0 > current lwp : 0x00007f7ff7b3f800 last held: 000000000000000000 > last locked : 000000000000000000 unlocked*: 000000000000000000 > > > panic: LOCKDEBUG: mutex error: lockdebug_alloc: already initializedIt seems taht drvctl_init gets called twice: first call of drvctl_init #0 drvctl_init () at /usr/src/sys/rump/dev/lib/libdrvctl/../../../../kern/kern_drvctl.c:118 #1 0x00007f7ff6401e29 in rumpcompinitRUMP_COMPONENT_DEV () at /usr/src/sys/rump/dev/lib/libdrvctl/drvctl_component.c:46 #2 0x00007f7fe50d2fcd in rump_component_init (type=RUMP_COMPONENT_DEV) at /usr/src/sys/rump/librump/rumpkern/rump.c:606 #3 0x00007f7fe5c0b348 in rumpcompinitRUMP__FACTION_DEV () at /usr/src/sys/rump/librump/rumpdev/rump_dev.c:54 #4 0x00007f7fe50d2fcd in rump_component_init (type=RUMP__FACTION_DEV) at /usr/src/sys/rump/librump/rumpkern/rump.c:606 #5 0x00007f7fe50d297b in rump_init () at /usr/src/sys/rump/librump/rumpkern/rump.c:434 #6 0x0000000000203cd9 in main (argc=1, argv=0x7f7fffffcb20) at /usr/src/usr.bin/rump_allserver/rump_allserver.c:401 second call: #0 drvctl_init () at /usr/src/sys/rump/dev/lib/libdrvctl/../../../../kern/kern_drvctl.c:118 #1 0x00007f7ff6402ef2 in drvctl_modcmd (cmd=MODULE_CMD_INIT, arg=0x0) at /usr/src/sys/rump/dev/lib/libdrvctl/../../../../kern/kern_drvctl.c:615 #2 0x00007f7fe50af0c4 in module_do_builtin (pmod=0x7f7ff7bd1c98, name=0x7f7ff640321b "drvctl", modp=0x0, props=0x0) at /usr/src/sys/rump/librump/rumpkern/../../../kern/kern_module.c:830 #3 0x00007f7fe50ae78c in module_init_class (modclass=MODULE_CLASS_ANY) at /usr/src/sys/rump/librump/rumpkern/../../../kern/kern_module.c:511 #4 0x00007f7fe50d2a95 in rump_init () at /usr/src/sys/rump/librump/rumpkern/rump.c:459 #5 0x0000000000203cd9 in main (argc=1, argv=0x7f7fffffcb20) at /usr/src/usr.bin/rump_allserver/rump_allserver.c:401
Yeah, it seems that the rump initialization code is calling routine drvctl_init() in order to determine the c-major for the /dev/drvctl node. The right thing to do here is to temporarily attach the cdevsw structure, retrieve the c-major, and then detach the cdevsw. Later, normal module initialization code will handle the full-blown attach of the drvctl device module.
Interestingly, it seems that this code is broken in other ways, too! In particular, even though it retrieves the c-major for /dev/drvctl, it never actually creates the device node! So I have to wonder if you can even use drvctl within rump at this time!
Anyway, try the attached patch. It should avoid the duplicate attempts at calling drvctl_init(), and it should also enable /dev/drvctl within the rump environment. Let me know if it helps.
FWIW, I suspect the reason that no-one else sees this is because very few others are running a LOCKDEBUG version of the rump_all_server! Without LOCKDEBUG the failure will be silently ignored.
+------------------+--------------------------+------------------------+ | Paul Goyette | PGP Key fingerprint: | E-mail addresses: | | (Retired) | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com | | Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org | +------------------+--------------------------+------------------------+
Index: drvctl_component.c =================================================================== RCS file: /cvsroot/src/sys/rump/dev/lib/libdrvctl/drvctl_component.c,v retrieving revision 1.2 diff -u -p -r1.2 drvctl_component.c --- drvctl_component.c 26 Jan 2016 23:12:15 -0000 1.2 +++ drvctl_component.c 14 Jan 2017 09:28:16 -0000 @@ -43,13 +43,13 @@ RUMP_COMPONENT(RUMP_COMPONENT_DEV) devmajor_t bmaj, cmaj; int error; - drvctl_init(); - - config_init_component(cfdriver_ioconf_drvctl, - cfattach_ioconf_drvctl, cfdata_ioconf_drvctl); - bmaj = cmaj = NODEVMAJOR; if ((error = devsw_attach("drvctl", NULL, &bmaj, &drvctl_cdevsw, &cmaj)) != 0) panic("drvctl devsw attach failed: %d", error); + if ((error = rump_vfs_makeonedevnode(S_IFCHR, "/dev/drvctl", cmaj, 0)) + !=0) + panic("cannot create drvctl device node: %d", error); + if ((error = devsw_detach(NULL, &drvctl_cdevsw)) != 0) + panic("cannot detach drvctl devsw: %d", error); }