Re: FOR REVIEW: New x86-64 vsyscall vgetcpu()

Andi Kleen
2006-06-19T08:21:07Z

On Monday 19 June 2006 02:15, Paul Jackson wrote:

>
> Roughly, he was looking to support something resembling the kernel's
> per-cpu data in userland library code for high performance scientific
> number crunching, for things like statistics gathering and perhaps (not
> sure of this) reduce locking costs.

While vgetcpu() can be used for this most likely glibc TLS is already
good enough for this. So it will help, but I don't think it's the primary
motivation.

> I see "x86-64" in the Subject. I don't see why this facility is
> arch-specific. Could it work on any arch, ia64 being the one of
> interest to me?

The implementation is x86-64 specific and optimized for x86-64. You could
probably implement something with the same prototype for IA64 too,
although the internal implementation will likely be very different
(there is nothing x86-64 specific in the prototype)

AFAIK ia64 supports fast system calls so it might be possible to
do a simple implementation without vsyscalls.

> I have some ignorance on your references to "CPUID(1)". I don't recall
> what it is. The only command so named I find on my systems are a

CPUID 1 is a x86 instruction that is one way to implement a user level
vgetcpu on x86.

-Andi