xiaoxiang781216 commented on code in PR #5985:
URL: https://github.com/apache/incubator-nuttx/pull/5985#discussion_r844897411
##########
arch/risc-v/src/common/riscv_percpu.c:
##########
@@ -86,13 +92,39 @@ void riscv_percpu_init(void)
void riscv_percpu_add_hart(uintptr_t hartid)
{
- /* Hart IDs go from 0...4 */
+ riscv_percpu_t *percpu;
+ uintptr_t stack_top;
+
+ /* Get free entry for this hart, this must not fail */
+
+ percpu = (riscv_percpu_t *)sq_remfirst(&g_freelist);
Review Comment:
> Answers:
>
> 1. Yes, you are right, need lock for sl list.
> 2. Then it gets hard to define index. Allocating from a free list does not
require defining index.
>
If you really prefer the allocation, please use flags instead, so we don't
need call riscv_percpu_init_hart.
> For now the call is done only during init but I'll add the lock to allow
hotloading CPUs.
Not about hotloading only, cpu1 and cpu2... will boot in parallel.
--
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]