hibernate, suspend and s2both support

Tim Dijkstra newsuser at famdijkstra.org
Mon Mar 19 00:41:15 EST 2007


On Sun, 18 Mar 2007 09:54:43 +0100
Johannes Berg <johannes at sipsolutions.net> wrote:

> Hi Tim,
> 
> Let me try to answer your questions, I've worked on suspend for powermac
> machines for quite a while.

Thanks for the answers! I removed debian-powerpc from the cc-list as
you suggested.

> > AFAIK, one can suspend-to-ram by using some ioctl's on the PMU. (Do all
> > ppc's have a PMU? What about ppc64?)
> 
> Yes, although I have a patch series that I'm going to post soon that
> deprecates the PMU ioctl and uses the regular mem > /sys/power/state
> mechanism, in fact the PMU ioctl only invokes that exact same code.
> However, you'll need to support older kernels, but trying
> sys/power/state before PMU will be safe on any kernel released after May
> 25 2006 (commit 0fba3a1f39f8b0a50b56c8b068fa52131cbc84c2). Before that,
> the machine just crashed when using the pm ops stuff and at the time I
> hadn't understood yet why and just papered over the problem.

So if I build a binary on ppc that first tries /dev/pmu (if it exists) and then
/sys/power/state, that would be safe? I guess that the powerpcs that do not
support suspend-to-ram will report that via the PMU_IOC_CAN_SLEEP ioctl and
they will lack 'mem' in /sys/power/state?

> > Hibernation can be done in the usual way. And s2both is unsupported. 
> 
> Yup; I've played with s2both a bit but it hangs the machine, I'm not
> really sure why yet. It may be related to another slight bug I just
> found yesterday though.

Hmm, so 'echo disk > /s/p/state' and s2ram suspend OK, but s2both doesn't?

> > If this is all true, could someone try to build 's2ram' and 's2both'
> > from the following tarball and run it? (no guarantees, on your own
> > risk, etc;)
> > 
> > http://www.famdijkstra.org/~tdykstra/suspend_pmu.tar.bz2
> 
> It works on my machine (see above), but it doesn't use the PMU ioctl:
> 
> #ifndef CONFIG_PMU
>         int fd;
>         unsigned long arg = 0;
> 
>         if ((fd = open("/dev/pmu", O_RDWR)) < 0)
> ...
> 
> seems to be the wrong way around. A kernel-based suspend to both has no
> chance of working properly since I currently disallow using 'platform'
> for the disk poweroff state, but I intend to fix this if I can. 

Oops, Yes that was the wrong way around... That's what you get if you
don't have a Mac;) Did you try it with the obvious fix?

> I can't
> try a userspace based s2both right now since I'd probably have to
> rebuild my initramfs at least to test a power-failure during suspend.

Yes you need an initramfs, but I don't see any reason why if
suspend-to-disk and suspend-to-ram work, s2both wouldn't. If we get
suspend-to-ram working I'll put up proper source package which you can
dpkg-buildpackage. That will include hooks for initramfs-tools and will
build an initramfs for you.

grts Tim



More information about the Linuxppc-dev mailing list