-
Notifications
You must be signed in to change notification settings - Fork 2k
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
cpu/atmega_common: return to non-interrupt context swaps #8904
Conversation
Results of a large number of tests with trunk and fix applied to trunk side by side. I did not examine what each test was doing in detail, as long as the output looked the same and didn't look like a failure.
tests of interest (significant divergences):
I will not be able to follow up on this right away. I will be out of town for a week. |
Testing on arduino-mega2560:
I will try to investigate the timing issues, but I'd say this PR is a step forward. Can you just confirm that this is getting to the exact previous implementation? I mean, before the context switching was implemented with interrupts. |
I just looked by myself and see that this is somehow a new approach, thus is not exactly coming back to a previous state. |
@kYc0o The old approach did not handle context swaps inside ISRs correctly. The context swap would run inside the ISR and the other thread would be executing in ISR mode. That was why the old approach was changed to use the interrupts. Non-ISR handling should be the same with this fix. Differences within an ISR from the old approach:
This fixes the problem the old code had with ISRs. |
@ZetaR60 from your textual description it sounds like the avr with this PR behaves like the Cortex-M port does |
@Josar can you test this in your jiminy board? |
@kYc0o test results.
|
c9b8b25
to
0a7b87b
Compare
0a7b87b
to
fc910f4
Compare
Rebased on master and merge conflicts solved. |
thread_flags looks okay to me after a closer look. 01-run.py expects EDIT: in core/include/thread_flags.h the define THREAD_FLAG_TIMEOUT is set to Still looking into posix_semaphore and trickle. |
The problems with trickle is not caused by the same underlying issue as posix_semaphore. There seems to be some problems with how tests/trickle works, at least on ATmegas, and is probably unrelated to this fix. Issue for tests/trickle: #9052 I have investigated the three main problem tests (thread_flags, posix_semaphore, and trickle). If the rest of you think that the other tests are okay or have only insignificant differences, then I think that all the currently outstanding problems with this fix have been solved. |
Ok, I understand. Let's tackle the other problems separately. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK. Please squash only the last fixup.
fc910f4
to
d3d2f02
Compare
@kYc0o Squashed. Thanks for your help! |
Second attempt. See also, first attempt: #8898
This removes the ISR based context swaps on the ATmegas. They were originally introduced in #5745. ISR swaps were introduced to handle the problems with context swaps while inside an ISR. However, there aren't really any differences in the execution environment within an ISR on the ATmega, which means that there are simpler ways to handle this problem.
The behavior is as follows:
tests/thread_* on mega-xplained all passed (including tests/thread_race added by #8897). Also tested with xtimer_* on mega-xplained and all passed except for xtimer_longterm (did not run this test) and xtimer_now64_continuity which showed some inaccuracy. This may be due to the low xtimer accuracy on mega-xplained however.
References: