From owner-freebsd-current@freebsd.org Thu Mar 22 05:42:01 2018 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E80CF6B572 for ; Thu, 22 Mar 2018 05:42:01 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x236.google.com (mail-it0-x236.google.com [IPv6:2607:f8b0:4001:c0b::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 897AA808FF for ; Thu, 22 Mar 2018 05:42:00 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x236.google.com with SMTP id k135-v6so9801112ite.2 for ; Wed, 21 Mar 2018 22:42:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=6zmF6oKg/D56mZguLoRUrwnDkfZLhxIQDN973J9QbNo=; b=O3IGGvDboqY4bPQy2PFcanYpMWa0NHtcULg0+SoaIXGVeNOVWKNCAwAxtzgXzjwMNx OfeZ23SRoXV0YquACClTydCVzdkT9qSuOuTNZOGZwxGjmZCYv/XOjEVLfeDQMF0hsSBJ TGjCryzgDKIvA1g9wY6vjJIA5LMPetVBHlrXf7duy0il5oSAkTOav1oqofuXMQKm5hKN 9HmrNDdsvLquZNBBgwvGTd/Lc2kkaLDCEViAC+aoB/ZOE1Q1E0dpD6yMEcSyZEHLMuH0 ckmvvTTgv+/vU5+zGhDZAR7lrnAijUPbXD2menTlznTVpgwoauHjedepRw8dz7hOs4at DYNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=6zmF6oKg/D56mZguLoRUrwnDkfZLhxIQDN973J9QbNo=; b=GY0tMVAoIqLXSdSON5DC/xvS4TKrk4OkxPxOhUJbktutzDQlBio2z0e2gsUyHkOTjD k3rVfBFS/rAa+e6TdpifDttEuFP1PhqPYgvFrB0dKFb47FinM8RqtsQgTdtJlRk29bHa fH/cohC/zYVNkSxtfcRBtF++ng5UHOqx8MQATnGsKCLUWgzsJc52dPZW0z7DsSkBVth1 RXYKBBtsBnDaWByxwkeuCm5Ol2nxgOJ4Cc1u57s6PhvRKnxLACRGVODQPgHKFaVQsGH7 l5GNH2ERjkBCtZdYCCLDyvD5rhj89hEMwoImSCU8IwF3AGQgGt0wjaLVWWrN1p+BlSO4 fTKg== X-Gm-Message-State: AElRT7HQbnxgQ16I2wRojy9cFSuNs+kjIeVTZZMLxxPiY4AyZaYyO2Ux UF4kLdehwCjRXHUvUa9pnlZsRmXy8GmsrcSKkEV9OQ== X-Google-Smtp-Source: AG47ELskDl+LJIwM5oEiJqfdAmkL0itHhAMKpHAyS0xNuVMBIppzg4h6RPtAIF5cXN/qUuQWcYNkwKfyVK2DE/S6BZQ= X-Received: by 2002:a24:6f04:: with SMTP id x4-v6mr7513451itb.51.1521697319917; Wed, 21 Mar 2018 22:41:59 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.203.196 with HTTP; Wed, 21 Mar 2018 22:41:59 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: References: <20180321120710.4eb3b944@hermann> <1521686539.3047757.1311778784.3E60E604@webmail.messagingengine.com> From: Warner Losh Date: Wed, 21 Mar 2018 23:41:59 -0600 X-Google-Sender-Auth: _B6F9VDcWnMlMFcmd4UvJMFgLRY Message-ID: Subject: Re: CURRENT r331284: crashing with USB To: Hyun Hwang Cc: "Hartmann, O." , FreeBSD CURRENT Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 05:42:01 -0000 On Wed, Mar 21, 2018 at 11:17 PM, Warner Losh wrote: > > > On Wed, Mar 21, 2018 at 8:42 PM, Hyun Hwang > wrote: > >> On Wednesday, March 21, 2018, 12:07 PM (UTC+0100), "Hartmann, O." < >> ohartmann@walstatt.org> wrote: >> > Hello. >> > >> > Incident: CURRENT r331284 can be brought down reliably with an USB >> > flash drive plugged in and out without mounting or doing anything with >> > it. >> > >> > [...] >> > >> > Does anyone else observe this bug? >> > >> >> Can confirm: whenever I plug my Transcend USB microSD reader into my >> builder (amd64, r331284), the kernel does attach da0 then immediately >> panics and falls down to `db>` prompt. >> > > Do you have a traceback? > actually, can you test https://reviews.freebsd.org/D14792 for me please? The hardware I bought to provoke this wound up in my wife's bags for a trip she's still on and I won't be able to test until Friday (which is why I've been slow to fix this). I hesitate to commit another change I'm sure will fix it on the off chance I'll be wrong again... Occasionally, we'll send a TUR to the device. To make sure that the periph doesn't go away while that's going on, we acquire a reference to the device. When the command completes we release it. The problem is that there's a race that the new asserts I put in uncovered. If we've sent a TUR to the device, but it hasn't completed when damediapoll timeout fires, it will think that we can send a TUR since we cleared the TUR work flag. This bumps the count, and bang! we have two TURs in flight. The Transend USB reader, at least the one I got takes a long time for TUR to return, so this can trigger the race. The above fix simply says that if a TUR is in flight, don't schedule another one. We'll poll again later anyway, and we have the TUR in flight already, so we'll accomplish the goal of TUR even though we chose to omit one we might otherwise do. Warner > Warner > > >> > I can plugin the USB and then unplug it and after two or three times >> doing this, the box goes down. >> >> I did not even have to plug-unplug the reader three times; plug the >> reader in and bam! immediate panic. >> >> AFAIK, r331115 did not have this issue because I was able to update my >> RPi 2 with the very reader from the very builder. >> I managed to salvage kernel binary dump; in case the dump is needed, >> please let me know. >> -- >> Hyun Hwang >> _______________________________________________ >> freebsd-current@freebsd.org mailing list >> https://lists.freebsd.org/mailman/listinfo/freebsd-current >> To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org >> " >> > >