svn commit: r301070 - head/sys/arm64/arm64

John Baldwin jhb at freebsd.org
Tue May 31 20:10:13 UTC 2016


On Tuesday, May 31, 2016 06:45:52 PM Andrew Turner wrote:
> Author: andrew
> Date: Tue May 31 18:45:52 2016
> New Revision: 301070
> URL: https://svnweb.freebsd.org/changeset/base/301070
> 
> Log:
>   Allow the kernel to boot on a CPU where the devicetree has numbered it with
>   a non-zero ID. To do this we increment the cpuid of any CPUs with a smaller
>   devicetree ID by one to stop them conflicting with the boot CPU.
>   
>   Obtained from:	ABT Systems Ltd
>   Sponsored by:	The FreeBSD Foundation

It's a bit more friendly if you can have FreeBSD CPU IDs still represent the
topology of the system if possible.  On x86 we don't always boot from CPU 0
either (in fact, it's an election system so that the APIC ID of the BSP can
vary from boot to boot).  What we do however, is add CPUs from the same
core, then package first after the BSP and then add remaining CPUs as we
normally would.  For x86, the first thread in a package is always chosen as
the BSP, so this is implemented by starting at the APIC ID of the BSP and
assigning CPU IDs to increasing APIC IDs and eventually wrapping back around
to APIC ID 0 to add CPUs from "earlier" packages if we did not boot from
package 0.  However, this means that if you have a system with dual quad-core
CPUs, CPUs 0-3 are always one package and 4-7 are always the other, regardless
of which package is used for booting.  Initially the x86 code did not do that
but just skipped over the BSP when adding APs (so something similar I think to
what you've done here), but that meant that when the second package won the
boot-time election, CPUs 0,5-7 were on one package and 1-4 were on another
package.

-- 
John Baldwin


More information about the svn-src-all mailing list