public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jesse Pollard <jesse@cats-chateau.net>
To: root@chaos.analogic.com,
	"Richard B. Johnson" <root@chaos.analogic.com>,
	Jonathan Lundell <jlundell@pobox.com>
Cc: Timur Tabi <ttabi@interactivesi.com>, linux-kernel@vger.kernel.org
Subject: Re: What is the truth about Linux 2.4's RAM limitations?
Date: Tue, 10 Jul 2001 18:56:24 -0500	[thread overview]
Message-ID: <01071019124201.20649@tabby> (raw)
In-Reply-To: <Pine.LNX.3.95.1010710142459.19170A-100000@chaos.analogic.com>
In-Reply-To: <Pine.LNX.3.95.1010710142459.19170A-100000@chaos.analogic.com>

On Tue, 10 Jul 2001, Richard B. Johnson wrote:
>On Tue, 10 Jul 2001, Jonathan Lundell wrote:
>
>> At 1:35 PM -0400 2001-07-10, Richard B. Johnson wrote:
>> >Unlike some OS (like VMS), a context-switch does not occur
>> >when the kernel provides services for the calling task.
>> >Therefore, it was most reasonable to have the kernel exist within
>> >each tasks address space. With modern processors, it doesn't make
>> >very much difference, you could have user space start at virtual
>> >address 0 and extend to virtual address 0xffffffff. However, this would
>> >not be Unix. It would also force the kernel to use additional
>> >CPU cycles when addressing a tasks virtual address space,
>> >i.e., when data are copied to/from user to kernel space.
>> 
>> Certainly the shared space is convenient, but in what sense would a 
>> separate kernel space "not be Unix"? I'm quite sure that back in the 
>
>I explained why it would not be Unix.
>
>
>> AT&T days that there were Unix ports with separate kernel (vs user) 
>> address spaces, as well as processors with special instructions for 
>
>No. The difference between kernel and user address space is protection.
>Let's say that you decided to revamp all the user space to go from
>0 to 2^32-1. You call the kernel with a pointer to a buffer into
>which you need to write kernel data:
>
>You will need to set a selector that will access both user and
>kernel data at the same time. Since the user address space is
>paged, this will not be possible, you get one or the other, but
>not both. Therefore, you need to use two selectors. In the case
>of ix86 stuff, you could set DS = KERNEL_DS and ES = a separately
>calculated selector that represents the base address of the caller's
>virtual address space. Note that you can't just use the caller's
>DS or ES because they can be changed by the caller.

Sure you can - But you do have to modify the page tables for the
kernel access. You also have to verity that the page is valid
to the user, that the offset to the location to modify is
valid from both the users context and the kernel context.

>Then you can move data from DS:OFFSET to ES:OFFSET, but not the
>other way. If you need to move data the other way, you need DS: = a
>separately calculated selector that represents the base address of the
>caller's virtual address space, and ES = KERNEL_DS. Then you can copy from
>ES:OFFSET to ES:OFFSET (as before), but the data goes the other way.

See, it can be done, but the changing page tables are a PITA. It's slow.

>With the same virtual address space for kernel and user, you
>don't need any of this stuff. The only reason we have special
>functions (macros) for copy to/from, is to protect the kernel
>from crashing when the user-mode caller gives it a bad address.

wrong - In either case, the parameters to the system call (and the
return values) have to be evaluated for proper usage and security.
That is NOT unique and can be done in many ways.

They provide the same protection as that provided by
other hardware. Even using page remapping will work, if implemented
properly. it just isn't as fast as using a single virtual mapping.

Been there, done that.

Multi-tasking real time systems do this a LOT - and because the
amount of data passed may be quite small it is frequently
more efficient. (largest I ever did was about 256 bytes - ocean going
autopilot/seismic surveys). The determining factor is:
1. correctness, 2. speed, 3. ease of implementation, 4. hardware
support.

>It all tasks were cooperative, you could use memcpy() perfectly
>fine (or rep movsl ; rep movsw ; rep movsb).

You still must verify that the source/destination are reasonably valid.

-------------------------------------------------------------------------
Jesse I Pollard, II
Email: jesse@cats-chateau.net

Any opinions expressed are solely my own.

  parent reply	other threads:[~2001-07-11  0:13 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-09 20:01 What is the truth about Linux 2.4's RAM limitations? Adam Shand
2001-07-09 21:15 ` Brian Gerst
2001-07-09 21:18 ` Rik van Riel
2001-07-09 22:17 ` Matti Aarnio
2001-07-10 13:49   ` Chris Wedgwood
2001-07-10 17:03     ` Timur Tabi
2001-07-10 17:35       ` Richard B. Johnson
2001-07-10 18:01         ` Timur Tabi
2001-07-10 18:08         ` Jonathan Lundell
2001-07-10 18:45           ` Richard B. Johnson
2001-07-10 19:26             ` Jonathan Lundell
2001-07-10 23:56             ` Jesse Pollard [this message]
2001-07-10 20:19         ` Malcolm Beattie
2001-07-10  3:01 ` jlnance
2001-07-10  3:29   ` Michael Bacarella
2001-07-16  8:37   ` Ingo Oeser
     [not found] <Pine.LNX.4.32.0107091250170.25061-100000@maus.spack.org.suse.lists.linux.kernel>
2001-07-09 21:03 ` Andi Kleen
  -- strict thread matches above, loose matches on Subject: below --
2001-07-09 21:29 Jesse Pollard
2001-07-10 17:01 ` Timur Tabi
2001-07-10 18:12 Jesse Pollard
2001-07-10 18:22 ` Jonathan Lundell
2001-07-10 18:28 ` Brian Gerst
2001-07-10 18:43   ` Chris Wedgwood
2001-07-10 19:35     ` Brian Gerst
2001-07-10 18:38 Jesse Pollard
2001-07-10 19:14 ` Mark H. Wood
2001-07-10 21:49 Jesse Pollard
2001-07-10 22:07 ` Jonathan Lundell
2001-07-11  4:31 alad

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=01071019124201.20649@tabby \
    --to=jesse@cats-chateau.net \
    --cc=jlundell@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=root@chaos.analogic.com \
    --cc=ttabi@interactivesi.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