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

Update latency_measure benchmark test for userspace #63636

Merged

Conversation

peter-mitsis
Copy link
Collaborator

This set of commits updates the latency measure benchmark test to add support for user space.

Where possible, results are provided for operations performed from both kernel and user threads.

dcpleung
dcpleung previously approved these changes Oct 17, 2023
teburd
teburd previously approved these changes Oct 24, 2023
dcpleung
dcpleung previously approved these changes Oct 24, 2023
teburd
teburd previously approved these changes Oct 24, 2023
jxstelter
jxstelter previously approved these changes Oct 26, 2023
@peter-mitsis
Copy link
Collaborator Author

This latest push modified the prj.conf and prj_user.conf files to minimize the number of timer interrupts. If the system supports a tickless kernel, it will be used automiatically; if not, then it falls back to the minimum number of system ticks per second.

@peter-mitsis
Copy link
Collaborator Author

Hmm ... when the twister tests fail on the user space version of the latency_measure test, it seems to be failing in one of two ways ...

  1. Timeout after approximately 60 seconds, and output has been cut off.
  2. Unexpected eof, and the output shows that the test has successfully finished.

I am not able to reproduce either case locally (even after updating to the 0.16.3. SDK)

# configurations on platforms that support user space.
benchmark.user.latency:
filter: CONFIG_ARCH_HAS_USERSPACE
slow: true
Copy link
Member

Choose a reason for hiding this comment

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

how slow is this? slow means it will almost never run as part of CI, and we do not want that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Locally, this test passes in very reasonable amount of time on my development box. However, I have been finding that when executed as part of CI, the user thread configuration has been consistently failing every platform. Those failures can be divided into two categories: timeout and unexpected eof. For both of these categories, CI indicates that the test is taking about 60 seconds. In the timeout case, the test will get to various points depending upon the platform, but for some of the cases it appears to be 25% of the way through.

Please correct me if I have misunderstood the use of the slow field. It was my understanding that this will not prevent it from nightly runs, but it will prevent it from regular CI. I was thinking, perhaps incorrectly, that the benefits of executing a benchmark test as part of every CI would be minimal, and that it would be something that would be better targeted for nightly testing. That being said, I have no problem dropping the slow field if there is a preference for it to be part of the regular CI.

Updates both the preemptive and cooperative thread context switch
benchmark tests so that not only will they share the same
infrastructure, but they can both get the context switch times
when switching from ...
  1. Kernel thread to kernel thread
  2. Kernel thread to user thread
  3. User thread to kernel thread
  4. User thread to user thread

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
Updates the interrupt to thread benchmark tests to address
a number of items.
  1. Updates descriptions to correctly indicate that it is not
     interrupt latency being measured, but the time to leave
     the interrupt and return to a thread.
  2. Repeats the test numerous times instead of just once to
     get an average.
  3. Overhead from obtaining timestamps is now accounted for.
  4. Adds support for returning to a user thread.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
Update the thread ops (create/start/suspend/resume/abort) to include
support for userspace.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
Updates the semaphore benchmarking in the latency_benchmark code
to support user threads.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
Updates the mutex benchmark tests to support user threads.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
Many architectures and platforms can not directly read a timestamp
from userspace as the relevant MMIO registers are inaccessible.
This necessitates that the timestamp be obtained by a system call.

The additional overhead from these system calls can be taken into
account and the recorded times adjusted depending upon whether
the test occurred entirely within kernel space, entirely within
user space, or a mix between the two.

It is worth noting that when the test requires a mix of both user
and kernel space threads, the overhead is estimated as the mean
average of purely kernel threads and purely user threads overhead
times. This might not be technically correct, but it ought to
provide a reasonable enough approximation.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
Adds userspace configuration to testcase.yaml.

Updates the README.rst with output from runs on a frdm_k64f board
as not only have the descriptions changed, but there is now
additional output for userspace configurations.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
@peter-mitsis
Copy link
Collaborator Author

Rebased to resolve merge conflicts.

@carlescufi carlescufi merged commit 6899c0d into zephyrproject-rtos:main Oct 31, 2023
16 checks passed
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.

6 participants