get_current is __pure__, maybe __const__ even
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 7 lines · Albert Cahalan
Quoted 3 lines · Andi Kleen
Please CSE "current" manually. It generates
much better code on some architectures
because the compiler cannot do it for you.This looks fixable.
I tried it some years ago, but I ran into problems with the scheduler and some other code and dropped it.
One problem is that gcc doesn't have a "drop all const/pure cache values" barrier. Without this I don't think it can be safely implemented.
-Andi
Quoted 4 lines · Andi Kleen
Quoted 2 lines · Albert Cahalan
Andi Kleen writes:
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Please CSE "current" manually. It generates
much better code on some architectures
because the compiler cannot do it for you.This looks fixable.
I tried it some years ago, but I ran into problems with the scheduler and some other code and dropped it.
Since then, have you changed:
a. the minimum required compiler version? b. the clobbers on your switch_to asm?
If not, maybe you should.
Quoted 3 lines
One problem is that gcc doesn't have a "drop all const/pure cache values" barrier. Without this I don't think it can be safely implemented.
That's only if gcc can find some place to hide state which will contaminate another task. Where could that be? Remember, arm works.
Also, glibc works, with per-thread errno:
/* Function to get address of global `errno' variable. */ extern int *__errno_location (void) __THROW __attribute__ ((__const__));
/* Function to get address of global `h_errno' variable. */ extern int *__h_errno_location (void) __THROW __attribute__ ((__const__));
Quoted 4 lines · Andi Kleen
Quoted 2 lines · Albert Cahalan
Andi Kleen writes:
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Please CSE "current" manually. It generates
much better code on some architectures
because the compiler cannot do it for you.This looks fixable.
I tried it some years ago, but I ran into problems with the scheduler and some other code and dropped it.
Right now, I'm thinking the switch_to assembly has bad asm constraints.
I count 8 items passed in or out of the asm. I count 11 clobbers. You don't have 19 registers.
If you pass something in and then destroy it, you're supposed to use a dummy output. Look at the i386 version, where esi and edi are dummy outputs for this reason.
I recall seeing i386 compilers complain about clobbered inputs. I guess the x86-64 gcc needs to have this warning added?
Quoted 2 lines
I count 8 items passed in or out of the asm. I count 11 clobbers. You don't have 19 registers.
Read it again. Many of the input arguments are not registers, but "i" or "m"
Quoted 3 lines
I recall seeing i386 compilers complain about clobbered inputs. I guess the x86-64 gcc needs to have this warning added?
All gcc ports use the same code for this, no difference.
-Andi