This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 41ca6706c56c7dae16caee4468acbe55f9dce32a
Author: ligd <[email protected]>
AuthorDate: Mon Jan 20 19:01:27 2025 +0800

    assert: flush dcache before panic other CPU
    
    At PANIC_KERNEL_FINAL other processors can be told about the panic,
    e.g. with CONFIG_RPTUN_AUTO_RESET_IN_PANIC_NOTIFIER rptun resets the
    remote cores with the panic cause, and they then panic as well and
    look at the memory shared with this CPU.  The dcache was only flushed
    in reset_board(), after the notifiers, so what this CPU wrote could
    still be in its cache.
    
    Move the flush from reset_board() to before PANIC_KERNEL_FINAL.
    
    Signed-off-by: ligd <[email protected]>
---
 sched/misc/assert.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sched/misc/assert.c b/sched/misc/assert.c
index 86243cfa68f..205e821e0f9 100644
--- a/sched/misc/assert.c
+++ b/sched/misc/assert.c
@@ -860,7 +860,6 @@ static void dump_core_info(void)
 static void reset_board(void)
 {
 #if CONFIG_BOARD_RESET_ON_ASSERT >= 1
-  up_flush_dcache_all();
   board_reset(CONFIG_BOARD_ASSERT_RESET_VALUE);
 #else
   for (; ; )
@@ -969,6 +968,12 @@ void _assert(FAR const char *filename, int linenum,
 
       dump_fatal_info(rtcb, filename, linenum, msg, regs);
 
+      /* Flush dcache before notify other CPU */
+
+      up_flush_dcache_all();
+
+      /* Notify PANIC_KERNEL_FINAL */
+
       panic_notifier_call_chain(PANIC_KERNEL_FINAL, &notifier_data);
 
       /* Dump core information */

Reply via email to