Comments (29)
I thought the memory corruption issue relates to an IPI (Inter Processor Interrupt) issue.
But I noticed that there was no nested interrupts.
Also, I noticed that there is a global temporary storage called irqtmp in arm_vectors.S.
I'm not sure why this storage is needed for Cortex-A implementation (perhaps, to store
registers to change processor mode?) but the irqtmp would be accessed from multiple
CPUs so I think the storage should be protected or should be allocated per CPU.
from incubator-nuttx.
Hello @gregory-nutt,
What do you think about my comments on irqtmp in armv7-a/arm_vectors.S?
from incubator-nuttx.
Hi @masayuki2009 , this week i have guests and we will be at the beach for 3 more days. I have only my cellphone now so I will not be able to do much.
From the name, that irqtmo is probably used to handle nested SGI interrupts, but I do not know for sure now.
from incubator-nuttx.
I have a vew minutes before we leave.
"From the name, that irqtmo is probably used to handle nested SGI interrupts, but I do not know for sure now."
No, that little storage area is use during normal interrupt processing.
"storage should be protected or should be allocated per CPU."
Yes, I think that is true. Also fiqtmp (FIQs are used with TrustZone). These is other *tmp storage, but these are fatal crashes. These need to be redesigned.
from incubator-nuttx.
Hi @patacongo , I'm not in hurry so enjoy your holiday.
from incubator-nuttx.
Also "They are very basic use-cases and should work with QEMU."
It has been awhile since I have used the sabre-6quad, but this historically has not been an issue on real hardware. I wonder if this is just lucky timing on real hardware, or a QEMU emulation difference?
from incubator-nuttx.
It has been awhile since I have used the sabre-6quad,
but this historically has not been an issue on real hardware.
I wonder if this is just lucky timing on real hardware, or a QEMU emulation difference?
I think it was lucky.
In my experience, QEMU has some differences from a real hardaware.
- No cache emulation.
- Emulation speed depends on host CPU
- No peripheral emulation (in most cases, only CPU and UART)
- No alignment exceptions (RISC-V only ?)
However, QEMU is very useful for debugging. (You can debug multi cores)
from incubator-nuttx.
Hi @patacongo,
I also noticed that calling setirqstack in arm_vectors.S destroys $r5 which should be preserved.
This might be a one of root cause.
from incubator-nuttx.
@masayuki2009 "I also noticed that calling setirqstack in arm_vectors.S destroys $r5 which should be preserved."
Are you referring to:
263 setirqstack r1, r5 /* SP = IRQ stack top */
it looks like R2 is available. Do you think that should be:
263 setirqstack r1, r2 /* SP = IRQ stack top */
No... a value in R2 is assumed at line 315, but I think r3 is available.
from incubator-nuttx.
I don't have a test setup here so I can't verify it. If you approve, I can submit the PR.
If you were to document how to use QEMU in your test case, I would try that too. However, I have not used QEMU much (and not for many years), so I am not so interested in that learning curve.
from incubator-nuttx.
@masayuki2009 QEMU is very important for automatiton test in the next step, it's great if you can create a basic config for both riscv and arm and README file to describe how to setup the simulator and debuging.
from incubator-nuttx.
For the case of the i.MX6 QEMU, this would be appropriate in boards/arm/imx6/sabre-6quad/README.txt
from incubator-nuttx.
@xiaoxiang781216 @patacongo I'll add comments on how to run sabre-6quad nuttx image on QEMU later. (FYI, running RISC-V FE310 and K210 images on QEMU is already described)
from incubator-nuttx.
@xiaoxiang781216 @patacongo I've just sent a PR #233
from incubator-nuttx.
I don't see any simple way to implement the first issue you mention, that where g_irqtmp would be invalid in the case of nested interrupts. Nested interrupts would occur only in the SMP case where the SGI inter-processor interrupts are non-maskable.
I see only two solutions and neither are simple:
-
Implement IRQ/FIQ stacks. I am not clear on the design that would use these stacks, but stacking the data should be able to support nesting.
-
Implement ICCMPR interrupt controls and prohibit nesting interrupts altogether.
from incubator-nuttx.
Hi @patacongo,
I just tried the latest upstream code with QEMU and confirmed that $r5 is not destroyed now.
What I did is that I added a breakpoint at Line 276 (the next line to .Lintnested:) in arm_vectors.S
then run the nuttx with QEMU and the breakpoint was not hit. Actually ps/free/smp commands worked.
However, if I modified defconfig to add a hello application and type free on nsh, it freezed.
Though the above breakpoint was not hit, heap memory was corrupted in this case.
--- a/boards/arm/imx6/sabre-6quad/configs/smp/defconfig
+++ b/boards/arm/imx6/sabre-6quad/configs/smp/defconfig
@@ -21,11 +21,13 @@ CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LOOPSPERMSEC=99369
CONFIG_BOOT_RUNFROMSDRAM=y
CONFIG_BUILTIN=y
+CONFIG_DEBUG_FULLOPT=y
+CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEV_ZERO=y
+CONFIG_EXAMPLES_HELLO=y
CONFIG_FS_PROCFS=y
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
-CONFIG_HOST_WINDOWS=y
CONFIG_IMX6_UART1=y
CONFIG_IMX_DDR_SIZE=1073741824
CONFIG_INTELHEX_BINARY=y
from incubator-nuttx.
@patacongo I found and fixed another bug for armv7-a smp which is a root cause of this issue.
Please see #292 for details.
from incubator-nuttx.
Thanks. I have merged that.
from incubator-nuttx.
@patacongo I've just sent another PR #325 which improves i.mx6 SMP stability. Now ostest works with QEMU (4cores enabled)
However, as I commented, nested interrupt issue might happen. (actually not happens when ostest is running)
from incubator-nuttx.
However, as I commented, nested interrupt issue might happen.
(actually not happens when ostest is running)
To reproduce this issue, more complicated use-cases which generate high frequency interrupts would be needed. For examples, DMA, Ethernet, SDIO ... should be involved but no drivers are implemented so far.
from incubator-nuttx.
I found DMA for i.mx6 is not supported in QEMU.
from incubator-nuttx.
Sorry, I didn't mean to close this. I hit the wrong button again, apparently.
from incubator-nuttx.
@masayuki2009 Should this issue be closed now? You did a lot of work with Cortex-A and got parity with the other architectures, right?
from incubator-nuttx.
@masayuki2009 Should this issue be closed now?
You did a lot of work with Cortex-A and got parity with the other architectures, right?
@patacongo Yes, but I checked SMP for Cortex-A with QMU only.
I believe it should work with a real board but I don't have any boards.
So could you check it with your i.MX6 board?
from incubator-nuttx.
Per recommendation of @masayuki2009
from incubator-nuttx.
I thought the memory corruption issue relates to an IPI (Inter Processor Interrupt) issue.
But I noticed that there was no nested interrupts.
@masayuki2009 Is it still true that "cpsid i" can't disable IPI interrupt?
https://github.com/apache/incubator-nuttx/blob/master/boards/arm/imx6/sabre-6quad/README.txt#L178-L200
If yes, could you point the document which mention this special behaviour?
from incubator-nuttx.
@masayuki2009 Is it still true that "cpsid i" can't disable IPI interrupt?
No, "cpsid" ** can *** disable IPI interrupt.
Oh, I updated the TODO file but forgot to update the README.txt
#2346
Anyway, I will create a new PR to update the README.txt
from incubator-nuttx.
Ok, I will send PR to remove all related trick.
from incubator-nuttx.
Here is the patch: #4094
from incubator-nuttx.
Related Issues (20)
- iob_free: io_offset not taken into consideration when adjusting remaining io_pktlen? HOT 6
- Documentation: migrate pages from wiki
- Buggy handling of unsigned long in vsprintf_internal HOT 1
- Why kasan.c cannot use to stack overflow check ? the algorithm limit it ? HOT 1
- Failure in compilation of sim_hostusrsock.c due to improper handling of header inclusion for fd_set HOT 2
- Failed to build simulator HOT 2
- Unexpected behaviour with poll and tickless scheduler HOT 6
- gdb nsh:tcpblaster cannot access network HOT 7
- stringstream linker problem when Normal, Full Optimization Activated HOT 4
- Feature Request: Make C-header files compatible with C++ HOT 3
- Fail to nxtask_delete by update of cancel point logic HOT 9
- Math library header files are not exported HOT 2
- How to expand the size of a heap? HOT 1
- Gh HOT 1
- [bug] cmake building failed HOT 2
- SPI/DMA issue with ws2812 driver HOT 4
- WIFI thread crash in OTA mode HOT 4
- [question] Since nuttx and uboot have the same .config configuration and macros, do they also overlap in functionality? HOT 3
- Networking 1s Send Delay and SO_SNDTIMEO odd behavior HOT 7
- IEEE802.15.4 support for nRF52 and nRF53
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from incubator-nuttx.