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: [PATCH][BZ #15533] Avoid unnecessary slowdown from profiling with audit


On 06/04/2013 04:57 AM, Alexander Monakov wrote:
> Ping?  The previous discussion focused on copyright assignment matters.
> 
> If this can go in, please commit.
> 
> On Sat, 25 May 2013, Alexander Monakov wrote:
>> Presently, using the rtld-audit interfaces introduces a slowdown due to
>> enabling profiling instrumentation (as if LD_AUDIT implied LD_PROFILE).
>> However, instrumenting is only necessary if one of audit libraries provides
>> PLT hooks (la_plt{enter,exit} symbols).  Otherwise, the slowdown can be
>> avoided.
>>
>> In the synthetic test attached to the bugzilla issue, the slowdown is 19x.  On
>> another application I tested, the slowdown from profiling was 10%.  The
>> current behavior strongly discourages using the audit interface when
>> compromising performance is not desired.
>>
>> The following patch adjusts the logic that enables profiling to iterate over
>> all audit modules and check if any of those provides a PLT hook.
>>
>> I have an FSF copyright assignment as a GCC contributor (but I do not have
>> commit access in glibc).
>>
>> Thanks.
>>
>>
>> 2013-05-25  Alexander Monakov  <amonakov@ispras.ru>
>>
>> 	* elf/dl-reloc.c (_dl_relocate_object): Enable profiling only if one
>> 	of audit libraries provides PLT hooks.
>>
>> diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c
>> index 73d98f8..675e15b 100644
>> --- a/elf/dl-reloc.c
>> +++ b/elf/dl-reloc.c
>> @@ -167,7 +167,16 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
>>  #ifdef SHARED
>>    /* If we are auditing, install the same handlers we need for profiling.  */
>>    if ((reloc_mode & __RTLD_AUDIT) == 0)
>> -    consider_profiling |= GLRO(dl_audit) != NULL;
>> +    {
>> +      struct audit_ifaces *afct = GLRO(dl_audit);
>> +      for (unsigned int cnt = 0; cnt < GLRO(dl_naudit); ++cnt)
>> +	{
>> +	  /* Profiling is needed only if PLT hooks are provided.  */
>> +	  if (afct->ARCH_LA_PLTENTER != NULL || afct->ARCH_LA_PLTEXIT != NULL)
>> +	    consider_profiling = 1;
>> +	  afct = afct->next;
>> +	}
>> +    }
>>  #elif defined PROF
>>    /* Never use dynamic linker profiling for gprof profiling code.  */
>>  # define consider_profiling 0
>>

It's on the patch review list:

http://sourceware.org/glibc/wiki/Pending%20Reviews

We just haven't gotten to it, sorry :-(

Cheers,
Carlos.


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