Skip to content

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

Merged
merged 2 commits into from
Jan 17, 2018

Conversation

0xc0170
Copy link
Contributor

@0xc0170 0xc0170 commented Nov 28, 2017

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.

@pan-
Copy link
Member

pan- commented Nov 28, 2017

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.

// 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) || \
Copy link
Contributor

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

Copy link
Contributor Author

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

#else
#define MBED_EXCLUSIVE_ACCESS 0U
#endif
#endif
Copy link
Contributor

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?

Copy link
Contributor Author

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

// 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) || \
Copy link
Contributor

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.)

Copy link
Contributor Author

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?).

Copy link
Contributor

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.

@0xc0170
Copy link
Contributor Author

0xc0170 commented Nov 28, 2017

/morph build

@theotherjimmy
Copy link
Contributor

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 MBED_EXCLUSIVE_ACCESS to the tools feels like magic to me.

@mbed-ci
Copy link

mbed-ci commented Nov 28, 2017

Build : SUCCESS

Build number : 615
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5597/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build

@mbed-ci
Copy link

mbed-ci commented Nov 28, 2017

@mbed-ci
Copy link

mbed-ci commented Nov 28, 2017

@0xc0170
Copy link
Contributor Author

0xc0170 commented Nov 29, 2017

/morph test

@mbed-ci
Copy link

mbed-ci commented Nov 29, 2017

@0xc0170
Copy link
Contributor Author

0xc0170 commented Nov 29, 2017

This fails NUCLEO_F746ZG-IAR.tests-netsocket-gethostbyname.tests-netsocket-gethostbyname . I'll find how to reproduce this, if I find locally a board or will ask for help. It might be that this fix results in IAR only failure for this board...

@0xc0170
Copy link
Contributor Author

0xc0170 commented Nov 29, 2017

/morph test

@mbed-ci
Copy link

mbed-ci commented Nov 29, 2017

@kegilbert
Copy link
Contributor

Had storage errors on the CI end, rekicking off the test.
/morph test

@mbed-ci
Copy link

mbed-ci commented Nov 29, 2017

@0xc0170
Copy link
Contributor Author

0xc0170 commented Nov 30, 2017

@kegilbert This might be real failure. I'll find a board somewhere to reproduce this locally.

@adbridge
Copy link
Contributor

@0xc0170 Any update on this ?

@0xc0170
Copy link
Contributor Author

0xc0170 commented Jan 8, 2018

2 lp ticker failures, investigating if we can reproduce locally with the outputs from the build system

@mbed-ci
Copy link

mbed-ci commented Jan 8, 2018

@0xc0170
Copy link
Contributor Author

0xc0170 commented Jan 9, 2018

/morph test

@mbed-ci
Copy link

mbed-ci commented Jan 9, 2018

@cmonr
Copy link
Contributor

cmonr commented Jan 16, 2018

That was odd. Resolving merge conflicts resulted in two additional commits. Rebuilding, just in case.

/morph build

@mbed-ci
Copy link

mbed-ci commented Jan 16, 2018

Build : FAILURE

Build number : 880
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5597/

@0xc0170
Copy link
Contributor Author

0xc0170 commented Jan 17, 2018

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.
@0xc0170
Copy link
Contributor Author

0xc0170 commented Jan 17, 2018

That was odd. Resolving merge conflicts resulted in two additional commits. Rebuilding, just in case.

This leads to merge commits that are not necessary, I rebased this locally to clean the history

/morph build

@mbed-ci
Copy link

mbed-ci commented Jan 17, 2018

Build : SUCCESS

Build number : 882
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5597/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build

@mbed-ci
Copy link

mbed-ci commented Jan 17, 2018

@0xc0170
Copy link
Contributor Author

0xc0170 commented Jan 17, 2018

/morph export-build

@mbed-ci
Copy link

mbed-ci commented Jan 17, 2018

@mbed-ci
Copy link

mbed-ci commented Jan 17, 2018

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.

10 participants