public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/14438] New: clock_gettime CLOCK_THREAD_CPUTIME_ID doesn't delegate to vsyscall
@ 2012-08-06 19:03 arun@sharma-home.net
  2013-05-10 13:02 ` [Bug libc/14438] " siddhesh at redhat dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: arun@sharma-home.net @ 2012-08-06 19:03 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=14438

             Bug #: 14438
           Summary: clock_gettime CLOCK_THREAD_CPUTIME_ID doesn't delegate
                    to vsyscall
           Product: glibc
           Version: 2.17
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: unassigned@sourceware.org
        ReportedBy: arun@sharma-home.net
                CC: drepper.fsp@gmail.com
    Classification: Unclassified


Created attachment 6566
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6566
clock_gettime() makes syscalls, but __vdso_clock_gettime doesn't.

clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts) seems to always make a syscall,
even on kernels that provide a vdso. Although upstream kernels don't have the
patches we're running with, I find this behavior surprising.

Why doesn't glibc always call __vdso_clock_gettime() and let the kernel decide
on the best implementation regardless of the clock id?

Relevant patches:

http://thread.gmane.org/gmane.linux.kernel/1231015/focus=1231016

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libc/14438] clock_gettime CLOCK_THREAD_CPUTIME_ID doesn't delegate to vsyscall
  2012-08-06 19:03 [Bug libc/14438] New: clock_gettime CLOCK_THREAD_CPUTIME_ID doesn't delegate to vsyscall arun@sharma-home.net
@ 2013-05-10 13:02 ` siddhesh at redhat dot com
  2013-05-10 14:09 ` arun@sharma-home.net
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: siddhesh at redhat dot com @ 2013-05-10 13:02 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=14438

Siddhesh Poyarekar <siddhesh at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |siddhesh at redhat dot com

--- Comment #1 from Siddhesh Poyarekar <siddhesh at redhat dot com> 2013-05-10 13:02:28 UTC ---
clock_gettime always calls __vdso_clock_gettime on x86_64.  What are you
testing on?

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libc/14438] clock_gettime CLOCK_THREAD_CPUTIME_ID doesn't delegate to vsyscall
  2012-08-06 19:03 [Bug libc/14438] New: clock_gettime CLOCK_THREAD_CPUTIME_ID doesn't delegate to vsyscall arun@sharma-home.net
  2013-05-10 13:02 ` [Bug libc/14438] " siddhesh at redhat dot com
@ 2013-05-10 14:09 ` arun@sharma-home.net
  2013-05-16  6:48 ` siddhesh at redhat dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: arun@sharma-home.net @ 2013-05-10 14:09 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=14438

--- Comment #2 from Arun Sharma <arun@sharma-home.net> 2013-05-10 14:09:18 UTC ---
3.2 kernel plus out of tree patches which provide a vdso implementation for
this clock.
On May 10, 2013 6:02 AM, "siddhesh at redhat dot com" <
sourceware-bugzilla@sourceware.org> wrote:

> http://sourceware.org/bugzilla/show_bug.cgi?id=14438
>
> Siddhesh Poyarekar <siddhesh at redhat dot com> changed:
>
>            What    |Removed                     |Added
>
> ----------------------------------------------------------------------------
>                  CC|                            |siddhesh at redhat dot com
>
> --- Comment #1 from Siddhesh Poyarekar <siddhesh at redhat dot com>
> 2013-05-10 13:02:28 UTC ---
> clock_gettime always calls __vdso_clock_gettime on x86_64.  What are you
> testing on?
>
> --
> Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You reported the bug.
>

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libc/14438] clock_gettime CLOCK_THREAD_CPUTIME_ID doesn't delegate to vsyscall
  2012-08-06 19:03 [Bug libc/14438] New: clock_gettime CLOCK_THREAD_CPUTIME_ID doesn't delegate to vsyscall arun@sharma-home.net
  2013-05-10 13:02 ` [Bug libc/14438] " siddhesh at redhat dot com
  2013-05-10 14:09 ` arun@sharma-home.net
@ 2013-05-16  6:48 ` siddhesh at redhat dot com
  2013-07-26 18:24 ` neleai at seznam dot cz
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: siddhesh at redhat dot com @ 2013-05-16  6:48 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=14438

--- Comment #3 from Siddhesh Poyarekar <siddhesh at redhat dot com> 2013-05-16 06:48:47 UTC ---
(In reply to comment #2)
> 3.2 kernel plus out of tree patches which provide a vdso implementation for
> this clock.

x86_64 or something else?  x86_64 calls __vdso_clock_gettime.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libc/14438] clock_gettime CLOCK_THREAD_CPUTIME_ID doesn't delegate to vsyscall
  2012-08-06 19:03 [Bug libc/14438] New: clock_gettime CLOCK_THREAD_CPUTIME_ID doesn't delegate to vsyscall arun@sharma-home.net
                   ` (2 preceding siblings ...)
  2013-05-16  6:48 ` siddhesh at redhat dot com
@ 2013-07-26 18:24 ` neleai at seznam dot cz
  2013-07-26 18:37 ` arun@sharma-home.net
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: neleai at seznam dot cz @ 2013-07-26 18:24 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=14438

Ondrej Bilka <neleai at seznam dot cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING
                 CC|                            |neleai at seznam dot cz

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libc/14438] clock_gettime CLOCK_THREAD_CPUTIME_ID doesn't delegate to vsyscall
  2012-08-06 19:03 [Bug libc/14438] New: clock_gettime CLOCK_THREAD_CPUTIME_ID doesn't delegate to vsyscall arun@sharma-home.net
                   ` (3 preceding siblings ...)
  2013-07-26 18:24 ` neleai at seznam dot cz
@ 2013-07-26 18:37 ` arun@sharma-home.net
  2013-07-27  2:45 ` siddhesh at redhat dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: arun@sharma-home.net @ 2013-07-26 18:37 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=14438

--- Comment #4 from Arun Sharma <arun@sharma-home.net> ---
x86_64. IIRC: the implementation calls vdso for some clockids, but not others.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libc/14438] clock_gettime CLOCK_THREAD_CPUTIME_ID doesn't delegate to vsyscall
  2012-08-06 19:03 [Bug libc/14438] New: clock_gettime CLOCK_THREAD_CPUTIME_ID doesn't delegate to vsyscall arun@sharma-home.net
                   ` (4 preceding siblings ...)
  2013-07-26 18:37 ` arun@sharma-home.net
@ 2013-07-27  2:45 ` siddhesh at redhat dot com
  2013-10-04 15:53 ` arun@sharma-home.net
  2014-06-17 18:47 ` fweimer at redhat dot com
  7 siblings, 0 replies; 9+ messages in thread
From: siddhesh at redhat dot com @ 2013-07-27  2:45 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=14438

--- Comment #5 from Siddhesh Poyarekar <siddhesh at redhat dot com> ---
It calls vdso_clock_gettime for all clockids.  If vdso function has support for
some clockids but not others, for which it does a context switch into the
kernel.

sysdeps/unix/clock_gettime.c:
...
    default:
#ifdef SYSDEP_GETTIME_CPU
      SYSDEP_GETTIME_CPU (clock_id, tp);
#endif
...

sysdeps/unix/sysv/linux/clock_gettime.c
...
#define SYSDEP_GETTIME_CPU(clock_id, tp) \
  retval = SYSCALL_GETTIME (clock_id, tp); \
  break
...

sysdeps/unix/sysv/linux/x86_64/clock_gettime.c
...
# define SYSCALL_GETTIME(id, tp) \
  ({ long int (*f) (clockid_t, struct timespec *) = __vdso_clock_gettime; \
  long int v_ret;                                                         \
  PTR_DEMANGLE (f);                                                       \
  v_ret = f (id, tp);                                                     \
  if (INTERNAL_SYSCALL_ERROR_P (v_ret, )) {                               \
    __set_errno (INTERNAL_SYSCALL_ERRNO (v_ret, ));                       \
    v_ret = -1;                                                           \
  }                                                                       \
  v_ret; })
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libc/14438] clock_gettime CLOCK_THREAD_CPUTIME_ID doesn't delegate to vsyscall
  2012-08-06 19:03 [Bug libc/14438] New: clock_gettime CLOCK_THREAD_CPUTIME_ID doesn't delegate to vsyscall arun@sharma-home.net
                   ` (5 preceding siblings ...)
  2013-07-27  2:45 ` siddhesh at redhat dot com
@ 2013-10-04 15:53 ` arun@sharma-home.net
  2014-06-17 18:47 ` fweimer at redhat dot com
  7 siblings, 0 replies; 9+ messages in thread
From: arun@sharma-home.net @ 2013-10-04 15:53 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=14438

Arun Sharma <arun@sharma-home.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Arun Sharma <arun@sharma-home.net> ---
Verified in glibc-2.14. Thanks for looking into this!

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug libc/14438] clock_gettime CLOCK_THREAD_CPUTIME_ID doesn't delegate to vsyscall
  2012-08-06 19:03 [Bug libc/14438] New: clock_gettime CLOCK_THREAD_CPUTIME_ID doesn't delegate to vsyscall arun@sharma-home.net
                   ` (6 preceding siblings ...)
  2013-10-04 15:53 ` arun@sharma-home.net
@ 2014-06-17 18:47 ` fweimer at redhat dot com
  7 siblings, 0 replies; 9+ messages in thread
From: fweimer at redhat dot com @ 2014-06-17 18:47 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=14438

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-06-17 18:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-06 19:03 [Bug libc/14438] New: clock_gettime CLOCK_THREAD_CPUTIME_ID doesn't delegate to vsyscall arun@sharma-home.net
2013-05-10 13:02 ` [Bug libc/14438] " siddhesh at redhat dot com
2013-05-10 14:09 ` arun@sharma-home.net
2013-05-16  6:48 ` siddhesh at redhat dot com
2013-07-26 18:24 ` neleai at seznam dot cz
2013-07-26 18:37 ` arun@sharma-home.net
2013-07-27  2:45 ` siddhesh at redhat dot com
2013-10-04 15:53 ` arun@sharma-home.net
2014-06-17 18:47 ` fweimer at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).