Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Nov 2017 09:46:46 +0000
From:      Andrew Turner <andrew@fubar.geek.nz>
To:        Nathan Whitehorn <nwhitehorn@freebsd.org>
Cc:        src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r326218 - head/sys/kern
Message-ID:  <59383A7D-FC99-4748-9561-53D968C4B150@fubar.geek.nz>
In-Reply-To: <201711252341.vAPNf5Qx001464@repo.freebsd.org>
References:  <201711252341.vAPNf5Qx001464@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 25 Nov 2017, at 23:41, Nathan Whitehorn <nwhitehorn@freebsd.org> =
wrote:
>=20
> Author: nwhitehorn
> Date: Sat Nov 25 23:41:05 2017
> New Revision: 326218
> URL: https://svnweb.freebsd.org/changeset/base/326218
>=20
> Log:
>  Remove some, but not all, assumptions that the BSP is CPU 0 and that =
CPUs
>  are numbered densely from there to n_cpus.
>=20
>  MFC after:	1 month
>=20
> 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
>=20
...
> Modified: head/sys/kern/subr_pcpu.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- 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] !=3D NULL,
> +	    ("Getting uninitialized PCPU %d", cpuid));
>=20
> 	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 =3D 0
time =3D 1
KDB: stack backtrace:
db_trace_self() at db_trace_self_wrapper+0x28
	 pc =3D 0xffff0000005f03e8  lr =3D 0xffff000000087048
	 sp =3D 0xffff0000000105a0  fp =3D 0xffff0000000107b0

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

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

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

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

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

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

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

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

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

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

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

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

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

KDB: enter: panic




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?59383A7D-FC99-4748-9561-53D968C4B150>