Skip to content

Conversation

@jsarha
Copy link

@jsarha jsarha commented Apr 26, 2024

No description provided.

Add new debug window slot type for second telemetry data slot.

Signed-off-by: Jyri Sarha <[email protected]>
@jsarha jsarha changed the title Thread analyzer telemetry2 debugfs Telemetry2 debugfs Apr 26, 2024
/* debug log slot types */
#define SOF_IPC4_DEBUG_SLOT_UNUSED 0x00000000
#define SOF_IPC4_DEBUG_SLOT_CRITICAL_LOG 0x54524300 /* byte 0: core ID */
#define SOF_IPC4_DEBUG_SLOT_DEBUG_LOG 0x474f4c00 /* byte 0: core ID */
Copy link
Collaborator

Choose a reason for hiding this comment

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

@jsarha can you please elaborate a bit on what telemetry2 is, the need for it and how it is different from the existing telemetry?

Copy link
Author

Choose a reason for hiding this comment

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

It tries to be what Liam has described here:
thesofproject/sof#5521 (comment)

Copy link
Member

Choose a reason for hiding this comment

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

yeah, but no one can figure this out. You have to add a simple enough abstract so that the PR is self-contained and self-explanatory.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@plbossart this should be GPL-2.0 only right?

Copy link
Member

Choose a reason for hiding this comment

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

Correct @ranj063. @jsarha we don't use dual-licensing when the infrastructure is specific to Linux. In this case debugfs is a Linux-specific solution which cannot be reused in other solutions, so GPL-2.0-only it is.

Copy link
Author

Choose a reason for hiding this comment

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

Ok, just copy-pasted this from somewhere. I try to find more suitable source.

Copy link
Member

Choose a reason for hiding this comment

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

@jsarha also drop the 'All rights reserved'. We removed all this recently.

#define SOF_IPC4_DEBUG_SLOT_DEBUG_LOG 0x474f4c00 /* byte 0: core ID */
#define SOF_IPC4_DEBUG_SLOT_GDB_STUB 0x42444700
#define SOF_IPC4_DEBUG_SLOT_TELEMETRY 0x4c455400
#define SOF_IPC4_DEBUG_SLOT_TELEMETRY2 0x4c455500
Copy link
Member

Choose a reason for hiding this comment

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

commit message: a 'second telemetry slot'?

so we can have two slots for telemetry used concurrently? if not, how do we know which one is valid?

That's not a good start for a review in general.

Copy link
Author

Choose a reason for hiding this comment

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

I'd assume this would require some discussion. The old telemetry slot is not very extendable so something new is needed to pass more debugging information to SOF side.

Copy link
Member

Choose a reason for hiding this comment

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

drop "All rights reserved."

Copy link
Member

Choose a reason for hiding this comment

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

is this even remotely backwards compatible with previous generations, e.g. if you update the kernel but not the firmware?

Copy link
Author

Choose a reason for hiding this comment

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

Sure it is, as much as it can be. There of course is no previous generations of this particular feature, but its using the old debug slot reservation mechanism on the FW side and using the same function as mtrace and telemetry(1) to look for the specific slot based on the id. Naturally, there is not much we can do if the ID is not found.

Copy link
Member

Choose a reason for hiding this comment

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

the kernel should continue if it doesn't find an ID that only supported in newer versions of firmware.
I think this feature should be clearly advertised in the extended manifest, checking for the presence of an ID is a bit weird.

In this case it's not lethal because we actually ignore ALL errors from this function, so even returning -EFAULT is useless. You don't need an error code...

Copy link
Member

Choose a reason for hiding this comment

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

commit message "left to user-space tools"

What tools are you referring to? are they open-source?

Copy link
Author

@jsarha jsarha May 2, 2024

Choose a reason for hiding this comment

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

The first prototype tool for extracting the thread information from the telemetry2 slot is implemented as third commit in this PR:
thesofproject/sof#9084

But I am vague on purpose. This debugfs file just shows the debug slot contents as it is in a file, and thus the Linux driver part can be quite agnostic of the both the FW and the tools to decode the information. The tool should then check that the ABI version in the debug window is something it can understand.

Copy link
Member

Choose a reason for hiding this comment

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

At minimum you should state that the tools to extract the thread information will be open-sourced. That's a common concern for reviewers/maintainers that a new kernel interface is exposed but it can only used with private tools. In this case this is not the direction at all so an additional comment would help.

Copy link
Member

Choose a reason for hiding this comment

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

what is the 2 in telemetry2?

Does this invalidate or exist concurrently with ipc4-telemetry?

Copy link
Author

Choose a reason for hiding this comment

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

Tried to answer to this question here: thesofproject/sof#9084 (comment)

The "telemetry2" debugfs file simply maps the telemetry2 debug slot as
a debugfs file. The decoding is left to user-space tools.

The telemetry2 debug window contents is encoded in SOF FW code found
under sof/src/debug/telemetry directory in the SOF FW sources.

Signed-off-by: Jyri Sarha <[email protected]>
@jsarha jsarha force-pushed the thread-analyzer-telemetry2-debugfs branch from c8ddb5b to 211db10 Compare May 2, 2024 19:46
@jsarha
Copy link
Author

jsarha commented May 2, 2024

Updated the license sections and added one something more to the commit message. But the number one question still is, what to call this debug window slot, if not telemetry2?

@jsarha
Copy link
Author

jsarha commented Sep 13, 2024

Closing this, as there is replacement PR here: #5154

@jsarha jsarha closed this Sep 13, 2024
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.

3 participants