Page MenuHomeFreeBSD

Simplify and cleanup startup code for secondary cores.
ClosedPublic

Authored by mmel on Jan 11 2018, 3:44 PM.
Tags
None
Referenced Files
F103261424: D13863.diff
Fri, Nov 22, 6:45 PM
Unknown Object (File)
Sun, Oct 27, 5:04 AM
Unknown Object (File)
Oct 17 2024, 6:11 AM
Unknown Object (File)
Oct 17 2024, 6:11 AM
Unknown Object (File)
Oct 17 2024, 6:11 AM
Unknown Object (File)
Oct 17 2024, 6:11 AM
Unknown Object (File)
Oct 17 2024, 6:11 AM
Unknown Object (File)
Oct 17 2024, 6:10 AM
Subscribers

Details

Summary

Record MPIDR for all started cores to table and use this table as link
between arbitrarily assigned cpuid and real system position of given core.

MFC after: 1 month

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

Will this still work on the Juno where the boot cpu is not the first CPU in the dtb?

sys/arm64/arm64/mp_machdep.c
127

You could put this into the pcpu structure.

427

You should use CPU_AFF_MASK. We should have used it previously, I'm not sure why it wasn't.

449

Extra space?

488

This looks broken, it doesn't increment the cpu id for the boot CPU. I think it would be safer to put this check into start_cpu.

532

Extra newline

Boot CPU have always cpuid 0 so yes, it boots (i hope). I have disordered cpus nodes in my DTS and all looks OK.

sys/arm64/arm64/mp_machdep.c
127

Nope, in view of D13864 we must be able to access this array before we known valid cpuid. But having a MPIDR also in pcpu structure doesn't sound bad.

427

Yep, thanks. I missed CPU_AFF_MASK completely.

488

The boot core have always cpuid=0 , so skipping it here is OK. But I forgot change initialization of 'cores' variable to 1 (at line 534 in new file). I will fix this in next version.

mmel edited the summary of this revision. (Show Details)

I pushed outdated diff, update it to final version

Revert previous diff update, committed to wrong review.

Rebased to head. Fixed cpuid assignment

mmel marked 2 inline comments as done.Jun 4 2020, 11:57 AM
mmel marked 2 inline comments as done.Jun 4 2020, 12:00 PM

Update to the final version. r359280 removed the need to access the cpu_mpidr table from the assembler. So eliminate it and insert the mpidr field into the pcpu structure as originally requested.

Will this reorder the CPU IDs? One reason for the previous scheme because at least one Arm CPU has 4 little CPUs and 2 big. As it booted on the first big this would be CPU 4 in the DTB. By rotating we can keep the big CPUs together.

My preference would be to allow booting from pcpu[4], but haven't had the time to audit the code to check it doesn't hard code the boot CPU is 0.

Yes, it changes CPU IDs. (For FDT case only. I assume that ACPI must always start on CPU0, even if I didn't find it in standard).
Please take in account that"

By all this, I think that we should take CPU ID as arbitrary value, without any relationship to physical topology and topology itself should be presented by cpu_topo().And other consumers (like GIC, scheduler, NUMA...) should build its own cpu_sets for given functionality. I don't see possibility how to represent all this by single number.

This revision was not accepted when it landed; it landed in state Needs Review.Dec 5 2020, 2:06 PM
This revision was automatically updated to reflect the committed changes.