Skip to content

sst: add detailed info API#188

Merged
askervin merged 3 commits into
intel:mainfrom
marquiz:devel/sst-info
Jun 1, 2026
Merged

sst: add detailed info API#188
askervin merged 3 commits into
intel:mainfrom
marquiz:devel/sst-info

Conversation

@marquiz
Copy link
Copy Markdown
Contributor

@marquiz marquiz commented May 27, 2026

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 info subcommand for the sst example cli.

@marquiz marquiz requested review from askervin and kad May 27, 2026 17:47
@kad kad requested a review from Copilot May 29, 2026 07:55
@marquiz marquiz force-pushed the devel/sst-info branch 2 times, most recently from b029c74 to 541982b Compare May 29, 2026 08:13

This comment was marked as resolved.

@kad kad requested a review from Copilot May 29, 2026 09:07
@marquiz marquiz requested review from Copilot and removed request for Copilot May 29, 2026 09:24

This comment was marked as resolved.

@kad kad requested a review from Copilot May 29, 2026 09:40

This comment was marked as resolved.

@marquiz marquiz requested a review from Copilot May 29, 2026 10:01
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@askervin askervin requested a review from Copilot May 29, 2026 10:43
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Comment thread pkg/sst/backend.go
Clos: closInfos,
}
if control.BFSupported && bfCores != nil {
punit.BF.Cores = bfCores
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have users of BF.Cores anywhere? e.g. in nri policies?
if yes, might be some backward compatible apis?

Copy link
Copy Markdown
Contributor Author

@marquiz marquiz May 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread pkg/sst/backend.go Outdated
var tfBuckets []TFBucketInfo
for b := range 8 {
if tfData.HPCoreCounts[b] == 0 {
break
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

continue instead of break? or shall it be also break above for tpmi?

Copy link
Copy Markdown
Contributor Author

@marquiz marquiz May 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed to continue to be in line with TPMI.

Comment thread pkg/sst/backend.go Outdated
}
}
var tfBuckets []TFBucketInfo
for b := range 8 {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This range, maybe declare constant?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Argh, ugly. Change to use range instead

Comment thread pkg/sst/tpmi/tpmi.go Outdated
}

// PerfLevelGetInfo reads detailed data for one SST-PP performance level.
func PerfLevelGetInfo(socketID, punitID uint8, level int) (isst.PerfLevelDataInfo, error) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@marquiz marquiz requested review from Copilot and kad May 29, 2026 12:48
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 4 comments.

Files not reviewed (1)
  • pkg/sst/isst/types_msr_amd64.go: Language not supported

Comment thread cmd/sst/main.go Outdated
Comment on lines +340 to +351
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),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +316 to +324
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
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread pkg/sst/package.go
Comment on lines +53 to +54
Supported bool `json:"supported"`
Enabled bool `json:"enabled"`
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@marquiz marquiz requested a review from Copilot June 1, 2026 06:48
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 7 comments.

Files not reviewed (1)
  • pkg/sst/isst/types_msr_amd64.go: Language not supported

Comment thread pkg/sst/backend.go Outdated
Comment thread pkg/sst/backend.go Outdated
Comment thread pkg/sst/backend.go
Comment thread pkg/sst/backend.go
Comment thread cmd/sst/main.go
Comment thread cmd/sst/main.go
Comment thread pkg/sst/internal/isst/msr.go
Make them not importable by other projects.

Signed-off-by: Markus Lehtonen <markus.lehtonen@intel.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 17 changed files in this pull request and generated 6 comments.

Files not reviewed (1)
  • pkg/sst/internal/isst/types_msr_amd64.go: Language not supported

Comment thread pkg/sst/backend.go
Comment thread pkg/sst/backend.go
Comment thread pkg/sst/backend.go
Comment thread pkg/sst/backend.go
Comment thread pkg/sst/backend.go
Comment thread cmd/sst/main.go
marquiz added 2 commits June 1, 2026 12:43
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>
@marquiz
Copy link
Copy Markdown
Contributor Author

marquiz commented Jun 1, 2026

Updated. Major churn included here is to move the mbox/, tpmi/ and isst/ helper packages under internal/ to make them not importable by other projects (those packages are really only designed for our internal use).

Also addressed copilot's review comments, with some renaming of methods and improving/consolidating error messages.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 17 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • pkg/sst/internal/isst/types_msr_amd64.go: Language not supported

Comment thread pkg/sst/internal/isst/msr.go
Copy link
Copy Markdown
Member

@kad kad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Contributor

@askervin askervin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@askervin askervin merged commit 293d231 into intel:main Jun 1, 2026
6 checks passed
@marquiz marquiz deleted the devel/sst-info branch June 1, 2026 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants