-
Notifications
You must be signed in to change notification settings - Fork 3k
critical: fix set exclusive access if not yet defined #5597
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
Conversation
It would be nice if that information was available system wide. If we add a new architecture that support LDREX/STREX then we have to apply modifications in RTX and mbed_critical to enable atomic support for that architecture. |
platform/mbed_critical.c
Outdated
// if __EXCLUSIVE_ACCESS rtx macro not defined, we need to get this via own-set architecture macros | ||
#ifndef __EXCLUSIVE_ACCESS | ||
#ifndef MBED_EXCLUSIVE_ACCESS | ||
#if ((__ARM_ARCH_7M__ == 1U) || \ |
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 would suggest adding any kind of reminder to update this upon new architecture arrival
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.
Added in the new commit
platform/mbed_critical.c
Outdated
#else | ||
#define MBED_EXCLUSIVE_ACCESS 0U | ||
#endif | ||
#endif |
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.
You're not doing anything with __EXCLUSIVE_ACCESS
here. Did you mean to have an #else #define MBED_EXCLUSIVE_ACCESS __EXCLUSIVE_ACCCESS
?
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.
+1, added new commit addressing it
platform/mbed_critical.c
Outdated
// if __EXCLUSIVE_ACCESS rtx macro not defined, we need to get this via own-set architecture macros | ||
#ifndef __EXCLUSIVE_ACCESS | ||
#ifndef MBED_EXCLUSIVE_ACCESS | ||
#if ((__ARM_ARCH_7M__ == 1U) || \ |
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 know this is copying the logic from RTX, but does kind of feel like the test should be the other way around - 0 only if 6M (or 6A). I think we can assume any future architecture will have exclusive access instructions, and we're not backporting to pre-6.
(On the other hand, I'm aware of platforms where the core supported exclusive access instructions, but the memory system lacked a correctly-functioning global monitor so they didn't work properly - so it's worth having the possibility for platform override.)
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 know this is copying the logic from RTX, but does kind of feel like the test should be the other way around - 0 only if 6M (or 6A). I think we can assume any future architecture will have exclusive access instructions, and we're not backporting to pre-6.
I could do that. I added a new commit that lists all architecture we are aware of and emits an error if not recognized (or can do warning and default to non-exclusive access, however that does not make much sense?).
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.
That error version seems fine. I think it's worth double-checking this sort of code when adding a new arch anyway.
/morph build |
I don't like adding it to any python file as it adds magic to the tools. I'm generally working to remove magic where I can, and adding |
Build : SUCCESSBuild number : 615 Triggering tests/morph test |
Test : FAILUREBuild number : 435 |
Exporter Build : SUCCESSBuild number : 232 |
/morph test |
Test : FAILUREBuild number : 440 |
This fails |
/morph test |
Test : FAILUREBuild number : 441 |
Had storage errors on the CI end, rekicking off the test. |
Test : FAILUREBuild number : 442 |
@kegilbert This might be real failure. I'll find a board somewhere to reproduce this locally. |
@0xc0170 Any update on this ? |
2 lp ticker failures, investigating if we can reproduce locally with the outputs from the build system |
Exporter Build : SUCCESSBuild number : 471 |
/morph test |
Test : SUCCESSBuild number : 664 |
That was odd. Resolving merge conflicts resulted in two additional commits. Rebuilding, just in case. /morph build |
Build : FAILUREBuild number : 880 |
Ill rebase this PR and restart CI |
Fixes ARMmbed#5555 bug. In case there is not yet defined __EXCLUSIVE_ACCESS, neither MBED_EXCLUSIVE_ACCESS that we are introducing, use architecture macros to find out if MBED_EXCLUSIVE_ACCESS can be enabled.
If any architecture is added, needs to update critical exclusive access. Also fixing if exclusive access is defined, we use the value.
This leads to merge commits that are not necessary, I rebased this locally to clean the history /morph build |
Build : SUCCESSBuild number : 882 Triggering tests/morph test |
Exporter Build : FAILUREBuild number : 553 |
/morph export-build |
Test : SUCCESSBuild number : 728 |
Exporter Build : SUCCESSBuild number : 555 |
Fixes #5555 bug.
In case there is not yet defined __EXCLUSIVE_ACCESS, neither MBED_EXCLUSIVE_ACCESS that
we are introducing, use architecture macros to find out if MBED_EXCLUSIVE_ACCESS can be
enabled.
First I thought that these could be added to
CORE_LABELS
that we have in tools/targets/init file. That might be better placement, but @theotherjimmy did not like the proposal. If we add a new core, this would need to be defined. In this case it might be overlooked.