-
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/msp430_common: Update to inline-able IRQ API #14362
Conversation
- Updated to inline-able IRQ API - Improved robustness of functions - Added memory barrier to prevent the compiler from moving code outside of a critical section guarded by irq_disable() ... irq_restore() - Reduced overhead of `irq_disable()` - After clearing the global interrupt enable (GIE) bit, IRQs remain enabled for up to one CPU cycle - The previous implementation just added a nop to fill that cycle - This implementation uses the cycle for masking the return value - Reduced overhead of `irq_restore()` - Now only one CPU cycle is needed - `irq_disable()`, `irq_restore()`, and `irq_enable()` work now in constant time
I'll test on |
That might be one of the last experiment on these devices: they are going to be removed during the summer :( |
extern "C" { | ||
#endif | ||
|
||
extern volatile int __irq_is_in; |
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.
why is volatile the best choice here?
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.
IMO it should not be volatile
. But I didn't want to change this, as this not directly related to the API transition.
I think this one will conflict a lot with #12457. That'll have to wait until I'm back from vacation, but IMO it would make sense to base this PR on that. |
Do the instructions for |
I just rebased #12457 on top of this PR. These were the conflicts:
None of them were caused by this PR. (And not was terrible difficult to fix; the first three files have just be removed, the |
thanks for checking! |
Anyway, soft feature freeze in effect since 20 minutes. So I guess this will have to wait until next release :-/ |
Results:
Considering #13267 I think failures are OK! |
I'm not familiar with the msp430 instruction set, I will need to read on it a bit. But since feautre freeze is in, there is no real urgency :) |
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.
I've looked at the assembler code and from my understanding looks OK, I had already tested before. With your change there is no usage of __enable_irq()
and __disable_irq()
is only used in thread_yield_higher
, I think those private functions should be removed from cpu/msp430_common/include/cpu.h
and the occurrence of __disable_irq
replaced by irq_disable()
.
If you agree that those function should be removed, then please trigger murdock afterwards @maribu! |
@maribu Maybe remove those functions in a distinct commit instead of a fixup? We can wait for murdock to finish for that to see if other things pop up. |
Some Murdock workers seem to have issues with the network file system right now :-/ Maybe someone from the CI team can take a look? |
Drop `__enable_irq()` and `__disable_irq()` and replace single remaining call of them with the standard IRQ API, as this is now equally fast.
e87991b
to
1a8defd
Compare
@riot-ci @RIOTCI @aabadie @kaspar030 @cgundogan any ideas what is going on with murdock? |
there was a test server running out of memory. That is removed now from the build queue. I retriggered the affected PRs. |
@cgundogan: Thanks! :-) All green now :-) |
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!
Thanks :-) |
Contribution description
a critical section guarded by irq_disable() ... irq_restore()
irq_disable()
for up to one CPU cycle
irq_restore()
irq_disable()
,irq_restore()
, andirq_enable()
work now in constant timeTesting procedure
tests/irq_disable_restore
I ran
tests/irq_disable_restore
on awsn430-v1_3b
board in the FIT/IoT-Lab:Console output
tests/tests/bench_mutex_pingpong
I ran
tests/tests/bench_mutex_pingpong
on the same hardware in the FIT/IoT-LabConsole output with `master`
Console output with this PR
So ~7.5% speedup.
Issues/PRs references
Follow up of: #13999
Tracked in: #14356