[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: USB3/xhci and hibernate/suspend to disk [SOLVED]



On Wed, Feb 16, 2011 at 2:04 PM, Andre [debian] <debian.a2@gmail.com> wrote:
> Hi,
>
> I've got a clean install of debian 6.0 squeeze, and am trying to get
> sleep/hibernate (suspend to ram/disk) to work.  I'll document what I
> have working first (to help anyone else searching for answers), and
> hopefully someone can help me past where I'm currently stuck...
>
> I'm writing this up at work, so can't quite remember all the details.
> ??? are bits I can't quite remember.
>
> I started with a new system:
>  - Gigabyte H55M-USB3 + i3-540
>  - 20TB WD20EARS (Incidentally, the drive suffers from this problem
>    [http://wdc.custhelp.com/app/answers/detail/a_id/5357].  I did
>    disable the head parking using the wdidle3 tool provided by WD.)
>  - SATA DVD drive
>  - 2x2GB RAM
>  - generic USB keyboard, PS/2 mouse
> and performed a netinstall of Debian Squeeze 6.0.
>
> Without doing anything else, I attempted to put the system to sleep:
>        # pm-sleep
> The screen blanked off the X session to a terminal window where I see
>        [xxxxx] pm_op(): usb_dev_freeze+0x0/0x20 returns -2
>        [xxxxx] PM: Device usb3 failed to quiesce: error -2
>        [xxxxx] PM: ???
> It isn't always usb3, but some random usb port as far as I can tell.
>
> Some research led me to the xhci driver.  It does not respond well to
> suspend commands, and the easiest workaround is to add a script which
> unloads it prior to suspend and reloads it afterward:
>        /etc/pm/sleep.d/05_xhci
>
>        #!/bin/sh
>        # Fix USB3 suspend and hibernate problems
>        case $1 in
>        hibernate)
>        modprobe -r xhci
>        ;;
>        suspend)
>        modprobe -r xhci
>        ;;
>        thaw)
>        modprobe xhci
>        ;;
>        resume)
>        modprobe xhci
>        ;;
>        *) echo "USB3 fix script: wrong argument!"
>        ;;
>        esac
> Change the script to mode 755.  The errors go away and sleep works fine.
> (Reference: http://disi.unitn.it/~ferro/index.php/linux)
>
> Next, I attempted to hibernate the system:
>        # pm-hibernate
> It showed this error:
>        ata3: softreset failed (???)
> but then the machine proceeded to (as far as I can tell) swap out memory
> and shut itself down.  Powering the machine back on resulted in a normal
> boot (not a resume).
>
> It turns out I had not told the kernel about the resume partition.  This
> can be done through grub by editing /etc/defaults/grub:
>        GRUB_CMDLINE_LINUX="resume=UUID=<partition_id>"
> where <partition_id> is the UUID of the swap partition from /etc/fstab.
> Run update-grub:
>        # update-grub
> In my case, I have a 4GB swap partition (as created by the installer),
> and I don't remember offhand where I saw this, but I believe that there
> is enough swap space for the memory.
>
> Now pm-hibernate still shows
>        ata3: softreset failed (???)
> and the shutdown appears as it was before.  But now powering up results
> in swapping in of memory before I get:
>        [xxxxx] pm_op(): usb_dev_freeze+0x0/0x20 returns -2
>        [xxxxx] PM: Device usb3 failed to quiesce: error -2
>        [xxxxx] PM: Resume failed
> The machine hangs for a few minutes before displaying a stack trace.
> (Sorry, I don't have the details now; I can check when I get home.)
>
> /var/log/pm-suspend.log does not show anything obviously wrong (to me).
> I can post that when I get home.
>
> I don't understand why devices need to quiesce on resume.  Are drivers
> loaded first, then need to make room for the drivers that were in the
> suspended image?
>
> Does anyone have any idea why I am unable to resume from a hibernation
> state?  Or is there something wrong with the suspend to disk in the
> first place?  Is the ata3 error meaningful?

I was on the right track with the thinking that drivers are loaded at
first, but then xhci can't unload when the resume happens.

The solution was to blacklist xhci.  Edit /etc/modprobe.d/xhci.conf:
   blacklist xhci
Then update initrd.img:
   # update-initramfs -u

That's it, now suspend to ram and suspend to disk work!

Andre


Reply to: