From owner-freebsd-bugs@FreeBSD.ORG Tue Jul 17 01:20:02 2007 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 849DB16A405 for ; Tue, 17 Jul 2007 01:20:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id 64FE313C48E for ; Tue, 17 Jul 2007 01:20:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.1/8.14.1) with ESMTP id l6H1K2gr009827 for ; Tue, 17 Jul 2007 01:20:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.1/8.14.1/Submit) id l6H1K2mC009826; Tue, 17 Jul 2007 01:20:02 GMT (envelope-from gnats) Resent-Date: Tue, 17 Jul 2007 01:20:02 GMT Resent-Message-Id: <200707170120.l6H1K2mC009826@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Cristian KLEIN Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2754816A403 for ; Tue, 17 Jul 2007 01:11:13 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (groups.freebsd.org [69.147.83.33]) by mx1.freebsd.org (Postfix) with ESMTP id F244413C4B8 for ; Tue, 17 Jul 2007 01:11:12 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.1/8.14.1) with ESMTP id l6H1BCNl005025 for ; Tue, 17 Jul 2007 01:11:12 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.1/8.14.1/Submit) id l6H1BBCl005022; Tue, 17 Jul 2007 01:11:11 GMT (envelope-from nobody) Message-Id: <200707170111.l6H1BBCl005022@www.freebsd.org> Date: Tue, 17 Jul 2007 01:11:11 GMT From: Cristian KLEIN To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.0 Cc: Subject: kern/114646: [patch] firewire0: device physically ejected? X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2007 01:20:02 -0000 >Number: 114646 >Category: kern >Synopsis: [patch] firewire0: device physically ejected? >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Jul 17 01:20:01 GMT 2007 >Closed-Date: >Last-Modified: >Originator: Cristian KLEIN >Release: 7.0-CURRENT >Organization: Technical University of Cluj-Napoca >Environment: FreeBSD hades.local 7.0-CURRENT FreeBSD 7.0-CURRENT #10: Mon Jul 16 22:41:04 EEST 2007 cristi@hades.local:/usr/obj/usr/src/sys/GENERIC i386 (source updated immediately before compile) >Description: When suspending / resuming my laptop (IBM Thinkpad R51) several times, it repeatedly prints the following message (written by hand): fwohci0: device physically ejected? The output of this message is so fast that the system is unusable. >How-To-Repeat: Compile a recent 7.0-CURRENT on a Laptop with firewire. Resume / suspend repeatedly. >Fix: Using a printf, I found out that fwohci_check_stat is called from fwohci_poll. Presumably, fwohci is not suspended or resumed correctly and the polling code repeatedly calls device_printf. I can't say for sure, but I assume the problem occurs during suspend, because the message flood starts few seconds before the laptop is actually suspended, and continues after resuming. Why fwohci is not suspended/resumed correctly is unknown to me, but the following patch will rate-limit that message, so the system becomes usable after resuming. I don't think that fwohci is reinitialized correctly, but as I don't have any firewire device, I can't say for sure. Anyway, after applying the patch below (and some other ACPI related patch), I was able to suspend / resume my laptop 20+ times. Patch attached with submission follows: --- sys/dev/firewire/fwohci.c.orig 2007-07-17 03:55:48.066278814 +0300 +++ sys/dev/firewire/fwohci.c 2007-07-17 03:58:20.899005320 +0300 @@ -2064,8 +2064,13 @@ stat = OREAD(sc, FWOHCI_INTSTAT); if (stat == 0xffffffff) { - device_printf(sc->fc.dev, - "device physically ejected?\n"); + /* Rate limit this message */ + static int verbose = 10; + if (verbose != 0) { + device_printf(sc->fc.dev, + "device physically ejected?\n"); + verbose--; + } return (FILTER_STRAY); } if (stat) >Release-Note: >Audit-Trail: >Unformatted: