Bug 11263

Summary: Re: 2.6.27-rc2: uvcvideo WARNING after suspend to ram
Product: Drivers Reporter: Alan Jenkins (alan-jenkins)
Component: USBAssignee: Alan Stern (stern)
Status: CLOSED CODE_FIX    
Severity: normal CC: m.s.tsirkin, oliver, pavel, rjw, stern
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.27-rc2 Tree: Mainline
Regression: Yes
Bug Depends on:    
Bug Blocks: 7216, 11167    
Attachments: Dmesg including boot, suspend, and WARNING
Debug patch to check device tree
Dmesg for boot with debug patch
Corrected debug patch
Dmesg for corrected patch
Patch that should fix the problem
Implement the new PM ops for USB

Description Alan Jenkins 2008-08-07 04:02:41 UTC
References: http://comments.gmane.org/gmane.linux.kernel/717552
Comment 1 Alan Jenkins 2008-08-07 04:04:10 UTC
Created attachment 17120 [details]
Dmesg including boot, suspend, and WARNING
Comment 2 Alan Jenkins 2008-08-07 04:07:43 UTC
Created attachment 17121 [details]
Debug patch to check device tree

Use CONFIG_PM_VERBOSE to output device's parents when added.
Comment 3 Alan Jenkins 2008-08-07 04:11:10 UTC
Created attachment 17122 [details]
Dmesg for boot with debug patch
Comment 4 Alan Jenkins 2008-08-07 04:35:45 UTC
Created attachment 17124 [details]
Corrected debug patch

Sorry, that was rushed.  I forgot to insert ->parent after copy&pasting.
Comment 5 Alan Jenkins 2008-08-07 04:40:03 UTC
Created attachment 17125 [details]
Dmesg for corrected patch

This kernel log shows boot, suspend, and WARNING with the extra debug info,
Comment 6 Alan Jenkins 2008-08-07 04:44:41 UTC
Oliver - there's a lot of debug output, and I'm not sure exactly which bits you're interested in.  Perhaps I shouldn't have used CONFIG_PM_VERBOSE.

Anyway, let me give this some more human-readable context.  The USB device in question is:

$ lsusb|grep eMPIA
Bus 001 Device 003: ID eb1a:2761 eMPIA Technology, Inc.

And the physical device tree looks like this:

$ lsusb -t
Bus#  5
`-Dev#   1 Vendor 0x1d6b Product 0x0001
...
Bus#  1
`-Dev#   1 Vendor 0x1d6b Product 0x0002
  |-Dev#   2 Vendor 0x0951 Product 0x1606
  `-Dev#   3 Vendor 0xeb1a Product 0x2761
Comment 7 Anonymous Emailer 2008-08-07 05:45:32 UTC
Reply-To: oliver@neukum.org

Am Donnerstag 07 August 2008 13:44:41 schrieb bugme-daemon@bugzilla.kernel.org:
> http://bugzilla.kernel.org/show_bug.cgi?id=11263
> 
> 
> 
> 
> 
> ------- Comment #6 from alan-jenkins@tuffmail.co.uk  2008-08-07 04:44 -------
> Oliver - there's a lot of debug output, and I'm not sure exactly which bits
> you're interested in.  Perhaps I shouldn't have used CONFIG_PM_VERBOSE.

The callchain goes through device_resume()->dpm_resume() which should have
set the parent to DPM_RESUMING, so the warning should not have triggered.
Can you also print the parent's power state in the branch leading to the WARN
in device_pm_add() ?

	Regards
		Oliver
Comment 8 Alan Jenkins 2008-08-07 06:31:50 UTC
"video4linux video0: parent 1-8:1.0 is sleeping (status 5), will not add"

5 == DPM_OFF
Comment 9 Alan Stern 2008-08-07 07:30:17 UTC
This is a known problem caused by changes to the driver core.  I haven't had time yet to update the USB suspend/resume infrastructure to match.
Comment 10 Rafael J. Wysocki 2008-08-08 11:41:39 UTC
*** Bug 11284 has been marked as a duplicate of this bug. ***
Comment 11 Rafael J. Wysocki 2008-08-08 15:55:26 UTC
Created attachment 17148 [details]
Patch that should fix the problem

Well, it looks like we have to drop the WARN_ON(true) that produces those stack traces until USB is redesigned not to trigger it.
Comment 12 Alan Stern 2008-08-11 12:48:38 UTC
Created attachment 17180 [details]
Implement the new PM ops for USB

This patch should fix the underlying problem.  Try it out, with Rafael's patch removed so that you can easily observe any unwanted symptoms.
Comment 13 Alan Jenkins 2008-08-12 03:08:21 UTC
Yes, that gets rid of the warning.  I found another bug during testing, but it also happens without the patch.

If I suspend with my card reader inserted & mounted, my laptop hangs on resume.  I get a blank screen with a flashing text cursor.  I will investigate this further and open a new bug.