LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: linux-pm@lists.linux-foundation.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Andi Kleen <ak@suse.de>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -mm 2/2] Hibernation: Arbitrary boot kernel support on x86_64 (updated)
Date: Mon, 27 Aug 2007 10:28:08 +0200	[thread overview]
Message-ID: <20070827082808.GH2060@elf.ucw.cz> (raw)
In-Reply-To: <200708252242.06197.rjw@sisk.pl>

On Sat 2007-08-25 22:42:05, Rafael J. Wysocki wrote:
> On Saturday, 25 August 2007 20:27, Rafael J. Wysocki wrote:
> > On Friday, 24 August 2007 22:46, Pavel Machek wrote:
> > > 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.
> > > > 
> > > > The idea is to split the core restoration code into two separate parts and to
> > > > place each of them in a different page.  The first part belongs to the boot
> > > 
> > > What happens in case where both parts want to be
> > > at the same place? (Like kernel being restored is 4KB smaller, so that
> > > routines now collide?)
> > 
> > Bad things, but I can't see how to avoid that reliably.
> 
> Below is an analogous patch without this problem.  The slightly ugly thing
> about it is that all pages in the temporary mapping have the NX bit cleard
> now, so that we can run some code out of one of them.  Still, IMO, that isn't
> really important, because the temporary page tables are dropped as soon as
> we jump to restore_registers.
> 
> Greetings,
> Rafael
> 
> ---
> 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.
> 
> The idea is to split the core restoration code into two separate parts and to
> place each of them in a different page.  The first part belongs to the boot
> kernel and is executed as the last step of the image kernel's memory restoration
> procedure.  Before being executed, it is relocated to a safe page that won't be
> overwritten while copying the image kernel pages.
> 
> The final operation performed by it is a jump to the second part of the core
> restoration code that belongs to the image kernel and has just been restored.
> This code makes the CPU switch to the image kernel's page tables and
> restores the state of general purpose registers (including the stack pointer)
> from before the hibernation.
> 
> The main issue with this idea is that in order to jump to the second part of the
> core restoration code the boot kernel needs to know its address.  However, this
> address may be passed to it in the image header.  Namely, the part of the image
> header previously used for checking if the version of the image kernel is
> correct can be replaced with some architecture specific data that will allow
> the boot kernel to jump to the right address within the image kernel.  These
> data should also be used for checking if the image kernel is compatible with
> the boot kernel (as far as the memory restroration procedure is concerned).
> It can be done, for example, with the help of a "magic" value that has to be
> equal in both kernels, so that they can be regarded as compatible.
> 
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
ACK.
								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-27 12:08 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-24 10:06 [PATCH -mm 0/2] Hibernation: Arbitrary boot kernel support on x86_64 Rafael J. Wysocki
2007-08-24 10:09 ` [PATCH -mm 1/2] Hibernation: Arbitrary boot kernel support - generic code Rafael J. Wysocki
2007-08-24 10:11 ` [PATCH -mm 2/2] Hibernation: Arbitrary boot kernel support on x86_64 Rafael J. Wysocki
2007-08-24 10:59   ` [linux-pm] " Johannes Berg
2007-08-24 13:11     ` Rafael J. Wysocki
2007-08-24 20:46   ` Pavel Machek
2007-08-25 18:27     ` Rafael J. Wysocki
2007-08-25 18:32       ` david
2007-08-25 19:51         ` Rafael J. Wysocki
2007-08-25 20:42       ` [PATCH -mm 2/2] Hibernation: Arbitrary boot kernel support on x86_64 (updated) Rafael J. Wysocki
2007-08-27  8:28         ` Pavel Machek [this message]
2007-08-24 23:23   ` [PATCH -mm 2/2] Hibernation: Arbitrary boot kernel support on x86_64 Andrew Morton
2007-08-25 19:13     ` [linux-pm] " Johannes Berg
2007-08-27 11:06       ` Rafael J. Wysocki
2007-08-27 11:09         ` Johannes Berg
2007-08-27 11:12       ` Rafael J. Wysocki
2007-08-25 20:32     ` 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=20070827082808.GH2060@elf.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=ak@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=rjw@sisk.pl \
    --subject='Re: [PATCH -mm 2/2] Hibernation: Arbitrary boot kernel support on x86_64 (updated)' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).