From owner-freebsd-amd64@FreeBSD.ORG Thu Dec 11 02:20:14 2008 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id 8746C1065677; Thu, 11 Dec 2008 02:20:12 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: freebsd-acpi@FreeBSD.org Date: Wed, 10 Dec 2008 21:19:58 -0500 User-Agent: KMail/1.6.2 References: <1224616985.00027652.1224606603@10.7.7.3> <200812021243.08513.jkim@FreeBSD.org> <49358684.7010508@FreeBSD.org> In-Reply-To: <49358684.7010508@FreeBSD.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200812102120.03788.jkim@FreeBSD.org> Cc: Alexander Motin , peter@freebsd.org, freebsd-amd64@freebsd.org Subject: Re: Semi-working patch for amd64 suspend/resume X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Dec 2008 02:20:14 -0000 On Tuesday 02 December 2008 02:03 pm, Alexander Motin wrote: > Hi. > > Jung-uk Kim wrote: > >> Here is problems I still have now: > >> - SMP kernel resume is not working, system reboots while doing > >> acpi_wakeup_cpus(); > > > > My dual-core CPU seems to resume okay but quite unstable. Can > > you try something like the following in amd64/mp_machdep.c and > > tell me if it helps? > > > > ------------ > > @@ -57,6 +57,7 @@ > > #include > > > > #include > > +#include > > #include > > #include > > #include > > @@ -1121,6 +1121,8 @@ > > int cpumask = PCPU_GET(cpumask); > > > > if (savectx2(&stopxpcbs[cpu])) { > > + /* Flush CPU cache. */ > > + wbinvd(); > > /* Indicate that we are suspended. */ > > atomic_set_int(&stopped_cpus, cpumask); > > } else { > > ------------ > > Wow, it works! > > I am writing this letter just after suspending/resuming my > dual-core C2D system 4 times straight. Music plays, USB, SATA, all > other hardware works fine. What kind of instability do you have? > > The only strange effect I have noticed was incorrect CPU time some > processes got: > %ps ax > PID TT STAT TIME COMMAND > 12 ?? WL 280503:38,05 [intr] > 1430 ?? Ss 280503:38,34 icewm > > But I think it is more timer driver related then resume itself. > > > Thanks for the feedback! > > Many thanks to you! I hope this long-waited feature will be > finished! FYI, I uploaded a new patch with some fixes (against today's CURRENT): http://people.freebsd.org/~jkim/amd64_suspend.diff This patch should be feature complete but I'd say it is still considered experimental as it is not properly reviewed. Now, some useful tips of the day for starters: Tip #1: Try 'sysctl debug.acpi.suspend_bounce=1" first. If it hangs, this patch won't do any good for you. Tip #2: Suspend/resume several times in single user mode first to be safe. I am sure you don't want to lose your data. ;-) Tip #3: If keyboard LEDs blink (keyboard reset) but nothing is displayed on screen, try 'sysctl hw.acpi.reset_video=1' next time. Tip #4: If #3 does not work for you, try 'vbetool post' (available from ports/sysutils/vbetool) next. It works better in some cases. Tip #5: With Xorg, it is always safe to suspend in console unless you have a hook in suspend script to do some magic. When you switch to console by pressing Ctrl+Alt+F[1-8], Xorg driver will save GPU states. After resume is complete, you can return to Xorg screen by pressing Alt-F9 later. Then, Xorg driver should restore GPU states and screen. Tip #6: If your mouse pointer does not move any more, try restarting moused by '/etc/rc.d/moused restart'. Cheers, Jung-uk Kim