|
[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
Tested with Clang 20.1.8 on Debian bookworm x86_64 and arm64.
Carry this if appropriate:
Tested-by: Wentao Zhang <wentaoz5@xxxxxxxxxxxx>
Steps for build:
$ make CC=/lib/llvm-20/bin/clang -C xen defconfig
$ pushd xen
$ kconfig-tweak -d LIVEPATCH
$ kconfig-tweak -e COVERAGE
# The below two are Arm only
$ kconfig-tweak -e UNSUPPORTED
$ kconfig-tweak -e ACPI
$ popd
$ make CC=/lib/llvm-20/bin/clang -C xen olddefconfig
$ /usr/bin/time -v make CC=/lib/llvm-20/bin/clang -j$(nproc) efi-y= dist-xen
$ sudo make CC=/lib/llvm-20/bin/clang -j$(nproc) efi-y= install-xen
$ sudo update-grub
Steps after reinstall:
$ COVERAGE_REPORT_DIR=`mktemp -d`
$ XEN_BUILD=$HOME/v4
$ sudo xencov read | tee >/dev/null default.profraw
$ file default.profraw
$ /lib/llvm-20/bin/llvm-profdata merge default.profraw -o default.profdata
$ file default.profdata
$ /lib/llvm-20/bin/llvm-cov show \
-instr-profile default.profdata \
-output-dir $COVERAGE_REPORT_DIR \
-show-directory-coverage \
-show-branches=count \
-use-color=false \
$XEN_BUILD/xen/xen-syms
Example reports:
$ less $COVERAGE_REPORT_DIR/index.txt
$ less $COVERAGE_REPORT_DIR/coverage/$XEN_BUILD/xen/common/coverage/llvm.c.txt
Notes:
1. On x86_64, LD=ld.lld also works (in fact, faster). On arm64, the build
would fail.
2. On arm64, a workaround is needed regardless of the linker:
diff --git a/xen/arch/arm/arm64/vfp.c b/xen/arch/arm/arm64/vfp.c
index c4f89c7b0e..dbe87f3f34 100644
--- a/xen/arch/arm/arm64/vfp.c
+++ b/xen/arch/arm/arm64/vfp.c
@@ -4,6 +4,7 @@
#include <asm/vfp.h>
#include <asm/arm64/sve.h>
+__attribute__((target("+fp+simd")))
static inline void save_state(uint64_t *fpregs)
{
asm volatile("stp q0, q1, [%1, #16 * 0]\n\t"
@@ -25,6 +26,7 @@ static inline void save_state(uint64_t *fpregs)
: "=Q" (*fpregs) : "r" (fpregs));
}
+__attribute__((target("+fp+simd")))
static inline void restore_state(const uint64_t *fpregs)
{
asm volatile("ldp q0, q1, [%1, #16 * 0]\n\t"
@@ -46,6 +48,7 @@ static inline void restore_state(const uint64_t *fpregs)
: : "Q" (*fpregs), "r" (fpregs));
}
+__attribute__((target("+fp+simd")))
void vfp_save_state(struct vcpu *v)
{
if ( !cpu_has_fp )
@@ -62,6 +65,7 @@ void vfp_save_state(struct vcpu *v)
v->arch.vfp.fpexc32_el2 = READ_SYSREG(FPEXC32_EL2);
}
+__attribute__((target("+fp+simd")))
void vfp_restore_state(struct vcpu *v)
{
if ( !cpu_has_fp )
For the above two issues, see the report in [1].
Once this patch gets in, we can help update [2] with Andrew Cooper and
send a follow-up supporting llvm-cov MC/DC [3].
[1] https://lists.xenproject.org/archives/html/xen-devel/2025-10/msg00805.html
[2] https://xenbits.xen.org/docs/latest/hypervisor-guide/code-coverage.html
[3]
https://clang.llvm.org/docs/SourceBasedCodeCoverage.html#mc-dc-instrumentation
Thanks,
Wentao
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |