Re: [PATCH] KVM: arm64: Avoid naming collision in tracing

From: Mostafa Saleh

Date: Mon Jul 13 2026 - 04:32:47 EST


On Mon, Jul 13, 2026 at 09:05:55AM +0100, Vincent Donnefort wrote:
> On Mon, Jul 13, 2026 at 09:02:48AM +0100, Vincent Donnefort wrote:
> > On Sun, Jul 12, 2026 at 03:38:35PM +0000, Mostafa Saleh wrote:
> > > When the hypervisor tracing (CONFIG_NVHE_EL2_TRACING) is disabled, it
> > > defines a static inline stub for trace_clock().
> > >
> > > However, trace_clock() is already declared as an extern function in
> > > linux/trace_clock.h which is pulled in EL2 compilation.
> >
> > I am completely unable to reproduce that. CONFIG_NVHE_EL2_TRACING, isn't a
> > selectable option, it depends on NVHE_EL2_DEBUG.
> >
> > How does your .config look like?
> >
> > >
> > > If the file <nvhe/clock.h> is included when CONFIG_NVHE_EL2_TRACING
> > > is disabled (by including it manually in setup.c) it will cause:
> > > In file included from arch/arm64/kvm/hyp/nvhe/setup.c:22:
> >
> > nvhe/clock.h seems already included in setup.c
>
> Ha no appologies, I was looking at the wrong branch.
>
> However I am still enable to reproduce this issue. So I am still interested in
> knowing your .defconfig

It is just defconfig (CONFIG_NVHE_EL2_TRACING is already disabled).

If you attempt to include <nvhe/clock.h> in another file:
diff --git a/arch/arm64/kvm/hyp/nvhe/hyp-main.c b/arch/arm64/kvm/hyp/nvhe/hyp-main.c
index d3c69de698f4..ca91e453fb10 100644
--- a/arch/arm64/kvm/hyp/nvhe/hyp-main.c
+++ b/arch/arm64/kvm/hyp/nvhe/hyp-main.c
@@ -15,6 +15,7 @@
#include <asm/kvm_hypevents.h>
#include <asm/kvm_mmu.h>

+#include <nvhe/clock.h>
#include <nvhe/ffa.h>
#include <nvhe/mem_protect.h>
#include <nvhe/mm.h>

With GCC: make ARCH=arm64 CROSS_COMPILE="aarch64-linux-gnu-" -j`nproc`
It will show the above error.

With LLVM, you have to include it in more than one file, which results
in:
>>> defined at clock.h:14 (./arch/arm64/kvm/hyp/include/nvhe/clock.h:14)
>>> arch/arm64/kvm/hyp/nvhe/hyp-main.nvhe.o:(trace_clock)
>>> defined at clock.h:14 (./arch/arm64/kvm/hyp/include/nvhe/clock.h:14)
>>> arch/arm64/kvm/hyp/nvhe/mem_protect.nvhe.o:(.text+0x0)
>>>

As the compiler would convert the function global.

Thanks,
Mostafa