Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Nov 2006 10:02:24 +0300
From:      Alex Povolotsky <tarkhil@webmail.sub.ru>
To:        Andrea Bittau <a.bittau@cs.ucl.ac.uk>
Cc:        freebsd-mobile@freebsd.org
Subject:   Re: hack for getting suspend/resume to half work on an IBM Thinkpad x60s [SMP]
Message-ID:  <456D3080.1040107@webmail.sub.ru>
In-Reply-To: <20060921000628.GA1832@shorty.sorbonet.org>
References:  <20060921000628.GA1832@shorty.sorbonet.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?456D3080.1040107>