You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/05/20 01:20:53 UTC

[GitHub] [incubator-nuttx] zhuyanlinzyl opened a new pull request, #6302: xtensa: coproc: modify coproc_save/restore to macro

zhuyanlinzyl opened a new pull request, #6302:
URL: https://github.com/apache/incubator-nuttx/pull/6302

   As coproc_save/restore only used in context_restore/save.
   Use macro instead of function.
   Some register use optimize.
   Unify with arm/riscv.
   
   Signed-off-by: zhuyanlin <zh...@xiaomi.com>
   
   ## Summary
   
   ## Impact
   
   ## Testing
   Testing in qemu esp32 with ostest with fputest


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] Ouss4 commented on pull request #6302: xtensa: coproc: modify coproc_save/restore to macro

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on PR #6302:
URL: https://github.com/apache/incubator-nuttx/pull/6302#issuecomment-1134422962

   The cause indicates 0x20 which is a coprocessor disabled but accessed (specifically the FPU here).  I think we are not cleaning `CPENABLE` for CPU1.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] gustavonihei commented on a diff in pull request #6302: xtensa: coproc: modify coproc_save/restore to macro

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on code in PR #6302:
URL: https://github.com/apache/incubator-nuttx/pull/6302#discussion_r878196043


##########
arch/xtensa/src/common/xtensa_coproc.S:
##########
@@ -70,13 +68,11 @@ _xtensa_coproc_saoffsets:
   .size	_xtensa_coproc_saoffsets, . - _xtensa_coproc_saoffsets
 
 /****************************************************************************
- * Public Functions
+ * Pre-processor Definitions
  ****************************************************************************/
 
-  .text
-
 /****************************************************************************
- * Name: _xtensa_coproc_savestate
+ * Marco: xtensa_coproc_savestate

Review Comment:
   ```suggestion
    * Macro: xtensa_coproc_savestate
   ```
   nit: Small typo



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6302: xtensa: coproc: modify coproc_save/restore to macro

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6302:
URL: https://github.com/apache/incubator-nuttx/pull/6302#issuecomment-1134159173

   @zhuyanlinzyl 
   
   >Testing in qemu esp32 with ostest with fputest
   
   I noticed that crash happened with esp32-devkitc:smp on qemu.
   
   ```
   NuttShell (NSH) NuttX-10.1.0
   nsh>  
   nsh> uname -a
   NuttX 10.1.0 e69c4ee637 May 23 2022 13:14:14 xtensa esp32-devkitc
   nsh> mount
     /proc type procfs
   nsh> ps
     PID GROUP CPU PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK   STACK   USED  FILLED COMMAND
       0     0   0   0 FIFO     Kthread N-- Assigned           00000000 003040 000696  22.8%  CPU0 IDLE
       1     1   1   0 FIFO     Kthread N-- Running            00000000 003040 000432  14.2%  CPU1 IDLE
       2     2   0 100 RR       Task    --- Running            00000000 003024 001592  52.6%  nsh_main
   
   ...
   
   nsh> ostest
   stdio_test: write fd=1
   stdio_test: Standard I/O Check: printf
   stdio_test: write fd=2
   stdio_test: Standard I/O Check: fprintf to stderr
   ostest_main: putenv(Variable1=BadValue3)
   ostest_main: setenv(Variable1, GoodValue1, TRUE)
   ostest_main: setenv(Variable2, BadValue1, FALSE)
   ostest_main: setenv(Variable2, GoodValue2, TRUE)
   ostest_main: setenv(Variable3, Variable3, FALSE)
   ostest_main: setenv(Variable3, Variable3, FALSE)
   show_variable: Variable=Variable1 has value=GoodValue1
   show_variable: Variable=Variable2 has value=GoodValue2
   show_variable: Variable=Variable3 has value=GoodValue3
   ostest_main: Started user_main at PID=24
   ...
   
   user_main: FPU test
   Starting task FPU#1
   fpu_test: Started task FPU#1 at PID=25
   [CPU1] xtensa_user_panic: User Exception: EXCCAUSE=0020 task: FPU#1
   [CPU1] xtensa_dumpstate: CPU1:
   [CPU1] xtensa_registerdump:    PC: 400e10b4    PS: 00060030
   [CPU1] xtensa_registerdump:    StartingA task F0PU#2
   : 800d37eb    A1: 3ffe59d0    A2: 3ffb2308    A3: 00000000
   pCPU1] xtensa_registfpu_etest: Srtarted dtask FPuU#2 at mPID=26
        A4: 00000000    A5: 00000001    A6: 00000002    A7: 0000000FPU#02: pass
   1
   [CPU1] xtensa_registerdump:    A8: 800e10b4    A9: 3ffe59b0   A10: 00000000   A11: 00000001
   [CPU1] xtensa_registerdump:   A12: 00060020   A13: 00000014   A14: 00000001   A15: 00060723
   [CPU1] xtensa_registerdump:   SAR: 0000001f CAUSE: 00000020 VADDR: 00000000
   [CPU1] xtensa_registerdump:  LBEG: 00000000  LEND: 00000000  LCNT: 00000000
   [CPU1] xtensa_dumpstate: sp:     3ffb1460
   [CPU1] xtensa_dumpstate: IRQ stack:
   [CPU1] xtensa_dumpstate:   base: 3ffb0d00
   [CPU1] xtensa_dumpstate:   size: 00000800
   [CPU1] xtensa_dumpstate:   used: 000002f0
   [CPU1] xtensa_stackdump: 3ffb1460: 00060723 3ffb14c0 00000020 3ffe58f8 000007e0 3ffb1480 00000008 3ffb42a8
   [CPU1] xtensa_stackdump: 3ffb1480: 3ffafeb0 3ffb1500 3ffb0d00 3ffe5280 800d4d32 3ffb14c0 00000020 3ffe58f8
   [CPU1] xtensa_stackdump: 3ffb14a0: 3f400210 00000020 3ffaff30 00000002 40080879 3ffb14e0 00000020 3ffe58f8
   [CPU1] xtensa_stackdump: 3ffb14c0: 800d1f16 3ffe5990 00060020 00000001 00040023 3ffb1500 00000000 3ffe5960
   [CPU1] xtensa_stackdump: 3ffb14e0: 800e10b4 3ffe59b0 00000000 00000001 deadbeef deadbeef deadbeef deadbeef
   [CPU1] xtensa_dumpstate: sp:     3ffe59d0
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] zhuyanlinzyl commented on pull request #6302: xtensa: coproc: modify coproc_save/restore to macro

Posted by GitBox <gi...@apache.org>.
zhuyanlinzyl commented on PR #6302:
URL: https://github.com/apache/incubator-nuttx/pull/6302#issuecomment-1134486539

   After that, the esp32 smp qemu was crash with this @Ouss4 
   
   ```
            If RR scheduling is working, they should start and complete at
            about the same time
   [CPU0] xtensa_user_panic: User Exception: EXCCAUSE=0014 task: pt-0x400e2d94
   [CPU0] xtensa_dumpstate: CPU0:
   [CPU0] xtensa_registerdump:    PC: 00000000    PS: 4008077d
   [CPU0] xtensa_registerdump:    A0: 00000000    A1: 3ffe7a80    A2: 00000000    A3: 00000000
   [CPU0] xtensa_registerdump:    A4: 00000002    A5: 00000000    A6: 00000000    A7: 00000000
   [CPU0] xtensa_registerdump:    A8: 00000002    A9: 00000000   A10: 00000000   A11: 00000000
   [CPU0] xtensa_registerdump:   A12: 00000000   A13: 00000000   A14: 00000000   A15: 00000000
   [CPU0] xtensa_registerdump:   SAR: 00000004 CAUSE: 00000014 VADDR: 00000000
   [CPU0] xtensa_registerdump:  LBEG: 00000000  LEND: 00000000  LCNT: 00000000
   [CPU0] xtensa_dumpstate: sp:     3ffb0c60
   [CPU0] xtensa_dumpstate: IRQ stack:
   [CPU0] xtensa_dumpstate:   base: 3ffb0500
   [CPU0] xtensa_dumpstate:   size: 00000800
   [CPU0] xtensa_dumpstate:   used: 000002f0
   [CPU0] xtensa_stackdump: 3ffb0c60: 00000000 3ffb0cc0 00000014 3ffe79a8 000007f0 3ffb0c80 00000008 3ffe2e18
   [CPU0] xtensa_stackdump: 3ffb0c80: 3ffe3c60 3ffb1500 3ffb0500 3ffe7290 800d4d32 3ffb0cc0 00000014 3ffe79a8
   [CPU0] xtensa_stackdump: 3ffb0ca0: 3f400210 00000014 3ffe3ce0 00000001 40080879 3ffb0ce0 00000014 3ffe79a8
   [CPU0] xtensa_stackdump: 3ffb0cc0: 3ffb1500 3ffe2f70 00000000 00000000 00040023 3ffb0d00 00000001 3ffe7a10
   [CPU0] xtensa_stackdump: 3ffb0ce0: 00000002 00000000 00000000 00000000 deadbeef deadbeef deadbeef deadbeef
   [CPU0] xtensa_dumpstate: sp:     3ffe7a80
   [CPU0] xtensa_dumpstate: User stack:
   [CPU0] xtensa_dumpstate:   base: 3ffe7290
   [CPU0] xtensa_dumpstate:   size: 000007f0
   [CPU0] xtensa_dumpstate:   used: 00000138
   [CPU0] xtensa_dumpstate: ERROR: Stack pointer is not within allocated stack
   [CPU0] xtensa_stackdump: 3ffe7280: 00000000 00000000 00000000 00000000 deadbeef deadbeef deadbeef deadbeef
   [CPU0] xtensa_stackdump: 3ffe72a0: deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef
   [CPU0] xtensa_stackdump: 3ffe72c0: deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef
   [CPU0] xtensa_stackdump: 3ffe72e0: deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef
   [CPU0] xtensa_stackdump: 3ffe7300: deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef
   [CPU0] xtensa_stackdump: 3ffe7320: deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef
   [CPU0] xtensa_stackdump: 3ffe7340: deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef
   [CPU0] xtensa_stackdump: 3ffe7360: deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef
   [CPU0] xtensa_stackdump: 3ffe7380: deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef
   [CPU0] xtensa_stackdump: 3ffe73a0: deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef
   [CPU0] xtensa_stackdump: 3ffe73c0: deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef
   [CPU0] xtensa_stackdump: 3ffe73e0: deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef
   [CPU0] xtensa_stackdump: 3ffe7400: deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef
   [CPU0] xtensa_stackdump: 3ffe7420: deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef
   [CPU0] xtensa_stackdump: 3ffe7440: deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef
   [CPU0] xtensa_stackdump: 3ffe7460: deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef
   [CPU0] xtensa_stackdump: 3ffe7480: deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef
   [CPU0] xtensa_stackdump: 3ffe74a0: deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef 
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 merged pull request #6302: xtensa: coproc: modify coproc_save/restore to macro

Posted by GitBox <gi...@apache.org>.
masayuki2009 merged PR #6302:
URL: https://github.com/apache/incubator-nuttx/pull/6302


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6302: xtensa: coproc: modify coproc_save/restore to macro

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6302:
URL: https://github.com/apache/incubator-nuttx/pull/6302#issuecomment-1135065173

   > I was trying to look into it but couldn't find an immediate solution/explanation. We can see from the crash dump that SP is pointing at the very bottom of the stack: `0x 3ffe7a80` = base `3ffe7290` + size `0x7f0`. I thought it was an overflow but even increasing the stack size this situation persists. Also, it happens only on QEMU, on real hardware I can't see it.
   
   @Ouss4 xtensa may need the similar fix https://github.com/apache/incubator-nuttx/pull/6198 after https://github.com/apache/incubator-nuttx/pull/6167.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] Ouss4 commented on pull request #6302: xtensa: coproc: modify coproc_save/restore to macro

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on PR #6302:
URL: https://github.com/apache/incubator-nuttx/pull/6302#issuecomment-1135109660

   > > I was trying to look into it but couldn't find an immediate solution/explanation. We can see from the crash dump that SP is pointing at the very bottom of the stack: `0x 3ffe7a80` = base `3ffe7290` + size `0x7f0`. I thought it was an overflow but even increasing the stack size this situation persists. Also, it happens only on QEMU, on real hardware I can't see it.
   > 
   > @Ouss4 xtensa may need the similar fix #6198 after #6167.
   
   Is that coloring the IDLE stack of the CPUs?  For ESP32 we allocate the PRO CPU stack using `up_create_stack` which already includes stack coloration.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6302: xtensa: coproc: modify coproc_save/restore to macro

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6302:
URL: https://github.com/apache/incubator-nuttx/pull/6302#discussion_r878349648


##########
arch/xtensa/src/common/xtensa_coproc.S:
##########
@@ -89,31 +85,18 @@ _xtensa_coproc_saoffsets:
  *   around the assembly language call to _xtensa_coproc_savestate.
  *
  * Entry Conditions:
- *   - A2 holds the address of current interrupt stack pointer.
+ *   in - Pointer to where the save is performed (e.g. a2)
  *   - Registers have been saved/spilled already.
  *
  * Exit conditions:
  *   - All necessary CP callee-saved state has been saved.
- *   - Registers a2-a7, a13-a15 have been trashed.
- *
- * Must be called from assembly code only, using CALL0.
+ *   - Registers a2-a7, a13-a14 have been trashed.
  *
  ****************************************************************************/
 
-  .global	_xtensa_coproc_savestate
-  .type	_xtensa_coproc_savestate, @function
-
-  .align	4
-  .literal_position
-  .align	4
-
-_xtensa_coproc_savestate:
-
-	/* Move the address of the thread state save area to R15 */
+	.macro xtensa_coproc_savestate in

Review Comment:
   why need in argument? Since xtensa_coproc_savestate already touch many registers(a2-a7, a13-a14), we can directly:
   ```
   .macro xtensa_coproc_savestate
   add a3, sp, (4 * XCPTCONTEXT_REGS)
   ```
   and keep the rest unchanged.



##########
arch/xtensa/src/common/xtensa_context.S:
##########
@@ -66,6 +66,7 @@
 #include <arch/xtensa/xtensa_abi.h>
 #include <arch/xtensa/xtensa_specregs.h>
 
+#include "xtensa_coproc.S"

Review Comment:
   move after line 71



##########
arch/xtensa/src/common/xtensa_coproc.S:
##########
@@ -216,28 +198,15 @@ _xtensa_coproc_savestate:
  *   around the assembly language call to _xtensa_coproc_restorestate.
  *
  * Entry Conditions:
- *   - A2 holds the address of the current interrupt stack pointer.
+ *   in - Pointer to where the save is performed (e.g. a2)
  *
  * Exit conditions:
  *   - All necessary CP callee-saved state has been restored.
- *   - Registers a2-a7, a13-a15 have been trashed.
- *
- * Must be called from assembly code only, using CALL0.
+ *   - Registers a2-a7, a13-a14 have been trashed.
  *
  ****************************************************************************/
 
-	.global	_xtensa_coproc_restorestate
-	.type	_xtensa_coproc_restorestate, @function
-
-	.align	4
-	.literal_position
-	.align	4
-
-_xtensa_coproc_restorestate:
-
-	/* Move the address of the thread state save area to R15 */
-
-	mov		a3, a2				/* A3 is now the address of the save area */
+	.macro xtensa_coproc_restorestate out

Review Comment:
   ditto, let's:
   ```
   .macro xtensa_coproc_restorestate
   addi		a3, a2, (4 * XCPTCONTEXT_REGS)
   ```
   and keep the rest unchanged.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] Ouss4 commented on pull request #6302: xtensa: coproc: modify coproc_save/restore to macro

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on PR #6302:
URL: https://github.com/apache/incubator-nuttx/pull/6302#issuecomment-1134580123

   I was trying to look into it but couldn't find an immediate solution/explanation.
   We can see from the crash dump that SP is pointing at the very bottom of the stack: `0x 3ffe7a80` = base `3ffe7290` + size `0x7f0`.  I thought it was an overflow but even increasing the stack size this situation persists.
   Also, it happens only on QEMU, on real hardware I can't see it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] gustavonihei commented on a diff in pull request #6302: xtensa: coproc: modify coproc_save/restore to macro

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on code in PR #6302:
URL: https://github.com/apache/incubator-nuttx/pull/6302#discussion_r878196367


##########
arch/xtensa/src/common/xtensa_coproc.S:
##########
@@ -123,86 +106,85 @@ _xtensa_coproc_savestate:
 	* ---------------------------------------------------| <- SP
 	*/
 
-	addi		a3, a3, (4 * XCPTCONTEXT_REGS)
+	addi		\in, \in, (4 * XCPTCONTEXT_REGS)
 
 	/* CPENABLE should show which CPs are enabled. */
 
-	rsr		a2, CPENABLE				/* a2 = which CPs are enabled */
-	beqz		a2, .Ldone1				/* Quick exit if none */
+	rsr		a3, CPENABLE				/* a3 = which CPs are enabled */
+	beqz		a3, Ldone1				/* Quick exit if none */
 
 	movi		a13, _xtensa_coproc_saoffsets		/* Array of CP save offsets */
 
 #if XCHAL_CP0_SA_SIZE > 0
-	bbci.l		a2,  0,   2f				/* CP 0 not enabled */
+	bbci.l		a3,  0,   2f				/* CP 0 not enabled */
 	l32i		a14, a13, 0				/* a14 = _xtensa_coproc_saoffsets[0] */
-	add		a3,  a14, a3				/* a3 = save area for CP 0 */
-	xchal_cp0_store	a3,  a4,  a5, a6, a7 continue=0 ofs=-1 select=XTHAL_SAS_TIE|XTHAL_SAS_NOCC|XTHAL_SAS_CALE alloc=XTHAL_SAS_ALL
+	add		\in,  a14, \in				/* \in = save area for CP 0 */
+	xchal_cp0_store	\in,  a4,  a5, a6, a7 continue=0 ofs=-1 select=XTHAL_SAS_TIE|XTHAL_SAS_NOCC|XTHAL_SAS_CALE alloc=XTHAL_SAS_ALL
 2:
 #endif
 
 #if XCHAL_CP1_SA_SIZE > 0
-	bbci.l		a2,  1,   2f				/* CP 1 not enabled */
+	bbci.l		a3,  1,   2f				/* CP 1 not enabled */
 	l32i		a14, a13, 4				/* a14 = _xtensa_coproc_saoffsets[1] */
-	add		a3,  a14, a3				/* a3 = save area for CP 1 */
-	xchal_cp1_store	a3,  a4,  a5, a6, a7 continue=0 ofs=-1 select=XTHAL_SAS_TIE|XTHAL_SAS_NOCC|XTHAL_SAS_CALE alloc=XTHAL_SAS_ALL
+	add		\in,  a14, \in  			/* \in = save area for CP 1 */
+	xchal_cp1_store	\in,  a4,  a5, a6, a7 continue=0 ofs=-1 select=XTHAL_SAS_TIE|XTHAL_SAS_NOCC|XTHAL_SAS_CALE alloc=XTHAL_SAS_ALL
 2:
 #endif
 
 #if XCHAL_CP2_SA_SIZE > 0
-	bbci.l		a2,  2,   2f
+	bbci.l		a3,  2,   2f
 	l32i		a14, a13, 8
-	add		a3,  a14, a3
-	xchal_cp2_store	a3,  a4,  a5, a6, a7 continue=0 ofs=-1 select=XTHAL_SAS_TIE|XTHAL_SAS_NOCC|XTHAL_SAS_CALE alloc=XTHAL_SAS_ALL
+	add		\in,  a14, \in
+	xchal_cp2_store	\in,  a4,  a5, a6, a7 continue=0 ofs=-1 select=XTHAL_SAS_TIE|XTHAL_SAS_NOCC|XTHAL_SAS_CALE alloc=XTHAL_SAS_ALL
 2:
 #endif
 
 #if XCHAL_CP3_SA_SIZE > 0
-	bbci.l		a2,  3,   2f
+	bbci.l		a3,  3,   2f
 	l32i		a14, a13, 12
-	add		a3,  a14, a3
-	xchal_cp3_store	a3,  a4,  a5, a6, a7 continue=0 ofs=-1 select=XTHAL_SAS_TIE|XTHAL_SAS_NOCC|XTHAL_SAS_CALE alloc=XTHAL_SAS_ALL
+	add		\in,  a14, \in
+	xchal_cp3_store	\in,  a4,  a5, a6, a7 continue=0 ofs=-1 select=XTHAL_SAS_TIE|XTHAL_SAS_NOCC|XTHAL_SAS_CALE alloc=XTHAL_SAS_ALL
 2:
 #endif
 
 #if XCHAL_CP4_SA_SIZE > 0
-	bbci.l		a2,  4,   2f
+	bbci.l		a3,  4,   2f
 	l32i		a14, a13, 16
-	add		a3,  a14, a3
-	xchal_cp4_store	a3,  a4,  a5, a6, a7 continue=0 ofs=-1 select=XTHAL_SAS_TIE|XTHAL_SAS_NOCC|XTHAL_SAS_CALE alloc=XTHAL_SAS_ALL
+	add		\in,  a14, \in
+	xchal_cp4_store	\in,  a4,  a5, a6, a7 continue=0 ofs=-1 select=XTHAL_SAS_TIE|XTHAL_SAS_NOCC|XTHAL_SAS_CALE alloc=XTHAL_SAS_ALL
 2:
 #endif
 
 #if XCHAL_CP5_SA_SIZE > 0
-	bbci.l		a2,  5,   2f
+	bbci.l		a3,  5,   2f
 	l32i		a14, a13, 20
-	add		a3,  a14, a3
-	xchal_cp5_store	a3,  a4,  a5, a6, a7 continue=0 ofs=-1 select=XTHAL_SAS_TIE|XTHAL_SAS_NOCC|XTHAL_SAS_CALE alloc=XTHAL_SAS_ALL
+	add		\in,  a14, \in
+	xchal_cp5_store	\in,  a4,  a5, a6, a7 continue=0 ofs=-1 select=XTHAL_SAS_TIE|XTHAL_SAS_NOCC|XTHAL_SAS_CALE alloc=XTHAL_SAS_ALL
 2:
 #endif
 
 #if XCHAL_CP6_SA_SIZE > 0
-	bbci.l		a2,  6,   2f
+	bbci.l		a3,  6,   2f
 	l32i		a14, a13, 24
-	add		a3,  a14, a3
-	xchal_cp6_store	a3,  a4,  a5, a6, a7 continue=0 ofs=-1 select=XTHAL_SAS_TIE|XTHAL_SAS_NOCC|XTHAL_SAS_CALE alloc=XTHAL_SAS_ALL
+	add		\in,  a14, \in
+	xchal_cp6_store	\in,  a4,  a5, a6, a7 continue=0 ofs=-1 select=XTHAL_SAS_TIE|XTHAL_SAS_NOCC|XTHAL_SAS_CALE alloc=XTHAL_SAS_ALL
 2:
 #endif
 
 #if XCHAL_CP7_SA_SIZE > 0
-	bbci.l		a2,  7,   2f
+	bbci.l		a3,  7,   2f
 	l32i		a14, a13, 28
-	add		a3,  a14, a3
-	xchal_cp7_store	a3,  a4,  a5, a6, a7 continue=0 ofs=-1 select=XTHAL_SAS_TIE|XTHAL_SAS_NOCC|XTHAL_SAS_CALE alloc=XTHAL_SAS_ALL
+	add		\in,  a14, \in
+	xchal_cp7_store	\in,  a4,  a5, a6, a7 continue=0 ofs=-1 select=XTHAL_SAS_TIE|XTHAL_SAS_NOCC|XTHAL_SAS_CALE alloc=XTHAL_SAS_ALL
 2:
 #endif
 
-.Ldone1:
-	ret
+Ldone1:
 
-	.size	_xtensa_coproc_savestate, . - _xtensa_coproc_savestate
+.endm
 
 /****************************************************************************
- * Name: _xtensa_coproc_restorestate
+ * Marco: xtensa_coproc_restorestate

Review Comment:
   ```suggestion
    * Macro: xtensa_coproc_restorestate
   ```
   nit: Small typo



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6302: xtensa: coproc: modify coproc_save/restore to macro

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6302:
URL: https://github.com/apache/incubator-nuttx/pull/6302#issuecomment-1135061260

   > @zhuyanlinzyl
   > 
   > > I noticed that crash happened with esp32-devkitc:smp on qemu.
   > 
   > The issue happens with the following PR. #6269
   
   @masayuki2009  FPU test is added recently by PR https://github.com/apache/incubator-nuttx/pull/6269.The problem exist for a while before #6269 and #6302 from the analysis, so should we merge #6302 and #6314?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] Ouss4 commented on pull request #6302: xtensa: coproc: modify coproc_save/restore to macro

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on PR #6302:
URL: https://github.com/apache/incubator-nuttx/pull/6302#issuecomment-1134497858

   Looks like the stack is corrupted.  I see that sack coloration is enabled, I remember having issues with it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] zhuyanlinzyl commented on pull request #6302: xtensa: coproc: modify coproc_save/restore to macro

Posted by GitBox <gi...@apache.org>.
zhuyanlinzyl commented on PR #6302:
URL: https://github.com/apache/incubator-nuttx/pull/6302#issuecomment-1134472638

   hi . @Ouss4 , @masayuki2009  . I have test with add this PR https://github.com/apache/incubator-nuttx/pull/6314
   Ostest with fpu success with esp32-qemu.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] zhuyanlinzyl commented on pull request #6302: xtensa: coproc: modify coproc_save/restore to macro

Posted by GitBox <gi...@apache.org>.
zhuyanlinzyl commented on PR #6302:
URL: https://github.com/apache/incubator-nuttx/pull/6302#issuecomment-1134571209

   @Ouss4  This crash seem have nothing to do with FPU. As I revert all xtensa new fpu patch, this crash also happen.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] Ouss4 commented on pull request #6302: xtensa: coproc: modify coproc_save/restore to macro

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on PR #6302:
URL: https://github.com/apache/incubator-nuttx/pull/6302#issuecomment-1135111700

   > > @zhuyanlinzyl
   > > > I noticed that crash happened with esp32-devkitc:smp on qemu.
   > > 
   > > 
   > > The issue happens with the following PR. #6269
   > 
   > @masayuki2009 FPU test is added recently by PR #6269 problem exist for a while before #6269 and #6302 from the analysis, so should we merge #6302 and #6314?
   
   The issue reported by @masayuki2009 was caused by enabling the FPU test.  On hardware the value of `CPENABLE` is undefined after reset, I think in all of our tests we had it enabled and thus never caused an exception.  In QEMU however, it seems that it's cleared after reset this is why #6314 was required.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6302: xtensa: coproc: modify coproc_save/restore to macro

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6302:
URL: https://github.com/apache/incubator-nuttx/pull/6302#issuecomment-1133890299

   LGTM.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #6302: xtensa: coproc: modify coproc_save/restore to macro

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on PR #6302:
URL: https://github.com/apache/incubator-nuttx/pull/6302#issuecomment-1134176517

   @zhuyanlinzyl 
   
   >I noticed that crash happened with esp32-devkitc:smp on qemu.
   
   The issue happens with the following PR.
   https://github.com/apache/incubator-nuttx/pull/6269
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] zhuyanlinzyl commented on pull request #6302: xtensa: coproc: modify coproc_save/restore to macro

Posted by GitBox <gi...@apache.org>.
zhuyanlinzyl commented on PR #6302:
URL: https://github.com/apache/incubator-nuttx/pull/6302#issuecomment-1134174108

   @masayuki2009  Ths, I will check it. I only test on quem esp32 non-smp confing.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org