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

Re: [PATCH v3] Support LLVM raw profile versions 5, 6, 7, 8, 9, and 10


  • To: Saman Dehghan <samaan.dehghan@xxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Sat, 25 Oct 2025 19:47:57 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • 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=N2YZOMGoAecLwEcYCX+Z6IfXrcGFzExwVl+rR4COTHs=; b=NQIIqK5kwqHR1DJG3JleOniAu5g057fwxibAG+tJqPCYr8eVH7a2pTPmVSUGZubbmcz4HNewm3dloDbuUX26prC2NO0mD31qzButTjnsC4bSixoxEDIZ7IawTIHIYWBXkGUc3TyU9pCYZS6+ys3Hq6W40S7Jc4czp9lrjNWMmiQ2xo4lhJqQtOTVbRDSz0gh7xZZjEafMN1G/mJZHqbKICRRJKRtWdKS43I8CpA3SE7/XjFlLF/xwCxfEfLBv0o2r+LmUK8EiszMWeaFKW1gdQDjY4EueX3q4DrRxldV81I3on+2C2DGAKjnZzrKDus94JgIOtRNzLK0hhaqSShq+Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lZmkRA/VRMdqKgqNjZ1QggOUUKEyV+a9kJgjn6k+UzR24W08rtGdEzBlps6xuib6iWoGhijozM5TSMnin4lvIieJb9DlkbkikX+SZBy9dSPk/F7iCyqmL1X4GIY34/iuJdEWjOXMcu5FWi5/+We4wNyBxBTNF82rRZT2jFWsQEnRoXseKWnJcTxCcHSGGa44d9YqBDK1odYPlr84fQFivEjq3Ry8lR1X1oJnD1cuckqVIrSlwDitB+FKijNPZExRZD89ctbnxBVmK3DvNMzGq8jGfRx6DzfJ6TAO+8TzvEVHdND7jtKgHLGtzi3UYS6vcrKAHzY3vYeMr8lmYNJfYA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, Wentao Zhang <wentaoz5@xxxxxxxxxxxx>, Matthew L Weber <matthew.l.weber3@xxxxxxxxxx>
  • Delivery-date: Sat, 25 Oct 2025 18:48:19 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 25/10/2025 12:38 am, Saman Dehghan wrote:
>>> +        .padding_bytes_after_counters = 0,
>>> +#if __clang_major__ >= 18
>>> +        .num_bitmap_bytes = 0,
>>> +        .padding_bytes_after_bitmap_bytes = 0,
>>> +#endif
>>>          .names_size = END_NAMES - START_NAMES,
>>> +#if __clang_major__ >= 14
>>> +        .counters_delta = START_COUNTERS - START_DATA,
>>> +#else
>>>          .counters_delta = (uintptr_t)START_COUNTERS,
>>> +#endif
>>> +
>>> +#if __clang_major__ >= 18
>>> +        .bitmap_delta = 0,
>>> +#endif
>>>          .names_delta = (uintptr_t)START_NAMES,
>>> +#if __clang_major__ >= 19 && __clang_major__ <= 20
>>> +        .num_vtables = 0,
>>> +        .vnames_size = 0,
>>> +#endif
>> Because this is a structure initialiser, everything set explicitly to 0
>> can be omitted.  This removes all #ifdef-ary except the .counters_delta
>> I believe, as well as the .padding_byte_* fields.
>>
> Is it undefined behaviour to leave struct members uninitialized for
> local variables?

They are well defined as 0 when using a structure initialiser.

>
>> The resulting diff is far smaller.
>>
>>>          .value_kind_last = LLVM_PROFILE_NUM_KINDS - 1,
>>>      };
>>>      unsigned int off = 0;
>>> diff --git a/xen/include/xen/xen.lds.h b/xen/include/xen/xen.lds.h
>>> index b126dfe887..42550a85a2 100644
>>> --- a/xen/include/xen/xen.lds.h
>>> +++ b/xen/include/xen/xen.lds.h
>>> @@ -81,6 +81,24 @@
>>>    .stab.index 0 : { *(.stab.index) }         \
>>>    .stab.indexstr 0 : { *(.stab.indexstr) }
>>>
>>> +#if defined(CONFIG_COVERAGE) && defined(CONFIG_CC_IS_CLANG)
>>> +
>>> +#define LLVM_COV_RW_DATA                                   \
>>> +    DECL_SECTION(__llvm_prf_cnts) { *(__llvm_prf_cnts) }   \
>>> +    DECL_SECTION(__llvm_prf_data) { *(__llvm_prf_data) }   \
>>> +    DECL_SECTION(__llvm_prf_bits) { *(__llvm_prf_bits) }
>>> +
>>> +#define LLVM_COV_RO_DATA                                   \
>>> +    DECL_SECTION(__llvm_prf_names) { *(__llvm_prf_names) }
>>> +
>>> +#define LLVM_COV_DEBUG                                     \
>>> +    DECL_DEBUG(__llvm_covfun, 8)                           \
>>> +    DECL_DEBUG(__llvm_covmap, 8)
>>> +#else
>>> +#define LLVM_COV_RW_DATA
>>> +#define LLVM_COV_RO_DATA
>>> +#define LLVM_COV_DEBUG
>>> +#endif
>> Newline here.
>>
>> But, there's no problem stating sections which are unused.  I think the
>> outer #if/#else can be dropped.
>>
>> Otherwise, Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
>>
>> I can fix these all up on commit, seeing as it's release acked for 4.21
> Thank you for offering to fix them up. Let me know how I can help or
> if I need to send another version.

This is the version with the fixups I suggested, run through CI:

https://gitlab.com/xen-project/hardware/xen-staging/-/pipelines/2118913271
https://gitlab.com/xen-project/hardware/xen-staging/-/commit/c06dadb80a1e4058c7cdef4144a7e4c4799a38a7

However, one further thing I noticed.  On v2, Roger asked you to express
struct llvm_profile_{header,data} in terms of LLVM_PROFILE_VERSION,
rather than __clang_major__.

If you want to start from the version I cleaned up, and then submit a v4
addressing Roger's feedback, please feel free.  This will save needing
to fix it up later.

~Andrew



 


Rackspace

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