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

Re: [PATCH 1/3] xen: add no_instrument_function attributes


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • Date: Mon, 29 Jul 2024 14:56:27 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=T88bbNJu3PbBdyPbHFKrw8RU47CY/WC7OGN+CqH8CWo=; b=d/nPFSeIepbhqSBbZKktdE058HqaoaUswclMtgXIzss7FJi2Q33smKthxn73CfsLkOMD0MsOBByKIlE5M3zfYDKWgNsE+Qu0TdAG4HjC+LWQNFdLge6Gefi6cptNI3Z2jtV7FEcPTqf/W1RWmIzLAPyJ51AldxlE5f4qgI3aicQdQbgbosWHPyyNp/4vA8lL2kqS4KZJP54ElPt12Q5jaZM48iRBtbA031Ksob3j0uVu5pEAvnTEooGu3zbe0doHNnuYmlLGJn3Q9pVcRmWiIL0mOIctnjTcuwzQkSgVGnDnK2ZO5lS0+Uz3ufjsCsqJ4MDton7MJXIUdfG+seeZqg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UDMopCobvKJO7V3IQDekX3czO4ee+hDdvQV0sTr1S29yGLlbXcYRVd+nirpgBR1wAq6+szCMvJ269fF9wSf6yUom609oI+Jypk0nuVRY+uRnaMmjdWeo5aeGwR/bcHPY/VpVuauxJSUoMqtwSX8GjMlXKAHRsgstSed/6SQwOMulMjBo0OYWXT1jpbMlK4o3qf+HAuwvZaxPP7/WpHDVHP68VKYM2G2kM5z8i4lQrDq3bX6rdVCmfmh4UVdksRoiVkkSbgHHwj/tONcprQPjOHyIqKhQTnCGrPLnbNQo7guYD71HySchAgSQXAClbpsuo2kCJHxTGOOOmEUK9qqPkg==
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 29 Jul 2024 18:56:44 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.