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

tests: rtio: rtio_api: test cq_count overflow #81820

Closed

Conversation

JordanYates
Copy link
Collaborator

Add a test for the behaviour of rtio_submit with CONFIG_RTIO_SUBMIT_SEM=n when the cq_count variable overflows.

Note CI is currently expected to fail, this is a POC of the behaviour.

Now that `CONFIG_RTIO_SUBMIT_SEM` is the default option, testing the
alternate code path requires explicitly disabling it.

Signed-off-by: Jordan Yates <[email protected]>
Add a test for the behaviour of `rtio_submit` with
`CONFIG_RTIO_SUBMIT_SEM=n` when the `cq_count` variable overflows.

Signed-off-by: Jordan Yates <[email protected]>
@teburd
Copy link
Collaborator

teburd commented Dec 16, 2024

Test makes sense to me.

I guess to fix this we will need to correct the compare to understand a rollover may be required, we can do that by perhaps tracking not just the needed (and potentially rolled over count) but by tracking the the starting count and the difference in count we need to wait on.

E.g. maybe something like this?

uintptr_t cq_start_count = atomic_get(...);
bool wraps = (cq_start_count + wait_count) < cq_start_count; /* wrapping! */
while (atomic_get(...) >= (cq_start_count + wait_count) && wraps) {
}
while ( atomic_get(...) < (cq_start_count + wait_count) ) {
}

I'm open to suggestions

@JordanYates
Copy link
Collaborator Author

Incorporated in #85079

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants