From nobody@FreeBSD.org  Tue Jul 17 01:11:13 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 2754816A403
	for <freebsd-gnats-submit@FreeBSD.org>; 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 <freebsd-gnats-submit@FreeBSD.org>; 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 <freebsd-gnats-submit@FreeBSD.org>; 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 <cristi@net.utcluj.ro>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] firewire0: device physically ejected?
X-Send-Pr-Version: www-3.0

>Number:         114646
>Category:       kern
>Synopsis:       [firewire] [patch] firewire fails after suspend/resume
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    sbruno
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jul 17 01:20:01 GMT 2007
>Closed-Date:    Thu Apr 04 15:26:22 UTC 2013
>Last-Modified:  Thu Apr 04 15:26:22 UTC 2013
>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:

From: Cristian KLEIN <cristi@net.utcluj.ro>
To: bug-followup@FreeBSD.org,  cristi@net.utcluj.ro
Cc:  
Subject: Re: kern/114646: [patch] firewire0: device physically ejected?
Date: Tue, 17 Jul 2007 04:56:19 +0300

 Sorry for the somewhat incorrect title of the PR. After applying the 
 patch I was able to get a copy-paste of the message ("###" are my comments):
 
 ### starting suspend
 usb0: interrupt while not operating ignored
 usb1: interrupt while not operating ignored
 usb2: interrupt while not operating ignored
 usb0: interrupt while not operating ignored
 usb1: interrupt while not operating ignored
 usb2: interrupt while not operating ignored
 fwohci0: fwohci_pci_suspend
 usb0: interrupt while not operating ignored
 usb1: interrupt while not operating ignored
 usb2: interrupt while not operating ignored
 fwohci0: device physically ejected?
 fwohci0: device physically ejected?
 fwohci0: device physically ejected?
 fwohci0: device physically ejected?
 fwohci0: device physically ejected?
 fwohci0: device physically ejected?
 fwohci0: device physically ejected?
 fwohci0: device physically ejected?
 fwohci0: device physically ejected?
 fwohci0: device physically ejected?
 ### system suspended
 ### starting resume
 fwohci0: Phy 1394a available S400, 2 ports.
 fwohci0: Link S400, max_rec 2048 bytes.
 fwohci0: resume iso receive ch: 0
 fwohci0: Initiate bus reset
 wakeup from sleeping state (slept 00:00:09)
 fwohci0: BUS reset
 fwohci0: node_id=0xc800ffc0, gen=1, CYCLEMASTER mode
 firewire0: 1 nodes, maxhop <= 0, cable IRM = 0 (me)
 firewire0: bus manager 0 (me)
 em0: link state changed to DOWN
 em0: link state changed to UP
 ums0: at uhub1 port 1 (addr 2) disconnected
 ums0: detached
 ums0: <A4Tech USB Optical Mouse, class 0/0, rev 1.10/0.01, addr 2> on uhub1
 ums0: 8 buttons and Z dir.
 ### resume done
 
State-Changed-From-To: open->feedback 
State-Changed-By: gavin 
State-Changed-When: Mon Feb 2 20:56:42 UTC 2009 
State-Changed-Why:  
To submitter: I'm sorry that this PR has laid dormant for so 
long.  Do you know if this is still a problem with newer 
versions of FreeBSD? 


Responsible-Changed-From-To: freebsd-bugs->gavin 
Responsible-Changed-By: gavin 
Responsible-Changed-When: Mon Feb 2 20:56:42 UTC 2009 
Responsible-Changed-Why:  
Track 

http://www.freebsd.org/cgi/query-pr.cgi?pr=114646 
State-Changed-From-To: feedback->patched 
State-Changed-By: gavin 
State-Changed-When: Mon Feb 2 21:35:00 UTC 2009 
State-Changed-Why:  
Mark this as patched, it looks like it was fixed with the commit 
http://docs.FreeBSD.org/cgi/mid.cgi?200805100922.m4A9M6fg014158 
although that has not been merged to the STABLE branches yet. 
To submitter: would you be able to apply the changes manually and 
verify they fix your issues? 


Responsible-Changed-From-To: gavin->freebsd-firewire 
Responsible-Changed-By: gavin 
Responsible-Changed-When: Mon Feb 2 21:35:00 UTC 2009 
Responsible-Changed-Why:  
Over to maintainer(s) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=114646 

From: Sean Bruno <sean.bruno@dsl-only.net>
To: bug-followup@FreeBSD.org, cristi@net.utcluj.ro
Cc:  
Subject: Re: kern/114646: [firewire] [patch] firewire fails after
 suspend/resume
Date: Tue, 07 Apr 2009 08:11:11 -0700

 I don't see that this patch was applied to HEAD at all.
 
 I'll have to run this check on my laptop and see what happens.  I'll
 report back tomorrow.
 
 Sean
 
State-Changed-From-To: patched->feedback 
State-Changed-By: eadler 
State-Changed-When: Sun Oct 23 22:52:29 UTC 2011 
State-Changed-Why:  
per gavin 

http://www.freebsd.org/cgi/query-pr.cgi?pr=114646 
Responsible-Changed-From-To: freebsd-firewire->sbruno-firewire 
Responsible-Changed-By: sbruno 
Responsible-Changed-When: Mon Jul 2 17:08:04 UTC 2012 
Responsible-Changed-Why:  
Taking PR for closure and documentation. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=114646 
Responsible-Changed-From-To: sbruno-firewire->sbruno 
Responsible-Changed-By: sbruno 
Responsible-Changed-When: Mon Jul 2 17:30:51 UTC 2012 
Responsible-Changed-Why:  
I'm sbruno not sbruno-firewire 

http://www.freebsd.org/cgi/query-pr.cgi?pr=114646 
State-Changed-From-To: feedback->closed 
State-Changed-By: sbruno 
State-Changed-When: Thu Apr 4 15:25:04 UTC 2013 
State-Changed-Why:  
Closing ticket as patch has been applied 


http://www.freebsd.org/cgi/query-pr.cgi?pr=114646 
>Unformatted:
