sst: add detailed info API#188
Conversation
b029c74 to
541982b
Compare
| Clos: closInfos, | ||
| } | ||
| if control.BFSupported && bfCores != nil { | ||
| punit.BF.Cores = bfCores |
There was a problem hiding this comment.
Do we have users of BF.Cores anywhere? e.g. in nri policies?
if yes, might be some backward compatible apis?
There was a problem hiding this comment.
Good comment. In the new API this is available via the GetPerfLevelInfo() method (BFInfo.HighPriorityCPUs) so the data is there. BUT, I had failed to add this to the legacy API wrapper so there was a bug (in legacy_api.go). This is now fixed.
EDIT: Yes, NRI plugins use this info to determine the cpu priority classes.
| var tfBuckets []TFBucketInfo | ||
| for b := range 8 { | ||
| if tfData.HPCoreCounts[b] == 0 { | ||
| break |
There was a problem hiding this comment.
continue instead of break? or shall it be also break above for tpmi?
There was a problem hiding this comment.
I changed to continue to be in line with TPMI.
| } | ||
| } | ||
| var tfBuckets []TFBucketInfo | ||
| for b := range 8 { |
There was a problem hiding this comment.
This range, maybe declare constant?
There was a problem hiding this comment.
Argh, ugly. Change to use range instead
| } | ||
|
|
||
| // PerfLevelGetInfo reads detailed data for one SST-PP performance level. | ||
| func PerfLevelGetInfo(socketID, punitID uint8, level int) (isst.PerfLevelDataInfo, error) { |
There was a problem hiding this comment.
Umm, yes, remnant of a a version with more detailed info (still WIP, I'll probably submit at some point later on as a separate PR). Dropped
| lo, err := BFReadCoreMask(cpu, level, 0) | ||
| if err != nil { | ||
| return BFInfo{}, err | ||
| } | ||
| hi, err := BFReadCoreMask(cpu, level, 1) | ||
| if err != nil { | ||
| return BFInfo{}, err | ||
| } | ||
| return BFInfo{ | ||
| HighPriorityBaseFreqRatio: int(getBits(p1, 8, 15)), | ||
| LowPriorityBaseFreqRatio: int(getBits(p1, 0, 7)), | ||
| CoreMask: uint64(lo) | (uint64(hi) << 32), |
There was a problem hiding this comment.
Our old impl looks like unnecessary "complication". The cpumask is capped to uint64 on the TPMI interface side, too. Also, what we have here matches the intel-speed-select reference tool implementation.
| lo, err := isst.SendMboxCmd(cpu, isst.CONFIG_TDP, isst.CONFIG_TDP_GET_CORE_MASK, 0, uint32(level)) | ||
| if err != nil { | ||
| return 0, fmt.Errorf("failed to read level core mask (lo) at level %d: %w", level, err) | ||
| } | ||
| hi, err := isst.SendMboxCmd(cpu, isst.CONFIG_TDP, isst.CONFIG_TDP_GET_CORE_MASK, 0, uint32(level|(1<<8))) | ||
| if err != nil { | ||
| return 0, fmt.Errorf("failed to read level core mask (hi) at level %d: %w", level, err) | ||
| } | ||
| return uint64(lo) | (uint64(hi) << 32), nil |
There was a problem hiding this comment.
Same here: the cpumask is capped to uint64 on the TPMI interface side, too. Also, what we have here matches the intel-speed-select reference tool implementation.
| Supported bool `json:"supported"` | ||
| Enabled bool `json:"enabled"` |
There was a problem hiding this comment.
IT's deliberate to drop it within the new API. The old API still has the field and is not changed. In the new API the "Cores" is retrieved with the GetPerfLevelInfo() method.
Make them not importable by other projects. Signed-off-by: Markus Lehtonen <markus.lehtonen@intel.com>
Add API to query information about TDP levels. This patch implements a very limited set of data, only basic info on SST-BF and SST-TF. Can be extended on future PRs. Signed-off-by: Markus Lehtonen <markus.lehtonen@intel.com>
Signed-off-by: Markus Lehtonen <markus.lehtonen@intel.com>
|
Updated. Major churn included here is to move the Also addressed copilot's review comments, with some renaming of methods and improving/consolidating error messages. |
Add API to query information about TDP levels. This patch implements a very limited set of data, only basic info on SST-BF and SST-TF. Can be extended on future PRs.
Also implements a new
infosubcommand for the sst example cli.