On 25 Nov 2017, at 23:41, Nathan Whitehorn <nwhiteh...@freebsd.org> wrote:
> 
> Author: nwhitehorn
> Date: Sat Nov 25 23:41:05 2017
> New Revision: 326218
> URL: https://svnweb.freebsd.org/changeset/base/326218
> 
> Log:
>  Remove some, but not all, assumptions that the BSP is CPU 0 and that CPUs
>  are numbered densely from there to n_cpus.
> 
>  MFC after:   1 month
> 
> Modified:
>  head/sys/kern/kern_clock.c
>  head/sys/kern/kern_clocksource.c
>  head/sys/kern/kern_shutdown.c
>  head/sys/kern/kern_timeout.c
>  head/sys/kern/sched_ule.c
>  head/sys/kern/subr_pcpu.c
> 
...
> Modified: head/sys/kern/subr_pcpu.c
> ==============================================================================
> --- head/sys/kern/subr_pcpu.c Sat Nov 25 23:23:24 2017        (r326217)
> +++ head/sys/kern/subr_pcpu.c Sat Nov 25 23:41:05 2017        (r326218)
> @@ -279,6 +279,8 @@ pcpu_destroy(struct pcpu *pcpu)
> struct pcpu *
> pcpu_find(u_int cpuid)
> {
> +     KASSERT(cpuid_to_pcpu[cpuid] != NULL,
> +         ("Getting uninitialized PCPU %d", cpuid));
> 
>       return (cpuid_to_pcpu[cpuid]);
> }

This breaks on one arm64 simulator I have where the device tree lists 8 cpus, 
but only 2 are enabled in the simulation. The ofw_cpu device nodes for these 
are cpu0 and cpu4 so the call to cpu_find in ofw_cpu_attach will hit this 
KASSERT when the CPU has not been enabled.

Andrew

cpu0: <Open Firmware CPU> on cpulist0
cpu1: <Open Firmware CPU> on cpulist0
panic: Getting uninitialized PCPU 1
cpuid = 0
time = 1
KDB: stack backtrace:
db_trace_self() at db_trace_self_wrapper+0x28
         pc = 0xffff0000005f03e8  lr = 0xffff000000087048
         sp = 0xffff0000000105a0  fp = 0xffff0000000107b0

db_trace_self_wrapper() at vpanic+0x184
         pc = 0xffff000000087048  lr = 0xffff000000316448
         sp = 0xffff0000000107c0  fp = 0xffff000000010840

vpanic() at kassert_panic+0x158
         pc = 0xffff000000316448  lr = 0xffff0000003162c0
         sp = 0xffff000000010850  fp = 0xffff000000010910

kassert_panic() at pcpu_find+0x3c
         pc = 0xffff0000003162c0  lr = 0xffff000000359450
         sp = 0xffff000000010920  fp = 0xffff000000010930

pcpu_find() at ofw_cpu_attach+0x114
         pc = 0xffff000000359450  lr = 0xffff0000001692d4
         sp = 0xffff000000010940  fp = 0xffff000000010970

ofw_cpu_attach() at device_attach+0x40c
         pc = 0xffff0000001692d4  lr = 0xffff00000034822c
         sp = 0xffff000000010980  fp = 0xffff0000000109d0

device_attach() at bus_generic_attach+0x5c
         pc = 0xffff00000034822c  lr = 0xffff00000034952c
         sp = 0xffff0000000109e0  fp = 0xffff000000010a00

bus_generic_attach() at device_attach+0x40c
         pc = 0xffff00000034952c  lr = 0xffff00000034822c
         sp = 0xffff000000010a10  fp = 0xffff000000010a60

device_attach() at bus_generic_new_pass+0x12c
         pc = 0xffff00000034822c  lr = 0xffff000000349c0c
         sp = 0xffff000000010a70  fp = 0xffff000000010aa0

bus_generic_new_pass() at bus_generic_new_pass+0xe4
         pc = 0xffff000000349c0c  lr = 0xffff000000349bc4
         sp = 0xffff000000010ab0  fp = 0xffff000000010ae0

bus_generic_new_pass() at bus_generic_new_pass+0xe4
         pc = 0xffff000000349bc4  lr = 0xffff000000349bc4
         sp = 0xffff000000010af0  fp = 0xffff000000010b20

bus_generic_new_pass() at bus_set_pass+0x8c
         pc = 0xffff000000349bc4  lr = 0xffff000000345aec
         sp = 0xffff000000010b30  fp = 0xffff000000010b60

bus_set_pass() at mi_startup+0xc8
         pc = 0xffff000000345aec  lr = 0xffff0000002b43e8
         sp = 0xffff000000010b70  fp = 0xffff000000010bb0

mi_startup() at virtdone+0x54
         pc = 0xffff0000002b43e8  lr = 0xffff000000001084
         sp = 0xffff000000010bc0  fp = 0x0000000000000000

KDB: enter: panic

_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to