Semi-working patch for amd64 suspend/resume

Alexander Motin mav at FreeBSD.org
Tue Dec 2 11:03:51 PST 2008


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!

-- 
Alexander Motin


More information about the freebsd-amd64 mailing list