[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#822236: vDSO is not in effect in static linked executable on jessie



On Sun, Apr 24, 2016 at 6:31 PM, Aurelien Jarno <aurelien@aurel32.net> wrote:
> control: tag -1 + moreinfo
>
> On 2016-04-22 11:11, Mattia Rizzolo wrote:
>> control: reassign -1 libc6  2.19-18+deb8u4
>>
>> On Fri, Apr 22, 2016 at 06:27:34PM +0800, jian wang wrote:
>> > Package: lib6
>>
>> lost a 'c' :)
>> reassigning.
>>
>> > Version: 2.19-18+deb8u4
>> > Severity: important
>> >
>> > vDSO is not in effect in static linked executable on jessie. This is
>> > not the case with wheezy.
>> >
>> > We build binary to run on both wheezy and jessie, so -static. When
>> > building platform is wheezy, vdso works fine, but jessie the opposite.
>> >
>> > This leads to performance hit. Unfortunately, we use g++ 4.9 for some
>> > application, so wheezy can't be used as build platform.
>
> There is not of information about your environment, so given what you
> describe, it seems you are using an i386 installation.
>

The context is for lots of servers. We use amd64 all over datacenters.

> The vDSO support requires at least a i686 CPU, while Debian i386 targets
> i586. When using dynamic linking, one can install libc6-i686 which
> provides an i686 optimized version of the libc, therefore with vDSO
> support. It is automatically loaded if the CPU supports it.
>
> In your case, given you use static linking, the i586 version of the libc
> is used, and it therefore doesn't support vDSO . That is true on wheezy,
> jessie, stretch, sid. I don't believe this is a regression, and in
> addition I can't reproduce it.
>

No.

We have looked into the code now.

Glibc 2.13 (wheezy) uses an asm version of gettimeofday.S for x86_64
which uses vDSO.

On the way up to glibc 2.19 (jessie), vDSO was rewritten into
gettimeofday.c. And as we dig out, Ulrich Drepper decided to not
optimize static linking, or even to dwarf static linking

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

2.19 uses vDSO for 'SHARED' build,  otherwise uses syscall.

U.D. does have his reasons. I personally agree that static linking is
not good. But considering there is no universal or even popular method
to bundle binaries and libraries (compile once and run everywhere) on
linux, static linking _is_ useful in some cases, there is no need to
dwarf it intentionally.

See source code of 2.19,  sysdeps/unix/sysv/linux/x86_64/gettimeofday.c


Reply to: