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

subsys/ztest: Make 1cpu tests run on CPU 0 specifically #43547

Merged
merged 1 commit into from
Mar 8, 2022

Conversation

andyross
Copy link
Contributor

@andyross andyross commented Mar 8, 2022

Some hardware has "interesting" configuration like asymmetric default
interrupt masking (the intel_adsp devices in particular, but x86's
IO-APIC driver has tripped over this in the past too) that needs
special treatment if you want to run something on "core 1"
specifically, and 1cpu test cases pretty much by definition are going
to have been written without SMP details in mind. Switch the logic
around a tiny bit such that these test cases always run on CPU ID zero
explicitly.

Actually in practice this was ALMOST guaranteed to be true already,
because test setup and happens serially, having been started on the
main thread, which starts on CPU 0 by definition. Then the test
teardown aborts all the spawned threads that might have been running
on CPUs 1+, so those reach idle, and the next test case starts
syncronously on the same thread (and thus CPU) where it started. But
nonetheless that wasn't actually enforced, and we've found at least
one simulation environment where timing conspires to break things.

Signed-off-by: Andy Ross [email protected]

@andyross andyross requested a review from nashif as a code owner March 8, 2022 16:59
@github-actions github-actions bot added the area: Test Framework Issues related not to a particular test, but to the framework instead label Mar 8, 2022
@andyross andyross requested review from ceolin, dcpleung and enjiamai March 8, 2022 17:00
@andyross
Copy link
Contributor Author

andyross commented Mar 8, 2022

Recreating a new PR to replace #42803 , as that seems to have gotten into some kind of weird state following a rebase. Needs re-review, obviously.

dcpleung
dcpleung previously approved these changes Mar 8, 2022
Some hardware has "interesting" configuration like asymmetric default
interrupt masking (the intel_adsp devices in particular, but x86's
IO-APIC driver has tripped over this in the past too) that needs
special treatment if you want to run something on "core 1"
specifically, and 1cpu test cases pretty much by definition are going
to have been written without SMP details in mind.  Switch the logic
around a tiny bit such that these test cases always run on CPU ID zero
explicitly.

Actually in practice this was ALMOST guaranteed to be true already,
because test setup and happens serially, having been started on the
main thread, which starts on CPU 0 by definition.  Then the test
teardown aborts all the spawned threads that might have been running
on CPUs 1+, so those reach idle, and the next test case starts
syncronously on the same thread (and thus CPU) where it started.  But
nonetheless that wasn't actually enforced, and we've found at least
one simulation environment where timing conspires to break things.

Signed-off-by: Andy Ross <[email protected]>
@nashif nashif merged commit adc901a into zephyrproject-rtos:main Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Test Framework Issues related not to a particular test, but to the framework instead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants