forked from sosreport/sos
-
Notifications
You must be signed in to change notification settings - Fork 30
[mellanox_firmware] PCC collector (opt in) #104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
DanGoldberg
wants to merge
12
commits into
NVIDIA:main
Choose a base branch
from
DanGoldberg:ppcc-collector
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 11 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
658e673
PPCC collector
DanGoldberg 5481945
Renamed collector and target subdir for PCC
DanGoldberg 197f390
Optional execution for pcc (false by default)
DanGoldberg 5fb385b
Fixes and small additions
DanGoldberg 1269e97
Added fwctl support to pcc colelctor
DanGoldberg 7ef3cc6
Cleanup
DanGoldberg 7006fb3
Updated plugin description and fixed flake8 error
DanGoldberg 9e31ac4
Merge upstream/main into ppcc-collector
DanGoldberg 7a6e8d3
Styling fixes
DanGoldberg 854db61
Updated mellanox_firmware and global timeouts to 2160 seconds
DanGoldberg 2b63e94
doca_pcc collector
DanGoldberg d4c295f
Revert "doca_pcc collector"
DanGoldberg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
sos/report/mellanox_firmware_suite/collectors/doca_pcc_collector.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| import os | ||
| import re | ||
|
|
||
|
|
||
| class DocaPccCollector(object): | ||
| _TOOL_PATH = "/opt/mellanox/doca/tools/pcc_counters.sh" | ||
| _OUTPUT_SUBDIR = "pcc_info/doca_pcc_counters" | ||
|
|
||
| # sw_dev_id values embedded in MST device names for supported devices: | ||
| # ConnectX6DX: 4125 (/dev/mst/mt4125_*) | ||
| # ConnectX7: 4129 (/dev/mst/mt4129_*) | ||
| # BlueField3: 41692 (/dev/mst/mt41692_*) | ||
| _SUPPORTED_DEV_IDS = frozenset({"4125", "4129", "41692"}) | ||
| _MST_DEV_ID_RE = re.compile(r"/dev/mst/mt(\d+)_") | ||
|
|
||
| def _is_supported_device(self, mst_device): | ||
| match = self._MST_DEV_ID_RE.search(mst_device) | ||
| return match is not None and match.group(1) in self._SUPPORTED_DEV_IDS | ||
|
|
||
| def run(self, plugin, ctx): | ||
| if not ctx.primary: | ||
| return | ||
|
|
||
| if ctx.mst_device is None: | ||
| plugin._log_info( | ||
| f"doca_pcc: skipping {ctx.pci} — no MST device path available" | ||
| ) | ||
| return | ||
|
|
||
| if not self._is_supported_device(ctx.mst_device): | ||
| plugin._log_info( | ||
| f"doca_pcc: skipping {ctx.pci} — " | ||
| f"{ctx.mst_device!r} is not a supported device" | ||
| ) | ||
| return | ||
|
|
||
| if not os.path.isfile(self._TOOL_PATH): | ||
| plugin._log_info( | ||
| f"doca_pcc: {self._TOOL_PATH} not found; skipping collection" | ||
| ) | ||
| return | ||
|
|
||
| self._collect(plugin, ctx) | ||
|
|
||
| def _collect(self, plugin, ctx): | ||
| mst_dev = ctx.mst_device | ||
|
|
||
| result = plugin.exec_cmd(cmd=f"{self._TOOL_PATH} set {mst_dev}") | ||
| rc = result.get("status", 1) | ||
|
|
||
| if rc != 0: | ||
| plugin._log_info( | ||
| f"doca_pcc: setting counters failed for {mst_dev} (rc={rc}); " | ||
| "skipping query" | ||
| ) | ||
| return | ||
|
|
||
| filename = f"pcc_counters_{ctx.bdf}_query" | ||
|
|
||
| plugin._collect_cmd_output( | ||
| cmd=f"{self._TOOL_PATH} query {mst_dev}", | ||
| suggest_filename=filename, | ||
| subdir=self._OUTPUT_SUBDIR, | ||
| stderr=True, | ||
| ) | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.