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
Unknown Object (File)
Mon, Jun 24, 12:00 AM
Unknown Object (File)
Thu, Jun 20, 10:56 AM
Unknown Object (File)
Thu, Jun 13, 9:42 AM
Unknown Object (File)
May 9 2024, 3:33 AM
Unknown Object (File)
May 7 2024, 11:19 PM
Unknown Object (File)
May 7 2024, 10:01 PM
Unknown Object (File)
May 6 2024, 12:12 AM
Unknown Object (File)
May 4 2024, 3:37 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 Not Applicable
Unit
Tests Not Applicable

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
128 ↗(On Diff #37809)

You could put this into the pcpu structure.

453 ↗(On Diff #37809)

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

471 ↗(On Diff #37809)

Extra space?

506 ↗(On Diff #37809)

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.

543 ↗(On Diff #37809)

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
128 ↗(On Diff #37809)

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.

453 ↗(On Diff #37809)

Yep, thanks. I missed CPU_AFF_MASK completely.

506 ↗(On Diff #37809)

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.