Sponsored by: FreeBSD Foundation
Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me>
Differential D56547
hmp(4): add provider interface Authored by minsoochoo0122_proton.me on Tue, Apr 21, 10:21 AM. Tags None Referenced Files
Subscribers
Details
Diff Detail
Event TimelineComment Actions I'm facing some challenges while working on making IntelHFI compatible with HMP, and I'd like to ask for your advice. It seems that the current HMP mechanism doesn't allow for dynamic loading of providers like intelhfi using kldload. I understand that HMP providers don't require dynamic loading or unloading for their purpose, hence this approach. Is my understanding correct? (Currently, intelhfi is being developed as a device driver, so changing to this approach would require some adjustments.) Comment Actions Yes. The reason is that this will be integrated with scheduler later, and I haven't found a good approach to kldload/kldunload on runtime without confusing the scheduler. Comment Actions Thank you very much for improving HMP. Excuse me, but I have a problem regarding how to make intelhfi compatible with HMP, and I'd like to ask for your advice.
Comment Actions
Right, I'll add return value for init() and if it fails, provider with next lower priority will do their init(), and so on.
Device driver probe() and hmp probe() are different things. E.g. even if the provider isn't selected, you might want to report what it gets (e.g. score) through sysctl. So please keep it as device driver for now.
hmp(4) exists for schedulers. In other words, if something is too excessive or too much provider-dependent and not used by scheduler, it shouldn't be processed by hmp(4) at all. Different providers might have different CLASS, and making hmp(4) contain info regarding all those classes will be excessive. In fact, the scheduler only needs performance and efficient scores which are stored in hmp_pcpu struct. If a provider has a class other than perf/eff, then it can be displayed through provider's sysctl, but hmp(4) and scheduler doesn't need that info.
Capacity is for load balancing. Because scheduler will use (individual capacity of core)/(total capacity) a lot, we'll need if (has_capacity) many places without default capacity provider. Although the default capacity provider is called "provider", it's nothing more than filling static values into capacity field. Now, score is used for thread preference (e.g. when there is new thread/load balancing, which core should take the thread?). In this case, having if (has_scores) is better because 1) we only have few places that need this logic and 2) with if (has_scores), we can fall back to capacities so cores with larger capacity can take the thread. Please note that core with larger capacity is always better choice for new threads, but I believe it is in most cases (benchmark is needed).
Device trees is capacity-only, while SCMI is score-only. The separation of capacity and score providers is for cases like having device tree as capacity provider and SCMI as score providers. On intelhfi, this is trivial. Comment Actions probe() and init() now returns int. When init() fails, init() from next highest provider will run. |