mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Tom Spink" <tspink@gmail.com>
To: "Jeff Dike" <jdike@addtoit.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: UML fails to locate address space
Date: Tue, 20 May 2008 23:03:10 +0100	[thread overview]
Message-ID: <7b9198260805201503j333963c4ya19b84f16b31d0fd@mail.gmail.com> (raw)
In-Reply-To: <20080520212735.GA13319@c2.user-mode-linux.org>

2008/5/20 Jeff Dike <jdike@addtoit.com>:
> On Tue, May 20, 2008 at 08:42:54PM +0100, Tom Spink wrote:
>> And this is what I did:
>
> Looks OK, but I need a Signed-off-by.
>
> Some style comments, which I can take care of if you don't feel like it:
>        there's only one use of PROC_MMAP_MIN_ADDR, so you might as
> well inline the filename
>        the stat is unnecessary - open failing will tell you what you
> need to know
>        the strtoul needs some error checking
>        I'd change the mmap_min_addr[8] to [sizeof("12345678")] to
> make it clear what's expected to fit into it
>
> On a less-stylistic note, this thing does have to work in the absence
> of /proc since UML is commonly run inside chroot.  So, I'm thinking we
> still need the loop looking for the bottom of the address space in
> this case.  And, if you have it, you might as well use it, as that's
> less code, and it makes sure the loop is exercised.  That grieves me a
> little, as I'd like to just read mmap_min_addr and be done with it in
> the normal case.
>
>                        Jeff
>
> --
> Work email - jdike at linux dot intel dot com
>

I was re-writing the patch, but after reading over the function, is
the return value correct? I did a quick run through on paper about
what would happen if the (real) bottom = 5 and the (real) top = 15,
and the (initial) top = 20.  So this is a size of 10 pages, which is
what the function should return... but:

top = 20, bottom = 5
test = 12
bottom = 12
(top - bottom) = 8

top = 20, bottom = 12
test = 16
top = 16
(top - bottom) = 4

top = 16, bottom = 12
test = 14
bottom = 14
(top - bottom) = 2

top = 16, bottom = 14
test = 15
bottom = 15
(top - bottom) = 1

<loop exits>

return 16 << UM_KERN_PAGE_SHIFT;

Hmm.  Are my calculations wrong?

-- 
Tom Spink

  reply	other threads:[~2008-05-20 22:03 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-20 11:08 Tom Spink
2008-05-20 13:52 ` Jeff Dike
2008-05-20 13:59   ` Tom Spink
2008-05-20 16:10     ` Jeff Dike
2008-05-20 16:43       ` Tom Spink
2008-05-20 17:56         ` Jeff Dike
2008-05-20 18:01           ` Tom Spink
2008-05-20 19:24             ` Jeff Dike
2008-05-20 19:42               ` Tom Spink
2008-05-20 21:27                 ` Jeff Dike
2008-05-20 22:03                   ` Tom Spink [this message]
2008-05-20 23:57                     ` Tom Spink
2008-05-21  1:58                       ` Jeff Dike
2008-05-20 15:22   ` linux-os (Dick Johnson)
2008-05-20 17:35     ` Jeff Dike
2008-05-20 21:54       ` linux-os (Dick Johnson)
2008-05-21  2:15         ` Jeff Dike
2008-05-21 12:02           ` Tom Spink
2008-05-21 12:04             ` Tom Spink
2008-05-21 17:58               ` Jeff Dike
2008-05-21 19:01                 ` Tom Spink
2008-05-20 21:58       ` linux-os (Dick Johnson)

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=7b9198260805201503j333963c4ya19b84f16b31d0fd@mail.gmail.com \
    --to=tspink@gmail.com \
    --cc=jdike@addtoit.com \
    --cc=linux-kernel@vger.kernel.org \
    /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®