Semi-working patch for amd64 suspend/resume

Nate Lawson nate at root.org
Tue Dec 2 11:31:53 PST 2008


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?

Thank you both for debugging this.  It's good to see progress on
suspend/resume.

> 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.

If you are using the LAPIC timer (default), it won't be running properly
during resume.  However, this wide discrepancy seems to indicate that
the timer state is not being resumed properly.  What if you use the ACPI
timer (hw.timecounter.* I think are the sysctls)?

-- 
Nate


More information about the freebsd-amd64 mailing list