From owner-dev-commits-src-all@freebsd.org Mon Sep 27 12:45:48 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 83B736B53D3; Mon, 27 Sep 2021 12:45:48 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HJ2Rw3Mfwz3FP4; Mon, 27 Sep 2021 12:45:48 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 3A7921E95; Mon, 27 Sep 2021 12:45:48 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 9D50246A96; Mon, 27 Sep 2021 14:45:46 +0200 (CEST) From: Kristof Provost To: Andrew Turner Cc: Alexander Motin , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 695323ae88c7 - main - acpi_cpu: Fix panic if some CPU devices are disabled. Date: Mon, 27 Sep 2021 14:45:45 +0200 X-Mailer: MailMate (1.14r5818) Message-ID: <8AEE4F18-6D9E-4FE5-A5B4-C245FE693C07@FreeBSD.org> In-Reply-To: References: <202109252101.18PL1W4I003365@gitrepo.freebsd.org> <1D490397-E56E-4D39-A4CC-BDF0CC25E91D@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 12:45:48 -0000 On 27 Sep 2021, at 13:48, Andrew Turner wrote: >> On 27 Sep 2021, at 09:16, Kristof Provost wrote: >> >> On 25 Sep 2021, at 23:01, Alexander Motin wrote: >> >> The branch main has been updated by mav: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=3D695323ae88c71776e131940= ed7dedd25365e932f >> commit 695323ae88c71776e131940ed7dedd25365e932f >> Author: Alexander Motin >> AuthorDate: 2021-09-25 20:54:28 +0000 >> Commit: Alexander Motin >> CommitDate: 2021-09-25 21:01:28 +0000 >> >> acpi_cpu: Fix panic if some CPU devices are disabled. >> >> While there, remove couple unneeded global variables. >> --- >> sys/dev/acpica/acpi_cpu.c | 66 +++++++++++++++++++++------------------= -------- >> 1 file changed, 29 insertions(+), 37 deletions(-) >> >> diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c >> index ab4ffda7a02e..0577b6eac8b7 100644 >> --- a/sys/dev/acpica/acpi_cpu.c >> +++ b/sys/dev/acpica/acpi_cpu.c >> @@ -154,8 +154,6 @@ static struct sysctl_oid *cpu_sysctl_tree; >> static int cpu_cx_generic; >> static int cpu_cx_lowest_lim; >> >> -static device_t *cpu_devices; >> -static int cpu_ndevices; >> static struct acpi_cpu_softc **cpu_softc; >> ACPI_SERIAL_DECL(cpu, "ACPI CPU"); >> >> @@ -443,26 +441,21 @@ acpi_cpu_attach(device_t dev) >> static void >> acpi_cpu_postattach(void *unused __unused) >> { >> >> I=E2=80=99m seeing this panic on a bhyve VM running an up-to-date main= kernel: >> >> 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 0xffffffff= 8358bbc0 >> 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 0xffffffff8358= bfa0 >> 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 a= cpi_cpu_postattach() and you touched that last =E2=80=A6, well you know h= ow that goes. >> > I hit what looks to be the same issue on arm64. In my case it was a NUL= L pointer dereference on cpu_softc because acpi_cpu_probe never called ma= lloc as I=E2=80=99m booting using FDT. > > I=E2=80=99ve pushed a fix for this in 4e50efb1. > And that fixed my panic too. Thanks! Kristof