Page MenuHomeFreeBSD

bus: Create dev_wired_cache
ClosedPublic

Authored by imp on Nov 1 2021, 7:18 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Mar 22, 11:35 PM
Unknown Object (File)
Jan 16 2024, 3:46 PM
Unknown Object (File)
Jan 7 2024, 8:25 AM
Unknown Object (File)
Jan 7 2024, 8:21 AM
Unknown Object (File)
Jan 7 2024, 8:21 AM
Unknown Object (File)
Jan 7 2024, 8:21 AM
Unknown Object (File)
Jan 7 2024, 8:21 AM
Unknown Object (File)
Jan 7 2024, 8:03 AM
Subscribers
None

Details

Summary

A simple cache to cache differnet locators to the same device.

Sponsored by: Netflix

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

imp requested review of this revision.Nov 1 2021, 7:18 PM
imp created this revision.
sys/kern/subr_bus.c
6116
6195
sys/kern/subr_bus.c
6152

You could simplify this a fair bit by just donating the allocated path pointer and then just malloc'ing the dln here. It does mean the fini routine above has to free dln->dln_path explicitly, but that seems like a lot simpler in implementation.

6181

You can make path a char * now that device_get_path returns that and then remove the need for the __DECONST below.

sys/kern/subr_bus.c
6152

That assumes that all the callers will have allocated this string and are cool with donating it. I don't think that's the case, especially for a cache miss. Then we'd have to pass back to the caller whether or not to free this thing.

6181

Sure.

sys/kern/subr_bus.c
6152

The only caller is the one call below that uses device_get_path which always has an allocated string (this is a static function, it's not one of the public APIs).

6199

This is the sole call, and path is always allocated.

Updating with these suggestions.

I also think that before I add FDT, I'll need to shift to creating a locator object and using it to make decisions rather than wiring different behaviors to string compares and stuff (noted here since all the other reviews are accept with reservations and I think this will address them in the future).

sys/kern/subr_bus.c
6152

The only caller is the one call below that uses device_get_path which always has an allocated string (this is a static function, it's not one of the public APIs).

You're correct. I was confusing this with a different interface. Those are great suggestions for improvement. Will roll them into next revision.

update per review + rebase

This revision was not accepted when it landed; it landed in state Needs Review.Mar 1 2022, 3:44 PM
This revision was automatically updated to reflect the committed changes.