From nobody Thu May 27 15:15:04 2021 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2A98DBFA63C for ; Thu, 27 May 2021 15:16:30 +0000 (UTC) (envelope-from wulf@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 4FrWcZ0KMvz3qsk; Thu, 27 May 2021 15:16:30 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from [192.168.0.30] (unknown [94.45.211.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: wulf) by smtp.freebsd.org (Postfix) with ESMTPSA id 804D319B2; Thu, 27 May 2021 15:16:29 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Subject: Re: panic: device_unbusy: called for non-busy device iichid0 To: freebsd-current@freebsd.org References: Cc: Ian Lepore From: Vladimir Kondratyev Message-ID: <479c1e04-4dc9-bb97-5a07-bfd34873ae31@FreeBSD.org> Date: Thu, 27 May 2021 18:15:04 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit X-ThisMailContainsUnwantedMimeParts: N On 27.05.2021 14:41, David Wolfskill wrote: > This was on the new(er) laptop with which I have been experimenting; it > uses iichid to controll/access the built-in mouse/touchpad. > > The machine was running: > > FreeBSD g1-48.catwhisker.org 14.0-CURRENT FreeBSD 14.0-CURRENT #252 main-n246951-38e7025a60b2: Wed May 26 04:56:25 PDT 2021 root@g1-48.catwhisker.org:/common/S4/obj/usr/src/amd64.amd64/sys/CANARY amd64 1400017 1400017 > > at the time. Note that the reboot after building the above (yesterday) > was without issue, and the reboot after the panic was also without issue > -- so this would seem to have elements of timing/racing involved. (And > it's likely to be distinctly unpleasant to debug, as it seems that > reproduction may be rather "iffy.") > > I took a photo of the displayed backtrace; it's at > https://www.catwhisker.org/~david/FreeBSD/head/n246951/device_unbusy.jpg > > Here's a slightly-abbreviated hand-transcribed version: > > panic: device_unbusy: called for non-busy device iichid0 > cpuid = 8 > time = 1622113818 > KDB: stack backtrace: > db_trace_self_wrapper() > vpanic() > panic() > device_unbusy() > iicbus_release_bus() > iichid_intr() > ithread-loop() > fork_exit() > fork_trampoline() > --- trap 0, rip = 0, rsp = 0, rbp = 0 --- > KDB: enter: panic > [ thread pid 12 tid 100170 ] > Stopped at 0xffffffff80c36867 = kdb_enter+ 0x37: $0,0x12a0b9e(%rip) > db> > It looks like iicbus issue. It was very easy reproducible with iichid when latter had a bug triggering interrupt storm on device_attach: https://github.com/wulf7/iichid/issues/22 It was caused by unlocked calls to device_busy() and device_unbusy() in iicbus_request_bus() routine. These unlocked calls resulted in races with parallel device attachment process. CC-ed ian@ -- WBR Vladimir Kondratyev