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

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

commit aa0346610bb2c2295d47f90ecc16e1341cb1974d
Author: hujun5 <huj...@xiaomi.com>
AuthorDate: Thu Aug 15 18:50:31 2024 +0800

    arm64: we need to initialize the percpu register storing the current task 
more earlier.
    
    A call stack looks like the following:
    sched_idletask
    syslog_write
    nx_vsyslog
    syslog
    getreg64
    gic_validate_redist_version
    arm64_gic_init
    arm64_gic_secondary_init
    arm64_boot_secondary_c_routine
    
    Signed-off-by: hujun5 <huj...@xiaomi.com>
---
 arch/arm64/src/common/arm64_cpustart.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/src/common/arm64_cpustart.c 
b/arch/arm64/src/common/arm64_cpustart.c
index fcc9a41b18..5aeb600944 100644
--- a/arch/arm64/src/common/arm64_cpustart.c
+++ b/arch/arm64/src/common/arm64_cpustart.c
@@ -115,10 +115,6 @@ static void arm64_smp_init_top(void)
 {
   struct tcb_s *tcb = current_task(this_cpu());
 
-  /* Init idle task to percpu reg */
-
-  up_update_task(tcb);
-
 #ifndef CONFIG_SUPPRESS_INTERRUPTS
   /* And finally, enable interrupts */
 
@@ -226,6 +222,12 @@ int up_cpu_start(int cpu)
 
 void arm64_boot_secondary_c_routine(void)
 {
+  struct tcb_s *tcb = current_task(this_cpu());
+
+  /* Init idle task to percpu reg */
+
+  up_update_task(tcb);
+
 #ifdef CONFIG_ARCH_HAVE_MPU
   arm64_mpu_init(false);
 #endif

Reply via email to