Page MenuHomeFreeBSD

Remove the FIRMWARE_MAX limit.
ClosedPublic

Authored by markj on Jun 5 2020, 10:51 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Oct 26, 4:22 PM
Unknown Object (File)
Sat, Oct 26, 4:22 PM
Unknown Object (File)
Sat, Oct 26, 4:21 PM
Unknown Object (File)
Sat, Oct 26, 4:01 PM
Unknown Object (File)
Sat, Oct 26, 1:28 AM
Unknown Object (File)
Mon, Oct 14, 4:51 PM
Unknown Object (File)
Sep 16 2024, 8:04 AM
Unknown Object (File)
Sep 16 2024, 5:17 AM

Details

Summary

The firmware module arbitrarily limits us to at most 50 images. It is
possible to hit this limit on platforms that preload many firmware
images, or link all of the firmware images for a set of devices into the
kernel.

Convert the table into a linked list instead of blindly bumping the
maximum.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj requested review of this revision.Jun 5 2020, 10:51 PM
markj created this revision.
rpokala added inline comments.
sys/kern/subr_firmware.c
270 ↗(On Diff #72754)

The original code did this without the lock held; the patch does it while holding the lock. Why the difference?

sys/kern/subr_firmware.c
270 ↗(On Diff #72754)

I removed the mtx_lock()/unlock() at the beginning of the function, which synchronizes with the msleep() in firmware_get(). A plain lock/unlock looks kind of strange, and this reduces the number of lock acquisitions in the common case (though that doesn't really matter). Both versions are correct.

sys/kern/subr_firmware.c
270 ↗(On Diff #72754)

Yeah, the back-to-back lock/unlock was... odd.

But, why was that necessary to synchronize with the msleep()? Wouldn't the actual meaningful lock and unlock have done that?

In any case, I'm still not clear on why the mutex needs to be held around the wakeup_one() now, when it didn't before.

sys/kern/subr_firmware.c
270 ↗(On Diff #72754)

Indeed, it's not strictly necessary to hold the lock across the wakeup_one() call. Acquiring and releasing the firmware mutex once in each path through loadimage() is enough: once loadimage() acquires the mutex, we know that firmware_get() is sleeping, so there is no possibility of lost wakeups. I did it this way to make it a bit more clear that the mutex is used to synchronize the wakeup as well as protect access to the firmware table.

I plan to commit this in a couple of days if there are no objections.

This revision is now accepted and ready to land.Jun 9 2020, 3:06 PM
This revision was automatically updated to reflect the committed changes.