From nobody Thu Oct 30 22:54:58 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1757955388; cv=none; d=zohomail.com; s=zohoarc; b=GuZP/boTHzwo8F4Ij1GhDOsvl1tZa97dgVPxm6PKXc21qBbqJD/BiYc8swqPwyODcwUUDyCBN4fJjTz4z0QnVct+OBWWeebM1OWT3y0lL439QzVu+RAsgE4xpbRiEKMrh9Fn0j88y7AeLp5RD1c6cPQbovEoPrvZMLxd1hlZDSM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757955388; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=1rAZQe97A8nOk7FS8pbW2Xc+T7ma3O2xAHfOfQiOuws=; b=gfxGaLfMseoGPmKn8fbfLE45yp/oFR4sWqr0ome7aGAV45lz9UpeDTUUNmsMN1IyqXzejbX/mrvg1BB3dIaQY7Jw5V3SZjAoXQ0/KDwo6Uk8XLqCoO3day+jjpVnrhECdevLNGyVCuWAKsBWOUsn6i7Shd/rgd3j7L/g15RL2Is= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1757955387995234.41095254009645; Mon, 15 Sep 2025 09:56:27 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1124381.1466760 (Exim 4.92) (envelope-from ) id 1uyCUv-0006Pq-6H; Mon, 15 Sep 2025 16:56:13 +0000 Received: by outflank-mailman (output) from mailman id 1124381.1466760; Mon, 15 Sep 2025 16:56:13 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uyCUv-0006Pj-2Z; Mon, 15 Sep 2025 16:56:13 +0000 Received: by outflank-mailman (input) for mailman id 1124381; Mon, 15 Sep 2025 16:56:12 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uyCUu-0006Pd-7E for xen-devel@lists.xenproject.org; Mon, 15 Sep 2025 16:56:12 +0000 Received: from mail-qk1-x732.google.com (mail-qk1-x732.google.com [2607:f8b0:4864:20::732]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id e0cd7200-9254-11f0-9809-7dc792cee155; Mon, 15 Sep 2025 18:56:10 +0200 (CEST) Received: by mail-qk1-x732.google.com with SMTP id af79cd13be357-8127215a4c6so518367385a.0 for ; Mon, 15 Sep 2025 09:56:10 -0700 (PDT) Received: from localhost.localdomain (host-154-4.mdu.ilcmifre.champaign.il.us.clients.pavlovmedia.net. [66.253.154.4]) by smtp.gmail.com with ESMTPSA id af79cd13be357-820c974d5edsm837402085a.26.2025.09.15.09.56.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 15 Sep 2025 09:56:08 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: e0cd7200-9254-11f0-9809-7dc792cee155 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1757955369; x=1758560169; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=1rAZQe97A8nOk7FS8pbW2Xc+T7ma3O2xAHfOfQiOuws=; b=Pjda92+4R+3jaesJYmKusDi2vD9cnO/1+R7Jj9aJTuIhyEENx/GvWbE00sKWLkqfIS abstBLS2yyor4o75+nPK5xajukTeluqMF7F8EXBlkMmQX7kFUq7yky1wRjmtVMExoxDB c0i8DIIxauoqxjZSzM2aFTHNUjLwjbHp+N1YeNGQkJE8tb6rf1MyCjctzPrG1/JHzfji psxbh9s7xmzj8i5nXrMXYABoMtTU9nqA2O036sbD3xpLw7kUcQUMwosv8wvyI1yklQCn PlGbAxxP4j2Mw3Yb/HNrW+BRtovZ9WqkMNxNtMah+mBr+dNTgmoVIZ+OhcG8beGa4T7F cNbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757955369; x=1758560169; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=1rAZQe97A8nOk7FS8pbW2Xc+T7ma3O2xAHfOfQiOuws=; b=U97kNj1z2171CHk8bqNPkFlqIUcs45XTSgaJQjJTpD3PlTmh9GeIjrG7C7lB34Jyd1 JerV7ZivpTH/c/s9WJPwmAZbk63/sGlyfVMBkNIzsPHMHnoV8NGAwlQKWrjSpZLxS58K qyCxgVPylH7rQzyQco9Zcab9VPK59FU0nsRV6tyb3JRwc9wFpBFCtjK4Z487l03RZc/z xPepDxsVNE6+bS+RiTJxgNymoxGrslvhk8JgBr6lIvTX3aK6o7R1YZU74VjAGplHOgZ1 kynCGufjn55HR427crWXffmWJyTC966sUBAFG5TNBUBb/wwlwQLs2ubC8hILaG+adsRJ yvvw== X-Gm-Message-State: AOJu0YzaKCdyOLDHQbhHxVlliicxri557oq65OYeZF87JgG0zsZUZyhb 3Eei0gK6gnDLhecehANqTg02taFT2H8ayo5Z8fFFpbQfndyfyHFVgyhzU9PEAH8= X-Gm-Gg: ASbGncs4JtwPyK+3orR22dQE9Yec9gOt4KFoVjS4YdxSKmtm9RM3lzByPbefZVtkRIy FmQJfpMjLvCa5oP45gZly+61NlZyZCpz/tBIORLQo7A/zosgcvPfnN/DmzMwkETcJ0tDagR688/ OEhojBUsUV30nbcOPfwHxpzEJcjBC7Ll8NUOHcrWTvS68gt4MZu6KlePjsNgcLmuGkujabfEc75 BANSQkqI266NZ5MxD9c0UjG4E9ZxWqlbDcoK2z9bX33epcMUw7PqSY+dQdv0LBL0gSsk+K6Sz7k 1fcZYluNkzm+R1Ft8VoclPXQqCkUk+38aA1nxKDwylo9pPaFG2JWu4aI1yve+OJarCgpEGrLlkk 7AjHjnUiL7vm353PLMTVp4jtKlv9qptfvr0g5GP+BgoSxJXJLyEgfFUqUP9IdK8njkIomgVpNBp 5RmnvCMmCsoGJ+ZpW565Dc4iROzmH5vGty1XKc4/mCQlXCMPEQPkJcRapRR66o X-Google-Smtp-Source: AGHT+IEUZt+Slbf2P4wxa7IUZCWchf5tchX1yumP4roroVSNZApDnQHzN0X3nxgCiIUQln9gdyYEmw== X-Received: by 2002:a05:620a:7185:b0:823:f5e9:db04 with SMTP id af79cd13be357-823f5e9dba8mr1283601785a.33.1757955368482; Mon, 15 Sep 2025 09:56:08 -0700 (PDT) From: Saman Dehghan To: xen-devel@lists.xenproject.org Cc: Saman Dehghan , Jan Beulich Subject: [llvm coverage] Update LLVM profile raw format from v4 to v10 Date: Mon, 15 Sep 2025 11:56:05 -0500 Message-ID: <12f2f3bd9010422004c38c23f6758c87df8682a5.1757951300.git.samaan.dehghan@gmail.com> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1757955390320116600 Content-Type: text/plain; charset="utf-8" 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 2. The patch could be extended to support multiple LLVM profile versions, e.g., from 5 to 10 The llvm-cov toolchain, with its Source-based Code Coverage, offers two substantial advantages over gcov: - More accurate coverage reporting when compiler optimizations are enabled, ensuring better analysis of optimized code. - Better tracking of coverage across inlined function boundaries, critical for complex control flows in Xen. 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. --- xen/common/coverage/llvm.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/xen/common/coverage/llvm.c b/xen/common/coverage/llvm.c index 517b2aa8c2..3da82c6cda 100644 --- a/xen/common/coverage/llvm.c +++ b/xen/common/coverage/llvm.c @@ -44,27 +44,37 @@ ((uint64_t)'f' << 16) | ((uint64_t)'R' << 8) | ((uint64_t)129) #endif =20 -#define LLVM_PROFILE_VERSION 4 -#define LLVM_PROFILE_NUM_KINDS 2 +#define LLVM_PROFILE_VERSION 10 +#define LLVM_PROFILE_NUM_KINDS 3 =20 struct llvm_profile_data { uint64_t name_ref; uint64_t function_hash; - void *counter; + void *relative_counter; + void *relative_bitmap; void *function; void *values; uint32_t nr_counters; uint16_t nr_value_sites[LLVM_PROFILE_NUM_KINDS]; + uint32_t numbitmap_bytes; }; =20 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; =20 + 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; }; =20 @@ -110,7 +120,7 @@ static int cf_check dump( .data_size =3D (END_DATA - START_DATA) / sizeof(struct llvm_profil= e_data), .counters_size =3D (END_COUNTERS - START_COUNTERS) / sizeof(uint64= _t), .names_size =3D END_NAMES - START_NAMES, - .counters_delta =3D (uintptr_t)START_COUNTERS, + .counters_delta =3D (uintptr_t)(START_COUNTERS - START_DATA), .names_delta =3D (uintptr_t)START_NAMES, .value_kind_last =3D LLVM_PROFILE_NUM_KINDS - 1, }; --=20 2.49.0