-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
arm: core: cortex_m: add a barrier before the dummy FP instruction #8373
Conversation
Codecov Report
@@ Coverage Diff @@
## master #8373 +/- ##
=======================================
Coverage 64.61% 64.61%
=======================================
Files 423 423
Lines 40293 40293
Branches 6801 6801
=======================================
Hits 26034 26034
Misses 11126 11126
Partials 3133 3133 Continue to review full report at Codecov.
|
Do we need both isb & dsb? |
Good point, I would think that only the instruction barrier is required. |
I have to say I copied the barriers from below. From what I understand we need both:
|
IMHO, a DSB instruction would be needed if we are doing read/write to RAM or system registers and then use that value (so make sure the value is updated before performing new access). |
Ok, I think I got it. Given your explanation I guess it also means the dsb after the vmov is useless. |
I have just pushed a new version without the dsb instruction. |
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.
with the dsb removal this looks ok
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.
Looks OK to me.
I think the commit message prefix should read: "arch: arm: ......." |
On Cortex-M7 CPU (at least on STM32F723), the dummy move FPU instruction is executed before the FPU lazy state preservation is disabled. Add an instruction synchronization barrier before it to avoid that. At the same time, remove the data synchronization barrier after the dummy move as it does not have any effect on RAM or registers. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
I have just updated the patch to add the "arch:" prefix. |
On Cortex-M7 CPU (at least on STM32F723 with patches from #7284), the dummy move FPU instruction is executed before the FPU lazy state preservation is disabled. This patch adds a barrier before it to avoid that.
This can be easily reproduced with a simple example, like
hello_world
, by settingCONFIG_FLOAT=y
. The system goes in an endless loop very early, before outputting anything on the console. This is something difficult to debug, as executing the instructions step by step in GDB hides the problem. I guess the other Cortex-M7 based platforms are also affected: NXP i.MX RT and Microchip SAM E70. I guess @MaureenHelm can test the first one.