Skip to content
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

Add system call instrumentation #1288

Conversation

YuuichiNakamura
Copy link
Contributor

Summary

This PR adds sched_note_syscall_enter/leave hooks for the system call instrumentation.
Syscall wrapper library is created for the hooks.

(Moved from PR #1271)

Impact

If CONFIG_SCHED_INSTRUMENTATION_SYSCALL is enabled, new library libwraps.a is built and additional linker options are passed to the final link process.
All syscalls are hooked by sched_note_syscall_enter/leave,

At this moment, only Arm and RISC-V can enable it.

Testing

Tested by spresense:nsh and maix-bit:nsh by changing the following configurations.
CONFIG_DRIVER_NOTE=y
CONFIG_SCHED_INSTRUMENTATION=y
CONFIG_SCHED_INSTRUMENTATION_BUFFER=y
CONFIG_SCHED_INSTRUMENTATION_SYSCALL=y
CONFIG_SCHED_NOTE_GET=y
CONFIG_SYSTEM_NOTE=y
"note" command displays the system call information.

@xiaoxiang781216
Copy link
Contributor

LGTM, @patacongo do you have any concern?

@masayuki2009
Copy link
Contributor

@YuuichiNakamura

Please fix the style violation.

../nuttx/tools/checkpatch.sh -g d24bd782a9a773480e9ecd4fe0340b5a143996fb..a2acd67e26b832116cb4e4d273696d696c6a54fd
##[warning]/home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/syscall/syscall_names.c:45:3: warning: #include outside of 'Included Files' section
##[error]/home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/syscall/syscall_names.c:48:1: error: "Private/Public Functions" not found! File was not be checked
##[error]Process completed with exit code 1.

Copy link
Contributor

@xiaoxiang781216 xiaoxiang781216 left a comment

Choose a reason for hiding this comment

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

@masayuki2009 it's hard to fix nxstyle warning due to the special design of syscall_lookup.h.

@masayuki2009
Copy link
Contributor

@xiaoxiang781216

@masayuki2009 it's hard to fix nxstyle warning due to the special design of syscall_lookup.h.

I've just checked the code and undestand it's hard to fix.

@xiaoxiang781216 xiaoxiang781216 merged commit 159b7b4 into apache:feature/syscall-instrumentation Jun 25, 2020
@YuuichiNakamura YuuichiNakamura deleted the feature/syscall-instrumentation branch June 25, 2020 23:46
@btashton btashton added this to To-Add in Release Notes - 10.0.0 Oct 14, 2020
@btashton btashton moved this from To-Add to Added in Release Notes - 10.0.0 Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants