xiaoxiang781216 commented on code in PR #7247:
URL: https://github.com/apache/incubator-nuttx/pull/7247#discussion_r988719184


##########
arch/risc-v/src/qemu-rv/qemu_rv_mm_init.c:
##########
@@ -252,9 +261,23 @@ void qemu_rv_kernel_mappings(void)
 
 void qemu_rv_mm_init(void)
 {
-  /* Setup the kernel mappings */
+#ifdef CONFIG_SMP
+  irqstate_t flags;
+  flags = spin_lock_irqsave(&g_mm_init_spin);

Review Comment:
   Yes, satp need be done by all cpu, but the construction of page table should 
be done by primary core only. I mean the code can check hartid to decide 
whether to skip the shared part. But for the synchronization, we can't depend 
on the normal variable or spinlock because they mayn't fully initialize if the 
secondary core run too fast. The code may work if we are lucky, but it will be 
broken definitely sometime later, so it is worth to take time to develop a 
reliable solution instead.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to