Saman,

> -----Original Message-----
> From: Xen-devel <xen-devel-boun...@lists.xenproject.org> On Behalf Of Saman 
> Dehghan
> Sent: Monday, September 15, 2025 9:56 AM
> To: xen-devel@lists.xenproject.org
> Cc: Saman Dehghan <samaan.dehg...@gmail.com>; Jan Beulich <jbeul...@suse.com>
> 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

Reply via email to