diff options
author | Justus Winter <justus@gnupg.org> | 2016-05-04 19:31:05 +0200 |
---|---|---|
committer | Justus Winter <justus@gnupg.org> | 2016-05-04 19:31:05 +0200 |
commit | 8c4febf4adc6397fd379560921906aabd69ef5ec (patch) | |
tree | cfbfbe56117cc6fe754d755afc833b7420d2cc20 /microkernel | |
parent | bc82ad88a23387089a87de10cb598fec8a59eecb (diff) |
Add flexible syscall interface
Diffstat (limited to 'microkernel')
-rw-r--r-- | microkernel/mach/gnumach/projects/mach_5.mdwn | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/microkernel/mach/gnumach/projects/mach_5.mdwn b/microkernel/mach/gnumach/projects/mach_5.mdwn index 0dc63228..bf678556 100644 --- a/microkernel/mach/gnumach/projects/mach_5.mdwn +++ b/microkernel/mach/gnumach/projects/mach_5.mdwn @@ -40,6 +40,8 @@ using an union. The kernel indicates this using a distinct message type. MIG-generated code will detect this, and do the receiver lookup using a specialized translation function. +### Status + This change has been implemented in GNU Mach and MIG 1.5. ## Type descriptor rework @@ -70,3 +72,63 @@ The Mach4 type descriptor contains one unused bit. This bit can be used to indicate that this message uses a Mach5 style index. MIG can be modified to handle both cases for a smooth transition to the new ABI. + +### Status + +Not started. + +## Flexible syscall interface + +Currently, the GNU Mach kernel uses trap gates to enter the kernel (on +i386). We always suspected this mechanism to be slow, but afaik noone +quantified that. + +Tl;dr: sysenter is twice as fast as a trap gate (on my system). + +I have a prototype that allows one to enter the kernel using sysenter. +Here are the numbers: + + start sysenter: mach_print using [trap gate] [sysenter]. + Running 268435456(1U<<28) times mach_print("")... + using trap gate: 45s960000us 171.214342ns 5840632.202 (1/s) + using sysenter: 20s600000us 76.740980ns 13030847.379 (1/s) + Running 268435456(1U<<28) times mach_msg (NULL, ...)... + using glibc stub: 46s050000us 171.549618ns 5829217.286 (1/s) + using trap gate: 44s820000us 166.967511ns 5989189.112 (1/s) + using sysenter: 20s050000us 74.692070ns 13388302.045 (1/s) + exiting. + +So using sysenter is roughly 95ns faster. To put this into +perspective, sending a simple (ie. no ports/external data in body) +message takes ~950ns on my system. That suggests that merely using +sysenter improves our IPC performance by ~10%. + +### Implementation + +I'd like to implement something similar: + +1. There is a platform dependent way to map a special page. +2. That page contains a function that executes a syscall. + +This way we do not hardcode the system call method into the ABI. The +kernel selects one appropriate for the processor, and we are free to +change this interface anytime we want. + +### Required ABI changes + +None. We merely provide another way to call the kernel on existing +platforms. + +On i386, the 'platform dependent way' to get the syscall wrapper is to +use the current syscall mechanism to map a special device (the +"syscall" device, or "/dev/syscall" on the Hurd) similar to how the +mapped time interface works. + +### Status + +A prototype exists. + +### Discussions + +* <https://lists.gnu.org/archive/html/bug-hurd/2015-05/msg00000.html> + |