From owner-freebsd-mobile@FreeBSD.ORG Wed Nov 29 07:10:47 2006 Return-Path: X-Original-To: freebsd-mobile@freebsd.org Delivered-To: freebsd-mobile@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D5EC716A79B for ; Wed, 29 Nov 2006 07:10:46 +0000 (UTC) (envelope-from tarkhil@webmail.sub.ru) Received: from mail.sub.ru (webmail.sub.ru [213.247.139.22]) by mx1.FreeBSD.org (Postfix) with ESMTP id 95D1A43D62 for ; Wed, 29 Nov 2006 07:10:16 +0000 (GMT) (envelope-from tarkhil@webmail.sub.ru) Received: (qmail 70636 invoked by uid 0); 29 Nov 2006 10:03:32 +0300 Received: from tarkhil.rostokino.net (HELO ?85.192.19.9?) (tarkhil%sub.ru@85.192.19.9) by techno.sub.ru with SMTP; 29 Nov 2006 07:03:32 -0000 Message-ID: <456D3080.1040107@webmail.sub.ru> Date: Wed, 29 Nov 2006 10:02:24 +0300 From: Alex Povolotsky User-Agent: Thunderbird 1.5 (X11/20060310) MIME-Version: 1.0 To: Andrea Bittau References: <20060921000628.GA1832@shorty.sorbonet.org> In-Reply-To: <20060921000628.GA1832@shorty.sorbonet.org> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-mobile@freebsd.org Subject: Re: hack for getting suspend/resume to half work on an IBM Thinkpad x60s [SMP] X-BeenThere: freebsd-mobile@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Mobile computing with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Nov 2006 07:10:48 -0000 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