Skip to content

Comments

userspace: add a performance test#10563

Draft
lyakh wants to merge 4 commits intothesofproject:mainfrom
lyakh:perf
Draft

userspace: add a performance test#10563
lyakh wants to merge 4 commits intothesofproject:mainfrom
lyakh:perf

Conversation

@lyakh
Copy link
Collaborator

@lyakh lyakh commented Feb 20, 2026

compare kernel- and userspace performance

Currently ztest delay is set to 100ms, which adds that time between
each too ztest runs. This very quickly adds up to cause an IPC
timeout in the kernel driver. That timeout isn't needed for SOF, set
it to 1ms.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
When dynamically allocating thread stack with the current Zephyr
implementation it's allocated uncached. So far there is no proper
solution to support fully dynamic cached stack. Switch to the system
stack pool until a solution is implemented. This only affects
userspace threads currently.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
3 bytes per object aren't enough any more. Increase to 4 which still
fits in an atomic 32-bit field.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Add a test to compare kernel and userspace performance when
performing tight loop calculations with no API calls.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
bool first = true;

for (;;) {
load_fn_t fn = (load_fn_t)k_event_wait(event, 0xffffffff, !first, K_FOREVER);
Copy link
Collaborator

Choose a reason for hiding this comment

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

That is some serious event overuse to pass a value here 😆. You might also try k_poll_signal_raise(), it can pass a value too. The only catch is that we don't have enabled k_poll, so it won't help. I guess this is just a quick draft for tests, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@softwarecki well, I do think it would be good to have it merged. "overuse" - well, maybe indeed this isn't how events are intended to be used, but I'd call it a "creative use" ;-)

Copy link
Collaborator

Choose a reason for hiding this comment

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

This would be the perfect place to use RTIO! Just kidding 😄 I'd suggest using something actually meant for passing data, maybe a FIFO or a queue? https://docs.zephyrproject.org/latest/kernel/services/index.html#data-passing

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