suspend on ThinkPad X31 hangs

Michael Collette metrol at metrol.net
Fri Jun 13 16:29:19 PDT 2003


I'm replying here to this as I'm seeing the exact same kind of apm problem on 
an R40.

Dan Pelleg wrote:
> Dave Tweten writes:
>  > daniel+bsd at pelleg.org said:
>  > >I recently installed 4.8-RC on an IBM thinkpad X31. APM seems to work
>  > >(reporting battery status), and hibernation to a special partition
>  > >(created with the IBM tool) works. But suspend has problems resuming.
>  > 
>  > That's strange, since FreeBSD 4.8 doesn't know about hibernation.  It
>  > just
>  > thinks it's being put to sleep.  The BIOS knows to copy things to the
>  > hibernation partition and shut down after the OS has gone to sleep.
>  > 
>  > You didn't answer any of the following questions in your original
>  > message, so:
>  > 
>  > 1. Did you put
>  > 
>  > options		CPU_SUSP_HALT

No I didn't.  According to LINT this option is to have the "halt" command 
suspend rather than shut down.  Although this may be convenient, it doesn't 
sound like a solution.

>  > 
>  >    and
>  > 
>  > device		apm0

I've compiled my kernel exactly as you have shown.  I've also tried it with...

device    apm0  at nexus? disable flags 0x20
   and
device    apm0  at nexus?

No changes to the results.


>  >    into your custom kernel config?
>  > 
>  > 2. Did you put all of:
>  > 
>  > apm_enable="YES"
>  > apmd_enable="YES"
>  > apmd_flags="-f /usr/local/etc/apmd.conf"

I pointed the apmd_flags to the config file in /etc.  It contains the exact 
lines you illustrate below.

>  > 
>  >    into /etc/rc.conf (changing the path name to the location of your
>  >    customized apmd configuration file)?
>  > 
>  > 3. Did you customize apmd.conf to incorporate
>  > 
>  > apm_event SUSPENDREQ, USERSUSPENDREQ {
>  > exec "/usr/local/etc/rc.suspend";
>  > }
>  > 
>  > apm_event NORMRESUME, CRITRESUME, STANDBYRESUME {
>  > exec "/usr/local/etc/rc.resume";
>  > }
>  > 
>  >    or the rough equivalent, to invoke your customized suspend and
>  >    resume scripts?
>  >
>  > 4. Does your customized suspend script do
>  > 
>  > sync && sync && sync
>  > sleep 3
>  > zzz

The default rc.suspend has these exact lines in it.  With that in mind, I kept 
everything pointing at the default configs.

>  > 
>  >    to make sure all outstanding disk I/O is complete before you
>  >    actually suspend?
>  > 
>  > 5. Are you running any detachable devices (PCCard or USB) when you
>  >    suspend?  If so, you may want to detach them in rc.suspend and
>  >    re-attach them in rc.resume.

I've got a USB mouse.  No other removable media.  Well, there is a DVD/CD-RW 
in the Ultrabay.  Somehow I don't think this is the problem.

>  > You said you've already created a hibernation slice.  If you've done
>  > all these things, and if your X31 works at all like my T23, suspend and
>  > hibernate should work well, except for the need to switch to a virtual
>  > console and back to X when you wake up from hibernation.
> 
> Thank you for the reply. I have CPU_SUSP_HALT and apm0. apmd_flags is not
> set in my rc.conf. But it seems that syncing is taken care of in
> /etc/rc.suspend. I tried this with and without detachable devices, and
> with and without X running. No luck.
> 
> This is strange. My X23 suspends and resumes fine (I don't have an
> hibernation partition on it).

Same here.  I've got a T23 that does pretty well.  Every once in a great while 
it would glitch.  This R40 glitches every single time.
 
> Here is a more detailed description of the failure (from booting with -v):
> 
> At resume, it shows:
> 
> ata0: resetting devices .. ata0: mask=03 ostat0=50 ostat2=00
> ad0: ATAPI 00 00
> ata0-slave: ATAPI 00 00
> ata0: mask=03 stat0=50 stat1=00
> ad0: ATA 01 a5
> ata0: devices=01
> ad0: success setting WDMA2 on generic chip
> done
> ata1: resetting devices .. ata1: mask=03 ostat0=00 ostat2=00
> ata1-master: ATAPI 00 00
> ata1-slave: ATAPI 00 00
> ata1: mask=o3 stat0=00 stat1=00
> ata1: devices=00
> done
> 
> about a second later is shows:
> ad0: WRITE command timeout tag=0 serv=0 - resetting
> ata0: resetting devices ..
> 
> and then locks
> 
> sometimes it will instead show this before locking::
> ad0: READ command timeout tag=0 serv=0 - restting
> ata0: resetting devices ..

I'm not seeing any timeouts, or any indication that something didn't resume... 
other than a complete lock up.  The last two messages I get:

ata0: resetting devices .. done
ata1: resetting devices .. done
 
I also see a couple of messages above that concerning fwohci0 and firewire0 
resetting.

Something is seriously not right with how FreeBSD is conversing with these new 
Thinkpads.


... This just in ....

In the midst of writing this I decided that I'd better just go ahead and pull 
both the USB mouse and the Ultrabay DVD.  I'm still locking, but now right 
after it gives me that last bit about resetting devices, as shown above, it 
gets a timeout error trying to write to ad0.  Right after this it looks like 
it's attempting to reset ata0 again, then hangs.

ad0: WRITE command timeout tag=0 serv=0 - resetting
ata0: resetting devices ..

And that is exactly all I get.  Perhaps some additional delay needs to be 
kicked in prior to attempting to access the drive?

Later on,
-- 
"Always listen to experts.  They'll tell you what can't be done, and why.  
Then do it."
- Robert A. Heinlein



More information about the freebsd-mobile mailing list