From: Linus Torvalds <torvalds@cs.Helsinki.FI>
Subject: Re: Linux-2.1.4
Date: Thu, 17 Oct 1996 13:18:44 +0300 (EET DST) [thread overview]
Message-ID: <2da95d472a2edf79c380fa963e5e239b.axp-list@archive.invalid> (raw)
In-Reply-To: <Pine.LNX.3.93.961017104701.8482A-100000@pc5829.hil.siemens.at>
On Thu, 17 Oct 1996, Ingo Molnar wrote:
>
> could it be optimized even one step further? We could do the following:
>
> movl xxxx,%eax /* get the value */
>
> the exception handler could maintain a cross-table that identifies EIPs
> and abort points. It would do something like this:
>
> jmp UGLY_AS_HELL_BUT_FAST_AS_LIGHTNING_CROSSJUMP_TABLE[exception_eip]
Yes, we could actually do something like this. It needs compiler support, but
that is possible, and g++ exceptions are actually kind of moving in this
direction.
However, in real life this is probably not an option. We'll see if g++
exceptions ever get that good, but right now I doubt this will be a realistic
option within at least a year.
> [ actually, we possibly dont even need such a table, the exception code
> could just do a very simple (and fast) deassembly of the exception EIP,
> and could decide where to jump ]
Note that we can indeed do disassemblies: it doesn't even need to be fast. It
can be slow as molasses, and nobody would care, because the exceptions never
happen for good code. So we can have an _extremely_ stupid disassembly
function that takes ages to do it.
> > It's the RISC philosophy: make the basic operations simple, and do them
> > extremely quickly. Complex operations might be slower, but complex operations
> > are relatively rare.
>
> lets push it to the extreme ...
We actually discussed this already with David Miller, especially as the
disassembly phase is totally unnecessary in many cases (most RISC chips
have equal-length instructions, so the only thing the exception handler
would need to do is
regs->flag_reg = -EFAULT;
regs->ip += 4;
return;
However, there are some problems with that approach too, and while it's
good for "get_user()" and "put_user()", it has some real problems for
some other code. In particular, think of the case where we do a
copy_from_user(buffer_cache, user_ptr, nr);
Now, if we just skip the instructions that fault and set a return register
value, the above will return an error, but it may have written incorrect data
to the buffer cache (because the instructions following the faulting
instruction were still executed). Now, we can handle that by having a
copy_from_user() that tests the register value every now and then, and this
is actually an option in the long run, but right now I'm nervous about the
disassembly phase on x86 (on RISC it's simple, but the x86 disassembly is
horrible and while I do not care about speed I _do_ care about correctness ;)
So yes, we can potentially actually get the overhead down even further.
That's one advantage with the new interface in 2.1.4 - the generic kernel
code doesn't even need to know exactly _how_ we handle the exceptions.
Linus
--
To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null
next parent reply other threads:[~1996-10-17 10:18 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Pine.LNX.3.93.961017104701.8482A-100000@pc5829.hil.siemens.at>
1996-10-17 10:18 ` Linus Torvalds [this message]
[not found] <Pine.LNX.3.91.961018075100.23966E-100000@linux.cs.Helsinki.FI>
1996-10-18 7:34 ` Linux-2.1.4 Richard Henderson
[not found] <Pine.LNX.3.95.961017232056.6666A-100000@odin.asgard.hr>
1996-10-17 22:03 ` Linux-2.1.4 Richard Henderson
1996-10-18 5:16 ` Linux-2.1.4 Linus Torvalds
[not found] <Pine.LNX.3.93.961017124005.6940C-100000@pc5829.hil.siemens.at>
1996-10-17 20:26 ` Linux-2.1.4 Richard Henderson
[not found] <Pine.LNX.3.91.961017130736.25546C-100000@linux.cs.Helsinki.FI>
1996-10-17 11:52 ` Linux-2.1.4 Ingo Molnar
1996-10-17 14:00 ` Linux-2.1.4 Linus Torvalds
1996-10-17 10:31 Linux-2.1.4 David A Rusling
-- strict thread matches above, loose matches on Subject: below --
1996-10-17 10:03 Linux-2.1.4 David A Rusling
[not found] <Pine.LNX.3.91.961017082647.20618H-100000@linux.cs.Helsinki.FI>
1996-10-17 10:00 ` Linux-2.1.4 Ingo Molnar
[not found] <199610171003.KAA00502@linux.reo.dec.com>
1996-10-17 9:03 ` Linux-2.1.4 Linus Torvalds
[not found] <Pine.LNX.3.93.961016194825.19685A-100000@pc5829.hil.siemens.at>
1996-10-17 6:06 ` Linux-2.1.4 Linus Torvalds
[not found] <Pine.LNX.3.91.961016101122.19371J-100000@linux.cs.Helsinki.FI>
1996-10-16 17:20 ` Linux-2.1.4 Theodore Y. Ts'o
1996-10-16 18:58 ` Linux-2.1.4 Ingo Molnar
1996-10-17 4:51 ` Linux-2.1.4 Linus Torvalds
1996-10-17 3:42 ` Linux-2.1.4 Marc Singer
1996-10-17 12:39 ` Linux-2.1.4 Jim Nance
[not found] <9610160531.AA04330@feral.com>
1996-10-16 7:18 ` Linux-2.1.4 Linus Torvalds
[not found] <Pine.LNX.3.95.961015224149.4897A-100000@hlermen.ffm.fgan.de>
1996-10-15 21:56 ` Linux-2.1.4 Hans Lermen
1996-10-15 18:41 Linux-2.1.4 Michael Stiller
1996-10-15 21:15 ` Linux-2.1.4 Hans Lermen
[not found] <Pine.LNX.3.91.961010180237.1289A-100000@linux.cs.Helsinki.FI>
1996-10-15 17:14 ` Linux-2.1.4 Linus Torvalds
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox