| 
    
 [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 1/3] xen: add no_instrument_function attributes
 On 7/29/24 10:55, Jan Beulich wrote:
> On 29.07.2024 16:24, Stewart Hildebrand wrote:
>> In preparation for using -finstrument-functions option, we need to tag a
>> few functions that don't work well with such instrumentation. If we
>> don't intervene, we would end up with linker errors such as undefined
>> reference to __bad_cmpxchg.
> 
> I can't spot mention of such a side effect from the documentation. Talk
> there is of function calls being added at function entry and exit.
> Nothing is being said that calls to other functions would also be
> affected.
Oddly, it seems the compiler fails remove the implementations of the
affected functions from the object files even though they are not called
in the generated code (because they were inlined). I can mention this in
the commit message.
For example, if no_instrument is omitted from __int_cmpxchg, feeding one
of the object files through aarch64-none-linux-gnu-objdump -d yields for
example:
0000000000000048 <__int_cmpxchg>:
     <snip>
     16c:       94000000        bl      0 <__bad_cmpxchg>
     <snip>
Yet, __int_cmpxchg is not called by anything.
Even more oddly, this appears to be the case for both clang and gcc.
>> --- a/xen/arch/arm/include/asm/arm64/cmpxchg.h
>> +++ b/xen/arch/arm/include/asm/arm64/cmpxchg.h
>> @@ -5,6 +5,7 @@
>>  
>>  extern void __bad_xchg(volatile void *ptr, int size);
>>  
>> +__attribute__((no_instrument_function))
> 
> I guess it would be nice to have
> 
> #define no_instrument __attribute__((no_instrument_function))
> 
> in xen/compiler.h. I also don't think these annotations want placing
> ahead of the entire declaration, but rather where other similar
> annotations would also go.
Will do, thanks for the suggestion.
 
 
  | 
  
![]()  | 
            
         Lists.xenproject.org is hosted with RackSpace, monitoring our  |