You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "jasonbu (via GitHub)" <gi...@apache.org> on 2024/10/16 10:48:50 UTC
[PR] arm/cxd56: use chip specific ramvectors to allow smpcall update regs [nuttx]
jasonbu opened a new pull request, #14363:
URL: https://github.com/apache/nuttx/pull/14363
## Summary
When sig dispatch do up_schedule_sigaction, need to make a new frame to run arm_sigdeliver. But the exception_direct cannot handle xcp.regs as we are using c-function exception handler.
Need to use exception_common to handle SMP call.
issue from https://github.com/apache/nuttx/pull/13606#issuecomment-2406601519
@masayuki2009 please review the update, and see it at your environments also work as expected.
use chip specific vector cxd56_vectors to make CXD56_IRQ_SMP_CALL not use c-call version exception handler.
## Impact
can pass the self-test in Spresense CPU=3 case.
for self-test, the _vector still in .map, maybe we should add option to make unique between cxd56_vectors and _vectors.
## Testing
CI-test.
```bash
./tools/configure.sh -l spresense/smp
kconfig-tweak --set-val CONFIG_SMP_NCPUS 3
make -j
./tools/flash_writer.py -s -c /dev/ttyUSB0 -d -b 115200 -n nuttx.spk
minicom -D /dev/ttyUSB0 -b 115200 -C log/ttysprense-$(date +"%Y-%m-%d-%H-%M-%S").log
ostest
```
--
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
Re: [PR] arm/cxd56: use chip specific vectors to allow smpcall update regs [nuttx]
Posted by "jasonbu (via GitHub)" <gi...@apache.org>.
jasonbu commented on PR #14363:
URL: https://github.com/apache/nuttx/pull/14363#issuecomment-2416964462
> @jasonbu
>
> > When sig dispatch do up_schedule_sigaction, need to make a new frame to run arm_sigdeliver. But the exception_direct cannot handle xcp.regs as we are using c-function exception handler.
> > Need to use exception_common to handle SMP call.
>
> I think a similar issue would happen with rp2040 (dual Cortex-M0+), lc823450 (dual Cortex-M3) that use exception_direct. So they should be fixed as well.
let's make sure problem already converged, then talk about how to update correctly. for example if always one smp call have to use exception_common, we should make it a optional as a support in arm_vectors.c.
please give me a feedback if this patch can solve your problem.
--
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
Re: [PR] arm/cxd56: use chip specific vectors to allow smpcall update regs [nuttx]
Posted by "masayuki2009 (via GitHub)" <gi...@apache.org>.
masayuki2009 commented on PR #14363:
URL: https://github.com/apache/nuttx/pull/14363#issuecomment-2418132568
> let's make sure problem already converged, then talk about how to update correctly. for example if always one smp call have to use exception_common, we should make it a optional as a support in arm_vectors.c.
> please give me a feedback if this patch can solve your problem.
>
@jasonbu
I confirmed that this PR fixes https://github.com/apache/nuttx/pull/13606#issuecomment-2406601519
--
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
Re: [PR] arm/cxd56: use chip specific vectors to allow smpcall update regs [nuttx]
Posted by "masayuki2009 (via GitHub)" <gi...@apache.org>.
masayuki2009 commented on PR #14363:
URL: https://github.com/apache/nuttx/pull/14363#issuecomment-2416897042
@jasonbu
> When sig dispatch do up_schedule_sigaction, need to make a new frame to run arm_sigdeliver. But the exception_direct cannot handle xcp.regs as we are using c-function exception handler.
> Need to use exception_common to handle SMP call.
I think a similar issue would happen with rp2040 (dual Cortex-M0+), lc823450 (dual Cortex-M3) that use exception_direct.
So they should be fixed as well.
--
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
Re: [PR] arm/cxd56: use chip specific vectors to allow smpcall update regs [nuttx]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #14363:
URL: https://github.com/apache/nuttx/pull/14363#discussion_r1804086975
##########
arch/arm/src/cxd56xx/cxd56_vectors.c:
##########
@@ -0,0 +1,107 @@
+/****************************************************************************
+ * arch/arm/src/cxd56xx/cxd56_vectors.c
+ *
+ * Copyright (C) 2012 Michael Smith. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include "chip.h"
+#include "arm_internal.h"
+#include "ram_vectors.h"
+#include "nvic.h"
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/* Chip-specific entrypoint */
+
+extern void __start(void);
+
+static void start(void)
+{
+ /* Zero lr to mark the end of backtrace */
+
+ asm volatile ("mov lr, #0\n\t"
+ "b __start\n\t");
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/* Common exception entrypoint */
+
+extern void exception_common(void);
+extern void exception_direct(void);
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define IDLE_STACK (_ebss + CONFIG_IDLETHREAD_STACKSIZE)
+
+/****************************************************************************
+ * Public data
+ ****************************************************************************/
+
+/* The cx56 use CXD56_IRQ_SMP_CALL to do SMP call.
+ * When sig dispatch do up_schedule_sigaction, need to make a new frame to
+ * run arm_sigdeliver. But the exception_direct cannot handle xcp.regs as we
+ * did not update the regs when c-function expection handler is called.
+ *
+ * We need to use exception_common to handle SMP call.
+ */
+
+const void * const cxd56_vectors[] locate_data(".vectors")
+ aligned_data(VECTAB_ALIGN) =
+{
+ /* Initial stack */
+
+ IDLE_STACK,
+
+ /* Reset exception handler */
+
+ start,
+
+ /* Vectors 2 - n point directly at the generic handler */
+
+ [2 ... NVIC_IRQ_PENDSV] = &exception_common,
+ [NVIC_IRQ_SYSTICK ... (CXD56_IRQ_SMP_CALL - 1)]
+ = &exception_direct,
+ [CXD56_IRQ_SMP_CALL] = &exception_common,
Review Comment:
can we reuse the common vector table?
--
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
Re: [PR] arm/cxd56: use chip specific vectors to allow smpcall update regs [nuttx]
Posted by "GUIDINGLI (via GitHub)" <gi...@apache.org>.
GUIDINGLI commented on PR #14363:
URL: https://github.com/apache/nuttx/pull/14363#issuecomment-2416989679
@masayuki2009
Cause we don't have enough environment to test the code, it leads to regression issues.
Can you provide us with a copy of your testing script so that we can prevent such problems from happening?
As this PR said:
https://github.com/apache/nuttx/pull/14007
--
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
Re: [PR] arm/cxd56: use chip specific vectors to allow smpcall update regs [nuttx]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 merged PR #14363:
URL: https://github.com/apache/nuttx/pull/14363
--
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
Re: [PR] arm/cxd56: use chip specific ramvectors to allow smpcall update regs [nuttx]
Posted by "jasonbu (via GitHub)" <gi...@apache.org>.
jasonbu commented on PR #14363:
URL: https://github.com/apache/nuttx/pull/14363#issuecomment-2416450862
ramvectors should allso can solve the problem, but not work in my board.
--
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
Re: [PR] arm/cxd56: use chip specific vectors to allow smpcall update regs [nuttx]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on PR #14363:
URL: https://github.com/apache/nuttx/pull/14363#issuecomment-2418476286
let's fix other arm-m SMP chip.
--
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
Re: [PR] arm/cxd56: use chip specific vectors to allow smpcall update regs [nuttx]
Posted by "GUIDINGLI (via GitHub)" <gi...@apache.org>.
GUIDINGLI commented on PR #14363:
URL: https://github.com/apache/nuttx/pull/14363#issuecomment-2416970379
https://github.com/apache/nuttx/pull/14007
--
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
Re: [PR] arm/cxd56: use chip specific vectors to allow smpcall update regs [nuttx]
Posted by "jasonbu (via GitHub)" <gi...@apache.org>.
jasonbu commented on code in PR #14363:
URL: https://github.com/apache/nuttx/pull/14363#discussion_r1804291761
##########
arch/arm/src/cxd56xx/cxd56_vectors.c:
##########
@@ -0,0 +1,107 @@
+/****************************************************************************
+ * arch/arm/src/cxd56xx/cxd56_vectors.c
+ *
+ * Copyright (C) 2012 Michael Smith. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include "chip.h"
+#include "arm_internal.h"
+#include "ram_vectors.h"
+#include "nvic.h"
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/* Chip-specific entrypoint */
+
+extern void __start(void);
+
+static void start(void)
+{
+ /* Zero lr to mark the end of backtrace */
+
+ asm volatile ("mov lr, #0\n\t"
+ "b __start\n\t");
+}
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/* Common exception entrypoint */
+
+extern void exception_common(void);
+extern void exception_direct(void);
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define IDLE_STACK (_ebss + CONFIG_IDLETHREAD_STACKSIZE)
+
+/****************************************************************************
+ * Public data
+ ****************************************************************************/
+
+/* The cx56 use CXD56_IRQ_SMP_CALL to do SMP call.
+ * When sig dispatch do up_schedule_sigaction, need to make a new frame to
+ * run arm_sigdeliver. But the exception_direct cannot handle xcp.regs as we
+ * did not update the regs when c-function expection handler is called.
+ *
+ * We need to use exception_common to handle SMP call.
+ */
+
+const void * const cxd56_vectors[] locate_data(".vectors")
+ aligned_data(VECTAB_ALIGN) =
+{
+ /* Initial stack */
+
+ IDLE_STACK,
+
+ /* Reset exception handler */
+
+ start,
+
+ /* Vectors 2 - n point directly at the generic handler */
+
+ [2 ... NVIC_IRQ_PENDSV] = &exception_common,
+ [NVIC_IRQ_SYSTICK ... (CXD56_IRQ_SMP_CALL - 1)]
+ = &exception_direct,
+ [CXD56_IRQ_SMP_CALL] = &exception_common,
Review Comment:
there is three extra chip have arm-m & smp support, the irq number will not easy to be a configure in Kconfig, so in update patch, make a custom vectors option to allow chip not use default vector.
--
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