mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Magnus Damm" <magnus.damm@gmail.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: "Magnus Damm" <magnus@valinux.co.jp>,
	fastboot@lists.osdl.org, linux-kernel@vger.kernel.org
Subject: Re: [Fastboot] [PATCH 00/03] kexec: Avoid overwriting the current pgd (V2)
Date: Thu, 25 May 2006 16:29:00 +0900	[thread overview]
Message-ID: <aec7e5c30605250029jfab09e4y26556abf8f16628d@mail.gmail.com> (raw)
In-Reply-To: <m17j4aso43.fsf@ebiederm.dsl.xmission.com>

On 5/25/06, Eric W. Biederman <ebiederm@xmission.com> wrote:
> Magnus Damm <magnus@valinux.co.jp> writes:
>
> > Hi Eric,
> >
> > On Wed, 2006-05-24 at 20:56 -0600, Eric W. Biederman wrote:
> >>
> >> C code is much more accessible to other programmers than arch specific
> >> assembly.  The code on the control page was almost written in C, and
> >> I'm still not quite convinced that it would be wrong to do that.
> >
> > I agree with you that it is of course better to implement something in C
> > if possible compared to writing it in architecture-specific assembly.
> >
> > But I do not agree that wrapping architecture-specific assembly code in
> > C functions makes the code more understandable. I'd really like to meet
> > the kernel hacker that is aware of how x86 segmentation works but is
> > unable to read x86 assembly.
>
> For some young programmers it may be a matter of reading ability.
> For older programmers it is more likely to be a matter of reading
> speed.
>
> Regardless that is how the code is now, and how it came out of the series
> of code reviews I had to go through when I wrote it.  I had requests
> to do more in C and I never had a request to do more in assembly.
> Proving there was no sane way to write the control code page in
> C was actually difficult.

Consider this a "more assembly" request then. What about these reasons:

- C code requires a stack
You must access one page only and therefore you need to setup the
stackpointer somewhere. Requires assembly.

- We switch to a new page table, twice on x86_64
Requires assembly.

- Need to setup segment registeres and cr*
Requires assembly.

- You need to setup/clear registers before passing control
Requires assembly.

> If there is a legitimate reason to change the code that is fine.  But
> as it looked as simply a change without a good reason that is not
> fine.

We would have to duplicate the segment handling code in our xen port
otherwise. It's no biggie, it's just a matter of a few lines of code.

Also, I feel that my approach with a valid idt and gdt is more robust.

> The big problem was you did several things with a single patch,
> and that made the review much more difficult than it had to be.
>
> Having to check if you correctly modified the page tables, while also
> having to check for segmentation, and the interrupt descriptor
> transformations was distracting.

Let me know which parts you think are good and we will implement and
review them bit by bit instead then.

Thanks,

/ magnus

  reply	other threads:[~2006-05-25  7:29 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-24  4:40 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
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           ` Magnus Damm [this message]
2006-05-25 16:40             ` [Fastboot] " 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=aec7e5c30605250029jfab09e4y26556abf8f16628d@mail.gmail.com \
    --to=magnus.damm@gmail.com \
    --cc=ebiederm@xmission.com \
    --cc=fastboot@lists.osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=magnus@valinux.co.jp \
    /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

all inboxes | Powered by JetHome®