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)
Sat, Nov 16, 12:14 PM
Unknown Object (File)
Sat, Nov 16, 5:40 AM
Unknown Object (File)
Sep 30 2024, 8:56 AM
Unknown Object (File)
Sep 21 2024, 1:28 PM
Unknown Object (File)
Sep 19 2024, 11:09 PM
Unknown Object (File)
Sep 18 2024, 3:58 PM
Unknown Object (File)
Sep 15 2024, 11:54 PM
Unknown Object (File)
Sep 15 2024, 8:26 PM
Subscribers
None

Details

Summary

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

Sponsored by: Netflix

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 42495
Build 39383: arc lint + arc unit

Event Timeline

imp requested review of this revision.Nov 1 2021, 7:18 PM
imp created this revision.
sys/kern/subr_bus.c
6058
6137
sys/kern/subr_bus.c
6094

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.

6123

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
6094

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.

6123

Sure.

sys/kern/subr_bus.c
6094

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).

6141

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
6094

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.