From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 12 15:57:52 2012 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AC0A61065728 for ; Mon, 12 Mar 2012 15:57:48 +0000 (UTC) (envelope-from onwahe@gmail.com) Received: from mail-gx0-f182.google.com (mail-gx0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id 47C7E8FC0C for ; Mon, 12 Mar 2012 15:57:48 +0000 (UTC) Received: by ggnk4 with SMTP id k4so3244175ggn.13 for ; Mon, 12 Mar 2012 08:57:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=lK182WWb1gup7o4ZXorXQHRkIVpZlyTaZzR71BhBbLE=; b=oZiQMH7cWJ6u7JJ/zc9TbqIaBHzYVLvuyyImGm5XORuGucmuXYFgZV+xIoqwrOpuhK NkREUaDR8/lrNYliqrBgvx82X6YgXgchq1q5r3WY60Dvr60uHHLYSmaAmxiXumWuuSz0 CwTrFRm3tMrffcnaqwl4oT3c+5N/mQkuymtPIAM8OL5ngWuNLSvgo7XVHU59CpyDfZcH 2apCkEEbNjtwkgoYn5RcPScUuOrbiaQkrbHe9erRCYpgzAak3GPV3L2F1NFVEK74WNXg 0V2Xg1wgmtiXVbVEj392HYSM0fQnposuBW+cfSUnpLgsoseDpbvxTZ6MsZnzSlF6xkVP Nw4Q== MIME-Version: 1.0 Received: by 10.101.175.14 with SMTP id c14mr4258558anp.39.1331567867845; Mon, 12 Mar 2012 08:57:47 -0700 (PDT) Received: by 10.236.75.162 with HTTP; Mon, 12 Mar 2012 08:57:47 -0700 (PDT) Date: Mon, 12 Mar 2012 16:57:47 +0100 Message-ID: From: Svatopluk Kraus To: hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Cc: Subject: pccbb device doesn't send device_shutdown() to childs (reboot freezes) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Mar 2012 15:57:52 -0000 Hi, I solved very curious problem with rarely system (FreeBSD-9) freezing during reboot. Finally, I found out that system freezes in ep device callout. The part of device tree is following: -> pccbb -> pccard -> ep cbb_pci_shutdown() method in pccbb device places the cards in reset, turns off the interrupts and powers down the socket. No child has a chance to know about it. Thus, if ep device callout fires between device_shutdown() is called on root device and interrupts are disabled, the callout freezes in never-ending while loop, which reads status from hardware (now without power). I propose following change (editted by hand) in cbb_pci_shutdown(): struct cbb_softc *sc = (struct cbb_softc *)device_get_softc(brdev); + + /* Inform all childs. */ + bus_generic_shutdown(brdev); + /* * We're about to pull the rug out from the card, so mark it as * gone to prevent harm. */ sc->cardok = 0; Futhermore, ep device (ed device too, ... ?) has not implemented device_shutdown method. So, fixing pccbb device is not enough to solve the freezing problem. I somehow patched the mentioned devices too, but maybe someone more competent should do it for FreeBSD tree. Svata