Intel P6 vs P7 system call performance
I have been benchmarking Pentium 4 boxes against my Pentium III laptop with the exact same kernel and executables as well as custom compiled kernels. The Pentium III has a much lower clock rate and I have noticed that system call performance (and hence io performance) is up to an order of magnitude higher on my Pentium III laptop. 1k block IO reads/writes are anemic on the Pentium 4, for example, so I'm trying to figure out why and thought someone might have an idea.
Notice below that the System Call overhead is much higher on the Pentium 4 even though the cpu runs more than twice the speed and the system has DDRAM, a 400 Mhz FSB, etc. I even get pretty remarkable syscall/io performance on my Pentium III laptop vs. an otherwise idle dual Xeon.
See how the performance is nearly opposite of what one would expect:
----------------------------------------------------------------------
basic sys call performance iterated for 10 secs:
while (1) {
close(dup(0));
getpid();
getuid();
umask(022);
iter++;
}M-Pentium III 850Mhz Sys Call Rate 433741.8 Pentium 4 2Ghz Sys Call Rate 233637.8 Xeon x 2 2.4Ghz Sys Call Rate 207684.2
----------------------------------------------------------------------
1k read sys calls iterated for 10 secs (all buffered reads, no disk):
M-Pentium III 850Mhz File Read 1492961.0 (~149 io/s)
Pentium 4 2Ghz File Read 1088629.0 (~108 io/s)
Xeon x 2 2.4Ghz File Read 686892.0 (~ 69 io/s)
Any ideas? Not sure I want to upgrade to the P7 architecture if this is right, since for me system calls are probably more important than raw cpu computational power.
- Mike
--- Mobile Pentium III 850 Mhz ---
BYTE UNIX Benchmarks (Version 3.11)
System -- Linux flux.loup.net 2.4.7-10 #1 Thu Sep 6 17:27:27 EDT 2001 i686 unknown Start Benchmark Run: Thu Nov 8 07:55:04 PST 2001
1 interactive users.
Dhrystone 2 without register variables 1652556.1 lps (10 secs, 6 samples) Dhrystone 2 using register variables 1513809.2 lps (10 secs, 6 samples) Arithmetic Test (type = arithoh) 3770106.2 lps (10 secs, 6 samples) Arithmetic Test (type = register) 230897.5 lps (10 secs, 6 samples) Arithmetic Test (type = short) 230586.1 lps (10 secs, 6 samples) Arithmetic Test (type = int) 230916.2 lps (10 secs, 6 samples) Arithmetic Test (type = long) 232229.7 lps (10 secs, 6 samples) Arithmetic Test (type = float) 222990.2 lps (10 secs, 6 samples) Arithmetic Test (type = double) 224339.4 lps (10 secs, 6 samples) System Call Overhead Test 433741.8 lps (10 secs, 6 samples) Pipe Throughput Test 499465.5 lps (10 secs, 6 samples) Pipe-based Context Switching Test 229029.2 lps (10 secs, 6 samples) Process Creation Test 8696.6 lps (10 secs, 6 samples) Execl Throughput Test 1089.8 lps (9 secs, 6 samples)
File Read (10 seconds) 1492961.0 KBps (10 secs, 6 samples)
File Write (10 seconds) 157663.0 KBps (10 secs, 6 samples)
File Copy (10 seconds) 32516.0 KBps (10 secs, 6 samples)
File Read (30 seconds) 1507645.0 KBps (30 secs, 6 samples)
File Write (30 seconds) 161130.0 KBps (30 secs, 6 samples) File Copy (30 seconds) 20155.0 KBps (30 secs, 6 samples) C Compiler Test 491.2 lpm (60 secs, 3 samples) Shell scripts (1 concurrent) 1315.2 lpm (60 secs, 3 samples) Shell scripts (2 concurrent) 694.4 lpm (60 secs, 3 samples) Shell scripts (4 concurrent) 357.1 lpm (60 secs, 3 samples) Shell scripts (8 concurrent) 180.4 lpm (60 secs, 3 samples) Dc: sqrt(2) to 99 decimal places 46831.0 lpm (60 secs, 6 samples) Recursion Test--Tower of Hanoi 20954.1 lps (10 secs, 6 samples)
INDEX VALUES
TEST BASELINE RESULT INDEX
Arithmetic Test (type = double) 2541.7 224339.4 88.3 Dhrystone 2 without register variables 22366.3 1652556.1 73.9 Execl Throughput Test 16.5 1089.8 66.0
File Copy (30 seconds) 179.0 20155.0 112.6
Pipe-based Context Switching Test 1318.5 229029.2 173.7
Shell scripts (8 concurrent) 4.0 180.4 45.1
=========
SUM of 6 items 559.6
AVERAGE 93.3
--- Desktop Pentium 4 2.0 Ghz w/ 266 Mhz DDR ---
BYTE UNIX Benchmarks (Version 3.11)
System -- Linux gw2 2.4.19 #1 Mon Dec 9 05:31:23 GMT-7 2002 i686 unknown Start Benchmark Run: Mon Dec 9 05:45:47 GMT-7 2002
1 interactive users.
Dhrystone 2 without register variables 2910759.3 lps (10 secs, 6 samples) Dhrystone 2 using register variables 2928495.6 lps (10 secs, 6 samples) Arithmetic Test (type = arithoh) 9252565.4 lps (10 secs, 6 samples) Arithmetic Test (type = register) 498894.3 lps (10 secs, 6 samples) Arithmetic Test (type = short) 473452.0 lps (10 secs, 6 samples) Arithmetic Test (type = int) 498956.5 lps (10 secs, 6 samples) Arithmetic Test (type = long) 498932.0 lps (10 secs, 6 samples) Arithmetic Test (type = float) 451138.8 lps (10 secs, 6 samples) Arithmetic Test (type = double) 451106.8 lps (10 secs, 6 samples) System Call Overhead Test 233637.8 lps (10 secs, 6 samples) Pipe Throughput Test 437441.1 lps (10 secs, 6 samples) Pipe-based Context Switching Test 167229.2 lps (10 secs, 6 samples) Process Creation Test 9407.2 lps (10 secs, 6 samples) Execl Throughput Test 2158.8 lps (10 secs, 6 samples)
File Read (10 seconds) 1088629.0 KBps (10 secs, 6 samples)
File Write (10 seconds) 472315.0 KBps (10 secs, 6 samples)
File Copy (10 seconds) 10569.0 KBps (10 secs, 6 samples)
File Read (120 seconds) 1089526.0 KBps (120 secs, 6 samples)
File Write (120 seconds) 467028.0 KBps (120 secs, 6 samples) File Copy (120 seconds) 3541.0 KBps (120 secs, 6 samples) C Compiler Test 973.9 lpm (60 secs, 3 samples) Shell scripts (1 concurrent) 2590.8 lpm (60 secs, 3 samples) Shell scripts (2 concurrent) 1359.6 lpm (60 secs, 3 samples) Shell scripts (4 concurrent) 696.4 lpm (60 secs, 3 samples) Shell scripts (8 concurrent) 352.1 lpm (60 secs, 3 samples) Dc: sqrt(2) to 99 decimal places 99120.4 lpm (60 secs, 6 samples) Recursion Test--Tower of Hanoi 44857.5 lps (10 secs, 6 samples)
INDEX VALUES
TEST BASELINE RESULT INDEX
Arithmetic Test (type = double) 2541.7 451106.8 177.5 Dhrystone 2 without register variables 22366.3 2910759.3 130.1 Execl Throughput Test 16.5 2158.8 130.8
File Copy (120 seconds) 179.0 3541.0 19.7
Pipe-based Context Switching Test 1318.5 167229.2 126.8
Shell scripts (8 concurrent) 4.0 352.1 88.0
=========
SUM of 6 items 673.0
AVERAGE 112.1
--- Pentium 4 Xeon 2.4 Ghz x 2 w/ 2.4.19 ---
BYTE UNIX Benchmarks (Version 3.11)
System -- Linux brent-xeon 2.4.19-kel #5 SMP Wed Sep 25 03:15:13 GMT 2002 i686 unknown Start Benchmark Run: Thu Oct 10 03:48:07 MDT 2002
0 interactive users.
Dhrystone 2 without register variables 2200821.4 lps (10 secs, 6 samples) Dhrystone 2 using register variables 2233296.6 lps (10 secs, 6 samples) Arithmetic Test (type = arithoh) 7366670.5 lps (10 secs, 6 samples) Arithmetic Test (type = register) 399261.4 lps (10 secs, 6 samples) Arithmetic Test (type = short) 361354.7 lps (10 secs, 6 samples) Arithmetic Test (type = int) 364200.0 lps (10 secs, 6 samples) Arithmetic Test (type = long) 345292.9 lps (10 secs, 6 samples) Arithmetic Test (type = float) 539907.7 lps (10 secs, 6 samples) Arithmetic Test (type = double) 537355.5 lps (10 secs, 6 samples) System Call Overhead Test 207684.2 lps (10 secs, 6 samples) Pipe Throughput Test 283868.3 lps (10 secs, 6 samples) Pipe-based Context Switching Test 98205.6 lps (10 secs, 6 samples) Process Creation Test 5395.9 lps (10 secs, 6 samples) Execl Throughput Test 1612.9 lps (9 secs, 6 samples) File Read (10 seconds) 686892.0 KBps (10 secs, 6 samples) File Write (10 seconds) 272217.0 KBps (10 secs, 6 samples) File Copy (10 seconds) 56415.0 KBps (10 secs, 6 samples) File Read (30 seconds) 681181.0 KBps (30 secs, 6 samples) File Write (30 seconds) 272351.0 KBps (30 secs, 6 samples) File Copy (30 seconds) 20611.0 KBps (30 secs, 6 samples) C Compiler Test 873.5 lpm (60 secs, 3 samples) Shell scripts (1 concurrent) 2970.1 lpm (60 secs, 3 samples) Shell scripts (2 concurrent) 1294.2 lpm (60 secs, 3 samples) Shell scripts (4 concurrent) 845.2 lpm (60 secs, 3 samples) Shell scripts (8 concurrent) 409.2 lpm (60 secs, 3 samples)
Dc: sqrt(2) to 99 decimal places no measured results
Recursion Test--Tower of Hanoi 33661.9 lps (10 secs, 6 samples)
INDEX VALUES
TEST BASELINE RESULT INDEX
Arithmetic Test (type = double) 2541.7 537355.5 211.4
Dhrystone 2 without register variables 22366.3 2200821.4 98.4
Execl Throughput Test 16.5 1612.9 97.8
File Copy (30 seconds) 179.0 20611.0 115.1
Pipe-based Context Switching Test 1318.5 98205.6 74.5
Shell scripts (8 concurrent) 4.0 409.2 102.3
=========
SUM of 6 items 699.5
AVERAGE 116.6
Quoted 15 lines · Mike Hayward
I have been benchmarking Pentium 4 boxes against my Pentium III laptop with the exact same kernel and executables as well as custom compiled kernels. The Pentium III has a much lower clock rate and I have noticed that system call performance (and hence io performance) is up to an order of magnitude higher on my Pentium III laptop. 1k block IO reads/writes are anemic on the Pentium 4, for example, so I'm trying to figure out why and thought someone might have an idea.
Notice below that the System Call overhead is much higher on the Pentium 4 even though the cpu runs more than twice the speed and the system has DDRAM, a 400 Mhz FSB, etc. I even get pretty remarkable syscall/io performance on my Pentium III laptop vs. an otherwise idle dual Xeon.
See how the performance is nearly opposite of what one would expect:
...
Quoted 3 lines
M-Pentium III 850Mhz Sys Call Rate 433741.8 Pentium 4 2Ghz Sys Call Rate 233637.8 Xeon x 2 2.4Ghz Sys Call Rate 207684.2
...[other benchmark deleted]...
Quoted 3 lines
Any ideas? Not sure I want to upgrade to the P7 architecture if this is right, since for me system calls are probably more important than raw cpu computational power.
You're assuming that ALL operations in a P4 are linearly faster than a P-III. This is definitely not the case.
A P4 has a much longer pipeline (for a many cases, considerably longer than the diagrams imply) than the P-III, and in particular it has a much longer latency in handling mode transitions.
The results you got don't surprise me whatsoever. In fact the raw system call transition instructions are likely 5x slower on the P4.
--
Erich Stefan Boleyn <[email protected]> http://www.uruk.org/
"Reality is truly stranger than fiction; Probably why fiction is so popular"
In article <[email protected]>,
Quoted 8 lines · Mike Hayward
I have been benchmarking Pentium 4 boxes against my Pentium III laptop with the exact same kernel and executables as well as custom compiled kernels. The Pentium III has a much lower clock rate and I have noticed that system call performance (and hence io performance) is up to an order of magnitude higher on my Pentium III laptop. 1k block IO reads/writes are anemic on the Pentium 4, for example, so I'm trying to figure out why and thought someone might have an idea.
P4's really suck at system calls. A 2.8GHz P4 does a simple system call a lot _slower_ than a 500MHz PIII.
The P4 has problems with some other things too, but the "int + iret" instruction combination is absolutely the worst I've seen. A 1.2GHz Athlon will be 5-10 times faster than the fastest P4 on system call overhead.
HOWEVER, the P4 is really good at a lot of other things. On average, a P4 tends to perform quite well on most loads, and hyperthreading (if you have a Xeon or one of the newer desktop CPU's) also tends to work quite well to smooth things out in real life.
In short: the P4 architecture excels at some things, and it sucks at others. It _mostly_ tends to excel more than suck.
Linus
Quoted 7 lines · Linus Torvalds
P4's really suck at system calls. A 2.8GHz P4 does a simple system call a lot _slower_ than a 500MHz PIII.
The P4 has problems with some other things too, but the "int + iret" instruction combination is absolutely the worst I've seen. A 1.2GHz Athlon will be 5-10 times faster than the fastest P4 on system call overhead.
Time to look into an alternative like SYSCALL perhaps ?
Dave
Signature · 2 lines
| Dave Jones. http://www.codemonkey.org.uk | SuSE Labs
Followup to: <[email protected]> By author: Dave Jones <[email protected]> In newsgroup: linux.dev.kernel
Quoted 6 lines · Linus Torvalds
Quoted 4 lines
P4's really suck at system calls. A 2.8GHz P4 does a simple system call a lot _slower_ than a 500MHz PIII.
Quoted 7 lines
Quoted 4 lines
The P4 has problems with some other things too, but the "int + iret" instruction combination is absolutely the worst I've seen. A 1.2GHz Athlon will be 5-10 times faster than the fastest P4 on system call overhead.
Time to look into an alternative like SYSCALL perhaps ?
SYSCALL is AMD. SYSENTER is Intel, and is likely to be significantly faster. Unfortunately SYSENTER is also extremely braindamaged, in that it destroys *both* the EIP and the ESP beyond recovery, and because it's allowed in V86 and 16-bit modes (where it will cause permanent data loss) which means that it needs to be able to be turned off for things like DOSEMU and WINE to work correctly.
-hpa
Signature · 3 lines
<[email protected]> at work, <[email protected]> in private! "Unix gives you enough rope to shoot yourself in the foot." http://www.zytor.com/~hpa/puzzle.txt <[email protected]>
Quoted 2 lines · you [H. Peter Anvin]
SYSCALL is AMD. SYSENTER is Intel, and is likely to be significantly
Now that Linus has killed the dragon and everybody seems happy with the shiny new SYSENTER code, let just add one more stupid question to this
thread: has anyone made benchmarks on SYSCALL/SYSENTER/INT80 on Athlon? Is SYSCALL worth doing separately for Athlon (and perhaps Hammer/32-bit mode)?
-- v --
Quoted 4 lines · Ville Herva
Now that Linus has killed the dragon and everybody seems happy with the shiny new SYSENTER code, let just add one more stupid question to this
thread: has anyone made benchmarks on SYSCALL/SYSENTER/INT80 on Athlon? Is SYSCALL worth doing separately for Athlon (and perhaps Hammer/32-bit mode)?
Yes, the output of the programm Linus posted is on a Duron 750 with 2.5.53 like this:
igor3:~# ./a.out 187.894946 cycles (call 0xffffe000) 299.155075 cycles (int 80)
(cycles per getpid() call)
Christian Leber
Signature · 3 lines
"Omnis enim res, quae dando non deficit, dum habetur et non datur, nondum habetur, quomodo habenda est." (Aurelius Augustinus) Translation: <http://gnuhh.org/work/fsf-europe/augustinus.html>
Quoted 5 lines · Christian Leber
Quoted 4 lines
Now that Linus has killed the dragon and everybody seems happy with the shiny new SYSENTER code, let just add one more stupid question to this
thread: has anyone made benchmarks on SYSCALL/SYSENTER/INT80 on Athlon? Is SYSCALL worth doing separately for Athlon (and perhaps Hammer/32-bit mode)?
Quoted 7 lines
Yes, the output of the programm Linus posted is on a Duron 750 with 2.5.53 like this:
igor3:~# ./a.out 187.894946 cycles (call 0xffffe000) 299.155075 cycles (int 80) (cycles per getpid() call)
Damn, false lines, this where numbers from 2.5.52-bk2+sysenter-patch.
But now the right and interesting lines:
2.5.53:
igor3:~# ./a.out 166.283549 cycles 278.461609 cycles
2.5.53-bk5:
igor3:~# ./a.out 150.895348 cycles 279.441955 cycles
The question is: are the numbers correct?
(I don't know if the TSC thing is actually right)
And why have int 80 also gotten faster?
Is this a valid testprogramm to find out how long a system call takes?
igor3:~# cat sysc.c
#define rdtscl(low) \
__asm__ __volatile__ ("rdtsc" : "=a" (low) : : "edx")int getpiddd()
{
int i=0; return i+10;
}int main(int argc, char **argv) {
long a,b,c,d;
int i1,i2,i3;
rdtscl(a);
i1 = getpiddd(); //just to see how long a simple function takes
rdtscl(b);
i2 = getpid();
rdtscl(c);
i3 = getpid();
rdtscl(d);
printf("function call: %lu first: %lu second: %lu cycles\n",b-a,c-b,d-c);
return 0;
}I link it against a slightly modified (1 line of code) dietlibc:
igor3:~# dietlibc-0.22/bin-i386/diet gcc sysc.c igor3:~# ./a.out function call: 42 first: 1821 second: 169 cycles
I heard that there are serious problems involved with TSC, therefore I don't know if the numbers are correct/make seens.
Christian Leber
Signature · 3 lines
"Omnis enim res, quae dando non deficit, dum habetur et non datur, nondum habetur, quomodo habenda est." (Aurelius Augustinus) Translation: <http://gnuhh.org/work/fsf-europe/augustinus.html>
In article <[email protected]>,
Quoted 8 lines · Christian Leber
But now the right and interesting lines:
2.5.53:
igor3:~# ./a.out 166.283549 cycles 278.461609 cycles
Quoted 6 lines
2.5.53-bk5:
igor3:~# ./a.out 150.895348 cycles 279.441955 cyclesThe question is: are the numbers correct?
Roughly. The program I posted has some overflow errors (which you will hit if testing expensive system calls that take >4000 cycles). They also
do an average, which is "mostly correct", but not stable if there is some load in the machine. The right way to do timings like this is probably to do minimums for individual calls, and then subtract out the TSC reading overhead. See attached silly program.
Quoted 1 line
And why have int 80 also gotten faster?
Random luck. Sometimes you get cacheline alignment magic etc. Or just because the timings aren't stable for other reasons (background processes etc).
Quoted 1 line
Is this a valid testprogramm to find out how long a system call takes?
Not really. The results won't be stable, since you might have cache misses, page faults, other processes, whatever.
So you'll get _somehat_ correct numbers, but they may be randomly off.
Linus
---
#include <sys/types.h>
#include <time.h>
#include <sys/time.h>
#include <sys/fcntl.h>
#include <asm/unistd.h>
#include <sys/stat.h>
#include <stdio.h>
#define rdtsc() ({ unsigned long a, d; asm volatile("rdtsc":"=a" (a), "=d" (d)); a; })
// for testing _just_ system call overhead.
//#define __NR_syscall __NR_stat64
#define __NR_syscall __NR_getpid
#define NR (100000)
int main()
{
int i, ret;
unsigned long fast = ~0UL, slow = ~0UL, overhead = ~0UL;
struct timeval x,y;
char *filename = "test";
struct stat st;
int j;
for (i = 0; i < NR; i++) {
unsigned long cycles = rdtsc();
asm volatile("");
cycles = rdtsc() - cycles;
if (cycles < overhead)
overhead = cycles;
}
printf("overhead: %6d\n", overhead);
for (j = 0; j < 10; j++)
for (i = 0; i < NR; i++) {
unsigned long cycles = rdtsc();
asm volatile("call 0xffffe000"
:"=a" (ret)
:"0" (__NR_syscall),
"b" (filename),
"c" (&st));
cycles = rdtsc() - cycles;
if (cycles < fast)
fast = cycles;
}
fast -= overhead;
printf("sysenter: %6d cycles\n", fast);
for (i = 0; i < NR; i++) {
unsigned long cycles = rdtsc();
asm volatile("int $0x80"
:"=a" (ret)
:"0" (__NR_syscall),
"b" (filename),
"c" (&st));
cycles = rdtsc() - cycles;
if (cycles < slow)
slow = cycles;
}
slow -= overhead;
printf("int0x80: %6d cycles\n", slow);
printf(" %6d cycles difference\n", slow-fast);
printf("factor %f\n", (double) slow / fast);
}Quoted 5 lines · Ville Herva
Quoted 1 line
SYSCALL is AMD. SYSENTER is Intel, and is likely to be significantly
Now that Linus has killed the dragon and everybody seems happy with the shiny new SYSENTER code, let just add one more stupid question to this
thread: has anyone made benchmarks on SYSCALL/SYSENTER/INT80 on Athlon? Is SYSCALL worth doing separately for Athlon (and perhaps Hammer/32-bit mode)?
Its something I wondered about too. Even if it isn't a win for K7, it's possible that the K6 family may benefit from SYSCALL support. Maybe even the K5 if it was around that early ? (too lazy to check pdf's)
Dave
Signature · 2 lines
| Dave Jones. http://www.codemonkey.org.uk | SuSE Labs
Quoted 2 lines · Dave Jones
Time to look into an alternative like SYSCALL perhaps ?
Well, here's a very raw first try at using intel sysenter/sysexit.
It does actually work, I've done a "hello world" program that used sysenter to enter the kernel, but kernel exit requires knowing where to return to (the SYSENTER_RETURN define in entry.S), and I didn't set up a fixmap entry for this yet, so I don't have a good value to return to yet.
But this, together with a fixmap entry that is user-readable (and thus executable) that contains the "sysenter" instruction (and enough setup so that %ebp points to the stack we want to return with), and together with some debugging should get you there.
WARNING! I may be setting up the stack slightly incorrectly, since this also hurls chunks when debugging. Dunno. Ingo, care to take a look?
Btw, that per-CPU sysenter entry-point is really clever of me, but it's not strictly NMI-safe. There's a single-instruction window between having started "sysenter" and having a valid kernel stack, and if an NMI comes in at that point, the NMI will now have a bogus stack pointer.
That NMI problem is pretty fundamentally unfixable due to the stupid sysenter semantics, but we could just make the NMI handlers be real careful about it and fix it up if it happens.
Most of the diff here is actually moving around some of the segments, since sysenter/sysexit wants them in one particular order. The setup code to initialize sysenter is itself pretty trivial.
Linus
----
===== arch/i386/kernel/sysenter.c 1.1 vs edited =====
arch/i386/kernel/sysenter.c +52 -0
@@ -0,0 +1,52 @@ +/* +* linux/arch/i386/kernel/sysenter.c +* +* (C) Copyright 2002 Linus Torvalds +* +* This file contains the needed initializations to support sysenter. +*/ + +#include <linux/init.h> +#include <linux/smp.h> +#include <linux/thread_info.h> +#include <linux/gfp.h> + +#include <asm/cpufeature.h> +#include <asm/msr.h> + +extern asmlinkage void sysenter_entry(void); + +static void __init enable_sep_cpu (void *info) +{ +unsigned long page =__get_free_page (GFP_ATOMIC ); +int cpu =get_cpu (); +unsigned long *esp0_ptr = &(init_tss + cpu)->esp0; +unsigned long rel32; + + rel32 = (unsigned long ) sysenter_entry - (page+11 ); + + + *(short *) (page+0 ) =0x258b ;/* movl xxxxx,%esp */ + *(long **) (page+2 ) = esp0_ptr; + *(char *) (page+6 ) =0xe9 ;/* jmp rl32 */ + *(long *) (page+7 ) = rel32; + +wrmsr (0x174 , __KERNEL_CS,0 );/* SYSENTER_CS_MSR */ +wrmsr (0x175 , page+PAGE_SIZE ,0 );/* SYSENTER_ESP_MSR */ +wrmsr (0x176 , page,0 );/* SYSENTER_EIP_MSR */ + +printk ("Enabling SEP on CPU %d\n" , cpu); +put_cpu (); +} + +static int __init sysenter_setup (void ) +{ +if (!boot_cpu_has (X86_FEATURE_SEP )) +return 0 ; + +enable_sep_cpu (NULL ); +smp_call_function (enable_sep_cpu,NULL ,1 ,1 ); +return 0 ; +} + +__initcall (sysenter_setup);
===== arch/i386/kernel/Makefile 1.30 vs edited =====
arch/i386/kernel/Makefile +1 -0
@@ -29,6 +29,7 @@ obj-$(CONFIG_PROFILING) += profile.o obj-$(CONFIG_EDD) += edd.o obj-$(CONFIG_MODULES) += module.o +obj-y += sysenter.o EXTRA_AFLAGS := -traditional
===== arch/i386/kernel/entry.S 1.41 vs edited =====
arch/i386/kernel/entry.S +53 -9
91 lines not on this page · raw message
===== arch/i386/kernel/head.S 1.18 vs edited =====
arch/i386/kernel/head.S +14 -11
@@ -414,8 +414,8 @@ .quad 0x0000000000000000 /* 0x0b reserved */ .quad 0x0000000000000000 /* 0x13 reserved */ .quad 0x0000000000000000 /* 0x1b reserved */ - .quad 0x00cffa000000ffff /* 0x23 user 4GB code at 0x00000000 */ - .quad 0x00cff2000000ffff /* 0x2b user 4GB data at 0x00000000 */ + .quad 0x0000000000000000 /* 0x20 unused */ + .quad 0x0000000000000000 /* 0x28 unused */ .quad 0x0000000000000000 /* 0x33 TLS entry 1 */ .quad 0x0000000000000000 /* 0x3b TLS entry 2 */ .quad 0x0000000000000000 /* 0x43 TLS entry 3 */
@@ -425,22 +425,25 @@ .quad 0x00cf9a000000ffff /* 0x60 kernel 4GB code at 0x00000000 */ .quad 0x00cf92000000ffff /* 0x68 kernel 4GB data at 0x00000000 */ - .quad 0x0000000000000000 /* 0x70 TSS descriptor */ - .quad 0x0000000000000000 /* 0x78 LDT descriptor */ + .quad 0x00cffa000000ffff /* 0x73 user 4GB code at 0x00000000 */ + .quad 0x00cff2000000ffff /* 0x7b user 4GB data at 0x00000000 */ + + .quad 0x0000000000000000 /* 0x80 TSS descriptor */ + .quad 0x0000000000000000 /* 0x88 LDT descriptor */ /* Segments used for calling PnP BIOS */ - .quad 0x00c09a0000000000 /* 0x80 32-bit code */ - .quad 0x00809a0000000000 /* 0x88 16-bit code */ - .quad 0x0080920000000000 /* 0x90 16-bit data */ - .quad 0x0080920000000000 /* 0x98 16-bit data */ + .quad 0x00c09a0000000000 /* 0x90 32-bit code */ + .quad 0x00809a0000000000 /* 0x98 16-bit code */ .quad 0x0080920000000000 /* 0xa0 16-bit data */ + .quad 0x0080920000000000 /* 0xa8 16-bit data */ + .quad 0x0080920000000000 /* 0xb0 16-bit data */ /* * The APM segments have byte granularity and their bases * and limits are set at run time. */ - .quad 0x00409a0000000000 /* 0xa8 APM CS code */ - .quad 0x00009a0000000000 /* 0xb0 APM CS 16 code (16 bit) */ - .quad 0x0040920000000000 /* 0xb8 APM DS data */ + .quad 0x00409a0000000000 /* 0xb8 APM CS code */ + .quad 0x00009a0000000000 /* 0xc0 APM CS 16 code (16 bit) */ + .quad 0x0040920000000000 /* 0xc8 APM DS data */ #if CONFIG_SMP .fill (NR_CPUS-1)*GDT_ENTRIES,8,0 /* other CPU's GDT */
===== include/asm-i386/segment.h 1.2 vs edited =====
include/asm-i386/segment.h +19 -17
@@ -9,8 +9,8 @@* 2 - reserved * 3 - reserved * -* 4 - default user CS <==== new cacheline -* 5 - default user DS +* 4 - unused <==== new cacheline +* 5 - unused * * ------- start of TLS (Thread-Local Storage) segments: *
@@ -25,16 +25,18 @@* * 12 - kernel code segment <==== new cacheline * 13 - kernel data segment -* 14 - TSS -* 15 - LDT -* 16 - PNPBIOS support (16->32 gate) -* 17 - PNPBIOS support -* 18 - PNPBIOS support +* 14 - default user CS +* 15 - default user DS +* 16 - TSS +* 17 - LDT +* 18 - PNPBIOS support (16->32 gate) * 19 - PNPBIOS support * 20 - PNPBIOS support -* 21 - APM BIOS support -* 22 - APM BIOS support -* 23 - APM BIOS support +* 21 - PNPBIOS support +* 22 - PNPBIOS support +* 23 - APM BIOS support +* 24 - APM BIOS support +* 25 - APM BIOS support */ #define GDT_ENTRY_TLS_ENTRIES 3#define GDT_ENTRY_TLS_MIN 6
@@ -42,10 +44,10 @@#define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES * 8) -#define GDT_ENTRY_DEFAULT_USER_CS 4 +#define GDT_ENTRY_DEFAULT_USER_CS 14#define __USER_CS (GDT_ENTRY_DEFAULT_USER_CS * 8 + 3) -#define GDT_ENTRY_DEFAULT_USER_DS 5 +#define GDT_ENTRY_DEFAULT_USER_DS 15#define __USER_DS (GDT_ENTRY_DEFAULT_USER_DS * 8 + 3)#define GDT_ENTRY_KERNEL_BASE 12
@@ -56,14 +58,14 @@#define GDT_ENTRY_KERNEL_DS (GDT_ENTRY_KERNEL_BASE + 1)#define __KERNEL_DS (GDT_ENTRY_KERNEL_DS * 8) -#define GDT_ENTRY_TSS (GDT_ENTRY_KERNEL_BASE + 2) -#define GDT_ENTRY_LDT (GDT_ENTRY_KERNEL_BASE + 3) +#define GDT_ENTRY_TSS (GDT_ENTRY_KERNEL_BASE + 4) +#define GDT_ENTRY_LDT (GDT_ENTRY_KERNEL_BASE + 5) -#define GDT_ENTRY_PNPBIOS_BASE (GDT_ENTRY_KERNEL_BASE + 4) -#define GDT_ENTRY_APMBIOS_BASE (GDT_ENTRY_KERNEL_BASE + 9) +#define GDT_ENTRY_PNPBIOS_BASE (GDT_ENTRY_KERNEL_BASE + 6) +#define GDT_ENTRY_APMBIOS_BASE (GDT_ENTRY_KERNEL_BASE + 11)/* -* The GDT has 21 entries but we pad it to cacheline boundary: +* The GDT has 23 entries but we pad it to cacheline boundary: */ #define GDT_ENTRIES 24
On Mon, Dec 16, 2002 at 04:47:00PM -0800, Linus Torvalds wrote:
Cool, new toys 8-) I'll have a play with this tomorrow. after a quick glance, one thing jumped out at me.
arch/i386/kernel/sysenter.c line 49
Quoted 8 lines
arch/i386/kernel/sysenter.c +8
-0+static int __init sysenter_setup (void ) +{ +if (!boot_cpu_has (X86_FEATURE_SEP )) +return 0 ; + +enable_sep_cpu (NULL ); +smp_call_function (enable_sep_cpu,NULL ,1 ,1 ); +return 0 ;
I'm sure I recall seeing errata on at least 1 CPU re sysenter. If we do decide to go this route, we'll need to blacklist ones with any really icky problems.
Dave
Signature · 2 lines
| Dave Jones. http://www.codemonkey.org.uk | SuSE Labs
Quoted 4 lines · Dave Jones
I'm sure I recall seeing errata on at least 1 CPU re sysenter. If we do decide to go this route, we'll need to blacklist ones with any really icky problems.
The errata is something like "all P6's report SEP, but it doesn't actually _work_ on anything before the third stepping".
However, that should _not_ be handled by magic sysenter-specific code. That's what the per-vendor cpu feature fixups are there for, so that these kinds of bugs get fixed in _one_ place (initialization) and not in all the users of the feature flags.
In fact, we already have that code in the proper place, namely arch/i386/kernel/cpu/intel.c:
/* SEP CPUID bug: Pentium Pro reports SEP but doesn't have it */
if ( c->x86 == 6 && c->x86_model < 3 && c->x86_mask < 3 )
clear_bit(X86_FEATURE_SEP, c->x86_capability);so the stuff I sent out should work on everything.
(Modulo the missing syscall page I already mentioned and potential bugs in the code itself, of course ;)
Linus
Quoted 3 lines · Linus Torvalds
(Modulo the missing syscall page I already mentioned and potential bugs in the code itself, of course ;)
Ok, I did the vsyscall page too, and tried to make it do the right thing (but I didn't bother to test it on a non-SEP machine).
I'm pushing the changes out right now, but basically it boils down to the fact that with these changes, user space can instead of doing an
int $0x80
instruction for a system call just do a
call 0xfffff000
instead. The vsyscall page will be set up to use sysenter if the CPU supports it, and if it doesn't, it will just do the old "int $0x80" instead (and it could use the AMD syscall instruction if it wants to). User mode shouldn't know or care, the calling convention is the same as it ever was.
On my P4 machine, a "getppid()" is 641 cycles with sysenter/sysexit, and something like 1761 cycles with the old "int 0x80/iret" approach. That's a noticeable improvement, but I have to say that I'm a bit disappointed in the P4 still, it shouldn't be even that much.
As a comparison, an Athlon will do a full int/iret faster than a P4 does a sysenter/sysexit. Pathetic. But it's better than it used to be.
Whatever. The code is extremely simple, and while I'm sure there are things I've missed I'd love to hear if this works for anybody else. I'm appending the (extremely stupid) test-program I used to test it.
The way I did this, things like system call restarting etc _should_ all work fine even with "sysenter", simply by virtue of both sysenter and "int 0x80" being two-byte opcodes. But it might be interesting to verify that a recompiled glibc (or even just a preload) really works with this on a "whole system" testbed rather than just testing one system call (and not even caring about the return value) a million times.
The good news is that the kernel part really looks pretty clean.
Linus
---
#include <time.h>
#include <sys/time.h>
#include <asm/unistd.h>
#include <sys/stat.h>
#include <stdio.h>
#define rdtsc() ({ unsigned long a,d; asm volatile("rdtsc":"=a" (a), "=d" (d)); a; })
int main()
{
int i, ret;
unsigned long start, end;
start = rdtsc();
for (i = 0; i < 1000000; i++) {
asm volatile("call 0xfffff000"
:"=a" (ret)
:"0" (__NR_getppid));
}
end = rdtsc();
printf("%f cycles\n", (end - start) / 1000000.0);
start = rdtsc();
for (i = 0; i < 1000000; i++) {
asm volatile("int $0x80"
:"=a" (ret)
:"0" (__NR_getppid));
}
end = rdtsc();
printf("%f cycles\n", (end - start) / 1000000.0);
}Quoted 5 lines · Linus Torvalds
On my P4 machine, a "
getppid()" is 641 cycles with sysenter/sysexit, and something like 1761 cycles with the old "int 0x80/iret" approach. That's a noticeable improvement, but I have to say that I'm a bit disappointed in the P4 still, it shouldn't be even that much.
On a slightly more real system call (gettimeofday - which actually matters in real life) the difference is still visible, but less so - because the system call itself takes more of the time, and the kernel entry overhead is thus not as clear.
For gettimeofday(), the results on my P4 are:
sysenter: 1280.425844 cycles int/iret: 2415.698224 cycles 1135.272380 cycles diff factor 1.886637
ie sysenter makes that system call almost twice as fast.
It's not as good as a pure user-mode solution using tsc could be, but we've seen the kinds of complexities that has with multi-CPU systems, and they are so painful that I suspect the sysenter approach is a lot more palatable even if it doesn't allow for the absolute best theoretical numbers.
Linus
Quoted 9 lines · Linus Torvalds
For
gettimeofday(), the results on my P4 are:sysenter: 1280.425844 cycles int/iret: 2415.698224 cycles 1135.272380 cycles diff factor 1.886637ie sysenter makes that system call almost twice as fast.
Final comparison for the evening: a PIII looks very different, since the system call overhead is much smaller to begin with. On a PIII, the above ends up looking like
gettimeofday() testing:
sysenter: 561.697236 cycles int/iret: 686.170463 cycles 124.473227 cycles diff factor 1.221602
ie the speedup is much less because the original int/iret numbers aren't nearly as embarrassing as the P4 ones. It's still a win, though.
Linus
Hi,
We've measured gettimeofday() cost on both of Xeon and P3, too. We also measured them on different kernels (UP and MP).
Xeon(2GHz) P3(1GHz)
=========================================
UP kernel 939[ns] 441[ns]
1878[cycles] 441[cycles]
-----------------------------------------
MP kernel 1054[ns] 485[ns]
2108[cycles] 485[cycles]-----------------------------------------
(The kernel version is 2.4.18)
In this experiment, Xeon is two times slower than P3, despite that the frequency of the Xeon is two times faster. More over, the performance difference between UP and MP is very interesting in Xeon case. The difference of Xeon (230 cycles) is five times larger than that of P3 (44 cycles).
We think that the instructions with lock prefix in the MP kernel damage the Xeon performance which serialize operations in an execution pipeline. On the P4/Xeon systems, these lock operations should be avoided as possible as we can.
The following web page shows the details of this experiment.
http://www.labs.fujitsu.com/en/techinfo/linux/lse-0211/index.html
Regards
At Mon, 16 Dec 2002 22:18:27 -0800 (PST),
Quoted 15 lines · Linus
Quoted 9 lines · Linus Torvalds
For
gettimeofday(), the results on my P4 are:sysenter: 1280.425844 cycles int/iret: 2415.698224 cycles 1135.272380 cycles diff factor 1.886637ie sysenter makes that system call almost twice as fast.
Final comparison for the evening: a PIII looks very different, since the system call overhead is much smaller to begin with. On a PIII, the above ends up looking like
Quoted 5 lines
gettimeofday() testing: sysenter: 561.697236 cycles int/iret: 686.170463 cycles 124.473227 cycles diff factor 1.221602
-----
Shuji Yamamura ([email protected])
Grid Computing & Bioinformatics Laboratory
Information Technology Core Laboratories
Fujitsu Laboratories LTD.
Quoted 12 lines · Linus Torvalds
Quoted 5 lines · Linus Torvalds
On my P4 machine, a "
getppid()" is 641 cycles with sysenter/sysexit, and something like 1761 cycles with the old "int 0x80/iret" approach. That's a noticeable improvement, but I have to say that I'm a bit disappointed in the P4 still, it shouldn't be even that much.On a slightly more real system call (gettimeofday - which actually matters in real life) the difference is still visible, but less so - because the system call itself takes more of the time, and the kernel entry overhead is thus not as clear.
Quoted 8 lines
For
gettimeofday(), the results on my P4 are:sysenter: 1280.425844 cycles int/iret: 2415.698224 cycles 1135.272380 cycles diff factor 1.886637ie sysenter makes that system call almost twice as fast.
I'm curious, if this is one of the Dual P4's non-Xeon(say, 2.4 Ghz+?) or if this is one of the Xeons? There seems to be some perceived disparity between which performs how. I think the biggest difference on the Xeon's is the stepping and the cache,(pipeline too?), but not too much else.
[...]
Quoted 2 lines
Linus
Quoted 5 lines · Linus Torvalds
It's not as good as a pure user-mode solution using tsc could be, but we've seen the kinds of complexities that has with multi-CPU systems, and they are so painful that I suspect the sysenter approach is a lot more palatable even if it doesn't allow for the absolute best theoretical numbers.
don't many of the multi-CPU problems with tsc go away because you've got a per-cpu physical page for the vsyscall?
i.e. per-cpu tsc epoch and scaling can be set on that page.
the only trouble i know of is what happens when an interrupt occurs and the task is rescheduled on another cpu... in theory you could test %eip against 0xfffffxxx and "rollback" (or complete) any incomplete gettimeofday call prior to saving a task's state. but i bet that test is undesirable on all interrupt paths.
-dean
Quoted 3 lines · dean gaudet
don't many of the multi-CPU problems with tsc go away because you've got a per-cpu physical page for the vsyscall?
No.
The per-cpu page is _inside_ the kernel, and is only pointed at by the SYSENTER_EIP_MSR, and not accessible from user space. It's not virtually mapped to the same address at all.
The userspace vsyscall page is shared on the whole system, and has to be so, because anything else is a disaster from a TLB standpoint (two threads running on different CPU's have the same page tables, so it's basically impossible to sanely do per-cpu TLB mappings with a hw-filled TLB like the x86).
Linus
Quoted 11 lines · dean gaudet
Quoted 5 lines · Linus Torvalds
It's not as good as a pure user-mode solution using tsc could be, but we've seen the kinds of complexities that has with multi-CPU systems, and they are so painful that I suspect the sysenter approach is a lot more palatable even if it doesn't allow for the absolute best theoretical numbers.
don't many of the multi-CPU problems with tsc go away because you've got a per-cpu physical page for the vsyscall?
Quoted 8 lines
i.e. per-cpu tsc epoch and scaling can be set on that page.
the only trouble i know of is what happens when an interrupt occurs and the task is rescheduled on another cpu... in theory you could test %eip against 0xfffffxxx and "rollback" (or complete) any incomplete gettimeofday call prior to saving a task's state. but i bet that test is undesirable on all interrupt paths.
Exactly. This is a real problem.
-hpa
Quoted 6 lines · H. Peter Anvin
Quoted 4 lines
against 0xfffffxxx and "rollback" (or complete) any incomplete gettimeofday call prior to saving a task's state. but i bet that test is undesirable on all interrupt paths.
Exactly. This is a real problem.
No, just take the number of context switches before and after the attempt to read the time of day.
-ben
Signature · 1 line
"Do you seek knowledge in time travel?"
Quoted 7 lines · Benjamin LaHaise
Quoted 5 lines · H. Peter Anvin
Quoted 4 lines
against 0xfffffxxx and "rollback" (or complete) any incomplete gettimeofday call prior to saving a task's state. but i bet that test is undesirable on all interrupt paths.
Quoted 6 lines
Quoted 1 line
Exactly. This is a real problem.
No, just take the number of context switches before and after the attempt to read the time of day.
How do you do that from userspace, atomically? A counter in the shared page?
-hpa
Quoted 5 lines · H. Peter Anvin
Quoted 2 lines
No, just take the number of context switches before and after the attempt to read the time of day.
How do you do that from userspace, atomically? A counter in the shared page?
Yup. You need some shared data for the TSC offset such anyways, so moving the context switch counter onto such a page won't be much of a problem. Using the %tr trick to get the CPU number would allow for some of these data structures to be per-cpu without incurring any LOCK overhead, too.
-ben
Signature · 1 line
"Do you seek knowledge in time travel?"
Hi!
Quoted 10 lines
Quoted 5 lines
It's not as good as a pure user-mode solution using tsc could be, but we've seen the kinds of complexities that has with multi-CPU systems, and they are so painful that I suspect the sysenter approach is a lot more palatable even if it doesn't allow for the absolute best theoretical numbers.
don't many of the multi-CPU problems with tsc go away because you've got a per-cpu physical page for the vsyscall?
i.e. per-cpu tsc epoch and scaling can be set on that page.
Problem is that cpu's can randomly drift +/- 100 clocks or so... Not nice at all.
Pavel
Signature · 2 lines
Worst form of spam? Adding advertisment signatures ala sourceforge.net. What goes next? Inserting advertisment *into* email?
Quoted 9 lines · Pavel Machek
Quoted 5 lines
don't many of the multi-CPU problems with tsc go away because you've got a per-cpu physical page for the vsyscall?
i.e. per-cpu tsc epoch and scaling can be set on that page.
Problem is that cpu's can randomly drift +/- 100 clocks or so... Not nice at all.
±100 clocks is what... ±50 ns these days? You can't get that kind of accuracy for anything outside the CPU core anyway...
-hpa
Hi!
Quoted 11 lines
Quoted 8 lines
Quoted 4 lines
don't many of the multi-CPU problems with tsc go away because you've got a per-cpu physical page for the vsyscall?
i.e. per-cpu tsc epoch and scaling can be set on that page.
Problem is that cpu's can randomly drift +/- 100 clocks or so... Not nice at all.
?100 clocks is what... ?50 ns these days? You can't get that kind of accuracy for anything outside the CPU core anyway...
50ns is bad enough when it makes your time go backwards.
Pavel
Signature · 2 lines
Casualities in World Trade Center: ~3k dead inside the building, cryptography in U.S.A. and free speech in Czech Republic.
Quoted 8 lines · Pavel Machek
Hi!
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
don't many of the multi-CPU problems with tsc go away because you've got a per-cpu physical page for the vsyscall?
i.e. per-cpu tsc epoch and scaling can be set on that page.
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
Problem is that cpu's can randomly drift +/- 100 clocks or so... Not nice at all.
?100 clocks is what... ?50 ns these days? You can't get that kind of accuracy for anything outside the CPU core anyway...
50ns is bad enough when it makes your time go backwards.
Backwards?? Clock spreading should make the rate change, but it should never decrement.
-hpa
Hi!
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
don't many of the multi-CPU problems with tsc go away because you've got a per-cpu physical page for the vsyscall?
i.e. per-cpu tsc epoch and scaling can be set on that page.
Problem is that cpu's can randomly drift +/- 100 clocks or so... Not nice at all.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
?100 clocks is what... ?50 ns these days? You can't get that kind of accuracy for anything outside the CPU core anyway...
50ns is bad enough when it makes your time go backwards.
Backwards?? Clock spreading should make the rate change, but it should never decrement.
User on cpu1 reads time, communicates it to cpu2, but cpu2 is drifted -50ns, so it reads time "before" time reported cpu1. And gets confused.
Pavel
Signature · 2 lines
Casualities in World Trade Center: ~3k dead inside the building, cryptography in U.S.A. and free speech in Czech Republic.
Quoted 4 lines · Pavel Machek
User on cpu1 reads time, communicates it to cpu2, but cpu2 is drifted -50ns, so it reads time "before" time reported cpu1. And gets confused.
How can you get that communication to happen in < 50 ns?
-hpa
Hi!
Quoted 5 lines
Quoted 3 lines
User on cpu1 reads time, communicates it to cpu2, but cpu2 is drifted -50ns, so it reads time "before" time reported cpu1. And gets confused.
How can you get that communication to happen in < 50 ns?
I'm not sure I can do that, but I'm not sure I can't either. CPUs snoop each other's cache, and that's supposed to be fast...
Signature · 2 lines
Casualities in World Trade Center: ~3k dead inside the building, cryptography in U.S.A. and free speech in Czech Republic.
Quoted 7 lines · Pavel Machek
Hi!
Quoted 4 lines
Quoted 3 lines
User on cpu1 reads time, communicates it to cpu2, but cpu2 is drifted -50ns, so it reads time "before" time reported cpu1. And gets confused.
Quoted 6 lines
Quoted 1 line
How can you get that communication to happen in < 50 ns?
I'm not sure I can do that, but I'm not sure I can't either. CPUs snoop each other's cache, and that's supposed to be fast...
Even over a 400 MHz FSB you have 2.5 ns cycles. I doubt you can transfer a cache line in 20 FSB cycles.
-hpa
Quoted 7 lines · Linus Torvalds
It's not as good as a pure user-mode solution using tsc could be, but we've seen the kinds of complexities that has with multi-CPU systems, and they are so painful that I suspect the sysenter approach is a lot more palatable even if it doesn't allow for the absolute best theoretical numbers.
The complexity only applies to nonsynchronized TSCs though, I would assume. I believe x86-64 uses a vsyscall using the TSC when it can provide synchronized TSCs, and if it can't it puts a normal system call inside the vsyscall in question.
-hpa
Quoted 10 lines
Quoted 5 lines
It's not as good as a pure user-mode solution using tsc could be, but we've seen the kinds of complexities that has with multi-CPU systems, and they are so painful that I suspect the sysenter approach is a lot more palatable even if it doesn't allow for the absolute best theoretical numbers.
The complexity only applies to nonsynchronized TSCs though, I would assume. I believe x86-64 uses a vsyscall using the TSC when it can provide synchronized TSCs, and if it can't it puts a normal system call inside the vsyscall in question.
You can't use the TSC to do gettimeofday on boxes where they aren't syncronised anyway though. That's nothing to do with vsyscalls, you just need a different time source (eg the legacy stuff or HPET/cyclone).
M.
Quoted 4 lines · Martin J. Bligh
Quoted 1 line
Quoted 1 line
It's not as good as a pure user-mode solution using tsc could be, but
You can't use the TSC to do gettimeofday on boxes where they aren't syncronised anyway though. That's nothing to do with vsyscalls, you just need a different time source (eg the legacy stuff or HPET/cyclone).
Ditto all the laptops and the like. With code provided by the kernel we can cheat however. If we know the fastest the CPU can go (ie full speed on spudstop/powernow etc) we can tell the tsc value at which we have to query the kernel to get time to any given accuracy, so allowing limited caching
Ditto by knowing the worst case drift on summit
Alan
Quoted 9 lines · Alan Cox
Quoted 5 lines · Martin J. Bligh
Quoted 1 line
Quoted 1 line
It's not as good as a pure user-mode solution using tsc could be, but
You can't use the TSC to do gettimeofday on boxes where they aren't syncronised anyway though. That's nothing to do with vsyscalls, you just need a different time source (eg the legacy stuff or HPET/cyclone).
Quoted 8 lines
Ditto all the laptops and the like. With code provided by the kernel we can cheat however. If we know the fastest the CPU can go (ie full speed on spudstop/powernow etc) we can tell the tsc value at which we have to query the kernel to get time to any given accuracy, so allowing limited caching
Ditto by knowing the worst case drift on summit
Clever. I like it :)
-hpa
Quoted 4 lines · H. Peter Anvin
The complexity only applies to nonsynchronized TSCs though, I would assume. I believe x86-64 uses a vsyscall using the TSC when it can provide synchronized TSCs, and if it can't it puts a normal system call inside the vsyscall in question.
For x86-64 there is the hpet timer, which is a lot saner but I don't think we can mmap it
Quoted 11 lines · Alan Cox
Quoted 4 lines · H. Peter Anvin
The complexity only applies to nonsynchronized TSCs though, I would assume. I believe x86-64 uses a vsyscall using the TSC when it can provide synchronized TSCs, and if it can't it puts a normal system call inside the vsyscall in question.
For x86-64 there is the hpet timer, which is a lot saner but I don't think we can mmap it
It's only necessary, though, when TSC isn't usable. TSC is psycho fast when it's available. Just about anything is saner than the old 8042 or whatever it is called timer chip, though...
-hpa
Linus,
Are you serious about moving of the banging we currently do on 0x80? If so, I have a P4 development board with leds to monitor all the lower io ports and can decode for you.
Quoted 81 lines · Linus Torvalds
Quoted 3 lines · Linus Torvalds
(Modulo the missing syscall page I already mentioned and potential bugs in the code itself, of course ;)
Ok, I did the vsyscall page too, and tried to make it do the right thing (but I didn't bother to test it on a non-SEP machine).
I'm pushing the changes out right now, but basically it boils down to the fact that with these changes, user space can instead of doing an
int $0x80instruction for a system call just do a
call 0xfffff000instead. The vsyscall page will be set up to use sysenter if the CPU supports it, and if it doesn't, it will just do the old "int $0x80" instead (and it could use the AMD syscall instruction if it wants to). User mode shouldn't know or care, the calling convention is the same as it ever was.
On my P4 machine, a "
getppid()" is 641 cycles with sysenter/sysexit, and something like 1761 cycles with the old "int 0x80/iret" approach. That's a noticeable improvement, but I have to say that I'm a bit disappointed in the P4 still, it shouldn't be even that much.As a comparison, an Athlon will do a full int/iret faster than a P4 does a sysenter/sysexit. Pathetic. But it's better than it used to be.
Whatever. The code is extremely simple, and while I'm sure there are things I've missed I'd love to hear if this works for anybody else. I'm appending the (extremely stupid) test-program I used to test it.
The way I did this, things like system call restarting etc _should_ all work fine even with "sysenter", simply by virtue of both sysenter and "int
0x80" being two-byte opcodes. But it might be interesting to verify that a recompiled glibc (or even just a preload) really works with this on a "whole system" testbed rather than just testing one system call (and not even caring about the return value) a million times.The good news is that the kernel part really looks pretty clean.
Linus
---
#include <time.h>
#include <sys/time.h>
#include <asm/unistd.h>
#include <sys/stat.h>
#include <stdio.h>#define
rdtsc()({ unsigned long a,d; asmvolatile("rdtsc":"=a" (a), "=d" (d)); a; })int
main(){ int i, ret; unsigned long start, end; start = rdtsc(); for (i = 0; i < 1000000; i++) { asm volatile("call 0xfffff000" :"=a" (ret) :"0" (__NR_getppid)); } end = rdtsc(); printf("%f cycles\n", (end - start) / 1000000.0); start = rdtsc(); for (i = 0; i < 1000000; i++) { asm volatile("int $0x80" :"=a" (ret) :"0" (__NR_getppid)); } end = rdtsc(); printf("%f cycles\n", (end - start) / 1000000.0); }
Quoted 6 lines
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Andre Hedrick
LAD Storage Consulting Group
Quoted 3 lines · Andre Hedrick
Are you serious about moving of the banging we currently do on
0x80? If so, I have a P4 development board with leds to monitor all the lower io ports and can decode for you.
INT 0x80 != IO port 0x80
8-)
Dave
Signature · 2 lines
| Dave Jones. http://www.codemonkey.org.uk | SuSE Labs
Okay I will go back to my storage cave, call when you need something.
Got some meat tenderizer for the shoe leather to make choking it down easier?
Cheers,
Quoted 6 lines · Dave Jones
Quoted 3 lines · Andre Hedrick
Are you serious about moving of the banging we currently do on
0x80? If so, I have a P4 development board with leds to monitor all the lower io ports and can decode for you.
Quoted 15 lines
INT
0x80!= IO port0x808-)
Dave
Signature · 7 lines
| Dave Jones. http://www.codemonkey.org.uk | SuSE Labs - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Andre Hedrick
LAD Storage Consulting Group
Quoted 6 lines · Andre Hedrick
Linus,
Are you serious about moving of the banging we currently do on
0x80? If so, I have a P4 development board with leds to monitor all the lower io ports and can decode for you.
Different thing - int 0x80 syscall not i/o port 80. I've done I/O port 80 (its very easy), but requires we set up some udelay constants with an initial safety value right at boot (which we should do - we udelay before it is initialised)
Hi!
Quoted 8 lines
Quoted 3 lines
Are you serious about moving of the banging we currently do on
0x80? If so, I have a P4 development board with leds to monitor all the lower io ports and can decode for you.Different thing - int
0x80syscall not i/o port 80. I've done I/O port 80 (its very easy), but requires we set up some udelay constants with an initial safety value right at boot (which we should do - we udelay before it is initialised)
Actually that would be nice -- I have leds on 0x80 too ;-).
Pavel
Signature · 2 lines
Worst form of spam? Adding advertisment signatures ala sourceforge.net. What goes next? Inserting advertisment *into* email?
Quoted 8 lines · Pavel Machek
Quoted 5 lines
Different thing - int
0x80syscall not i/o port 80. I've done I/O port 80 (its very easy), but requires we set up some udelay constants with an initial safety value right at boot (which we should do - we udelay before it is initialised)Actually that would be nice -- I have leds on
0x80too ;-).
Pavel
We have tried before, and failed. Phoenix uses something like 0xe2, but apparently some machines with non-Phoenix BIOSes actually use that port.
-hpa
Quoted 7 lines · Linus Torvalds
Ok, I did the vsyscall page too, and tried to make it do the right thing (but I didn't bother to test it on a non-SEP machine).
But it might be interesting to verify that a
recompiled glibc (or even just a preload) really works with this on a "whole system" testbed rather than just testing one system call (and not even caring about the return value) a million times.
I've created a modified glibc which uses the syscall code for almost everything. There are a few int $0x80 left here and there but mostly it is a centralized change.
The result: all works as expected. Nice.
On my test machine your little test program performs the syscalls on roughly twice as fast (HT P4, pretty new). Your numbers are perhaps for the P4 Xeons. Anyway, when measuring some more involved code (I ran my thread benchmark) I got only about 3% performance increase. It's doing a fair amount of system calls. But again, the good news is your code survived even this stress test.
The problem with the current solution is the instruction set of the x86.
In your test code you simply use call 0xfffff000 and it magically work. But this is only the case because your program is linked statically.
For the libc DSO I had to play some dirty tricks. The x86 CPU has no absolute call. The variant with an immediate parameter is a relative jump. Only when jumping through a register or memory location is it possible to jump to an absolute address. To be clear, if I have
call 0xfffff000
in a DSO which is loaded at address 0x80000000 the jumps ends at 0x7fffffff. The problem is that the static linker doesn't know the load address. We could of course have the dynamic linker fix up the addresses but this is plain stupid. It would mean fixing up a lot of places and making of those pages covered non-sharable.
Instead I've changed the syscall handling to effectve do
pushl %ebp
movl $0xfffff000, %ebp
call *%ebp
popl %ebp
An alternative is to store the address in a memory location. But since %ebx is used for a syscall parameter it is necessary to address the memory relative to the stack pointer which would mean loading the stack address with 0xfffff000 before making the syscall. Not much better than the code sequence above.
Anyway, it's still an improvement. But now the question comes up: how the ld.so detect that the kernel supports these syscalls and can use an appropriate DSO? This brings up again the idea of the read-only page(s) mapped into all processes (you remember).
Anyway, it works nicely. If you need more testing let me know.
Signature · 3 lines
--------------. ,-. 444 Castro Street Ulrich Drepper \ ,-----------------' \ Mountain View, CA 94041 USA Red Hat `--' drepper at redhat.com `---------------------------
Quoted 5 lines
For the libc DSO I had to play some dirty tricks. The x86 CPU has no absolute call. The variant with an immediate parameter is a relative jump. Only when jumping through a register or memory location is it possible to jump to an absolute address. To be clear, if I have
Quoted 8 lines
call 0xfffff000in a DSO which is loaded at address
0x80000000the jumps ends at0x7fffffff. The problem is that the static linker doesn't know the load address. We could of course have the dynamic linker fix up the addresses but this is plain stupid. It would mean fixing up a lot of places and making of those pages covered non-sharable.
You could have only one routine that would need a relocation / patch at dynamic linking stage :
absolute_syscall:
jmp 0xfffff000
Then all syscalls routine could use :
getpid:
...
call absolute_syscall
...instead of "call 0xfffff000"
If the kernel doesnt support the 0xfffff000 page, you could patch absolute_syscall (if it resides in .data section) with :
absolute_syscall:
int 0x80
ret(3 bytes instead of 5 bytes)
See you
Quoted 2 lines · dada1 wrote:
You could have only one routine that would need a relocation / patch at dynamic linking stage :
That's a horrible way to deal with this in DSOs. THere is no writable and executable segment and it would have to be created which means enormous additional setup costs and higher memory requirement. I'm not going to use any scode modification.
Signature · 3 lines
--------------. ,-. 444 Castro Street Ulrich Drepper \ ,-----------------' \ Mountain View, CA 94041 USA Red Hat `--' drepper at redhat.com `---------------------------
Quoted 4 lines · Ulrich Drepper
The problem with the current solution is the instruction set of the x86.
In your test code you simply use call0xfffff000and it magically work. But this is only the case because your program is linked statically.
Yeah, it's not very convenient. I didn't find any real alternatives, though, and you can always just put 0xfffff000 in memory or registers and jump to that. In fact, I suspect that if you actually want to use it in glibc, then at least in the short term that's what you need to do anyway, sinc eyou probably don't want to have a glibc that only works with very recent kernels.
So I was actually assuming that the glibc code would look more like something like this:
old_fashioned: int $0x80 ret unsigned long system_call_ptr = old_fashioned; /* .. startup .. */ if (kernel_version > xxx) system_call_ptr = 0xfffff000; /* ... usage ... */ call *system_call_ptr;
since you cannot depend on the 0xfffff000 on older kernels anyway..
Quoted 6 lines
Instead I've changed the syscall handling to effectve do
pushl %ebp movl $0xfffff000, %ebp call *%ebp popl %ebp
The above will work, but then you'd have limited yourself to a binary that _only_ works on new kernels. So I'd suggest the memory indirection instead.
Linus
Quoted 3 lines · Linus Torvalds
Yeah, it's not very convenient. I didn't find any real alternatives, though, and you can always just put
0xfffff000in memory or registers and jump to that.
Putting the value into memory myself is not possible. In a DSO I have to address memory indirectly. But all registers (except %ebp, and maybe it'll be used some day) are used at the time of the call.
But there is a way: if I'm using
#define makesyscall(name) \
movl $__NR_##name, $eax; \
call 0xfffff000-__NR_##name($eax)and you'd put at address 0xfffff000 the address of the entry point the wrappers wouldn't have any problems finding it.
Quoted 4 lines
In fact, I suspect that if you actually want to use it in glibc, then at least in the short term that's what you need to do anyway, sinc eyou probably don't want to have a glibc that only works with very recent kernels.
That's a compilation option. We might want to do dynamic testing and yes, a simple pointer indirection is adequate.
But still, the problem is detecting the capable kernels. You have said not long ago that comparing kernel versions is wrong. And I agree. It doesn't cover backports and nothing. But there is a lack of an alternative.
If you don't like the process-global page thingy (anymore) the alternative would be a sysconf() system call.
Signature · 3 lines
--------------. ,-. 444 Castro Street Ulrich Drepper \ ,-----------------' \ Mountain View, CA 94041 USA Red Hat `--' drepper at redhat.com `---------------------------
Quoted 3 lines · Ulrich Drepper
If you don't like the process-global page thingy (anymore) the alternative would be a
sysconf()system call.
Well, we do _have_ the process-global thingy now - it's the vsyscall page. It's not settable by the process, but it's useful for information. Together with an elf AT_ entry pointing to it, it's certainly sufficient for this usage, and it should also be sufficient for "future use" (ie we can add future system information in the page later: bitmaps of features at offset "start + 128" for example).
Linus
Quoted 8 lines · Ulrich Drepper
But there is a way: if I'm using
#define makesyscall(name) \ movl $__NR_##name, $eax; \ call 0xfffff000-__NR_##name($eax)and you'd put at address
0xfffff000the address of the entry point the wrappers wouldn't have any problems finding it.
Is there any reason you can't just keep the linker out of the entire mess by generating
.byte whatever .dword 0xFFFF0000
instead of call ?
Quoted 8 lines · Alan Cox
Is there any reason you can't just keep the linker out of the entire mess by generating
.byte whatever .dword 0xFFFF0000instead of call ?
Alan, the problem is that there _is_ no such instruction as a "call absolute".
There is only a "call relative" or "call indirect-absolute". So you either have to indirect through memory or a register, or you have to fix up the call at link-time.
Yeah, I know it sounds strange, but it makes sense. Absolute calls are actually very unusual, and using relative calls is _usually_ the right thing to do. It's only in cases like this that we really want to call a specific address.
Linus
It doesn't make sense to me to use a specially formatted page forced into user space to tell libraries how to do system calls. Perhaps each executable personality in the kernel should export a special shared library in it's own native format that contains the necessary information. That way we don't have to worry as much about code or values changing sizes or locations.
We would have the chicken/egg problem with how the special shared library gets loaded in the first place. For that we either support a legacy syscall method (i.e. int 0x80 on x86) which should only be used by ld.so or the equivalent or magically force the library into user space at a known address.
Ross
Quoted 34 lines · Linus Torvalds
Quoted 9 lines · Alan Cox
Is there any reason you can't just keep the linker out of the entire mess by generating
.byte whatever .dword 0xFFFF0000instead of call ?
Alan, the problem is that there _is_ no such instruction as a "call absolute".
There is only a "call relative" or "call indirect-absolute". So you either have to indirect through memory or a register, or you have to fix up the call at link-time.
Yeah, I know it sounds strange, but it makes sense. Absolute calls are actually very unusual, and using relative calls is _usually_ the right thing to do. It's only in cases like this that we really want to call a specific address.
Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 8 lines · Linus Torvalds
There is only a "call relative" or "call indirect-absolute". So you either have to indirect through memory or a register, or you have to fix up the call at link-time.
Yeah, I know it sounds strange, but it makes sense. Absolute calls are actually very unusual, and using relative calls is _usually_ the right thing to do. It's only in cases like this that we really want to call a specific address.
The stubs I used for the vsyscall bits just did an absolute jump to the vsyscall page, which would then do a ret to the original calling userspace code (since that provided library symbols for the user to bind against).
-ben
Signature · 1 line
"Do you seek knowledge in time travel?"
Quoted 6 lines · Benjamin LaHaise
The stubs I used for the vsyscall bits just did an absolute jump to the vsyscall page, which would then do a ret to the original calling userspace code (since that provided library symbols for the user to bind against).
What kind of "absolute jumps" were this?
-hpa
Quoted 9 lines · H. Peter Anvin
Quoted 6 lines · Benjamin LaHaise
The stubs I used for the vsyscall bits just did an absolute jump to the vsyscall page, which would then do a ret to the original calling userspace code (since that provided library symbols for the user to bind against).
What kind of "absolute jumps" were this?
It was a far jump (ljmp $__USER_CS,<address>).
-ben
Signature · 1 line
"Do you seek knowledge in time travel?"
Quoted 7 lines · Alan Cox
Is there any reason you can't just keep the linker out of the entire mess by generating
.byte whatever .dword 0xFFFF0000instead of call ?
There is no such instruction. Unless you know about some secret undocumented opcode...
Signature · 3 lines
--------------. ,-. 444 Castro Street Ulrich Drepper \ ,-----------------' \ Mountain View, CA 94041 USA Red Hat `--' drepper at redhat.com `---------------------------
Quoted 5 lines · Ulrich Drepper
Quoted 3 lines · Alan Cox
Is there any reason you can't just keep the linker out of the entire mess by generating
Quoted 7 lines
Quoted 4 lines
.byte whatever .dword 0xFFFF0000instead of call ?
There is no such instruction. Unless you know about some secret undocumented opcode...
No I'd forgotten how broken x86 was
Quoted 9 lines · Alan Cox
Quoted 8 lines · Ulrich Drepper
Quoted 6 lines · Alan Cox
Is there any reason you can't just keep the linker out of the entire mess by generating
.byte whatever .dword 0xFFFF0000
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
instead of call ?
There is no such instruction. Unless you know about some secret undocumented opcode...
No I'd forgotten how broken x86 was
You can call intersegment with a full pointer. I don't know how expensive that is. Since USER_CS is a fixed value in Linux, it can be hard-coded
.byte 0x9a .dword 0xfffff000 .word USER_CS
No. I didn't try this, I'm just looking at the manual. I don't know what the USER_CS is (didn't look in the kernel) The book says the pointer is 16:32 which means that it's a dword, followed by a word.
Cheers,
Dick Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips). Why is the government concerned about the lunatic fringe? Think about it.
Quoted 5 lines · Richard B. Johnson
You can call intersegment with a full pointer. I don't know how expensive that is. Since
USER_CSis a fixed value in Linux, it can be hard-coded
Quoted 8 lines
.byte 0x9a .dword 0xfffff000 .word USER_CSNo. I didn't try this, I'm just looking at the manual. I don't know what the
USER_CSis (didn't look in the kernel) The book says the pointer is 16:32 which means that it's a dword, followed by a word.
It's quite expensive (not as expensive as INT, but not that far from it), and you also push CS onto the stack.
-hpa
Quoted 3 lines · Richard B. Johnson
You can call intersegment with a full pointer. I don't know how expensive that is.
It's so expensive as to not be worth it, it's cheaper to load a register or something, i eyou can do
pushl $0xfffff000 call *(%esp)
faster than doing a far call.
Linus
[email protected] (Linus Torvalds) wrote on 17.12.02 in <[email protected]>:
Quoted 5 lines · Richard B. Johnson
Quoted 3 lines
You can call intersegment with a full pointer. I don't know how expensive that is.
Quoted 7 lines
It's so expensive as to not be worth it, it's cheaper to load a register or something, i eyou can do
pushl $0xfffff000 call *(%esp)faster than doing a far call.
Hmm ...
How expensive would it be to have a special virtual DSO built into ld.so which exported this (and any other future entry points), to be linked against like any other DSO? That way, the *actual* interface would only be between the kernel and ld.so.
MfG Kai
Quoted 6 lines · Ulrich Drepper
Quoted 3 lines · Alan Cox
Is there any reason you can't just keep the linker out of the entire mess by generating
Quoted 9 lines
Quoted 4 lines
.byte whatever .dword 0xFFFF0000instead of call ?
There is no such instruction. Unless you know about some secret undocumented opcode...
Well, there is lcall $0xffff0000, $USER_CS... (no, I'm most definitely *not* suggesting it.)
-hpa
Hi!
Quoted 23 lines
I've created a modified glibc which uses the syscall code for almost everything. There are a few int $0x80 left here and there but mostly it is a centralized change.
The result: all works as expected. Nice.
On my test machine your little test program performs the syscalls on roughly twice as fast (HT P4, pretty new). Your numbers are perhaps for the P4 Xeons. Anyway, when measuring some more involved code (I ran my thread benchmark) I got only about 3% performance increase. It's doing a fair amount of system calls. But again, the good news is your code survived even this stress test.
The problem with the current solution is the instruction set of the x86.
In your test code you simply use call0xfffff000and it magically work. But this is only the case because your program is linked statically.For the libc DSO I had to play some dirty tricks. The x86 CPU has no absolute call. The variant with an immediate parameter is a relative jump. Only when jumping through a register or memory location is it possible to jump to an absolute address. To be clear, if I have
Quoted 7 lines
call 0xfffff000in a DSO which is loaded at address
0x80000000the jumps ends at0x7fffffff. The problem is that the static linker doesn't know the load address. We could of course have the dynamic linker fix up the addresses but this is plain stupid. It would mean fixing up a lot of places and making of those pages covered non-sharable.
Can't you do call far __SOME_CS, 0xfffff000?
Pavel
Signature · 2 lines
Worst form of spam? Adding advertisment signatures ala sourceforge.net. What goes next? Inserting advertisment *into* email?
Quoted 4 lines · Linus Torvalds
Ok, I did the vsyscall page too, and tried to make it do the right thing (but I didn't bother to test it on a non-SEP machine).
Quoted 8 lines
I'm pushing the changes out right now, but basically it boils down to the fact that with these changes, user space can instead of doing an
int $0x80instruction for a system call just do a
call 0xfffff000
I thought that last page was intentionally left invalid?
So that, for example, *(char *)MAP_FAILED will give SIGSEGV; whereas now I can read a 0 there (and perhaps you should be using get_zeroed_page rather than __get_free_page?).
I cannot name anything which relies on that page being invalid, but think it would be safer to keep that it way; though I guess more compatibility pain to use the next page down (or could seg lim be used? I forget the granularity restrictions).
Hugh
Quoted 5 lines · Hugh Dickins
Quoted 4 lines · Linus Torvalds
Ok, I did the vsyscall page too, and tried to make it do the right thing (but I didn't bother to test it on a non-SEP machine).
Quoted 9 lines
Quoted 8 lines
I'm pushing the changes out right now, but basically it boils down to the fact that with these changes, user space can instead of doing an
int $0x80instruction for a system call just do a
call 0xfffff000
So you are going to do a system-call off a trap instead of an interrupt. The difference in performance should be practically nothing. There is also going to be additional overhead in returning from the trap since the IP and caller's segment was not saved by the initial trap. I don't see how you can possibly claim any improvement in performance. Further, it doesn't make any sense. We don't call physical addresses from a virtual address anyway, so there will be additional translation that must take some time. With the current page-table translation you would need to put your system-call entry point at 0xfffff000 - 0xc0000000 = 0x3ffff000 and there might not even be any RAM there. This guarantees that you are going to have to set up a special PTE, resulting in additional overhead.
Cheers,
Dick Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips). Why is the government concerned about the lunatic fringe? Think about it.
Quoted 7 lines · Richard B. Johnson
Quoted 4 lines · Linus Torvalds
instruction for a system call just do a
call 0xfffff000So you are going to do a system-call off a trap instead of an interrupt.
No no. The kernel maps a magic read-only page at 0xfffff000, and there's no trap involved. The code at that address is kernel-generated for the CPU in question, and it will do whatever is most convenient.
No traps. They're slow as hell.
Linus
Quoted 2 lines · Hugh Dickins
whereas now I can read a 0 there (and perhaps you should be using
get_zeroed_pagerather than__get_free_page?).
Sorry, yes, you are using get_zeroed_page for the one that needs it.
Hugh
Quoted 2 lines · Hugh Dickins
I thought that last page was intentionally left invalid?
It was. But I thought it made sense to use, as it's the only really "special" page.
But yes, we should decide on this quickly - it's easy to change right now, but..
Linus
Quoted 5 lines · Linus Torvalds
Quoted 1 line · Hugh Dickins
I thought that last page was intentionally left invalid?
It was. But I thought it made sense to use, as it's the only really "special" page.
In couple of occasions I have caught myself from pre-decrementing a char pointer which "just happened" to be NULL.
Please keep the last page, as well as a few of the first pages as NULL-pointer poisons.
Quoted 4 lines
But yes, we should decide on this quickly - it's easy to change right now, but..
Linus
/Matti Aarnio
Quoted 5 lines · Matti Aarnio
Quoted 3 lines · Linus Torvalds
Quoted 1 line · Hugh Dickins
I thought that last page was intentionally left invalid?
Quoted 8 lines
Quoted 2 lines
It was. But I thought it made sense to use, as it's the only really "special" page.
In couple of occasions I have caught myself from pre-decrementing a char pointer which "just happened" to be NULL.
Please keep the last page, as well as a few of the first pages as NULL-pointer poisons.
I think I have a good clean solution to this, that not only avoids the need for any hard-coded address _at_all_, but also solves Uli's problem quite cleanly.
Uli, how about I just add one ne warchitecture-specific ELF AT flag, which is the "base of sysinfo page". Right now that page is all zeroes except for the system call trampoline at the beginning, but we might want to add other system information to the page in the future (it is readable, after all).
So we'd have an AT_SYSINFO entry, that with the current implementation would just get the value 0xfffff000. And then the glibc startup code could easily be backwards compatible with the suggestion I had in the previous email. Since we basically want to do an indirect jump anyway (because of the lack of absolute jumps in the instruction set), this looks like the natural way to do it.
That also allows the kernel to move around the SYSINFO page at will, and even makes it possible to avoid it altogether (ie this will solve the inevitable problems with UML - UML just wouldn't set AT_SYSINFO, so user level just wouldn't even _try_ to use it).
With that, there's nothing "special" about the vsyscall page, and I'd just go back to having the very last page unmapped (and have the vsyscall page in some other fixmap location that might even depend on kernel configuration).
Whaddaya think?
Linus
Quoted 6 lines · Linus Torvalds
Uli, how about I just add one ne warchitecture-specific ELF AT flag, which is the "base of sysinfo page". Right now that page is all zeroes except for the system call trampoline at the beginning, but we might want to add other system information to the page in the future (it is readable, after all).
Here's the suggested (totally untested as of yet) patch:
- it moves the system call page to 0xffffe000 instead, leaving an unmapped page at the very top of the address space. So trying to dereference -1 will cause a SIGSEGV.
- it adds the AT_SYSINFO elf entry on x86 that points to the system page.
Thus glibc startup should be able to just do
ptr = default_int80_syscall;
if (AT_SYSINFO entry found)
ptr = value(AT_SYSINFO)
and then you can just do a
call *ptr
to do a system call regardless of kernel version. This also allows the kernel to later move the page around as it sees fit.
The advantage of using an AT_SYSINFO entry is that
- no new system call needed to figure anything out
- backwards compatibility (ie old kernels automatically detected)
- I think glibc already parses the AT entries at startup anyway
so it _looks_ like a perfect way to do this.
Linus
----
===== arch/i386/kernel/entry.S 1.42 vs edited =====
arch/i386/kernel/entry.S +1 -1
@@ -232,7 +232,7 @@ #endif /* Points to after the "sysenter" instruction in the vsyscall page */ -#define SYSENTER_RETURN 0xfffff007 +#define SYSENTER_RETURN 0xffffe007 # sysenter call handler stub ALIGN
===== include/asm-i386/elf.h 1.3 vs edited =====
include/asm-i386/elf.h +11 -0
@@ -100,6 +100,12 @@#define ELF_PLATFORM (system_utsname.machine) +/* +* Architecture-neutral AT_ values in 0-17, leave some room +* for more of them, start the x86-specific ones at 32. +*/ +#define AT_SYSINFO 32 +#ifdef __KERNEL__#define SET_PERSONALITY (ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
@@ -115,6 +121,11 @@extern void dump_smp_unlazy_fpu (void );#define ELF_CORE_SYNC dump_smp_unlazy_fpu#endif + +#define ARCH_DLINFO \ +do { \ + NEW_AUX_ENT(AT_SYSINFO, 0xffffe000); \ +} while (0)#endif
===== include/asm-i386/fixmap.h 1.9 vs edited =====
include/asm-i386/fixmap.h +1 -1
@@ -42,8 +42,8 @@* task switches. */ enum fixed_addresses { -FIX_VSYSCALL ,FIX_HOLE , +FIX_VSYSCALL ,#ifdef CONFIG_X86_LOCAL_APIC FIX_APIC_BASE ,/* local (CPU) APIC) -- required for SMP or not */ #endif
Quoted 9 lines · Linus Torvalds
Thus glibc startup should be able to just do
ptr =
default_int80_syscall;
if (AT_SYSINFOentry found)
ptr =value(AT_SYSINFO)and then you can just do a
call *ptr
This won't work as I just wrote but something similar I can make work. I think the use of the TCB is the best thing to do. Replicating the info in all thread new thread's TCBs doesn't cost much and with NPTL it's even lower cost since we reuse old TCBs.
Signature · 3 lines
--------------. ,-. 444 Castro Street Ulrich Drepper \ ,-----------------' \ Mountain View, CA 94041 USA Red Hat `--' drepper at redhat.com `---------------------------
Quoted 6 lines · Linus Torvalds
Uli, how about I just add one ne warchitecture-specific ELF AT flag, which is the "base of sysinfo page". Right now that page is all zeroes except for the system call trampoline at the beginning, but we might want to add other system information to the page in the future (it is readable, after all).
Quoted 6 lines
So we'd have an
AT_SYSINFOentry, that with the current implementation would just get the value0xfffff000. And then the glibc startup code could easily be backwards compatible with the suggestion I had in the previous email. Since we basically want to do an indirect jump anyway (because of the lack of absolute jumps in the instruction set), this looks like the natural way to do it.
Yes, I definitely think that a new AT_* value is at order and it's a nice way to determine the address.
But it will eliminate the problem. Remember: the x86 (unlike x86-64) has no PC-relative data addressing mode. I.e., in a DSO to find a memory location with an address I need a base register which isn't available anymore at the time the call is made.
You have to assume that all the registers, including %ebp, are used at the time of the call. This makes it impossible to find a memory location in a DSO without text relocation (i.e., making parts of the code writable, at least for a moment). This is time consuming and not resource friendly.
There is one way around this and maybe it is what should be done: we have the TLS memory available. And since this vsyscall stuff gets introduced after the TLS is functional it is a possibility.
The address received in AT_SYSINFO is stored in a word in the TCB (thread control block). Then the code to call through this is a variant of what I posted earlier
movl $__NR_##name, %eax
call *%gs:-__NR_##name+TCB_OFFSET(%eax)
In case the vsyscall stuff is not available we jump to something like
int $0x80
ret
The address of this code is the default value of the TCB word.
There is another thing we might want to consider. The above code jump to 0xfffff000 or whatever adddres is specified. I.e., the demultiplexing happens in the kernel. Do we want to do this at userlevel? This would allow almost no-cost determination of those syscalls which can be handled at userlevel (getpid, getppid, ...).
Signature · 3 lines
--------------. ,-. 444 Castro Street Ulrich Drepper \ ,-----------------' \ Mountain View, CA 94041 USA Red Hat `--' drepper at redhat.com `---------------------------
Quoted 3 lines · Ulrich Drepper
demultiplexing happens in the kernel. Do we want to do this at userlevel? This would allow almost no-cost determination of those syscalls which can be handled at userlevel (getpid, getppid, ...).
getppid changes and so I think has to go to kernel (unless we go around patching user pages on process exit [ick]). getpid can already be done by reading it once at startup time and caching the data.
Quoted 2 lines · Alan Cox
getppid changes and so I think has to go to kernel (unless we go around patching user pages on process exit [ick]).
But this is exactly what I expect to happen. If you want to implement gettimeofday() at user-level you need to modify the page. Some of the information the kernel has to keep for the thread group can be stored in this place and eventually be used by some uerlevel code executed by jumping to 0xfffff000 or whatever the address is.
Signature · 3 lines
--------------. ,-. 444 Castro Street Ulrich Drepper \ ,-----------------' \ Mountain View, CA 94041 USA Red Hat `--' drepper at redhat.com `---------------------------
Quoted 3 lines · Ulrich Drepper
But this is exactly what I expect to happen. If you want to implement
gettimeofday()at user-level you need to modify the page.
Note that I really don't think we ever want to do the user-level gettimeofday(). The complexity just argues against it, it's better to try to make system calls be cheap enough that you really don't care.
sysenter helps a bit there.
If we'd need to modify the page, we couldn't share one page between all processes, and we couldn't make it global in the TLB. So modifying the info page is something we should avoid at all cost - it's not totally unlikely that the overheads implied by per-thread pages would drown out the wins from trying to be clever.
The advantage of the current static fixmap is that it's _extremely_ streamlined. The only overhead is literally the system entry itself, which while a bit too high on a P4 is not that bad in general (and hopefully Intel will fix the stupidities that cause the P4 to be slow at kernel entry. Somebody already mentioned that apparently the newer P4 cores are actually faster at system calls than mine is).
Linus
Quoted 10 lines · Linus Torvalds
Quoted 2 lines · Ulrich Drepper
But this is exactly what I expect to happen. If you want to implement
gettimeofday()at user-level you need to modify the page.Note that I really don't think we ever want to do the user-level
gettimeofday(). The complexity just argues against it, it's better to try to make system calls be cheap enough that you really don't care.
Let's see... it works fine on UP and on *most* SMP, and on the ones where it doesn't work you just fill in a system call into the vsyscall slot. It just means that gettimeofday() needs a different vsyscall slot.
-hpa
Quoted 4 lines · H. Peter Anvin
Let's see... it works fine on UP and on *most* SMP, and on the ones where it doesn't work you just fill in a system call into the vsyscall slot. It just means that
gettimeofday()needs a different vsyscall slot.
The thing is, gettimeofday() isn't _that_ special. It's just not worth a vsyscall of it's own, I feel. Where do you stop? Do we do getpid() too? Just because we can?
This is especially true since the people who _really_ might care about gettimeofday() are exactly the people who wouldn't be able to use the fast user-space-only version.
How much do you think gettimeofday() really matters on a desktop? Sure, X apps do gettimeofday() calls, but they do a whole lot more of _other_ calls, and gettimeofday() is really far far down in the noise for them. The people who really call for gettimeofday() as a performance thing seem to be database people who want it as a timestamp. But those are the same people who also want NUMA machines which don't necessarily have synchronized clocks.
Linus
Quoted 5 lines · Linus Torvalds
The thing is,
gettimeofday()isn't _that_ special. It's just not worth a vsyscall of it's own, I feel. Where do you stop? Do we dogetpid()too? Just because we can?
getpid() could be implemented in userspace, but not via vsyscalls (instead it could be passed in the ELF data area at process start.)
"Because we can and it's relatively easy" is a pretty good argument in my opinion.
Quoted 4 lines
This is especially true since the people who _really_ might care about
gettimeofday()are exactly the people who wouldn't be able to use the fast user-space-only version.
Quoted 8 lines
How much do you think
gettimeofday()really matters on a desktop? Sure, X apps dogettimeofday()calls, but they do a whole lot more of _other_ calls, andgettimeofday()is really far far down in the noise for them. The people who really call forgettimeofday()as a performance thing seem to be database people who want it as a timestamp. But those are the same people who also want NUMA machines which don't necessarily have synchronized clocks.
I think this is really an overstatement. Timestamping etc. (and heck, even databases) are actually perfectly usable even on smaller machines these days. Sure, DB vendors like to boast of their 128-way NUMA machines, but I suspect the bulk of them run on single- and dual-processor machines (by count, not necessarily by data volume.)
-hpa
(cutting down To:/Cc:)
Quoted 7 lines · H. Peter Anvin
Quoted 3 lines · Linus Torvalds
The thing is,
gettimeofday()isn't _that_ special. It's just not worth a vsyscall of it's own, I feel. Where do you stop? Do we dogetpid()too? Just because we can?
getpid()could be implemented in userspace, but not via vsyscalls (instead it could be passed in the ELF data area at process start.)
After fork() or clone() ?
If we had only spawn(), and some separate way to start threads...
...
Quoted 1 line
-hpa
/Matti Aarnio
Quoted 10 lines · Matti Aarnio
(cutting down To:/Cc:)
Quoted 6 lines · H. Peter Anvin
Quoted 3 lines · Linus Torvalds
The thing is,
gettimeofday()isn't _that_ special. It's just not worth a vsyscall of it's own, I feel. Where do you stop? Do we dogetpid()too? Just because we can?
Quoted 7 lines
Quoted 2 lines
getpid()could be implemented in userspace, but not via vsyscalls (instead it could be passed in the ELF data area at process start.)After
fork()orclone()?
If we had onlyspawn(), and some separate way to start threads...
fork() and clone() would have to return the self-pid as an auxilliary return value. This, of course, is getting rather fuggly.
Anything that cares caches getpid() anyway.
-hpa
Quoted 8 lines · Linus Torvalds
Quoted 3 lines · H. Peter Anvin
Let's see... it works fine on UP and on *most* SMP, and on the ones where it doesn't work you just fill in a system call into the vsyscall slot. It just means that
gettimeofday()needs a different vsyscall slot.The thing is,
gettimeofday()isn't _that_ special. It's just not worth a vsyscall of it's own, I feel. Where do you stop? Do we dogetpid()too? Just because we can?
clone() -- which doesn't really like anybody using stack-pointer ?
(I do use gettimeofday() a _lot_, but I have my own userspace
mapped shared segment thingamajingie doing it.. And I write code that runs on lots of systems, not only at Linux. )
Quoted 1 line
Linus
/Matti Aarnio
Quoted 2 lines · Linus Torvalds
The thing is,
gettimeofday()isn't _that_ special. It's just not worth a vsyscall of it's own, I feel. Where do you stop? Do we dogetpid()too?
This is why I'd say mkae no distinction at all. Have the first nr_syscalls * 8 bytes starting at 0xfffff000 as a jump table. We can transfer to a different slot for each syscall. Each slot then could be a PC-relative jump to the common sysenter code or to some special code sequence which is also in the global page.
If we don't do this now and it seems desirable in future we wither have to introduce a second ABI for the vsyscall stuff (ugly!) or you'll have to do the demultiplexing yourself in the code starting at 0xfffff000.
Signature · 3 lines
--------------. ,-. 444 Castro Street Ulrich Drepper \ ,-----------------' \ Mountain View, CA 94041 USA Red Hat `--' drepper at redhat.com `---------------------------
Quoted 11 lines · Ulrich Drepper
Quoted 2 lines · Linus Torvalds
The thing is,
gettimeofday()isn't _that_ special. It's just not worth a vsyscall of it's own, I feel. Where do you stop? Do we dogetpid()too?This is why I'd say mkae no distinction at all. Have the first
nr_syscalls* 8 bytes starting at0xfffff000as a jump table. We can transfer to a different slot for each syscall. Each slot then could be a PC-relative jump to the common sysenter code or to some special code sequence which is also in the global page.
Quoted 3 lines
If we don't do this now and it seems desirable in future we wither have to introduce a second ABI for the vsyscall stuff (ugly!) or you'll have to do the demultiplexing yourself in the code starting at
0xfffff000.
But what does this do to things like PTRACE_SYSCALL? And do we care... I suppose not if we keep the syscall trace checks on every kernel entry path.
Signature · 2 lines
Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer
Quoted 3 lines · Ulrich Drepper
This is why I'd say mkae no distinction at all. Have the first
nr_syscalls* 8 bytes starting at0xfffff000as a jump table.
No, the way sysenter works, the table approach just sucks up dcache space (the kernel cannot know which sysenter is the one that the user uses anyway, so the jump table would have to just add back some index and we'd be back exactly where we started)
I'll keep it the way it is now.
Linus
Quoted 6 lines · Linus Torvalds
No, the way sysenter works, the table approach just sucks up dcache space (the kernel cannot know which sysenter is the one that the user uses anyway, so the jump table would have to just add back some index and we'd be back exactly where we started)
I'll keep it the way it is now.
I won't argue since honestly, not doing it is much easier for me. But I want to be sure I'm clear.
What I suggested is to have the first part of the global page be
.p2align 3
jmp sysenter_label
.p2align 3
jmp sysenter_label
...
.p2align
jmp userlevel_gettimeofday
sysenter_label:
the usual sysenter code
userlevel_gettimeofday:
whatever necessary
All this would be in the global page. There is only one sysenter call.
Signature · 3 lines
--------------. ,-. 444 Castro Street Ulrich Drepper \ ,-----------------' \ Mountain View, CA 94041 USA Red Hat `--' drepper at redhat.com `---------------------------
[email protected] (Linus Torvalds) wrote on 17.12.02 in <[email protected]>:
Quoted 9 lines · H. Peter Anvin
Quoted 4 lines
Let's see... it works fine on UP and on *most* SMP, and on the ones where it doesn't work you just fill in a system call into the vsyscall slot. It just means that
gettimeofday()needs a different vsyscall slot.The thing is,
gettimeofday()isn't _that_ special. It's just not worth a vsyscall of it's own, I feel. Where do you stop? Do we dogetpid()too? Just because we can?
It's special enough that while programming under DOS, I had my own special routine which just took the BIOS ticker from low memory for a lot of things - even to decide if calling the actual time-of-day syscall was useful or if I should expect to get the same value back as last time.
That was a *serious* performance improvement. (Of course, DOS syscalls are S-L-O-W ...)
These days, the equivalent does call gettimeofday(). It's still probably the most-used syscall by far. (Hmm - maybe I can get some numbers for that? Must see if I get time today.) And *that* is why optimizing this one call makes sense.
Quoted 3 lines
This is especially true since the people who _really_ might care about
gettimeofday()are exactly the people who wouldn't be able to use the fast user-space-only version.
Say what? Why wouldn't I be able to use it? Right now, I know of no SMP installation that's even in the planning ...
Quoted 1 line
How much do you think
gettimeofday()really matters on a desktop? Sure, X
Why desktop? We use the same kind of thing in the server, and it's much more important there. Client performance is uninteresting - clients mostly wait anyway.
Quoted 2 lines
The people who really call for
gettimeofday()as a performance thing seem to be database people who want it as a timestamp. But those are the same
Not database, but otherwise on the nail.
Quoted 2 lines
people who also want NUMA machines which don't necessarily have synchronized clocks.
Nope, no interest in those. SMP *might* become interesting, but I don't think we'd ever want to care about weird stuff like NUMA ... at least not for the next five years or so.
We don't shovel nearly as much data around as the database guys.
MfG Kai
Quoted 7 lines · Linus Torvalds
How much do you think
gettimeofday()really matters on a desktop? Sure, X apps dogettimeofday()calls, but they do a whole lot more of _other_ calls, andgettimeofday()is really far far down in the noise for them. The people who really call forgettimeofday()as a performance thing seem to be database people who want it as a timestamp. But those are the same people who also want NUMA machines which don't necessarily have synchronized clocks.
Once the kernel provides the right infrastructure, doing it may become so easy that it can be tried and implemented and benchmarked with so little effort that it would simply stick.
Roger.
Signature · 5 lines
** [email protected] ** http://www.BitWizard.nl/ ** +31-15-2600998 ** *-- BitWizard writes Linux device drivers for any device you may have! --* * The Worlds Ecosystem is a stable system. Stable systems may experience * * excursions from the stable situation. We are currently in such an * * excursion: The stable situation does not include humans. ***************
Quoted 3 lines · Linus Torvalds
Intel will fix the stupidities that cause the P4 to be slow at kernel entry. Somebody already mentioned that apparently the newer P4 cores are actually faster at system calls than mine is).
My HT Northwood returns slightly better results than your xeon, but the syscall stuff still completely trounces it.
(19:38:46:davej@tetrachloride:davej)$ ./a.out 440.107164 cycles 1152.596084 cycles
Dave
Signature · 2 lines
| Dave Jones. http://www.codemonkey.org.uk | SuSE Labs
Quoted 10 lines · Linus Torvalds
Quoted 3 lines · Ulrich Drepper
But this is exactly what I expect to happen. If you want to implement
gettimeofday()at user-level you need to modify the page.Note that I really don't think we ever want to do the user-level
gettimeofday(). The complexity just argues against it, it's better to try to make system calls be cheap enough that you really don't care.
I'd say that this should not be "fixed" from userspace, but from the kernel. Thus if the kernel knows that the "gettimeofday" can be made faster by doing it completely in userspace, then that system call should be "patched" by the kernel to do it faster for everybody.
Next, someone might find a faster (full-userspace) way to do some "reads"(*). Then it might pay to check for that specific filedescriptor in userspace, and only call into the kernel for the other filedescriptors. The idea is that the kernel knows best when optimizations are possible.
Thus that ONE magic address is IMHO not the right way to do it. By demultiplexing the stuff in userspace, you can do "sane" things with specific syscalls.
So for example, the code at 0xffff80000 would be:
mov 0x00,%eax int $80 ret
(in the case where sysenter & friends is not available)
moving the "load syscall number into the register" into the kernel-modifiable area does not cost a thing, but because we have demultiplexed the code, we can easily replace the gettimeofday call by something that (when it's easy) doesn't require the 600-cycle call into kernel mode.
The "syscall _NR" would then become:
call 0xffff8000 + _NR * 0x80
allowing for up to 0x80 bytes of "patchup code" or "do it quickly" code, but also for a jump to some other "magic page", that has more extensive code.
(Oh, I'm showing a base of 0xffff8000: A bit lower than previous
suggestions: allowing for a per-syscall entrypoint, and up to 0x80 bytes of fixup or "do it really quickly" code.)
P.S. People might argue that using this large "stride" would have a larger cache-footprint. I think that all "where it matters" programs will have a very small working-set of system calls. It might pay to use a stride of say 0xa0 to spread the different system-call-code-points over different cache-lines whenever possible.
Roger.
(*) I was trying to pick a particularly unlikely case, but I can even see a case where this is useful. For example, a kernel might be compiled with "high performance pipes", which would move most of the pipe reads and writes into userspace, through a shared-memory window.
Signature · 5 lines
** [email protected] ** http://www.BitWizard.nl/ ** +31-15-2600998 ** *-- BitWizard writes Linux device drivers for any device you may have! --* * The Worlds Ecosystem is a stable system. Stable systems may experience * * excursions from the stable situation. We are currently in such an * * excursion: The stable situation does not include humans. ***************
Hi!
Quoted 22 lines
Quoted 6 lines
Quoted 2 lines
But this is exactly what I expect to happen. If you want to implement
gettimeofday()at user-level you need to modify the page.Note that I really don't think we ever want to do the user-level
gettimeofday(). The complexity just argues against it, it's better to try to make system calls be cheap enough that you really don't care.I'd say that this should not be "fixed" from userspace, but from the kernel. Thus if the kernel knows that the "gettimeofday" can be made faster by doing it completely in userspace, then that system call should be "patched" by the kernel to do it faster for everybody.
Next, someone might find a faster (full-userspace) way to do some "reads"(*). Then it might pay to check for that specific filedescriptor in userspace, and only call into the kernel for the other filedescriptors. The idea is that the kernel knows best when optimizations are possible.
Thus that ONE magic address is IMHO not the right way to do it. By demultiplexing the stuff in userspace, you can do "sane" things with specific syscalls.
Quoted 6 lines
So for example, the code at
0xffff80000would be:mov 0x00,%eax int $80 ret(in the case where sysenter & friends is not available)
This could save that one register needed for 6-args syscalls. If code at 0xffff8000 was mov %ebp, %eax; sysenter; ret for P4, you could do 6-args syscalls this way.
Pavel
Signature · 2 lines
Worst form of spam? Adding advertisment signatures ala sourceforge.net. What goes next? Inserting advertisment *into* email?
Quoted 5 lines · Ulrich Drepper
But this is exactly what I expect to happen. If you want to implement
gettimeofday()at user-level you need to modify the page. Some of the information the kernel has to keep for the thread group can be stored in this place and eventually be used by some uerlevel code executed by jumping to0xfffff000or whatever the address is.
You don't actually need to modify the page, rather the data for the user level gettimeofday needs to be in a shared page and some register (like %tr) must expose the current cpu number to index into the data. Either way, it's an internal implementation detail for the kernel to take care of, with multiple potential solutions.
-ben
Signature · 1 line
"Do you seek knowledge in time travel?"
Quoted 9 lines · Benjamin LaHaise
Quoted 5 lines · Ulrich Drepper
But this is exactly what I expect to happen. If you want to implement
gettimeofday()at user-level you need to modify the page. Some of the information the kernel has to keep for the thread group can be stored in this place and eventually be used by some uerlevel code executed by jumping to0xfffff000or whatever the address is.
Quoted 6 lines
You don't actually need to modify the page, rather the data for the user level gettimeofday needs to be in a shared page and some register (like %tr) must expose the current cpu number to index into the data. Either way, it's an internal implementation detail for the kernel to take care of, with multiple potential solutions.
That's not the problem... the problem is that the userland code can get preempted at any time and rescheduled on another CPU.
-hpa
Quoted 5 lines · Ulrich Drepper
But it will eliminate the problem. Remember: the x86 (unlike x86-64) has no PC-relative data addressing mode. I.e., in a DSO to find a memory location with an address I need a base register which isn't available anymore at the time the call is made.
Actually, I see a more serious problem with the current "syscall"
interface: it doesn't allow six-argument system calls AT ALL, since it needed %ebp to keep the stack pointer.
So a six-argument system call _has_ to use "int $0x80" anyway, which to some degree simplifies your problem: you can only use the indirect call approach for things where %ebp will be free for use anyway.
So then you can use %ebp as the indirection, and the code will look something like
games, since that is guaranteed not to be ever used by a system call (it wasn't guaranteed before, but since the sysenter really needs something to hold the stack pointer I made %ebp do that, so there's no way we can ever use %ebp for system calls on x86).
So you _can_ do something like this:
syscall_with_5_args: pushl %ebx pushl %esi pushl %edi pushl %ebp movl syscall_ptr + GOT,%ebp // uses DSO ptr in %ebx or whatever movl $__NR_xxxxxx,%eax movl 20(%esp),%ebx movl 24(%esp),%ecx movl 28(%esp),%edx movl 32(%esp),%esi movl 36(%esp),%edi call *%ebp .. test for errno if needed .. popl %ebp popl %edi popl %esi popl %ebx ret
Quoted 2 lines
You have to assume that all the registers, including %ebp, are used at the time of the call.
See why this isn't possible right now anyway.
Hmm.. Which system calls have all six parameters? I'll have to see if I can find any way to make those use the new interface too.
In the meantime, I do agree with you that the TLS approach should work too, and might be better. It will allow all six arguments to be used if we just find a good calling conventions (too bad sysenter is such a pig of an instruction, it's really not very well designed since it loses information).
Linus
Quoted 3 lines · Linus Torvalds
In the meantime, I do agree with you that the TLS approach should work too, and might be better. It will allow all six arguments to be used if we just find a good calling conventions
If you push out the AT_* patch I'll hack the glibc bits (probably the TLS variant). Won't take too long, you'll get results this afternoon.
What about AMD's instruction? Is it as flawed as sysenter? If not and %ebp is available I really should use the TLS method.
Signature · 3 lines
--------------. ,-. 444 Castro Street Ulrich Drepper \ ,-----------------' \ Mountain View, CA 94041 USA Red Hat `--' drepper at redhat.com `---------------------------
Quoted 3 lines · Linus Torvalds
Hmm.. Which system calls have all six parameters? I'll have to see if I can find any way to make those use the new interface too.
The only ones I found from a quick grep are
- sys_recvfrom
- sys_sendto
- sys_mmap2()
- sys_ipc()
and none of them are of a kind where the system call entry itself is the biggest performance issue (and sys_ipc() is deprecated anyway), so it's probably acceptable to just use the old interface for them.
One other alternative is to change the calling convention for the new-style system call, and not have arguments in registers at all. We could make the interface something like
- %eax contains system call number
- %edx contains pointer to argument block
- call *syscallptr // trashes all registers
and then the old "compatibility" function would be something like
movl 0(%edx),%ebx movl 4(%edx),%ecx movl 12(%edx),%esi movl 16(%edx),%edi movl 20(%edx),%ebp movl 8(%edx),%edx int $0x80 ret
while the "sysenter" interface would do the loads from kernel space.
That would make some things easier, but the problem with this approach is that if you have a single-argument system call, and you just pass in the stack pointer offset in %edx directly, then the system call stubs will always load 6 arguments, and if we're just at the end of the stack it won't actually _work_. So part of the calling convention would have to be the guarantee that there is stack-space available (should always be true in practice, of course).
Linus
Quoted 13 lines · Linus Torvalds
Quoted 2 lines · Linus Torvalds
Hmm.. Which system calls have all six parameters? I'll have to see if I can find any way to make those use the new interface too.
The only ones I found from a quick grep are
-sys_recvfrom
-sys_sendto
-sys_mmap2()
-sys_ipc()
Quoted 4 lines
and none of them are of a kind where the system call entry itself is the biggest performance issue (and
sys_ipc()is deprecated anyway), so it's probably acceptable to just use the old interface for them.
recvfrom() and sendto() can also be implemeted as sendmsg() recvmsg() if one really wants to.
What one can also do is that a sixth argument, if one exists, is passed on the stack (i.e. in (%ebp), since %ebp contains the stack pointer.)
-hpa
Quoted 3 lines · H. Peter Anvin
What one can also do is that a sixth argument, if one exists, is passed on the stack (i.e. in (%ebp), since %ebp contains the stack pointer.)
I like this. I will make it so. It will allow the old calling conventions and has none of the stack size issues that my "memory block" approach had.
Also since this will all be done inside the wrapper and is thus entirely invisible to the caller. Good, this solves the six-arg case nicely.
Linus
Quoted 7 lines · Linus Torvalds
The only ones I found from a quick grep are
-sys_recvfrom
-sys_sendto
-sys_mmap2()
-sys_ipc()
All but mmap2 do not use 6 parameters. They are implemented via the sys_ipc multiplexer which takes the stack pointer as an argument which then helps to locate the parameters.
Signature · 3 lines
--------------. ,-. 444 Castro Street Ulrich Drepper \ ,-----------------' \ Mountain View, CA 94041 USA Red Hat `--' drepper at redhat.com `---------------------------
How about this diff? It does both the 6-parameter thing _and_ the AT_SYSINFO addition. Untested, since I have to run off and watch my kids do their winter program ;)
Linus
-----
===== arch/i386/kernel/entry.S 1.42 vs edited =====
arch/i386/kernel/entry.S +16 -1
@@ -232,7 +232,7 @@ #endif /* Points to after the "sysenter" instruction in the vsyscall page */ -#define SYSENTER_RETURN 0xfffff007 +#define SYSENTER_RETURN 0xffffe007 # sysenter call handler stub ALIGN
@@ -243,6 +243,21 @@ pushfl pushl $(__USER_CS) pushl $SYSENTER_RETURN + +/* + * Load the potential sixth argument from user stack. + * Careful about security. + */ + cmpl $0xc0000000,%ebp + jae syscall_badsys +1: movl (%ebp),%ebp +.section .fixup,"ax" +2: xorl %ebp,%ebp +.previous +.section __ex_table,"a" + .align 4 + .long 1b,2b +.previous pushl %eax SAVE_ALL
===== arch/i386/kernel/sysenter.c 1.1 vs edited =====
arch/i386/kernel/sysenter.c +2 -2
@@ -48,14 +48,14 @@ 0xc3 /* ret */ };static const char sysent[] = { -0x55 ,/* push %ebp */ 0x51 ,/* push %ecx */ 0x52 ,/* push %edx */ +0x55 ,/* push %ebp */ 0x89 ,0xe5 ,/* movl %esp,%ebp */ 0x0f ,0x34 ,/* sysenter */ +0x5d ,/* pop %ebp */ 0x5a ,/* pop %edx */ 0x59 ,/* pop %ecx */ -0x5d ,/* pop %ebp */ 0xc3 /* ret */ };unsigned long page =get_zeroed_page (GFP_ATOMIC );
===== include/asm-i386/elf.h 1.3 vs edited =====
include/asm-i386/elf.h +11 -0
@@ -100,6 +100,12 @@#define ELF_PLATFORM (system_utsname.machine) +/* +* Architecture-neutral AT_ values in 0-17, leave some room +* for more of them, start the x86-specific ones at 32. +*/ +#define AT_SYSINFO 32 +#ifdef __KERNEL__#define SET_PERSONALITY (ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
@@ -115,6 +121,11 @@extern void dump_smp_unlazy_fpu (void );#define ELF_CORE_SYNC dump_smp_unlazy_fpu#endif + +#define ARCH_DLINFO \ +do { \ + NEW_AUX_ENT(AT_SYSINFO, 0xffffe000); \ +} while (0)#endif
===== include/asm-i386/fixmap.h 1.9 vs edited =====
include/asm-i386/fixmap.h +1 -1
@@ -42,8 +42,8 @@* task switches. */ enum fixed_addresses { -FIX_VSYSCALL ,FIX_HOLE , +FIX_VSYSCALL ,#ifdef CONFIG_X86_LOCAL_APIC FIX_APIC_BASE ,/* local (CPU) APIC) -- required for SMP or not */ #endif
Quoted 8 lines · Linus Torvalds
=====
arch/i386/kernel/sysenter.c1.1 vs edited =====arch/i386/kernel/sysenter.c +0
-1@@ -48,14 +48,14 @@0xc3 /* ret */ };static const char sysent[] = { -0x55 ,/* push %ebp */
arch/i386/kernel/sysenter.c line 59
Quoted 10 lines
arch/i386/kernel/sysenter.c +2
-10x51 ,/* push %ecx */ 0x52 ,/* push %edx */ +0x55 ,/* push %ebp */ 0x89 ,0xe5 ,/* movl %esp,%ebp */ 0x0f ,0x34 ,/* sysenter */ +0x5d ,/* pop %ebp */ 0x5a ,/* pop %edx */ 0x59 ,/* pop %ecx */ -0x5d ,/* pop %ebp */ 0xc3 /* ret */
Instead of duplicating the push/pop %ebp just use the first one by using
movl 12(%ebo), %ebp
in the kernel code or remove the first. The later is better, smaller code.
Signature · 3 lines
--------------. ,-. 444 Castro Street Ulrich Drepper \ ,-----------------' \ Mountain View, CA 94041 USA Red Hat `--' drepper at redhat.com `---------------------------
Quoted 6 lines · Ulrich Drepper
arch/i386/kernel/sysenter.c line 58
Quoted 4 lines
arch/i386/kernel/sysenter.c +2
-2-0x55 ,/* push %ebp */ +0x55 ,/* push %ebp */ + 0x5d, /* pop %ebp */ - 0x5d, /* pop %ebp */Instead of duplicating the push/pop %ebp just use the first one by using
No, it's not duplicating it. Look closer. It's just _moving_ it, so that the old %ebp value will naturally be pointed to by %esp, which is what we want.
Anyway, I reverted the %ebp games from my kernel, because they are fundamentally not restartable and thus not really a good idea. Besides, it might be wrong to try to optimize the fast system calls to handle six arguments too, if that makes the (much more common case) the other system calls slower. So the six-argument case might as well just continue to use "int 0x80".
Linus
Quoted 3 lines · Linus Torvalds
How about this diff? It does both the 6-parameter thing _and_ the
AT_SYSINFOaddition.
The 6-parameter thing is broken. It's clever, but playing games with %ebp is not going to work with restarting of the system call - we need to restart with the proper %ebp.
I pushed out the AT_SYSINFO stuff, but we're back to the "needs to use 'int $0x80' for system calls that take 6 arguments" drawing board.
The only sane way I see to fix the %ebp problem is to actually expand the kernel "struct ptregs" to have separate "ebp" and "arg6" fields (so that we can re-start with the right ebp, and have arg6 as the right argument on the stack). That would work but is not really worth it.
Linus
Quoted 10 lines · Linus Torvalds
Quoted 2 lines · Linus Torvalds
How about this diff? It does both the 6-parameter thing _and_ the
AT_SYSINFOaddition.The 6-parameter thing is broken. It's clever, but playing games with %ebp is not going to work with restarting of the system call - we need to restart with the proper %ebp.
This confuses me -- there seems to be no reason this shouldn't work as long as %esp == %ebp on sysexit. The SYSEXIT-trashed GPRs seem like a bigger problem.
-hpa
Quoted 4 lines · H. Peter Anvin
This confuses me -- there seems to be no reason this shouldn't work as long as %esp == %ebp on sysexit. The SYSEXIT-trashed GPRs seem like a bigger problem.
The thing is, the argument save area == the kernel stack frame. This is part of the reason why Linux has very fast system calls - there is absolutely _zero_ extraneous setup. No argument fetching and marshalling, it's all part of just setting up the regular kernel stack.
So to get the right argument in arg6, the argument _needs_ to be saved in the %ebp entry on the kernel stack. Which means that on return from the system call (which may not actually be through a "sysenter" at all, if signals happen it will go through the generic paths), %ebp will have been updated as part of the kernel stack unwinding.
Which is ok for a regular fast system call (ebp will get restored immediately), but it is NOT ok for the system call restart case, since in that case we want %ebp to contain the old stack pointer, not the sixth argument.
If we just save the stack pointer value (== the initial %ebx value), the right thing will get restored, but then system calls will see the stack pointer value as arg6 - because of the 1:1 relationship between arguments and stack save.
Linus
Quoted 5 lines · Linus Torvalds
Which is ok for a regular fast system call (ebp will get restored immediately), but it is NOT ok for the system call restart case, since in that case we want %ebp to contain the old stack pointer, not the sixth argument.
I came up with an absolutely wonderfully _disgusting_ solution for this.
The thing to realize on how to solve this is that since "sysenter" loses track of EIP, there's really no real reason to try to return directly after the "sysenter" instruction anyway. The return point is really totally arbitrary, after all.
Now, couple this with the fact that system call restarting will always just subtract two from the "return point" aka saved EIP value (that's the size of an "int 0x80" instruction), and what you can do is to make the kernel point the sysexit return point not at just past the "sysenter", but instead make it point to just past a totally unrelated 2-byte jump instruction.
With that in mind, I made the sysentry trampoline look like this:
static const char sysent[] = {
0x51, /* push %ecx */
0x52, /* push %edx */
0x55, /* push %ebp */
0x89, 0xe5, /* movl %esp,%ebp */
0x0f, 0x34, /* sysenter */
/* System call restart point is here! (SYSENTER_RETURN - 2) */
0xeb, 0xfa, /* jmp to "movl %esp,%ebp" */
/* System call normal return point is here! (SYSENTER_RETURN in entry.S) */
0x5d, /* pop %ebp */
0x5a, /* pop %edx */
0x59, /* pop %ecx */
0xc3 /* ret */
};which does the right thing for a "restarted" system call (ie when it restarts, it won't re-do just the sysenter instruction, it will really restart at the backwards jump, and thus re-start the "movl %esp,%ebp" too).
Which means that now the kernel can happily trash %ebp as part of the sixth argument setup, since system call restarting will re-initialize it to point to the user-level stack that we need in %ebp because otherwise it gets totally lost.
I'm a disgusting pig, and proud of it to boot.
Linus
Quoted 13 lines · Linus Torvalds
Quoted 3 lines · Linus Torvalds
How about this diff? It does both the 6-parameter thing _and_ the
AT_SYSINFOaddition.The 6-parameter thing is broken. It's clever, but playing games with %ebp is not going to work with restarting of the system call - we need to restart with the proper %ebp.
I pushed out the
AT_SYSINFOstuff, but we're back to the "needs to use 'int $0x80' for system calls that take 6 arguments" drawing board.
Quoted 7 lines
The only sane way I see to fix the %ebp problem is to actually expand the kernel "struct ptregs" to have separate "ebp" and "arg6" fields (so that we can re-start with the right ebp, and have arg6 as the right argument on the stack). That would work but is not really worth it.
Linus
How about for the new interface, a one-parameter arg, i.e., a pointer to a descriptor (structure)?? For the typical one-argument call, i.e., getpid(), it's just one de-reference. The pointer register can be EAX on Intel, a register normally available in a 'C' call.
Cheers,
Dick Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips). Why is the government concerned about the lunatic fringe? Think about it.
[Extremely interesting new syscall mechanism tread elided]
What happened to "feature freeze"?
Signature · 4 lines
Dr. Horst H. von Brand User #22616 counter.li.org Departamento de Informatica Fono: +56 32 654431 Universidad Tecnica Federico Santa Maria +56 32 654239 Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513
commence Horst von Brand quotation:
Quoted 3 lines
[Extremely interesting new syscall mechanism tread elided]
What happened to "feature freeze"?
How are system calls a new feature? Or is optimizing an existing feature not allowed by your definition of "feature freeze"?
Signature · 4 lines
/ | [|] Sean Neakums | Questions are a burden to others; [|] <[email protected]> | answers a prison for oneself. \ |
Quoted 3 lines · Horst von Brand
[Extremely interesting new syscall mechanism tread elided]
What happened to "feature freeze"?
I'm wondering that. 2.5.49 was usable for devel work, no kernel since has been. Its stopped IDE getting touched until January.
Linus. you are doing the slow slide into a second round of development work again, just like mid 2.3, just like 1.3.60, ...
Quoted 3 lines · Horst von Brand
[Extremely interesting new syscall mechanism tread elided]
What happened to "feature freeze"?
*bites lip* it's fairly low impact *duck*.
Given the wins seem to be fairly impressive across the board, spending a few days on getting this right isn't going to push 2.6 back any noticable amount of time.
This stuff is mostly of the case "it either works, or it doesn't". And right now, corner cases like apm aside, it seems to be holding up so far. This isn't as far reaching as it sounds. There are still drivers being turned upside down which are changing things in a lot bigger ways than this[1]
Dave
[1] Myself being one of the guilty parties there, wrt agp.
Signature · 1 line
| Dave Jones. http://www.codemonkey.org.uk
Freezing.. (was Re: Intel P6 vs P7 system call performance)
Quoted 6 lines · Dave Jones
Quoted 3 lines · Horst von Brand
[Extremely interesting new syscall mechanism tread elided]
What happened to "feature freeze"?
*bites lip* it's fairly low impact *duck*.
However, it's a fair question.
I've been wondering how to formalize patch acceptance at code freeze, but it might be a good idea to start talking about some way to maybe put brakes on patches earlier, ie some kind of "required approval process".
I think the system call thing is very localized and thus not a big issue, but in general we do need to have something in place.
I just don't know what that "something" should be. Any ideas? I thought about the code freeze require buy-in from three of four people (me, Alan, Dave and Andrew come to mind) for a patch to go in, but that's probably too draconian for now. Or is it (maybe start with "needs approval by two" and switch it to three when going into code freeze)?
Linus
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
Quoted 3 lines
I've been wondering how to formalize patch acceptance at code freeze, but it might be a good idea to start talking about some way to maybe put brakes on patches earlier, ie some kind of "required approval process".
We went through this here for the bk-3.0 release. We're a much smaller team so this may not work at all for you, but it was very successful for us, so much so that we are looking at formalizing it in BK. But you can apply the same process outside of BK just fine.
We created a well known spot for pending patches; all reviewers need access to that spot. Here's the README from that directory:
There should be the following subdirectories here
ready/ -> waiting on review
done/ -> in the tree
rejected/ -> no good
In the ready/ subdirectory, for each repository which has changes that want to be in bk-3.0 but are not, I want:
ready/atrev -> /home/bk/wscott/bk-3.0-atrev ready/atrev.RTI ready/atrev.REVIEWED
The first is a symlink to the location of the repository.
The second is an RTI request which describes what is in the repo and why it should go in.
The third contains the review comments in the form
lm (approved|not approved)
review comments
wscott (approved|not approved)
review comments
etc.
Once the REVIEWED file contains enough approvals, in the judgement of the gatekeeper, then he pulls the repo into the bk-3.0 tree and moves the 3 files from ready/* to done/*
The things which worked very well were:
a) extremely simple. As we added developers they understood right away what the process was.
b) centralized location. Anyone could be bored and go do a review.
c) tight control on the tree.
We're thinking about formalizing this in the context of BK as follows:
NAME
bk queue - manage the queue of pending changes
DESCRIPTION
bk queue is used to manage a queue of changes to a repository. It is typically used on integration repositories where tighter controls on change are desirable.
In all commands, if no URL is specified, the implied URL is the parent of the current repository, if any. The URL "." means this repository.
XXX - need a large paragraph on the importance of not circulating changesets which are in review state. They'll come back.
bk queue [-n<name>] [-R<rti>] [<URL>]
This is like a bk push but wants a "request to integrate" (RTI) which is sent with the changes. It also wants a name for the set of changes. All pending changesets are pushed.
If no name is given, the user is prompted for one. If no
RTI is given, the user is prompted for one.
bk queue -l [-n<name>] [<URL>]
Lists the set of pending changes in the queue like so:
<name> <date> <user> <state>
Values for the <state> field:
unreviewed - nobody has looked at it yet reviewed by <reviewer> on <date> - obvious accepted - it is in accepted state but not integrated rejected - reviewed and rejected
Note that if there are multiple reviewers of a change, there will be multiple lines in the listing for that change.
If the <name> arg is present then restrict the listing to that name. If the <name> arg is present more than once, restrict the listing to the set of named changes.
Could also have a -s<state> option which restricts the listing to those changes in <state> state.
bk queue -pR [-o<file>] <name> [<URL>]
Retrieves and displays the RTI for change <name>. If <file> is specified, put the form there.
bk queue -pr [-o<file>] [-u<user>] <name> [<URL>]
Retrieves and displays the review form[s] for change <name>. If a user is specified, retrieve that users' review only. If <file> is specified, put the form there.
bk queue -uR [<rti>] [<URL>]
Replaces any existing RTI with the specified RTI. If no RTI is specified, it prompts you for one like bk setup does.
bk queue -ur [<review>] [<URL>]
Adds or replaces any existing review form with the specified review. If no review is specified, it prompts you for one like bk setup does. You may only replace your own reviews.
bk queue -O[<owner>] [<URL>]
Sets the owner of the repository to <owner>. Only the owner may update the repository. Only the current owner can change the ownership. If no owner is specified and there is an owner and the caller is the owner, then delete the owner. (This is nothing more than a pre-{incoming,commit}-owner trigger)
bk queue -d<name> [-f] [<URL>]
Delete the named change from the queue. This deletes EVERYTHING, the patch, rti, reviews, everything. Only the submitter of the change may delete the change unless the -f option is supplied.
bk queue -U<name> [-R<rti>] [<URL>]
Replace the changes in the queue <name> with the set of changesets in the current repository. If the <rti> is present, replace the current RTI form with the specified form. All reviews, if any, are updated with a note that indicates the existing review was against changes which have been replaced.
GUI
This is a command line tool; Bryan gets to do bk queuetool using these interfaces.
TODO
- how do we merge?
- define a format for the RTI
- define a format for reviews
- should the RTI & review files be KV files?
- should the {name/RTI/REVIEWS} live as part of the repo and be propogated? I think yes for upstream propogation, no for downstream. Hard to say.
- need a way to add a queue item with no changes, i.e., an RFE which needs to be in the tree but there are no changes yet.
FILES
BitKeeper/queue/<name>/CSETS - changeset keys for change <name> BitKeeper/queue/<name>/RTI - RTI for change <name> BitKeeper/queue/<name>/PATCH - BK patch for change <name> BitKeeper/queue/<name>/RESYNC - exploded patch for change <name> BitKeeper/queue/<name>/review.user - review by user for change <name>
Signature · 2 lines
--- Larry McVoy lm at bitmover.com http://www.bitmover.com/lm
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
In reply to Linus TorvaldsQuoted 3 lines · Linus Torvalds
Quoted 2 lines
Quoted 1 line
What happened to "feature freeze"?
*bites lip* it's fairly low impact *duck*.
However, it's a fair question.
Indeed. Were you merging something like preempt at this stage, I'd be wondering if you'd broken out the eggnog a little too soon.
Quoted 5 lines
I just don't know what that "something" should be. Any ideas? I thought about the code freeze require buy-in from three of four people (me, Alan, Dave and Andrew come to mind) for a patch to go in, but that's probably too draconian for now. Or is it (maybe start with "needs approval by two" and switch it to three when going into code freeze)?
You'd likely need an odd number of folks in this cabal^Winner circle though, or would you just do it and be damned if you got an equal number of 'aye's and 'nay's ? 8-)
Other than that, it reminds me of the way the gcc folks work, with a number of people reviewing patches before acceptance [not that this doesn't happen on l-k already], and at least 1 approval from someone prepared to approve submissions.
The approval process does seem to be quite a lot of work though. I think it was rth last year at OLS who told me that at that time he'd been doing more approving of other peoples stuff than coding himself.
Dave
Signature · 2 lines
| Dave Jones. http://www.codemonkey.org.uk | SuSE Labs
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
Quoted 10 lines · Dave Jones
Quoted 6 lines
I just don't know what that "something" should be. Any ideas? I thought about the code freeze require buy-in from three of four people (me, Alan, Dave and Andrew come to mind) for a patch to go in, but that's probably too draconian for now. Or is it (maybe start with "needs approval by two" and switch it to three when going into code freeze)?
You'd likely need an odd number of folks in this cabal^Winner circle though, or would you just do it and be damned if you got an equal number of 'aye's and 'nay's ? 8-)
Quite frankly, I wouldn't expect a lot of dissent.
I suspect a group approach has very little inherent disagreement, and to me the main result of having an "approval process" is to really just slow things down and make people think about the submitting. The actual approval itself is secondary (it _looks_ like a primary objective, but in real life it's just the _existence_ of rules that make more of a difference).
Quoted 3 lines
The approval process does seem to be quite a lot of work though. I think it was rth last year at OLS who told me that at that time he'd been doing more approving of other peoples stuff than coding himself.
I heartily disagree with the approval process for development, just because it gets so much in the way and just annoys people. But for stabilization, that's exactly what you want. So I think gcc is using the approval process much too much, but apparently it works for them.
And I think it could work for the kernel too, especially the stable releases and for the process of getting there. I just don't really know how to set it up well.
Linus
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
Quoted 10 lines · Linus Torvalds
Quoted 3 lines · Dave Jones
The approval process does seem to be quite a lot of work though. I think it was rth last year at OLS who told me that at that time he'd been doing more approving of other peoples stuff than coding himself.
I heartily disagree with the approval process for development, just because it gets so much in the way and just annoys people. But for stabilization, that's exactly what you want. So I think gcc is using the approval process much too much, but apparently it works for them.
gcc's approval process looks a lot like the Linux approval process. Dave's description of rth's work sounds a lot like the Linus Role in Linux... with the exception I guess that there are multiple peer Linii in gcc, and they read every patch <runs for cover> More seriously, gcc appears to be "post the patch to gcc-patches, hope someone applies it" which is a lot more like Linux than some think :)
Jeff
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
Quoted 1 line · Jeff Garzik
Linux... with the exception I guess that there are multiple peer Linii
Perhaps this is the solution. Would someone please obtain a DNA sample from Linus?
Mike
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
[email protected] (Mike Dresser) wrote on 18.12.02 in <Pine.LNX.4.33.0212181308380.11644-100000@router.windsormachine.com>:
Quoted 6 lines · Jeff Garzik
Quoted 2 lines
Linux... with the exception I guess that there are multiple peer Linii
Perhaps this is the solution. Would someone please obtain a DNA sample from Linus?
It's been in the works for quite some time now, I gather, but the process is expected to take maybe two decades more before the first candidate becomes available.
It *was* announced here, however.
MfG Kai
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
In reply to Linus TorvaldsQuoted 3 lines
And I think it could work for the kernel too, especially the stable releases and for the process of getting there. I just don't really know how to set it up well.
A start might be
1. Ack large patches you don't want with "Not for 2.6" instead
of ignoring them. I'm bored of seeing the 18th resend of this and that wildly bogus patch.
Then people know the status
2. Apply patches only after they have been approved by the maintainer
of that code area.
Where it is core code run it past Andrew, Al and other people with extremely good taste.
3. Anything which changes core stuff and needs new tools, setup
etc please just say NO to for now. Modules was a mistake (hindsight I grant is a great thing), but its done. We don't want any more
4. Violate 1-3 when appropriate as always, but preferably not to
often and after consulting the good taste department 8)
Alan
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
Make it async. So anyone can review stuff and record their feelings in a centralized place. We have a spare machine set up, kernel.bkbits.net, that could be used as a dumping grounds for patches and reviews if master.kernel.org is too locked down.
If you force the review process into a "push" model where patches are sent to someone, then you are stuck waiting for them to review it and it may or may not happen. Do the reviews in a centralized place where everyone can see them and add their own comments.
Quoted 32 lines · Alan Cox
Quoted 3 lines
And I think it could work for the kernel too, especially the stable releases and for the process of getting there. I just don't really know how to set it up well.
A start might be
1. Ack large patches you don't want with "Not for 2.6" instead
of ignoring them. I'm bored of seeing the 18th resend of this and that wildly bogus patch.Then people know the status
2. Apply patches only after they have been approved by the maintainer
of that code area.Where it is core code run it past Andrew, Al and other people with extremely good taste.
3. Anything which changes core stuff and needs new tools, setup
etc please just say NO to for now. Modules was a mistake (hindsight I grant is a great thing), but its done. We don't want any more4. Violate 1-3 when appropriate as always, but preferably not to
often and after consulting the good taste department 8)Alan
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 2 lines
--- Larry McVoy lm at bitmover.com http://www.bitmover.com/lm
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
We've got one - its called linux-kernel.
Alan
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
Quoted 1 line · Alan Cox
We've got one - its called linux-kernel.
Huh? That's like saying "we don't need a bug database, we have a mailing list". That's patently wrong and so is your statement. If you want reviews you need some place to store them. A mailing list isn't storage.
You'll do it however you want of course, but you are being stupid about it. Why is that?
Signature · 2 lines
--- Larry McVoy lm at bitmover.com http://www.bitmover.com/lm
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
Quoted 9 lines · Alan Cox
Quoted 1 line
We've got one - its called linux-kernel.
Huh? That's like saying "we don't need a bug database, we have a mailing list". That's patently wrong and so is your statement. If you want reviews you need some place to store them. A mailing list isn't storage.
You'll do it however you want of course, but you are being stupid about it. Why is that?
We've got a bug database (bugzilla), we've got a system for seeing what opinion appears to be -kernel-list
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
Quoted 7 lines · Alan Cox
Quoted 7 lines · Alan Cox
Quoted 1 line
We've got one - its called linux-kernel.
Huh? That's like saying "we don't need a bug database, we have a mailing list". That's patently wrong and so is your statement. If you want reviews you need some place to store them. A mailing list isn't storage.
Quoted 5 lines
Quoted 2 lines
You'll do it however you want of course, but you are being stupid about it. Why is that?
We've got a bug database (bugzilla), we've got a system for seeing what opinion appears to be -kernel-list
And exactly how is your statement different than
"we have a system for seeing what bugs appear to be -kernel-list"
?
Signature · 2 lines
--- Larry McVoy lm at bitmover.com http://www.bitmover.com/lm
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
Quoted 12 lines · Alan Cox
Quoted 11 lines
Quoted 10 lines · Alan Cox
Quoted 1 line
We've got one - its called linux-kernel.
Huh? That's like saying "we don't need a bug database, we have a mailing list". That's patently wrong and so is your statement. If you want reviews you need some place to store them. A mailing list isn't storage.
You'll do it however you want of course, but you are being stupid about it.
Why is that?
Quoted 8 lines
Quoted 2 lines
We've got a bug database (bugzilla), we've got a system for seeing what opinion appears to be -kernel-list
And exactly how is your statement different than
"we have a system for seeing what bugs appear to be -kernel-list"
?
This forthcoming BK-related flamewar falls in to category 1, I.E. is not a 2.6 feature :-)
John.
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
Quoted 7 lines
Quoted 4 lines
And exactly how is your statement different than
"we have a system for seeing what bugs appear to be -kernel-list"
?This forthcoming BK-related flamewar falls in to category 1, I.E. is not a 2.6 feature :-)
I don't understand why BK is part of the conversation. It has nothing to do with it. If every time I post to this list the assumption is that it's "time to beat larry up about BK" then it's time for me to get off the list.
I can understand it when we're discussing BK; other than that, it's pretty friggin lame. If that's what was behind your posts, Alan, there is an easy procmail fix for that.
Signature · 2 lines
--- Larry McVoy lm at bitmover.com http://www.bitmover.com/lm
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
Quoted 10 lines
Quoted 2 lines
This forthcoming BK-related flamewar falls in to category 1, I.E. is not a 2.6 feature :-)
I don't understand why BK is part of the conversation. It has nothing to do with it. If every time I post to this list the assumption is that it's "time to beat larry up about BK" then it's time for me to get off the list.
I can understand it when we're discussing BK; other than that, it's pretty friggin lame. If that's what was behind your posts, Alan, there is an easy procmail fix for that.
My interpretation was that that is what he meant. If I was wrong, I appologise.
I was trying to point out in an amusing way that a repeat of the BK flamewar we've seen on LKML was inappropriate.
John.
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
Quoted 2 lines · John Bradford
I was trying to point out in an amusing way that a repeat of the BK flamewar we've seen on LKML was inappropriate.
I got the joke but I don't have a US postal address 8)
More seriously we have defect tracking now - > bugzilla.kernel.org We have an advanced scalable groupware communication environment (email)
How the actual patches get applied really isnt relevant. I know Linus hated jitterbug, Im guessing he hates bugzilla too ?
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
Quoted 2 lines · Alan Cox
How the actual patches get applied really isnt relevant. I know Linus hated jitterbug, Im guessing he hates bugzilla too ?
I'm waiting for the kernel bugzilla to become useful - currently the record for me has been:
3 bugs total
3 bugs for serial code for drivers I don't maintain, reassigned to mbligh.
This means I write (choose one):
1. non-buggy code (highly unlikely)
2. code no one tests
3. code people do test but report via other means (eg, email, irc)
If it's (3), which it seems to be, it means that bugzilla is failing to do its job properly, which is most unfortunate.
Signature · 2 lines
Russell King ([email protected]) The developer of ARM Linux http://www.arm.linux.org.uk/personal/aboutme.html
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
Quoted 5 lines · Russell King
This means I write (choose one):
3. code people do test but report via other means (eg, email, irc)If it's (3), which it seems to be, it means that bugzilla is failing to do its job properly, which is most unfortunate.
Given that it started around Halloween, I would at least give it a chance before claiming its failure. :)
IMO Bugzilla is gonna become even more useful as the code freeze hits, and there are bugs we want to track until we get around to fixing them...
Jeff
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
In reply to Russell KingQuoted 8 lines
This means I write (choose one):
1. non-buggy code (highly unlikely)
2. code no one tests
3. code people do test but report via other means (eg, email, irc)If it's (3), which it seems to be, it means that bugzilla is failing to do its job properly, which is most unfortunate.
Not everyone will end up using it ... if people want to log bugs from lkml into bugzilla, I think that'd help gather a critical mass.
Are you getting a lot of bug-reports for serial code on lkml? I use it heavily, and it seems to work just fine to me .... so I pick (1). Yay! ;-)
Some of the bugs in there lie fallow, but I've seen quite a few get fixed. The fact that some people (Dave Jones springs to mind) trawl through there being extremely helpful fixing things is very useful ;-) Lots of things got fixed, though I can't *prove* it was solely due to it being in Bugzilla.
As the list of bugs increases, it'll become an increasingly powerful search engine for information as well .... I'll draw up a list of things that don't seem to being worked on, and mail it out to kernel-janitors and/or lkml and see if people are interested in fixing some of the fallow stuff.
M.
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
In reply to Russell KingQuoted 9 lines · Russell King
Quoted 2 lines · Alan Cox
How the actual patches get applied really isnt relevant. I know Linus hated jitterbug, Im guessing he hates bugzilla too ?
I'm waiting for the kernel bugzilla to become useful - currently the record for me has been:
3 bugs total
3 bugs for serial code for drivers I don't maintain, reassigned to mbligh.
That was unfortunate, and you got dumped with those because some thought "Ah, serial! RMK!". Some of the categories in bugzilla still need broadening IMO.
Quoted 7 lines
This means I write (choose one):
1. non-buggy code (highly unlikely)
2. code no one tests
3. code people do test but report via other means (eg, email, irc)If it's (3), which it seems to be, it means that bugzilla is failing to do its job properly, which is most unfortunate.
It's early days. The types of bugs being filed still fall into the "useful" "not useful" categories though. I don't think it's really that important that we track what doesn't compile at this stage. Those reports are being either closed within a few hours of them being opened with a "Fixed in BK", or are drivers which no-one currently wants to fix/can fix (Things like the various sti/cli breakage)
Dave
Signature · 2 lines
| Dave Jones. http://www.codemonkey.org.uk | SuSE Labs
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
In reply to Alan CoxQuoted 4 lines
Quoted 2 lines
I was trying to point out in an amusing way that a repeat of the BK flamewar we've seen on LKML was inappropriate.
I got the joke but I don't have a US postal address 8)
Eh??? US postal address? What!? Now I am really confused.
Quoted 5 lines
More seriously we have defect tracking now - > bugzilla.kernel.org We have an advanced scalable groupware communication environment (email)
How the actual patches get applied really isnt relevant. I know Linus hated jitterbug, Im guessing he hates bugzilla too ?
I don't like bugzilla particularly, it's too clunky, and it's difficult to check that you are not entering a duplicate bug when the database gets too big. Maybe that's just my opinion, though. Maybe I should write a better bug tracking system...
John.
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
Quoted 3 lines · John Bradford
I don't like bugzilla particularly, it's too clunky, and it's difficult to check that you are not entering a duplicate bug when the database gets too big.
File bug anyway and worry about it later. The bugzilla elves regularly go through the database cleaning up crufty bits, marking dupes, closing invalids, world peace etc etc. It seems to be holding up well so far. Of the 180 bugs filed, I think I've personally rejected <10 dupes/invalids. Other folks haven't done that many too. Here's to hoping it continues to remain high signal.
Dave
Signature · 1 line
| Dave Jones. http://www.codemonkey.org.uk
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
In reply to Alan CoxQuoted 3 lines · Alan Cox
How the actual patches get applied really isnt relevant. I know Linus hated jitterbug, Im guessing he hates bugzilla too ?
I didn't start out hating jitterbug, I tried it for a while.
I ended up not really being able to work with anything that was so email-hostile. You had to click on things from a browser, write passwords, and generally just act "gooey", instead of getting things just _done_.
If I can't do my work by email from a standard keyboard interface, it's just not worth it. Maybe bugzilla works better, but I seriously expect it to help _others_ track bugs more than it helps me.
Which is fine. We don't all have to agree on the tools or on how to track stuff. The worst we can do (I think) is to _force_ people to work some way.
[ This is where the angel chorus behind me started singing "Why can't we
all live together in peace and harmony" and put up a big banner saying "Larry [heart] Alan". At that point my fever-induced brain just said "plop" ]
Linus
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
In reply to Larry McVoyQuoted 7 lines
I don't understand why BK is part of the conversation. It has nothing to do with it. If every time I post to this list the assumption is that it's "time to beat larry up about BK" then it's time for me to get off the list.
I can understand it when we're discussing BK; other than that, it's pretty friggin lame. If that's what was behind your posts, Alan, there is an easy procmail fix for that.
It wasnt me who brought up bitkeeper
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
Quoted 10 lines
Quoted 7 lines
I don't understand why BK is part of the conversation. It has nothing to do with it. If every time I post to this list the assumption is that it's "time to beat larry up about BK" then it's time for me to get off the list.
I can understand it when we're discussing BK; other than that, it's pretty friggin lame. If that's what was behind your posts, Alan, there is an easy procmail fix for that.
It wasnt me who brought up bitkeeper
No, it's my fault - I was skimming through list traffic, and not concentrating, (proof of this is the fact that I've had sendmail configured incorrectly all day, and been posting from the wrong address, and only just realised :-) ).
I saw Larry mention kernel.bkbits.net, and Alan say, "We've got one - its called linux-kernel", (in a separate message without quoting anything, so it's really your fault :-) :-) :-) ), and assumed that a BK argument was imminent, and I made a joke comment that it, (an argument), was not a 2.6 required feature.
Sorry about the wasted bandwidth, I'll stop posting as it's now past midnight, and I obviously need sleep.
Oh, 2.4.20-pre2 compiled OK for me, I hope that proves I've done something useful tonight.
John.
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
In reply to Larry McVoyQuoted 7 lines · Larry McVoy
I don't understand why BK is part of the conversation. It has nothing to do with it. If every time I post to this list the assumption is that it's "time to beat larry up about BK" then it's time for me to get off the list.
I can understand it when we're discussing BK; other than that, it's pretty friggin lame. If that's what was behind your posts, Alan, there is an easy procmail fix for that.
Boy, talk about humor-impaired. When was the last time you got out and had some fun not related to computer, Larry?
I don't read more than 95 percent of this mailing list and I got the joke.
Lighten up, and take a hint from the nearest cat: see the toy in everything.
Satch, another relative nobody.
Signature · 3 lines
The human mind treats a new idea the way the body treats a strange protein: it rejects it. -- P. Medawar This posting is for entertainment purposes only; it is not a legal opinion.
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
In reply to Alan CoxRelated thought:
One of the things that we are trying to do is to automate
patch testing.
The PLM (www.osdl.org/plm) takes every patch that it gets
and does a quick "Does it compile test". Right now there are only 4 kernel configuration files that we try but we are going to be adding more. We could expand this to 100's if needed as it would just be a matter of adding additional hardware to make the compiles go faster in parallel.
Here is the example of the output from a baseline kernel.
http://www.osdl.org/cgi-bin/plm?module=patch_info&patch_id=986
A patch would look the same. The PASS reports are really
short and the FAIL reports just give you the configuration files and the tail of the output from the kernel make.
We've talked to a couple of system vendors about expanding
this to take the configurations that have passed and running them on their 10's of hardware platforms of interest and we would be very happy to expand this to a very large number of configurations of all sorts.
Tim
Quoted 32 lines · Alan Cox
Quoted 3 lines
And I think it could work for the kernel too, especially the stable releases and for the process of getting there. I just don't really know how to set it up well.
A start might be
1. Ack large patches you don't want with "Not for 2.6" instead
of ignoring them. I'm bored of seeing the 18th resend of this and that wildly bogus patch.Then people know the status
2. Apply patches only after they have been approved by the maintainer
of that code area.Where it is core code run it past Andrew, Al and other people with extremely good taste.
3. Anything which changes core stuff and needs new tools, setup
etc please just say NO to for now. Modules was a mistake (hindsight I grant is a great thing), but its done. We don't want any more4. Violate 1-3 when appropriate as always, but preferably not to
often and after consulting the good taste department 8)Alan
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 2 lines
Timothy D. Witham <[email protected]> Open Sourcre Development Lab, Inc
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
Quoted 6 lines · Timothy D. Witham
Related thought:
One of the things that we are trying to do is to automate
patch testing.
Quoted 6 lines
The PLM (www.osdl.org/plm) takes every patch that it gets
and does a quick "Does it compile test". Right now there are only 4 kernel configuration files that we try but we are going to be adding more. We could expand this to 100's if needed as it would just be a matter of adding additional hardware to make the compiles go faster in parallel.
It would be valuable to be able to test that things compile cleanly on non-ia32 machines. And boot, too.
That's probably a lot of ongoing work though.
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
Quoted 14 lines · Andrew Morton
Quoted 6 lines · Timothy D. Witham
Related thought:
One of the things that we are trying to do is to automate
patch testing.Quoted 6 lines
The PLM (www.osdl.org/plm) takes every patch that it gets
and does a quick "Does it compile test". Right now there are only 4 kernel configuration files that we try but we are going to be adding more. We could expand this to 100's if needed as it would just be a matter of adding additional hardware to make the compiles go faster in parallel.
Quoted 3 lines
It would be valuable to be able to test that things compile cleanly on non-ia32 machines. And boot, too.
The way the software is configured it is fairly easy to
add multiple servers (even different instruction sets) that have the complies farmed out to them.
Quoted 1 line
That's probably a lot of ongoing work though.
The largest portion of the work would be keeping
up with the breakages in the trees.
BTW I'm in Japan so my access times are going to be a little strange.
Signature · 5 lines
Timothy D. Witham - Lab Director - [email protected] Open Source Development Lab Inc - A non-profit corporation 15275 SW Koll Parkway - Suite H - Beaverton OR, 97006 (503)-626-2455 x11 (office) (503)-702-2871 (cell) (503)-626-2436 (fax)
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
In reply to Timothy D. WithamQuoted 11 lines
Related thought:
One of the things that we are trying to do is to automate
patch testing.The PLM (www.osdl.org/plm) takes every patch that it gets
and does a quick "Does it compile test". Right now there are only 4 kernel configuration files that we try but we are going to be adding more. We could expand this to 100's if needed as it would just be a matter of adding additional hardware to make the compiles go faster in parallel.
URL doesn't seem to work. But would be cool if you had one SMP config, one UP with IO/APIC, and one without IO/APIC. I seem to break the middle one whenever I write a patch ;-(
M.
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
Sorry, they changed it last week and my fingers still
have the old firmware.
www.osdl.org/cgi-bin/plm
TIm
Quoted 23 lines · Martin J. Bligh
Quoted 11 lines
Related thought:
One of the things that we are trying to do is to automate
patch testing.The PLM (www.osdl.org/plm) takes every patch that it gets
and does a quick "Does it compile test". Right now there are only 4 kernel configuration files that we try but we are going to be adding more. We could expand this to 100's if needed as it would just be a matter of adding additional hardware to make the compiles go faster in parallel.URL doesn't seem to work. But would be cool if you had one SMP config, one UP with IO/APIC, and one without IO/APIC. I seem to break the middle one whenever I write a patch ;-(
M.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 5 lines
Timothy D. Witham - Lab Director - [email protected] Open Source Development Lab Inc - A non-profit corporation 15275 SW Koll Parkway - Suite H - Beaverton OR, 97006 (503)-626-2455 x11 (office) (503)-702-2871 (cell) (503)-626-2436 (fax)
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
In reply to Linus TorvaldsQuoted 5 lines · Linus Torvalds
Quoted 4 lines
The approval process does seem to be quite a lot of work though. I think it was rth last year at OLS who told me that at that time he'd been doing more approving of other peoples stuff than coding himself.
Quoted 8 lines
I heartily disagree with the approval process for development, just because it gets so much in the way and just annoys people. But for stabilization, that's exactly what you want. So I think gcc is using the approval process much too much, but apparently it works for them.
And I think it could work for the kernel too, especially the stable releases and for the process of getting there. I just don't really know how to set it up well.
Actually, I think Marcello's got the stable process pretty well figured out without any of this committee business. And given that his credibility as 2.4 maintainer depends on his holding to the mandate to make the kernel stable, he probably doesn't have too hard a time holding the line. As benevolent dictator, you're simply not beholden to such expectations and I doubt the committee approach would work for long either.
So perhaps you should throw out a date for 'code freeze' and then plan to hand off to the 2.6 maintainer at that date.
The other piece that will help is if the timeline for 2.7 shows up around then and is short enough so that people won't despair of ever getting their big feature in.
Signature · 1 line
"Love the dolphins," she advised him. "Write by W.A.S.T.E.."
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
In reply to Linus TorvaldsQuoted 17 lines · Linus Torvalds
Quoted 6 lines · Dave Jones
Quoted 3 lines · Horst von Brand
[Extremely interesting new syscall mechanism tread elided]
What happened to "feature freeze"?
*bites lip* it's fairly low impact *duck*.
However, it's a fair question.
I've been wondering how to formalize patch acceptance at code freeze, but it might be a good idea to start talking about some way to maybe put brakes on patches earlier, ie some kind of "required approval process".
Quoted 8 lines
I think the system call thing is very localized and thus not a big issue, but in general we do need to have something in place.
I just don't know what that "something" should be. Any ideas? I thought about the code freeze require buy-in from three of four people (me, Alan, Dave and Andrew come to mind) for a patch to go in, but that's probably too draconian for now. Or is it (maybe start with "needs approval by two" and switch it to three when going into code freeze)?
Well, Linus, you're not the most conservative when it comes to freezes.
(Hey! Watch it with those thunderbolts!) Alan, on the other hand, I
would trust to be pretty conservative.
I'm afraid I haven't followed Dave & Andrew well enough in that light.
But my question is... if 2 are required, and say, Dave is as slushy on freezes as you are, then have we gained much?
Perhaps 2 of 4 approve with no dissenting votes?
If Dave and Andrew are relatively conservative on freezes, then this concern is sufficiently addressed already.
Food for thought from a relative nobody. ;)
Eli
--------------------. "If it ain't broke now,
Eli Carter \ it will be soon." -- crypto-gram
eli.carter(a)inet.com `-------------------------------------------------
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
In reply to Linus TorvaldsQuoted 15 lines · Linus Torvalds
Quoted 6 lines · Dave Jones
Quoted 3 lines · Horst von Brand
[Extremely interesting new syscall mechanism tread elided]
What happened to "feature freeze"?
*bites lip* it's fairly low impact *duck*.
However, it's a fair question.
I've been wondering how to formalize patch acceptance at code freeze, but it might be a good idea to start talking about some way to maybe put brakes on patches earlier, ie some kind of "required approval process".
Quoted 9 lines
I think the system call thing is very localized and thus not a big issue, but in general we do need to have something in place.
I just don't know what that "something" should be. Any ideas? I thought about the code freeze require buy-in from three of four people (me, Alan, Dave and Andrew come to mind) for a patch to go in, but that's probably too draconian for now. Or is it (maybe start with "needs approval by two" and switch it to three when going into code freeze)?
It does sound a little bureacratic for this point in development.
The first thing we need is a set of widely-understood guidelines. Such as:
Only
- bugfixes
- speedups
- previously-agreed-to or in-progress features
- totally new things (new drivers, new filesystems)
Once everyone understands this framework then it becomes easy to decide what to drop, what not.
So right now, sysenter is "in". Later, even "speedups" falls off the list and sysenter would at that stage be "out".
Can it be that simple?
Re: Freezing.. (was Re: Intel P6 vs P7 system call performance)
In reply to Linus TorvaldsQuoted 19 lines · Linus Torvalds
Quoted 6 lines · Dave Jones
Quoted 3 lines · Horst von Brand
[Extremely interesting new syscall mechanism tread elided]
What happened to "feature freeze"?
*bites lip* it's fairly low impact *duck*.
However, it's a fair question.
I've been wondering how to formalize patch acceptance at code freeze, but it might be a good idea to start talking about some way to maybe put brakes on patches earlier, ie some kind of "required approval process".
I think the system call thing is very localized and thus not a big issue, but in general we do need to have something in place.
Quoted 7 lines
I just don't know what that "something" should be. Any ideas? I thought about the code freeze require buy-in from three of four people (me, Alan, Dave and Andrew come to mind) for a patch to go in, but that's probably too draconian for now. Or is it (maybe start with "needs approval by two" and switch it to three when going into code freeze)?
Linus
I think there should be a distinction between changes which make an API change/new function/user interface change, versus bug fixes, adapting to new APIs, documentation, etc.
john alvord
Quoted 9 lines · Dave Jones
Quoted 3 lines · Horst von Brand
[Extremely interesting new syscall mechanism tread elided]
What happened to "feature freeze"?
*bites lip* it's fairly low impact *duck*.
Given the wins seem to be fairly impressive across the board, spending a few days on getting this right isn't going to push 2.6 back any noticable amount of time.
Ever hear Larry McVoy's [I think, please correct me if wrong] standard rant of how $UNIX_FROM_BIG_VENDOR sucks, one "almost unnoticeable performance impact" feature at a time?
Similarly, Fred Brooks tells in "The Mythical Man Month" how schedules don't slip by months, they slip a day at a time...
Quoted 9 lines
This stuff is mostly of the case "it either works, or it doesn't". And right now, corner cases like apm aside, it seems to be holding up so far. This isn't as far reaching as it sounds. There are still drivers being turned upside down which are changing things in a lot bigger ways than this[1]
Dave
[1] Myself being one of the guilty parties there, wrt agp.
Fixing a broken feature is in for me. Adding new features is supposed to be out until 2.7 opens.
Signature · 4 lines
Dr. Horst H. von Brand User #22616 counter.li.org Departamento de Informatica Fono: +56 32 654431 Universidad Tecnica Federico Santa Maria +56 32 654239 Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513
Quoted 4 lines · [email protected] said:
That also allows the kernel to move around the SYSINFO page at will, and even makes it possible to avoid it altogether (ie this will solve the inevitable problems with UML - UML just wouldn't set
AT_SYSINFO, so user level just wouldn't even _try_ to use it).
Why shouldn't I just set it to where UML provides its own SYSINFO page?
Jeff
Quoted 8 lines · Jeff Dike
Quoted 4 lines · [email protected] said:
That also allows the kernel to move around the SYSINFO page at will, and even makes it possible to avoid it altogether (ie this will solve the inevitable problems with UML - UML just wouldn't set
AT_SYSINFO, so user level just wouldn't even _try_ to use it).Why shouldn't I just set it to where UML provides its own SYSINFO page?
Sure, that works fine too.
Linus
Quoted 5 lines · Linus Torvalds
Uli, how about I just add one ne warchitecture-specific ELF AT flag, which is the "base of sysinfo page". Right now that page is all zeroes except for the system call trampoline at the beginning, but we might want to add other system information to the page in the future (it is readable, after all).
The P4 optimisation guide promises horrible things if you write within 2k of a cached instruction from another CPU (it dumps the whole trace cache, it seems), so you'd need to be careful about mixing mutable data and the syscall code in that page.
Immutable data should be fine.
J
Quoted 9 lines · Jeremy Fitzhardinge
Quoted 5 lines · Linus Torvalds
Uli, how about I just add one ne warchitecture-specific ELF AT flag, which is the "base of sysinfo page". Right now that page is all zeroes except for the system call trampoline at the beginning, but we might want to add other system information to the page in the future (it is readable, after all).
Quoted 7 lines
The P4 optimisation guide promises horrible things if you write within 2k of a cached instruction from another CPU (it dumps the whole trace cache, it seems), so you'd need to be careful about mixing mutable data and the syscall code in that page.
Immutable data should be fine.
Yes, you really want to use a second page.
-hpa
Quoted 4 lines · Jeremy Fitzhardinge
The P4 optimisation guide promises horrible things if you write within 2k of a cached instruction from another CPU (it dumps the whole trace cache, it seems), so you'd need to be careful about mixing mutable data and the syscall code in that page.
The PIII errata promise worse things with SMP and code modified as another cpu ruins it and seems to mark them WONTFIX, so there is another dragon to beware of
Hi!
Quoted 13 lines
Quoted 2 lines
(Modulo the missing syscall page I already mentioned and potential bugs in the code itself, of course ;)
Ok, I did the vsyscall page too, and tried to make it do the right thing (but I didn't bother to test it on a non-SEP machine).
I'm pushing the changes out right now, but basically it boils down to the fact that with these changes, user space can instead of doing an
int $0x80instruction for a system call just do a
Quoted 7 lines
call 0xfffff000instead. The vsyscall page will be set up to use sysenter if the CPU supports it, and if it doesn't, it will just do the old "int $0x80" instead (and it could use the AMD syscall instruction if it wants to). User mode shouldn't know or care, the calling convention is the same as it ever was.
Perhaps it makes sense to define that gettimeofday is done by
call 0xfffff100,
NOW? So we can add vsyscalls later?
Pavel
Signature · 2 lines
Worst form of spam? Adding advertisment signatures ala sourceforge.net. What goes next? Inserting advertisment *into* email?
Quoted 3 lines · Mike Hayward
Any ideas? Not sure I want to upgrade to the P7 architecture if this is right, since for me system calls are probably more important than raw cpu computational power.
This is the same for me. I'm extremely uninterested in the P-IV for my own use because of this.
Bill
Hi Bill,
Quoted 7 lines · Mike Hayward
Quoted 3 lines
Any ideas? Not sure I want to upgrade to the P7 architecture if this is right, since for me system calls are probably more important than raw cpu computational power.
This is the same for me. I'm extremely uninterested in the P-IV for my own use because of this.
I've also noticed that algorithms like the recursive one I run which simulates solving the Tower of Hanoi problem are most likely very hard to do branch prediction on. Both the code and data no doubt fit entirely in the L2 cache. The AMD processor below is a much lower cost and significantly lower clock rate (and on a machine with only a 100Mhz Memory bus) than the Xeon, yet dramatically outperforms it with the same executable, compiled with gcc -march=i686 -O3. Maybe with a better Pentium 4 optimizing compiler the P4 and Xeon could improve a few percent, but I doubt it'll ever see the AMD numbers.
Recursion Test--Tower of Hanoi
Uni AMD XP 1800 2.4.18 kernel 46751.6 lps (10 secs, 6 samples) Dual Pentium 4 Xeon 2.4Ghz 2.4.19 kernel 33661.9 lps (10 secs, 6 samples)
- Mike
Quoted 10 lines · Mike Hayward
Hi Bill,
Quoted 7 lines · Mike Hayward
Quoted 3 lines
Any ideas? Not sure I want to upgrade to the P7 architecture if this is right, since for me system calls are probably more important than raw cpu computational power.
This is the same for me. I'm extremely uninterested in the P-IV for my own use because of this.
Quoted 9 lines
I've also noticed that algorithms like the recursive one I run which simulates solving the Tower of Hanoi problem are most likely very hard to do branch prediction on. Both the code and data no doubt fit entirely in the L2 cache. The AMD processor below is a much lower cost and significantly lower clock rate (and on a machine with only a 100Mhz Memory bus) than the Xeon, yet dramatically outperforms it with the same executable, compiled with gcc -march=i686 -O3. Maybe with a better Pentium 4 optimizing compiler the P4 and Xeon could improve a few percent, but I doubt it'll ever see the AMD numbers.
What GCC were you using? I'd use 3.2, or 3.2.1 myself with -march=pentium4 and -mcpu=pentium4 to see if there *is* any difference there. On my quad P4 Xeon 1.6Ghz with 1M L3 cache, I can compile a kernel in about 35 seconds. Mind you that's my own config, not *everything*. On a dual athlon MP at 1.8 Ghz, I get about 5 mins or so. Both are running with make -jx where X is the saturation value.
Quoted 11 lines
Recursion Test--Tower of Hanoi
Uni AMD XP 1800 2.4.18 kernel 46751.6 lps (10 secs, 6 samples) Dual Pentium 4 Xeon 2.4Ghz 2.4.19 kernel 33661.9 lps (10 secs, 6 samples)- Mike
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 1 line
GrandMasterLee <[email protected]>
Quoted 4 lines · GrandMasterLee
there. On my quad P4 Xeon 1.6Ghz with 1M L3 cache, I can compile a kernel in about 35 seconds. Mind you that's my own config, not *everything*. On a dual athlon MP at 1.8 Ghz, I get about 5 mins or so. Both are running with make -jx where X is the saturation value.
Something seems odd about the athlon MP time, I've got a celeron 533 with slow disks that does a pretty standard make dep ; make of 2.4.20 in 7m05, which is not that much different considering it's a third the speed, and one cpu instead of two.
The single P4/2.53 in another machine can haul down in 3m17s
Guess our kernel .config's or version must vary greatly.
Mike
Quoted 2 lines · Mike Dresser
The single P4/2.53 in another machine can haul down in 3m17s
Amend that to 2m19s, forgot to kill a background backup that was moving files around at about 20 meg a second.
Mike
Quoted 6 lines · Mike Dresser
Quoted 2 lines · Mike Dresser
The single P4/2.53 in another machine can haul down in 3m17s
Amend that to 2m19s, forgot to kill a background backup that was moving files around at about 20 meg a second.
Note that there are more factors at play than raw cpu speed in a kernel compile. Your time here is slightly faster than my 2.8Ghz P4-HT for example. My guess is you have faster disk(s) than I do, as most of the time mine seems to be waiting for something to do.
*note also that this is compiling stock 2.4.20 with default configuration. The minute you change any options, we're comparings apples to oranges.
Dave
Signature · 2 lines
| Dave Jones. http://www.codemonkey.org.uk | SuSE Labs
Quoted 4 lines · Dave Jones
Note that there are more factors at play than raw cpu speed in a kernel compile. Your time here is slightly faster than my 2.8Ghz P4-HT for example. My guess is you have faster disk(s) than I do, as most of the time mine seems to be waiting for something to do.
Quantum Fireball AS's in that machine. My main comment was that his Althon MP at 1.8 was half or less the speed of a single P4. Even with compiler changes, I wouldn't think it would make THAT much of a difference?
Mike
Quoted 10 lines · Dave Jones
Quoted 6 lines · Mike Dresser
Quoted 2 lines · Mike Dresser
The single P4/2.53 in another machine can haul down in 3m17s
Amend that to 2m19s, forgot to kill a background backup that was moving files around at about 20 meg a second.
Quoted 4 lines
Note that there are more factors at play than raw cpu speed in a kernel compile. Your time here is slightly faster than my 2.8Ghz P4-HT for example. My guess is you have faster disk(s) than I do, as most of the time mine seems to be waiting for something to do.
An easy way to level the playing field would be to use /dev/shm to build your kernel in. That way it's all in memory. If you've got a maching with 512M, then it's easily accomplished.
Quoted 4 lines
*note also that this is compiling stock 2.4.20 with default configuration. The minute you change any options, we're comparings apples to oranges.
Dave
Quoted 11 lines · On 2002.12.14 GrandMasterLee wrote:
Quoted 7 lines · Dave Jones
Quoted 6 lines · Mike Dresser
Quoted 2 lines · Mike Dresser
The single P4/2.53 in another machine can haul down in 3m17s
Amend that to 2m19s, forgot to kill a background backup that was moving files around at about 20 meg a second.
Quoted 9 lines
Quoted 4 lines
Note that there are more factors at play than raw cpu speed in a kernel compile. Your time here is slightly faster than my 2.8Ghz P4-HT for example. My guess is you have faster disk(s) than I do, as most of the time mine seems to be waiting for something to do.
An easy way to level the playing field would be to use
/dev/shmto build your kernel in. That way it's all in memory. If you've got a maching with 512M, then it's easily accomplished.
tmpfs does not guarantee you that it is always in ram. It also can be paged. An easier way is to fill you page cache with the kernel tree like
werewolf:/usr/src/linux# grep -v -r "" *
and then build, so no disk read will be trown.
Signature · 4 lines
J.A. Magallon <[email protected]> \ Software is like sex: werewolf.able.es \ It's better when it's free Mandrake Linux release 9.1 (Cooker) for i586 Linux 2.4.20-jam1 (gcc 3.2 (Mandrake Linux 9.1 3.2-4mdk))
Hi!
Quoted 6 lines
Quoted 3 lines
Any ideas? Not sure I want to upgrade to the P7 architecture if this is right, since for me system calls are probably more important than raw cpu computational power.
This is the same for me. I'm extremely uninterested in the P-IV for my own use because of this.
Well, then you should fix the kernel so that syscalls are done by sysenter (or how is it called).
Pavel
Signature · 2 lines
Worst form of spam? Adding advertisment signatures ala sourceforge.net. What goes next? Inserting advertisment *into* email?
Quoted 2 lines · At some point in the past, I wrote:
Quoted 2 lines
This is the same for me. I'm extremely uninterested in the P-IV for my own use because of this.
Quoted 3 lines · Pavel Machek
Well, then you should fix the kernel so that syscalls are done by sysenter (or how is it called).
Pavel
ABI is immutable. I actually run apps at home.
sysenter is also unusable for low-level loss-of-state reasons mentioned elsewhere in this thread.
Nice try, though.
Bill
Hi!
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
This is the same for me. I'm extremely uninterested in the P-IV for my own use because of this.
Well, then you should fix the kernel so that syscalls are done by sysenter (or how is it called).
PavelABI is immutable. I actually run apps at home.
Perhaps that one killer app can be recompiled?
Quoted 2 lines
sysenter is also unusable for low-level loss-of-state reasons mentioned elsewhere in this thread.
Well, disabling v86 may be well wroth it :-).
Pavel
Signature · 2 lines
Casualities in World Trade Center: ~3k dead inside the building, cryptography in U.S.A. and free speech in Czech Republic.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 8 lines · Sean Neakums
commence Horst von Brand quotation:
Quoted 3 lines
[Extremely interesting new syscall mechanism tread elided]
What happened to "feature freeze"?
How are system calls a new feature? Or is optimizing an existing feature not allowed by your definition of "feature freeze"?
This "optimizing" is very much userspace-visible, and a radical change in an interface this fundamental counts as a new feature in my book.
Signature · 4 lines
Dr. Horst H. von Brand User #22616 counter.li.org Departamento de Informatica Fono: +56 32 654431 Universidad Tecnica Federico Santa Maria +56 32 654239 Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513
From: "Horst von Brand" <[email protected]>
Quoted 5 lines
Quoted 2 lines
How are system calls a new feature? Or is optimizing an existing feature not allowed by your definition of "feature freeze"?
This "optimizing" is very much userspace-visible, and a radical change in an interface this fundamental counts as a new feature in my book.
Since int 0x80 is supported/ will be supported for the next 20 years, I dont think this is a radical change.
No userspace visible at all.
You are free to use the old way of calling the kernel...
Quoted 5 lines · Horst von Brand
Quoted 2 lines · Sean Neakums
How are system calls a new feature? Or is optimizing an existing feature not allowed by your definition of "feature freeze"?
This "optimizing" is very much userspace-visible, and a radical change in an interface this fundamental counts as a new feature in my book.
Since operating systems like WIN32 are at least published to take advantage of SYSENTER, it may not be in Linux's interest to purposefully use a slower interface until 2.8 (how long will that be until people can use?). The last thing I want to read about in a technical journal is how WIN32 has lower system call overhead than Linux on IA-32 architectures. That might just be selfish of me for the Linux community... :-)
mark
Signature · 9 lines
[email protected]/[email protected]/[email protected] __________________________ . . _ ._ . . .__ . . ._. .__ . . . .__ | Neighbourhood Coder |\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ | | | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, Ontario, Canada One ring to rule them all, one ring to find them, one ring to bring them all and in the darkness bind them... http://mark.mielke.cc/