[PATCH 2/2] Add VDSO version of sched_getcpu on powerpc

Ryan S. Arnold ryan.arnold@gmail.com
Tue Jan 8 18:44:00 GMT 2013


On Mon, Jan 7, 2013 at 3:53 PM, Carlos O'Donell <carlos@systemhalted.org> wrote:
> Ensuring you have the feature available is an important
> part of the patch :-)
>
> If the minimum kernel version is new enough that you
> are guaranteed to have the feature then you don't
> need to use an __ASSUME_* macro.

Looking into this a bit more, the following line, I believe is incorrect.

+  __vdso_getcpu = _dl_vdso_vsym ("__kernel_getcpu", &linux2615);

Considering that __kernel_getcpu for powerpc went into the Linux
kernel last July (3.5), I believe this should be:

PREPARE_VERSION (linux35, "LINUX_3.5", 61765365);
__vdso_getcpu = _dl_vdso_vsym ("__kernel_getcpu", &linux35);

In the event that such a symbol isn't available in the vdso symbol
table (as-in, the kernel doesn't support it), _vdso_getcpu will be
null, and later when [INLINE|INTERNAL]_VSYSCALL(getcpu, ...) is called
and it is discovered that __vdso_getcpu is NULL the regular syscall
fallback will be used instead.

Also, as far as I can tell, the getcpu syscall has been around since
2.6.9 for PowerPC so no ASSUME_ is necessary.  Apparently (?) it
wasn't available for x86_64 until Linux Kernel 3.1 (hence the
necessity of the __ASSUME_GETCPU_SYSCALL check).

Ryan



More information about the Libc-alpha mailing list