public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: "Huang, Ying" <ying.huang@intel.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 11:39:47 -0700	[thread overview]
Message-ID: <m1lk2bs970.fsf@frodo.ebiederm.org> (raw)
In-Reply-To: <1210827473.23707.133.camel@caritas-dev.intel.com> (Ying Huang's message of "Thu, 15 May 2008 12:57:53 +0800")

"Huang, Ying" <ying.huang@intel.com> writes:

> 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.

Yes.  Because the stack state is different we need to be careful.

However I don't see that we care how we got to the proper piece of
code.  If we don't care we don't need to distinguish them.

Therefore I see two possible solutions.
1) Write a tiny trampoline that goes in the core file to keep
   the calling conventions sane.

2) After we figure out our address read the stack pointer from
   a fixed location and simply set it.  (This is my preference)

Eric

  reply	other threads:[~2008-05-15 18:50 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
2008-05-15 18:39             ` Eric W. Biederman [this message]
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=m1lk2bs970.fsf@frodo.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=akpm@linux-foundation.org \
    --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 \
    --cc=ying.huang@intel.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