|Summary:||/etc/rc.d/devmatch should REQUIRE kld|
|Product:||Base System||Reporter:||Helge Oldach <freebsd>|
|Component:||conf||Assignee:||Warner Losh <imp>|
|Severity:||Affects Only Me||CC:||brd, freebsd|
Description Helge Oldach 2021-02-06 06:43:01 UTC
In some configurations it is necessary to manually load a driver to make other devices visible, which then in turn can be detected by devmatch. For example (amd64 stable/13-n244484-154207a59bd VM under Virtualbox, MINIMAL kernel plus kld_list="virtio_pci snd_ich aesni fusefs"): Enter full pathname of shell or RETURN for /bin/sh: root@ / # service devmatch start Autoloading module: intpm.ko intsmb0: <Intel PIIX4 SMBUS Interface> irq 23 at device 7.0 on pci0 intsmb0: intr IRQ 9 enabled revision 0 smbus0: <System Management Bus> on intsmb0 root@ / # service kld start Loading kernel modules: virtio_pci0: <VirtIO PCI (legacy) Network adapter> port 0xd020-0xd03f irq 19 at device 3.0 on pci0 virtio_pci1: <VirtIO PCI (legacy) Network adapter> port 0xd240-0xd25f irq 16 at device 8.0 on pci0 pcm0: <Intel ICH (82801AA)> port 0xd100-0xd1ff,0xd200-0xd23f irq 21 at device 5.0 on pci0 pcm0: <SigmaTel STAC9700/83/84 AC97 Codec> cryptosoft0: <software crypto> aesni0: <AES-CBC,AES-CCM,AES-GCM,AES-ICM,AES-XTS> root@ / # service devmatch start Autoloading module: if_vtnet.ko vtnet0: <VirtIO Networking Adapter> on virtio_pci0 vtnet0: Ethernet address: 08:00:27:6a:04:1c vtnet1: <VirtIO Networking Adapter> on virtio_pci1 vtnet1: Ethernet address: 08:00:27:6a:59:37 root@ / # When devmatch is run before kld, it won't detect virtio_pci and therefore no if_vtnet devices as well. Only if we load virtio_pci through kld, if_vtnet becomes detectable for devmatch. So we need to ensure that kld is run before devmatch.
Comment 1 Helge Oldach 2021-02-06 07:11:50 UTC
Created attachment 222200 [details] proposed patch kld quite obviously requires kldxref, so shortcut to just kld
Comment 2 Brad Davis 2021-03-02 14:42:29 UTC
Warner, can you take a look at this?
Comment 3 Warner Losh 2021-03-02 16:06:33 UTC
devd should be running the newly visible devices through devmatch after things load. The fact that's not happening is the bug, not the order of the devmatch script in rc. This suggests the real bug is in virtio_pci doesn't generage NOMATCH events that devd will use to drive devmatch to load drivers for them. We need to see why that isn't happening.