Re: [linux-pm] [RFC 3/3] suspend to disk on powermac G5
From: Pavel Machek <hidden>
Date: 2006-12-12 13:20:24
Also in:
linux-pm
Hi!
This patch implements a very hacky suspend to disk for powermac G5 machines. I know it's broken in many places. Built and tested against the tree after commit 620034c84d1d939717bdfbe02c51a3fee43541c3. For some reason usb doesn't survive suspend even if I try to restore interrupts now... I use this script:
...
Oh and did I say this is hacky? MMIO save/restore, the need to hook many places, no proper MPIC suspend/resume functionality, snd-aoa doesn't work after resume (it plays but no sound comes out, interrupts are coming in though... go figure, eh wait, since I wrote it I guess I'll check it too).
Does aoa module load/unload help? Does making it build-in help? Also try playing with aumix after resume.
I also ifdef'ed out set_context(current->active_mm->context.id, current->active_mm->pgd); because I didn't know what it is doing and it works without :) I've suspended and resumed a few times in a row with this now, with and without longer breaks with the machine up and with the machine off. Ah who am I kidding... This is pretty much guaranteed to break. Parts of the assembly code are quite old (written like half a year ago) so I don't remember some things... Why, for example, the save area has holes. I shall fix these some time I guess.
+ /* phew. suckers. this 16MB area is left unmapped + * at another place but they don't bother to mark it so */ + for (i = 0; i < (1<<24); i+= PAGE_SIZE) + SetPageNosave(virt_to_page((void*)((unsigned long)dart_tablebase + i))); +
Can you move that marking where it belongs?
+ if (dart_tablebase == 0 || dart_tablesize == 0) + return; + + p = alloc_pages(GFP_KERNEL, 9); + BUG_ON(!p); + dart_copy = page_address(p); +}
Not sure how likely is 2MB allocation to succeed. You may need to prealocate it... And you definitely will need to handle error here.
quoted hunk ↗ jump to hunk
--- linux-2.6-git.orig/kernel/power/snapshot.c 2006-12-11 23:34:46.718716759 +0100 +++ linux-2.6-git/kernel/power/snapshot.c 2006-12-11 23:38:00.152716759 +0100@@ -707,6 +707,8 @@ static struct page *saveable_page(unsign return NULL; if (PageNosaveFree(page)) return NULL; + if (!page_is_ram(pfn)) + return NULL; return page; }
Could this get some testing in -mm? Overall, it looks pretty much okay. Thanks... Pavel -- Thanks for all the (sleeping) penguins.