Skip to content

Debug stream text msg improvements#10845

Open
jsarha wants to merge 2 commits into
thesofproject:mainfrom
jsarha:debug_stream_text_msg_improvements
Open

Debug stream text msg improvements#10845
jsarha wants to merge 2 commits into
thesofproject:mainfrom
jsarha:debug_stream_text_msg_improvements

Conversation

@jsarha
Copy link
Copy Markdown
Contributor

@jsarha jsarha commented Jun 4, 2026

Make ds_send_text_record() a syscall to make userspace debugging easier. And export ds_msg() to allow its usage in module code.

Jyri Sarha added 2 commits June 5, 2026 01:00
Refactor ds_vamsg() to separate the text formatting from the debug
stream record sending. The new ds_send_text_record() takes a
pre-formatted text buffer and length, and is declared as a Zephyr
syscall when CONFIG_USERSPACE is enabled.

ds_vamsg() now formats the message into a local buffer and calls
ds_send_text_record(), which can be invoked from both user and
supervisor contexts. Add the z_vrfy wrapper with K_SYSCALL_MEMORY_READ
validation and register the syscall header in CMakeLists.txt.

Define DS_TEXT_MSG_MAX_LEN (128) in the shared user header to keep
the buffer size consistent between user and kernel sides.

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
Export ds_msg() to allow using it in loadable modules.

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
Copilot AI review requested due to automatic review settings June 4, 2026 22:02
Copy link
Copy Markdown
Contributor

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

This PR improves debug stream text messaging for Zephyr-based SOF builds by making ds_send_text_record() callable from user space via a syscall and by exporting ds_msg() for use from module code.

Changes:

  • Register debug_stream_text_msg.h for Zephyr syscall header generation.
  • Add ds_send_text_record() API as a Zephyr syscall (when CONFIG_USERSPACE is enabled) and introduce DS_TEXT_MSG_MAX_LEN.
  • Implement syscall plumbing (z_impl_*/z_vrfy_* + marshalling include) and export ds_msg().

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
zephyr/CMakeLists.txt Adds the header to Zephyr’s syscall generation inputs.
src/include/user/debug_stream_text_msg.h Introduces DS_TEXT_MSG_MAX_LEN and the ds_send_text_record() syscall/public prototype.
src/debug/debug_stream/debug_stream_text_msg.c Implements the syscall handler + verifier and exports ds_msg(); refactors text record sending path.

Comment on lines +55 to +67
void ds_vamsg(const char *format, va_list args)
{
char text[DS_TEXT_MSG_MAX_LEN];
ssize_t len;

len = vsnprintf(text, sizeof(text), format, args);

if (len < 0)
return;
len = MIN(len, sizeof(text));

ds_send_text_record(text, len);
}
Comment on lines +27 to +33
#define DS_TEXT_MSG_MAX_LEN 128

#if defined(__ZEPHYR__) && defined(CONFIG_USERSPACE)
__syscall void ds_send_text_record(const char *text, size_t len);
#else
void ds_send_text_record(const char *text, size_t len);
#endif
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.

2 participants