mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: "Magnus Damm" <magnus.damm@gmail.com>
Cc: "Magnus Damm" <magnus@valinux.co.jp>,
	"Andrew Morton" <akpm@osdl.org>,
	fastboot@lists.osdl.org, linux-kernel@vger.kernel.org,
	Vivek Goyal <vgoyal@in.ibm.com>
Subject: Re: [Fastboot] [PATCH 03/03] kexec: Avoid overwriting the current pgd (V2, x86_64)
Date: Fri, 26 May 2006 10:32:19 -0600	[thread overview]
Message-ID: <m1ejygbvcc.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <aec7e5c30605252017v1d8269a4jf75f055fe256f966@mail.gmail.com> (Magnus Damm's message of "Fri, 26 May 2006 12:17:14 +0900")

"Magnus Damm" <magnus.damm@gmail.com> writes:

> The code is not broken. The code does exactly what you are talking
> about. Maybe I was a bit unclear.

Ack.  I got a little confused.  I was still thinking of what
the identity mapping was trying to achieve, and you don't achieve
the same thing.

> "page_table_a" contains two mappings. One which is the same as where
> the page is mapped in the kernel (the virtual address where
> relocate_new_kernel is located), and one identity mapped. So when the
> switch occurs the cpu will continue to run on the same virtual
> address.

In the general case which you want to cover page_table_a is still
slightly wrong.  In particular you can theoretically get a conflict
between the virtual address of your page table switching function and
the physical address of the control code page.

However while I agree that you need to do this in assembly for
control I disagree that this code should be part of the
relocate_new_kernel function.

Please move the code that uses page_table_a to a separate function,
that when it is done jumps to the control_code page.  Then you can
map this page both virtually and physically with a statically
allocated page table built a compile time.

This is a little simpler as you don't need to build this first
page table dynamically and a little clearer as you aren't trying to
get the control code page to serve two different functions.

If this function was more than 3 lines of assembly it could even
be written in C for clarity with a special section so that
the linker would not map it twice.  Of course that would still need
to address the stack usage problem.


>> So you need at least one additional entry in your page table.
>>
>> The fact that this bug did not jump out is a clear sign you were
>> changing too many things at once, and did not have an adequate
>> explanation in your change log.
>
> I will ignore that last part for now. I've tested the code on i386,
> i386/pae, x86_64 (both opteron and athlon64) and all the combinations
> with and without xen, and all configurations except x86_64 with both
> kexec and kdump.

Testing is important here.  But given that 99% of the bug hunting must
be done via code review and thinking about the problem testing is not
sufficient.

Eric

  reply	other threads:[~2006-05-26 16:33 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-24  4:40 [PATCH 00/03] kexec: Avoid overwriting the current pgd (V2) Magnus Damm
2006-05-24  4:40 ` [PATCH 01/03] kexec: Avoid overwriting the current pgd (V2, stubs) Magnus Damm
2006-05-25  2:41   ` [Fastboot] " Eric W. Biederman
2006-05-25  3:45     ` Magnus Damm
2006-05-25  4:37       ` Eric W. Biederman
2006-05-25  7:11         ` Magnus Damm
2006-05-25 16:36           ` Eric W. Biederman
2006-05-26  2:23             ` Magnus Damm
2006-05-24  4:40 ` [PATCH 02/03] kexec: Avoid overwriting the current pgd (V2, i386) Magnus Damm
2006-05-24 22:58   ` Vivek Goyal
2006-05-25  2:14     ` Magnus Damm
2006-05-25  2:18     ` [Fastboot] " Eric W. Biederman
2006-05-25  2:38   ` [Fastboot] " Eric W. Biederman
2006-05-24  4:40 ` [PATCH 03/03] kexec: Avoid overwriting the current pgd (V2, x86_64) Magnus Damm
2006-05-25  2:50   ` [Fastboot] " Eric W. Biederman
2006-05-25  8:26     ` Magnus Damm
2006-05-25 15:21       ` Vivek Goyal
2006-05-26 10:42         ` Magnus Damm
2006-05-26 15:08           ` Vivek Goyal
2006-05-26 15:52             ` Magnus Damm
2006-05-25 16:01       ` Eric W. Biederman
2006-05-26  3:17         ` Magnus Damm
2006-05-26 16:32           ` Eric W. Biederman [this message]
2006-05-29  8:40             ` Magnus Damm
2006-05-31 17:19               ` Vivek Goyal
2006-05-26  7:40       ` Gerd Hoffmann
2006-05-26  9:02         ` Magnus Damm
2006-05-26  9:18           ` Eric W. Biederman
2006-05-26  9:29             ` Magnus Damm
2006-05-24 22:56 ` [PATCH 00/03] kexec: Avoid overwriting the current pgd (V2) Vivek Goyal
2006-05-25  2:09   ` Magnus Damm
2006-05-25  2:56     ` Eric W. Biederman
2006-05-25  3:30       ` Magnus Damm
2006-05-25  4:51         ` Eric W. Biederman
2006-05-25  7:29           ` [Fastboot] " Magnus Damm
2006-05-25 16:40             ` Eric W. Biederman
2006-05-26  1:57               ` Magnus Damm

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=m1ejygbvcc.fsf@ebiederm.dsl.xmission.com \
    --to=ebiederm@xmission.com \
    --cc=akpm@osdl.org \
    --cc=fastboot@lists.osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=magnus@valinux.co.jp \
    --cc=vgoyal@in.ibm.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

Powered by JetHome