Semi-working patch for amd64 suspend/resume
Jung-uk Kim
jkim at FreeBSD.org
Wed Dec 10 18:20:14 PST 2008
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 <vm/vm_extern.h>
> >
> > #include <machine/apicreg.h>
> > +#include <machine/cpufunc.h>
> > #include <machine/md_var.h>
> > #include <machine/mp_watchdog.h>
> > #include <machine/pcb.h>
> > @@ -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
More information about the freebsd-amd64
mailing list