This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: X86-64 vsyscall is removed from Linux kernel 3.1.


On Mon, Aug 29, 2011 at 12:05 PM, Ulrich Drepper <drepper@gmail.com> wrote:
> On Wed, Aug 24, 2011 at 10:53, H.J. Lu <hjl.tools@gmail.com> wrote:
>> X86-64 vsyscall has been removed from Linux kernel 3.1 and
>> has been emulated with syscall instruction. ?So for kernel 3.1
>> and above, vsyscall is slower than direct syscall instruction.
>> I think glibc should try vdso first and fall back to direct syscall
>> instruction.
>
> That's already done. ?Where do you think there is a problem?
>

There are:

#ifdef SHARED
void *gettimeofday_ifunc (void) __asm__ ("__gettimeofday");

void *
gettimeofday_ifunc (void)
{
  PREPARE_VERSION (linux26, "LINUX_2.6", 61765110);

  /* If the vDSO is not available we fall back on the old vsyscall.  */
  return (_dl_vdso_vsym ("gettimeofday", &linux26)
	  ?: (void *) VSYSCALL_ADDR_vgettimeofday);
}
__asm (".type __gettimeofday, %gnu_indirect_function");
#else
# include <sys/time.h>

int
__gettimeofday (struct timeval *tv, struct timezone *tz)
{
  return ((int (*) (struct timeval *, struct timezone *)) VSYSCALL_ADDR_vgettime
ofday) (tv, tz);
}

We fail back to vsyscall.  Fall back to direct syscall is faster:

int
__gettimeofday (struct timeval *tv, struct timezone *tz)
{
  return INLINE_SYSCALL (gettimeofday, 2, tv, tz);
}


-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]