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

RE: [EXTERNAL] [llvm coverage] Update LLVM profile raw format from v4 to v10


  • To: Saman Dehghan <samaan.dehghan@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Weber (US), Matthew L" <matthew.l.weber3@xxxxxxxxxx>
  • Date: Mon, 15 Sep 2025 22:42:13 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=boeing.com; dmarc=pass action=none header.from=boeing.com; dkim=pass header.d=boeing.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector5401; 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=tIRoOIbJ52kYhtN19KU7Tov6Yt6nzIwL/SSo+i8lIeI=; b=dI/XREeDnlnKXqRcRkswxtVYGfGA7tgnzzTaRylQ8XHS0c86VKxhYbA4s8xhnG+niPF1Z7rnBP2OiJbKFWiKmnjy402HpLuj51TpHLkeP8ssYlCiUVdfj4B4axwRZLOtPtakNh6GG7B0iWojh2KrqEv+RwLHeDFrCagiFS8EzGq2BrbHqvxxwNJP0spAb99y3PM6d4aTScD/a6NDv7F4MJPwgZfhImqXQjAxEZ8k1DdCCHrPQDv0mnmZZmu1kj4johGPDoc1xCate6svYwbbyRELuLoPmLrIOQsgbGWJYexDwMWnKbZHWPgR8C1pA30hRTBrPshM9iit/4v/5Vm+jA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector5401; d=microsoft.com; cv=none; b=swDYddfAj0zC/YJ111gz1Cc+g2CvDmPDp5CIkjUpmZFn1351vadztF8fe2eNGn2kV4p6R4J0KSjmDOLIVK3c34p7hkXXpOwIbsj1K+FRgesIj5m2dJwntNvc9PifGmKR+fNoZD4+W8kLPnjHIdTd6vCB7fxyfLmFYYh87YZm7hC60xb6b+GLWKbr9RvYBakfCo4fT7uVzpxVuNv2qMKEeW9Np4yE+5oOqOvN7qm8RFtDOYhajCWX3cXwseSkhYu2GfqT7KWrOvWlX+4raFfmnKIDJJPB3WfDlN0YYpN76gVWKNBORWDa1rGlXLKAaAtniSXzVTo8t6yideNwvf6vUw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=boeing.com;
  • Cc: Jan Beulich <jbeulich@xxxxxxxx>
  • Delivery-date: Mon, 15 Sep 2025 22:42:56 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHcJmG2oeeyHeOUtEKLs5eugkA/BLSUy2Pg
  • Thread-topic: [EXTERNAL] [llvm coverage] Update LLVM profile raw format from v4 to v10

Saman,

> -----Original Message-----
> From: Xen-devel <xen-devel-bounces@xxxxxxxxxxxxxxxxxxxx> On Behalf Of Saman 
> Dehghan
> Sent: Monday, September 15, 2025 9:56 AM
> To: xen-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: Saman Dehghan <samaan.dehghan@xxxxxxxxx>; Jan Beulich <jbeulich@xxxxxxxx>
> Subject: [EXTERNAL] [llvm coverage] Update LLVM profile raw format from v4 to 
> v10
> 
> EXT email: be mindful of links/attachments.
> 
> 
> 
> This patch updates the LLVM profile raw format in 
> `xen/common/coverage/llvm.c` from version 4 to version 10, enabling 
> compatibility with LLVM versions 19 and 20.
> While the patch supports only one version:
> 1. It seems better to support one version than no version --
>    the current profile version 4 is not compatible with
>    LLVM version 11 or later

I'd suggest adding logic to check the LLVM version and conditionally add the 
struct field(s).  e.g., "__clang__", "__clang_major__" and "__clang_minor__".

[snip]

> 
> Overall, this change would enhance Xen's code coverage analysis capabilities 
> by leveraging the latest LLVM toolchain improvements, particularly for 
> safety-critical hypervisor code.
> 
> The patch modifies only `xen/common/coverage/llvm.c`, maintaining API 
> compatibility while enabling modern toolchain support.
> Testing was performed with LLVM 19 and 20 to confirm functionality.

Please elaborate on your testing.  You could put it under the --- so it's show 
what you did but not included in the git description when merged.
E.g. what dom0 was used, command sequence, etc.


[snip]

>  struct llvm_profile_header {
>      uint64_t magic;
>      uint64_t version;
> -    uint64_t data_size;
> -    uint64_t counters_size;
> +    uint64_t binary_ids_size;
> +    uint64_t num_data;
> +    uint64_t padding_bytes_before_counters;
> +    uint64_t num_counters;
> +    uint64_t padding_bytes_after_counters;
> +    uint64_t num_bitmap_bytes;    

The above line has extra spaces at the end.

> +    uint64_t padding_bytes_after_bitmap_bytes;
>      uint64_t names_size;
>      uint64_t counters_delta;
> +    uint64_t bitmap_delta;
>      uint64_t names_delta;
> +    uint64_t num_vtables;
> +    uint64_t vnames_size;
>      uint64_t value_kind_last;
> };
>

Steps I used to build
- I checked out latest master (656b9ca03b) 
- Applied this patch
- menuconfig'd to disable livepatch and enable coverage
- make dist-xen clang=y

I got the following.

  CC      common/coverage/llvm.o
common/coverage/llvm.c:120:10: error: field designator 'data_size' does not 
refer to any field in type 'struct llvm_profile_header'
        .data_size = (END_DATA - START_DATA) / sizeof(struct llvm_profile_data),
         ^
common/coverage/llvm.c:121:10: error: field designator 'counters_size' does not 
refer to any field in type 'struct llvm_profile_header'
        .counters_size = (END_COUNTERS - START_COUNTERS) / sizeof(uint64_t),
         ^

Best Regards,
Matt



 


Rackspace

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