Page MenuHomeFreeBSD

'devctl clear driver' shall not fail if no driver has been found
AcceptedPublic

Authored by saper_saper.info on Aug 20 2025, 5:04 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Oct 18, 7:27 AM
Unknown Object (File)
Mon, Oct 6, 5:10 AM
Unknown Object (File)
Fri, Oct 3, 8:05 AM
Unknown Object (File)
Wed, Oct 1, 7:48 AM
Unknown Object (File)
Tue, Sep 30, 9:16 AM
Unknown Object (File)
Sep 23 2025, 3:21 AM
Unknown Object (File)
Sep 17 2025, 11:37 AM
Unknown Object (File)
Sep 17 2025, 9:11 AM

Details

Reviewers
jhb
imp
Group Reviewers
bhyve
Summary

Detaching bhyve(4) ppt driver from the unsupported PCI device shall
not cause "Device not configured" error. We do not expect
that a new driver must take the device over in this case.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 66384
Build 63267: arc lint + arc unit

Event Timeline

I was really confused by the wifibox messages like this

2025-08-04T11:35:14+0200 WARN  PPT device pci2:0:0 could not be destroyed
2025-08-04T11:35:20+0200 WARN  PPT device pci2:0:0 could not be destroyed
2025-08-04T11:35:27+0200 WARN  PPT device pci2:0:0 could not be destroyed
2025-08-04T11:35:34+0200 WARN  PPT device pci2:0:0 could not be destroyed
2025-08-04T11:35:40+0200 WARN  PPT device pci2:0:0 could not be destroyed
2025-08-04T11:35:47+0200 WARN  PPT device pci2:0:0 could not be destroyed
2025-08-04T11:35:54+0200 WARN  PPT device pci2:0:0 could not be destroyed
2025-08-04T11:36:00+0200 WARN  PPT device pci2:0:0 could not be destroyed

https://lists.freebsd.org/archives/freebsd-current/2025-August/008456.html

imp added inline comments.
sys/kern/subr_bus.c
5937–5944

yea, device_probe() is weird. It returns -1 in two cases, only one of which is relevant here (the DS_ALIVE one). I guess neither could happen getting here though, assuming that device_detach does the right thing.

This revision is now accepted and ready to land.Aug 20 2025, 5:48 PM

Silence ENXIO from device_probe()

device_probe() will return ENXIO when no driver could be found.

This revision now requires review to proceed.Aug 20 2025, 6:47 PM

As it turns out, we get ENXIO from device_probe() when no driver has been found.

With this change wifibox does not report any error anymore and it can be stopped and started multiple times.

I wonder how to test this with some other device, or whether devmatch works/does not work with this

jhb added inline comments.
lib/libdevctl/devctl.3
380

This I think already covers the behavior you are fixing as it says the error is only if attach fails, not if probe doesn't find a driver, so I would probably leave off the manpage update.

sys/kern/subr_bus.c
5937

I think this needs a comment, something like:

devclass_delete_device(...);

/*
  * Don't use device_probe_and_attach so that failing to find a new driver
  * isn't reported as an error.
  */
error = device_probe(dev);
This revision is now accepted and ready to land.Aug 21 2025, 4:42 PM