Re: [PATCH][RFC] swsusp: speed up image restoring on x86-64

From: Pavel Machek
Date: Sat Jan 22 2005 - 04:58:36 EST


Hi!

> > The following patch speeds up the restoring of swsusp images on x86-64
> > and makes the assembly code more readable (tested and works on AMD64). It's
> > against 2.6.11-rc1-mm1, but applies to 2.6.11-rc1-mm2. Please consifer for applying.
> >
> > Signed-off-by: Rafael J. Wysocki <rjw@xxxxxxx>
>
> Thanks. I applied it with some small changes to not hardcode any
> C fields.
>
> BTW Pavel, while reading the code I noticed some dubious things
> in the code:
>
> - The TLB flush doesn't flush global pages (turn of PGE and turn it
> on again). Since that handles kernel pages which are marked global
> this is surely wrong.
>
> - Also is it really needed to flush the TLB after each page and wouldn't
> INVLPG be better here? Or do you want to flush other pages than the
> just copied one there too? INVLPG would also take care of the global
> pages at least on x86-64 (iirc there are some bugs in this regard on some
> older i386 cpus)
>
> - There is a comment that says the code shouldn't use stack, but
> it definitely uses the stack for some things. Either the comment
> or the code is wrong. Which is?

This should address it... I attempted to put answers into the
comments, because probably everyone is interested in those....
Pavel

--- clean/arch/x86_64/kernel/suspend_asm.S 2004-10-19 14:16:28.000000000 +0200
+++ linux/arch/x86_64/kernel/suspend_asm.S 2005-01-22 10:51:28.000000000 +0100
@@ -1,10 +1,16 @@
-/* Originally gcc generated, modified by hand
+/* Copyright 2004,2005 Pavel Machek <pavel@xxxxxxx>, Andi Kleen <ak@xxxxxxx>, Rafael J. Wysocki <rjw@xxxxxxx>
*
- * This may not use any stack, nor any variable that is not "NoSave":
+ * Distribute under GPLv2.
+ *
+ * swsusp_arch_resume may not use any stack, nor any variable that is
+ * not "NoSave" during copying pages:
*
* Its rewriting one kernel image with another. What is stack in "old"
* image could very well be data page in "new" image, and overwriting
* your own stack under you is bad idea.
+ *
+ * TLB flush is purely and debugging attempt to make it fail fast if we
+ * do something wrong. TLB is properly flushed in swsusp_restore.
*/

.text



--
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/