From: Jeff Dike <jdike@karaya.com>
To: Alan Cox <alan@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Accelerating user mode linux
Date: Fri, 02 Aug 2002 13:28:18 -0500 [thread overview]
Message-ID: <200208021828.NAA02466@ccure.karaya.com> (raw)
In-Reply-To: Your message of "Fri, 02 Aug 2002 05:50:03 -0400." <200208020950.g729o3K28069@devserv.devel.redhat.com>
alan@redhat.com said:
> Its not a veto. I was trying to avoid having to add any more branches
> to the fast paths in the kernel.
Unless I'm missing something, a test for altmm and a branch to out of line
mm switching should be about three instructions on x86 including a correctly
predicted branch not taken in the non-altmm case.
> The remaining sigreturn question is
> "how do you get into 'user' mode the first time"
Last night I told you it was by building a signal frame by hand and returning
through it. That's no longer true. Now, every UML thread (except the idle
thread, which I think can be reasonable expected not to try to enter userspace)
is in a host signal handler when in the kernel.
All entrances to userspace happen by returning through that signal frame.
Special userspace returns (exec and fork et al) fiddle the sigcontext in
that frame beforehand. Normal system calls stuff the return value in the
appropriate slot in the sigcontext before returning, as well.
So, there's nothing special about entering userspace for the first time.
Everything is under a signal frame, so any time something needs to enter
userspace, it just returns through it.
> This switches to the altmm (creating one if it doesnt exist as a copy
> of the current mm)
About this business of creating a UML kernel address space for each UML
user thread - I prefer to have a single kernel address space to which all
signals are delivered.
This has the slight disadvantage that the process address space isn't directly
accessible, but I can live with that. A virt_to_phys translation isn't too
painful.
A single separate kernel address space has the following attractions for me:
there are some cases where 3G of KVA would be very useful
it would make the UML kernel completely invisible to processes, which
is important for honeypots
apps which consume huge amounts of VM might run on the host, but
crap out inside a UML
This raises the question of how the process address spaces are created. For
a variety of reasons unrelated to altmm (which I can go into if anyone's
interested), I want address spaces to be separate user-visible objects.
You'd create a new empty one by opening /proc/new-mm or something and get
back a file descriptor as a handle to it. mmap/munmap/mprotect would be
extended to take a file descriptor pointing to the address space to be
changed.
So, altmm would look like this:
When it starts up, UML would call sigaltmm, passing a descriptor to its own
address space and register its signal handlers with a new flag, SA_IN_MM.
sigaction would have an mm field in which this descriptor would be put (and
would contain -1 in the non-altmm case).
The sigcontext would have an extra int in it which would be the descriptor
of the address space to which sigreturn will return.
Like now, UML would arrange that everything is under a host signal handler.
When it enters userspace it would change the address space fd in the sigcontext
if necessary.
Does this sound sane?
Jeff
next prev parent reply other threads:[~2002-08-02 17:22 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-01 20:16 Accelerating user mode linux Alan Cox
2002-08-02 4:40 ` Jeff Dike
2002-08-02 9:50 ` Alan Cox
2002-08-02 18:28 ` Jeff Dike [this message]
2002-08-02 17:48 ` Alan Cox
2002-08-02 22:33 ` Jeff Dike
2002-08-02 21:57 ` Alan Cox
2002-08-03 0:54 ` Jeff Dike
2002-08-02 11:34 ` Richard Zidlicky
2002-08-02 13:28 ` Alan Cox
2002-08-03 11:38 ` context switch vs. signal delivery [was: Re: Accelerating user mode linux] Ingo Molnar
2002-08-03 12:33 ` context switch vs. signal delivery [was: Re: Accelerating user mode Alan Cox
2002-08-03 15:29 ` Jeff Dike
2002-08-05 13:46 ` Udo A. Steinberg
2002-08-05 20:44 ` Richard Zidlicky
2002-08-05 22:34 ` Udo A. Steinberg
2002-08-06 0:42 ` Jeff Dike
2002-08-06 0:16 ` Udo A. Steinberg
2002-08-06 2:55 ` Jeff Dike
2002-08-06 8:10 ` Udo A. Steinberg
2002-08-06 11:20 ` Jeff Dike
2002-08-06 11:13 ` Udo A. Steinberg
2002-08-06 12:53 ` Jeff Dike
2002-08-06 13:04 ` Udo A. Steinberg
2002-08-06 14:12 ` Jeff Dike
2002-08-06 16:02 ` Udo A. Steinberg
2002-08-06 17:42 ` Jeff Dike
2002-08-06 18:01 ` Udo A. Steinberg
2002-08-08 1:27 ` Udo A. Steinberg
2002-08-08 3:14 ` Jeff Dike
2002-08-08 2:21 ` Benjamin LaHaise
2002-08-08 9:03 ` Udo A. Steinberg
2002-08-08 17:19 ` Jeff Dike
2002-08-05 22:06 ` Martin Waitz
2002-08-06 0:49 ` Jeff Dike
2002-08-04 6:46 ` context switch vs. signal delivery [was: Re: Accelerating user mode linux] Andi Kleen
2002-08-05 5:35 ` Linus Torvalds
2002-08-05 5:42 ` Arnaldo Carvalho de Melo
2002-08-05 6:37 ` Lincoln Dale
2002-08-05 15:39 ` Jamie Lokier
2002-08-05 16:38 ` Linus Torvalds
2002-08-05 20:01 ` context switch vs. signal delivery [was: Re: Accelerating usermode linux] Oliver Neukum
2002-08-05 20:23 ` Linus Torvalds
2002-08-06 5:31 ` context switch vs. signal delivery [was: Re: Accelerating user mode linux] Mark Mielke
2002-08-05 10:40 ` Ingo Molnar
2002-08-05 14:59 ` Larry McVoy
2002-08-05 15:41 ` Jamie Lokier
2002-08-05 15:44 ` Jamie Lokier
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=200208021828.NAA02466@ccure.karaya.com \
--to=jdike@karaya.com \
--cc=alan@redhat.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