From owner-dev-commits-src-all@freebsd.org Mon Sep 27 11:48:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2A5186B3FD1; Mon, 27 Sep 2021 11:48:27 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from fry.fubar.geek.nz (fry.fubar.geek.nz [139.59.165.16]) by mx1.freebsd.org (Postfix) with ESMTP id 4HJ19l00vmz4tMB; Mon, 27 Sep 2021 11:48:26 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from smtpclient.apple (cpc91232-cmbg18-2-0-cust554.5-4.cable.virginm.net [82.2.126.43]) by fry.fubar.geek.nz (Postfix) with ESMTPSA id AE6BE4E63E; Mon, 27 Sep 2021 11:48:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fubar.geek.nz; s=mail; t=1632743299; bh=Qhs50fdYsawDSqtj2RAhAth+9JRAlH7aodNqj5PYnSU=; h=From:Subject:Date:In-Reply-To:Cc:To:References; b=RqCkHVO1uVplI8rmcRIQlf01a9BVFsX6v5WHfaH/o322jySn/ZfVc+0oPw++t7jD/ 6YsBieiBhbS+BM2Da9FhL1AAsb/xCHsdL1xNrcSzmrgjCVyjMsr+ePE3sBYX6zY0Uj y/0gpyKUomZ+yCGp3wNgeumCj+Agd2PwD7zfH4+ns9BksjjNSWEdNd8pWijdmPoIRH OaAv5sE4HQtr24J3i8T1ETgdAGjfbxFadpZz4rY3nVhBL5yDog8cwdX0A4TTr++L+Y 45Fy3Fqg/R5uzvsG6r8JJmShpfNug6f2B1fBm2S2tqybSbRsnIHX+5R9hIRQH7SmOl Mgz2FnDuVt3pywdo40Q7gNOwX+EjiUyIKq1hw9HJsn/spF2Ffj9guRUdbWrDM/nrTu 1FZJJIze748QVLwvEEIhfSDawfc/RiAdRE/qcV+pwi/oNUX2iLWsNJnm7sqH8QIHkL 9tn8ZFkBLYoQFIJYs5wv3ADAtono6Nfrxa0kqd0wFPCG4IQexctCZ0ZurARAMMLh4q bz+JcawO8I2IqOO182y97ncCt+/5iBWjlMRk/lcyeH3PCfJiawo7Gq8RqCCC4vcCYH ic1rAAyS0FnEGMBLeaX+iK18kubBATqFmhMf9GJxg0Ar1wYlNS5uq9r+4DymhNYs5I C1rSWPELmQnfjbCzmeL1U4m4= From: Andrew Turner Message-Id: Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: git: 695323ae88c7 - main - acpi_cpu: Fix panic if some CPU devices are disabled. Date: Mon, 27 Sep 2021 12:48:19 +0100 In-Reply-To: <1D490397-E56E-4D39-A4CC-BDF0CC25E91D@FreeBSD.org> Cc: Alexander Motin , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" To: Kristof Provost References: <202109252101.18PL1W4I003365@gitrepo.freebsd.org> <1D490397-E56E-4D39-A4CC-BDF0CC25E91D@FreeBSD.org> X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Rspamd-Queue-Id: 4HJ19l00vmz4tMB X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 11:48:27 -0000 > On 27 Sep 2021, at 09:16, Kristof Provost wrote: >=20 > On 25 Sep 2021, at 23:01, Alexander Motin wrote: >=20 > The branch main has been updated by mav: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D695323ae88c71776e131940ed7dedd25= 365e932f = > commit 695323ae88c71776e131940ed7dedd25365e932f=20 > Author: Alexander Motin =20 > AuthorDate: 2021-09-25 20:54:28 +0000=20 > Commit: Alexander Motin =20 > CommitDate: 2021-09-25 21:01:28 +0000 >=20 > acpi_cpu: Fix panic if some CPU devices are disabled. >=20 > While there, remove couple unneeded global variables.=20 > ---=20 > sys/dev/acpica/acpi_cpu.c | 66 = +++++++++++++++++++++--------------------------=20 > 1 file changed, 29 insertions(+), 37 deletions(-) >=20 > diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c=20 > index ab4ffda7a02e..0577b6eac8b7 100644=20 > --- a/sys/dev/acpica/acpi_cpu.c=20 > +++ b/sys/dev/acpica/acpi_cpu.c=20 > @@ -154,8 +154,6 @@ static struct sysctl_oid *cpu_sysctl_tree;=20 > static int cpu_cx_generic;=20 > static int cpu_cx_lowest_lim; >=20 > -static device_t *cpu_devices;=20 > -static int cpu_ndevices;=20 > static struct acpi_cpu_softc **cpu_softc;=20 > ACPI_SERIAL_DECL(cpu, "ACPI CPU"); >=20 > @@ -443,26 +441,21 @@ acpi_cpu_attach(device_t dev)=20 > static void=20 > acpi_cpu_postattach(void *unused __unused)=20 > { >=20 > I=E2=80=99m seeing this panic on a bhyve VM running an up-to-date main = kernel: >=20 > Fatal trap 12: page fault while in kernel mode > cpuid =3D 2; apic id =3D 02 > fault virtual address =3D 0x0 > fault code =3D supervisor read data, page not present > instruction pointer =3D 0x20:0xffffffff804f643c > stack pointer =3D 0x28:0xffffffff8358bf20 > frame pointer =3D 0x28:0xffffffff8358bfa0 > code segment =3D base 0x0, limit 0xfffff, type 0x1b > =3D DPL 0, pres 1, long 1, def32 0, gran 1 > processor eflags =3D interrupt enabled, resume, IOPL =3D 0 > current process =3D 0 (swapper) > trap number =3D 12 > panic: page fault > cpuid =3D 2 > time =3D 1 > KDB: stack backtrace: > db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame = 0xffffffff8358bbc0 > vpanic() at vpanic+0x187/frame 0xffffffff8358bc20 > panic() at panic+0x43/frame 0xffffffff8358bc80 > trap_fatal() at trap_fatal+0x387/frame 0xffffffff8358bce0 > trap_pfault() at trap_pfault+0x99/frame 0xffffffff8358bd40 > trap() at trap+0x2a7/frame 0xffffffff8358be50 > calltrap() at calltrap+0x8/frame 0xffffffff8358be50 > --- trap 0xc, rip =3D 0xffffffff804f643c, rsp =3D 0xffffffff8358bf20, = rbp =3D 0xffffffff8358bfa0 --- > acpi_cpu_postattach() at acpi_cpu_postattach+0x5c/frame = 0xffffffff8358bfa0 > mi_startup() at mi_startup+0x1f0/frame 0xffffffff8358bff0 > btext() at btext+0x22 > KDB: enter: panic > [ thread pid 0 tid 100000 ] > Stopped at kdb_enter+0x37: movq $0,0x1274f0e(%rip) > db> > I=E2=80=99ve not done any digging, but given that it seems to die in = acpi_cpu_postattach() and you touched that last =E2=80=A6, well you know = how that goes. >=20 I hit what looks to be the same issue on arm64. In my case it was a NULL = pointer dereference on cpu_softc because acpi_cpu_probe never called = malloc as I=E2=80=99m booting using FDT. I=E2=80=99ve pushed a fix for this in 4e50efb1. Andrew