All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: discuss@x86-64.org, pm list <linux-pm@lists.linux-foundation.org>,
	Nigel Cunningham <nigel@nigel.suspend2.net>
Subject: Re: [RFC][PATCH -mm 1/4] Hibernation: Arbitrary boot kernel support on x86_64
Date: Tue, 21 Aug 2007 09:57:10 +0200	[thread overview]
Message-ID: <20070821075710.GE7258@elf.ucw.cz> (raw)
In-Reply-To: <200708201511.34254.rjw@sisk.pl>

Hi!

> From: Rafael J. Wysocki <rjw@sisk.pl>
> 
> Make it possible to restore a hibernation image on x86_64 with the help of a
> kernel different from the one in the image.

Looks mostly ok to me.

Should this be split in half (generic support, x86-64 support) and be
done last in the series, so that suspend still works when bisecting?

>  done:
> +	/* jump to the restore_registers address from the image header */
> +	jmpq	*%rax

So this is where the change from kernel text 1 to kernel text 2
happens, right? I see you are using %r10 for something here, perhaps
that should be commented?

> +.balign PAGE_SIZE
> +ENTRY(restore_registers)
> +	/* we are in the image kernel's text now */
> +	testq	%r10, %r10
> +	jz	1f
> +	/* copy the skipped page */
> +	movq	%r10, %rsi
> +	movq	%r9, %rdi
> +	movq	$(PAGE_SIZE >> 3), %rcx
> +	rep
> +	movsq

> @@ -84,10 +127,7 @@ done:
>  	movq	%rcx, %cr3
>  	movq	%rax, %cr4;  # turn PGE back on
>  
> -	movl	$24, %eax
> -	movl	%eax, %ds
> -
> -	/* We don't restore %rax, it must be 0 anyway */
> +	/* restore GPRs (we don't restore %rax, it must be 0 anyway) */
>  	movq	$saved_context, %rax
>  	movq	pt_regs_rsp(%rax), %rsp
>  	movq	pt_regs_rbp(%rax), %rbp

Hmm, in the old code, we knew we don't have to restore %ds, because it
is constant for one kernel. Now, we rely on %ds being constant accross
kernels. Not nice, and should be at least documented.

									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  reply	other threads:[~2007-08-21  7:57 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-20 13:10 [RFC][PATCH -mm 0/4] Hibernation: Arbitrary boot kernel support on x86_64 Rafael J. Wysocki
2007-08-20 13:11 ` [RFC][PATCH -mm 1/4] " Rafael J. Wysocki
2007-08-21  7:57   ` Pavel Machek [this message]
2007-08-21 14:37     ` [discuss] " Rafael J. Wysocki
2007-08-21 19:30       ` Rafael J. Wysocki
2007-08-21 20:47         ` Rafael J. Wysocki
2007-08-20 13:16 ` [RFC][PATCH -mm 2/4] Hibernation: Turn on ACPI during restore if necessary Rafael J. Wysocki
2007-08-21  7:57   ` Pavel Machek
2007-08-21 14:39     ` Rafael J. Wysocki
2007-08-21 23:36       ` Pavel Machek
2007-08-22 20:47         ` [discuss] " Rafael J. Wysocki
2007-08-20 13:17 ` [RFC][PATCH -mm 3/4] Hibernation: Use temporary kernel text mapping during restore on x86_64 Rafael J. Wysocki
2007-08-21  7:59   ` Pavel Machek
2007-08-21 14:42     ` Rafael J. Wysocki
2007-08-20 13:18 ` [RFC][PATCH -mm 4/4] Hibernation: Pass CR3 value in hibernation header " Rafael J. Wysocki
2007-08-21  8:01   ` Pavel Machek
2007-08-21 14:46     ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070821075710.GE7258@elf.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=discuss@x86-64.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=nigel@nigel.suspend2.net \
    --cc=rjw@sisk.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.