public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Huang, Ying" <ying.huang@intel.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Vivek Goyal <vgoyal@redhat.com>, Pavel Machek <pavel@ucw.cz>,
	nigel@nigel.suspend2.net, "Rafael J. Wysocki" <rjw@sisk.pl>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	Kexec Mailing List <kexec@lists.infradead.org>
Subject: Re: [PATCH] kexec based hibernation: a prototype of kexec multi-stage load
Date: Thu, 15 May 2008 12:57:53 +0800	[thread overview]
Message-ID: <1210827473.23707.133.camel@caritas-dev.intel.com> (raw)
In-Reply-To: <m1lk2c4l4i.fsf@frodo.ebiederm.org>

On Wed, 2008-05-14 at 14:43 -0700, Eric W. Biederman wrote:
[...]
> Then as a preliminary design let's plan on this.
> 
> - Pass the rentry point as the return address (using the C ABI).
>   We may want to load the stack pointer etc so we can act as
>   a direct entry point for new code.

There are some issues about passing entry point as return address. The
kexec jump (or kexec with return) is used for

- Switching between original kernel (A) and kexeced kernel (B)
- Call some code (such as BIOS code) in physical mode

1) When call some code in physical mode, the called code can use a
simple return to return to kernel A. So there is no return address on
stack after return to kernel A. Instead, argument 1 is on stack top.

2) When switch back from kernel B to kernel A, kernel B will call the
jump back entry of kernel A with C ABI. So, the return address is on
stack top. And kernel A get jump back entry of kernel B via the return
address.

Because the stack state is different between 1) and 2), the jump back
entry of kernel A should distinguish them. Possible solution can be as
follow:

a) Before kernel A call some physical mode code or kernel B, it set
argument 1 to be a magic number that can not be return address (such as
-1). Jump back entry of kernel A can check whether the stack top is
argument 1 or return address.

b) Distinguish by return address. Such as, called physical mode code
must return 0, while kernel B must set %eax to some other number.

c) Use different entry point for 1) and 2). Two entry points are deduced
from return address. Such as:

entry1 = return_address;
entry2 = return_address & ~0xfff;	/* page aligned */

entry1 is used by physical mode code. entry2 is used by kernel B.


Which one is better? Or some other solution?

Best Regards,
Huang Ying


  parent reply	other threads:[~2008-05-15  4:51 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-12  6:40 [PATCH] kexec based hibernation: a prototype of kexec multi-stage load Huang, Ying
2008-05-13  5:34 ` Vivek Goyal
2008-05-14  1:57   ` Huang, Ying
2008-05-14  2:56     ` Vivek Goyal
2008-05-14  3:37       ` Huang, Ying
2008-05-14 21:43         ` Eric W. Biederman
2008-05-15  2:40           ` Huang, Ying
2008-05-15  4:57           ` Huang, Ying [this message]
2008-05-15 18:39             ` Eric W. Biederman
2008-05-16  1:41               ` Huang, Ying
2008-05-16  2:25                 ` Eric W. Biederman
2008-05-16  2:56                   ` Huang, Ying
2008-05-16  3:27                     ` Vivek Goyal
2008-05-16 13:40                       ` Vivek Goyal
2008-05-18  1:59                       ` Eric W. Biederman
2008-05-16  3:33                     ` Eric W. Biederman
2008-05-16  2:00             ` Vivek Goyal
2008-05-16  2:19               ` Huang, Ying
2008-05-16  2:55                 ` Eric W. Biederman
2008-05-16  4:52                   ` Huang, Ying
2008-05-16 13:36                     ` Vivek Goyal
2008-05-16 11:58   ` Pavel Machek

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=1210827473.23707.133.camel@caritas-dev.intel.com \
    --to=ying.huang@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=ebiederm@xmission.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nigel@nigel.suspend2.net \
    --cc=pavel@ucw.cz \
    --cc=rjw@sisk.pl \
    --cc=vgoyal@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox