linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Phillips <phillips@arcor.de>
To: "David S. Miller" <davem@redhat.com>
Cc: imran.badr@cavium.com, linux-kernel@vger.kernel.org
Subject: Re: Calculating kernel logical address ..
Date: Sun, 8 Sep 2002 20:44:17 +0200	[thread overview]
Message-ID: <E17oGD2-0006lP-00@starship> (raw)
In-Reply-To: <20020907.170151.84915731.davem@redhat.com>

On Sunday 08 September 2002 02:01, David S. Miller wrote:
>    From: Daniel Phillips <phillips@arcor.de>
>    Date: Sat, 7 Sep 2002 03:44:53 +0200
>    
>    It looks good to me.  Note that somebody has added some new voodoo in 2.5
>    so that page table pages can be in highmem, with the result that the above
>    code won't work in 2.5, whether or not highmem is configured.
> 
> The example given won't work for kernel text/data addresses on a few
> platforms (sparc64 is one).  And in fact on MIPS the KSEG0 pages lack
> any page tables.
> 
> There are only three things one can portably obtain a physical address
> of:
> 
> 1) A user address, for a known MM
> 
> 2) a kmalloc/get_free_page kernel page
> 
> 3) A vmalloc page

Actually, he was trying to obtain a kernel virtual address, which
presents its own difficulties, particularly with respect to highmem.

> For anything else you're in non-portablt land, including and
> in partiular:
> 
> 1) kernel stack addresses

Could you elaborate on what bad things happen here?

> 2) addresses within the main kernel image text/data/bss

Yep.  MIPS's KSEG0 (a stupid design if there ever was one) and i386 large
kernel image pages are just two examples of wrinkles that would need to
be handled.  The general principle is: mappings in the kernel's virtual
address space are not maintained by the faulting mechanism, they are
maintained 'by hand'; and the cross-platform N-level page tree is defined
only for addresses that can fault.

Where the page tree does define a mapping to physical memory, obviously
only a physical address may be obtained that way, and due to highmem,
this address may not be mapped into the kernel's virtual address range,
in which case a further kmapping step has to be performed to obtain a
kernel-usable address, subject to bizarre rules that tend to change on
a weekly basis.

Somebody needs to write a book about this ;-)

-- 
Daniel

  reply	other threads:[~2002-09-09  4:54 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-04 22:00 BYTE Unix Benchmarks Version 3.6 Paolo Ciarrocchi
2002-09-04 22:44 ` Cliff White
2002-09-04 23:57 ` Andrea Arcangeli
2002-09-05 13:48 ` side-by-side " bert hubert
2002-09-05 15:11   ` venom
2002-09-06  3:23   ` Daniel Phillips
2002-09-06  3:34     ` Calculating kernel logical address Imran Badr
2002-09-07  1:44       ` Daniel Phillips
2002-09-08  0:01         ` David S. Miller
2002-09-08 18:44           ` Daniel Phillips [this message]
2002-09-09  5:00             ` David S. Miller
2002-09-09  5:17               ` Daniel Phillips
2002-09-09  5:28                 ` David S. Miller
2002-09-06  7:09     ` side-by-side Re: BYTE Unix Benchmarks Version 3.6 bert hubert
2002-09-06 15:44 Calculating kernel logical address Manfred Spraul
2002-09-06 17:13 ` Imran Badr
2002-09-07  1:57   ` Daniel Phillips
2002-09-09 17:06 Imran Badr
2002-09-09 17:29 ` Richard B. Johnson
2002-09-09 17:23   ` David S. Miller
2002-09-09 17:34     ` Martin J. Bligh
2002-09-09 17:40     ` Daniel Phillips
2002-09-09 17:31   ` Imran Badr
2002-09-09 18:00     ` Richard B. Johnson
2002-09-09 18:12       ` Imran Badr
2002-09-09 18:27         ` Daniel Phillips
2002-09-09 18:41           ` Imran Badr
2002-09-09 21:55         ` Alan Cox
2002-09-09 22:52           ` Imran Badr
2002-09-09 23:09             ` Alan Cox
2002-09-09 18:13       ` Jesse Barnes
2002-09-09 18:25         ` Daniel Phillips
2002-09-09 19:40           ` Andrew Morton
2002-09-09 20:41             ` Daniel Phillips
2002-09-10  6:43               ` Jens Axboe
2002-09-10  7:12                 ` Andrew Morton
2002-09-09 18:42         ` Andrew Morton
2002-09-10  7:03           ` Gerd Knorr
2002-09-09 18:16       ` Kurt Ferreira
2002-09-09 18:17       ` David S. Miller
2002-09-09 18:17       ` Daniel Phillips
2002-09-09 18:43         ` Richard B. Johnson
2002-09-09 18:50           ` Daniel Phillips
2002-09-09 18:57             ` Richard B. Johnson
2002-09-09 18:08     ` Andrew Morton
2002-09-09 18:23       ` Daniel Phillips
2002-09-09 18:49         ` Imran Badr
2002-09-09 18:46           ` David S. Miller
2002-09-09 19:06           ` Daniel Phillips
2002-09-09 19:14             ` Andrew Morton
2002-09-09 19:23               ` Imran Badr
2002-09-09 21:02 Manfred Spraul
2002-09-09 21:07 ` Imran Badr
2002-09-09 21:19 Manfred Spraul
2002-09-09 21:47 ` Andrew Morton
2002-09-10 17:01   ` Manfred Spraul

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=E17oGD2-0006lP-00@starship \
    --to=phillips@arcor.de \
    --cc=davem@redhat.com \
    --cc=imran.badr@cavium.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;
as well as URLs for NNTP newsgroup(s).