hack for getting suspend/resume to half work on an IBM Thinkpad x60s [SMP]

Alex Povolotsky tarkhil at webmail.sub.ru
Tue Nov 28 23:10:48 PST 2006


Andrea Bittau wrote:
> This is a half working hack for getting suspend/resume to "work" on an IBM
> Thinkpad x60s [Intel Duo].  It has two limitations:
> 1) All interrupts are routed to the BSP.
> 2) Upon resume, the AP sits in the idle loop.  You can try to make it escape,
>    but it doesn't quite work yet.
> I think these issues are both related and it has to do with the way how i
> restore the second CPU.  I think the page tables are messed up, and perhaps even
> other state.  Hopefully someone can give me some insight on how to fix this.
> [Question: from init_secondary() how do I get back to where I was [the IPI_STOP
> handler]? =D  Do I need to do something like acpi_wakeup.c?  Isn't there an
> easier way?] Also, if people seem interested, I can try and write a proper
> patch.
>
> In order to get suspend/resume to work, there are three main hurdles to jump:
> 1) SATA suspend/resume seems broken.  Change the SATA option in the BIOS to
>    "compatible".
>
> 2) apic.  FreeBSD reconfigures the io apic upon resume, but not the local apic.
>    The patch attached to this mail fixes this.  Indeed, it almost does so in the
>    "proper" way and not so much of a hack =D.
>
> 3) SMP.  The second core needs to be killed and woken up as appropriate.  The
>    way I do this is quite lame.
>    - Force the second core in the idle loop by setting machdep.hlt_cpus=2.
>    - make system look like UP instead of SMP [i.e. deactivate SMP] & suspend.
>    - resume, wake up other core [which will run idle process] and activate SMP.
>
> To get this to work in practice:
> 0) unload all drivers.
> 1) Apply the patch against today's freebsd-current.
> 2) My /etc/rc.suspend looks like this:
> #!/bin/sh
> sync
> sync
> sysctl machdep.hlt_cpus=2
> sleep 2
>
> 3) zzz
>
> 4) if you want to crash: sysctl machdep.hlt_cpus=0
>
> have fun
>   

Trying to do so on ThinkPad R60.

Applied patches well, installed and rebooted with new kernel. sysctl 
machdep.hlt_cpus=2, sysctl kern.smp.active=0, zzz - computer goes to 
sleep well.  (sleep indicator is on). That's all. Pressing power button 
makes disk LED blink for half a second once, and no other reaction on 
any of my attempts. Only extracting the battery and power cord seems to 
help, not in waking up, of course ;)

What can I investigate, fix, patch or something?

Alex


More information about the freebsd-mobile mailing list