From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C30F81F91F6 for ; Mon, 13 Jul 2026 08:02:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783929777; cv=none; b=oh8qXKdrmPc9BPRjJPkwm+4uH3YAR65fF45BAcLLnZ6Ec0iVne2P3fB+qKySM8SzQm1MHMCDQWVenn9Q+XIrZJ1JjH4vrsnd3QQzyWKJFwbwqYvWwu/lCJ6UL0KogO9lDQLgzPaxrFOTXMN6V7sBOmvhyY8OT+rJhr/6heeqNGg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783929777; c=relaxed/simple; bh=0Il60HPhYN8El4vcVpAIUvanEe/uUnAxZdvjILXmQsU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=U9YGjVsQTdXxehHROgyxug7YXDVkJr4OLXpW7cfh/TGTg7kRa3nNCOiqsHYHfTeFVZVyMZQKiZaOq8I9dnq3W3CWVYh7xLg7p9YU3975gDl/Pu2PBjVfWtII5qS39dPu7P7bVGcZDvcZfFp14gm8fmRwtMrvI3UKx/j3t4y3k6Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=m8iJH6sn; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="m8iJH6sn" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-493c19bad03so25151085e9.2 for ; Mon, 13 Jul 2026 01:02:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1783929774; x=1784534574; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :content-type:mime-version:references:message-id:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to:content-type; bh=Ui/q0Z17SIjSQaEuUEryDLv/RC+iz2sf/IL8bGmgkiM=; b=m8iJH6sn3Xu/BW643PFyXqzNPzPaADd2A2vJWUkjbDABEFVxb4oRdyIYaWREkBK7ez TF8WwTQuOVzBiAiT8SxF7wRaAFeCZujymzaPOnNAgjbw2Y6z5uFKN4D3yVc7h6fp8XFM nj9AG7Xi/U7Ke5n7GCVi5WDG8VWt5Gd6sEcTsMShmZFw25EOIMD/Fe7FMBmcf8zZsxcO SjukZI1y7qCYk2ptGfd52zukn2ul6oeYVo2NPxXJEkFeR5U1ZTczwBI+nL3IJeTV43Fu 0o6Y9amMHGJ4N8zxTpW3AaKRuUNe6Wu/wur8YuCZLlsToE3ExFiqjKAECv4k9CB519X4 K/dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783929774; x=1784534574; h=in-reply-to:content-transfer-encoding:content-disposition :content-type:mime-version:references:message-id:subject:cc:to:from :date:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=Ui/q0Z17SIjSQaEuUEryDLv/RC+iz2sf/IL8bGmgkiM=; b=nlnEIjJJ2HbCESxPvmyVfxsvORVViwkMs8EMDecnJrv5B6D92uF/TQU3sU8PXsO882 PLb2qOIzWGYcuZmr3+ZPtwnhB6qsEuDiXgLnp2V6xdQ6qmOvPBD8l1LvbqzaOOB6Sgnt Z+7ONqt4z6DHM70aBf0s0SNstlS7LYcfDd6BsrTo6glKf8mpJJ/5bYuBNyjx+s3Ke0lR omaSz/7FTrpDMVsZd+jGb+eoeWmqHNUFRhbt0o4yua/s6kLOb5A6EMTC8DDcW2VMdF+c 9xUCvld/cUcM5cwk2sabn+zR/w5zoPaEbbrblcF9T8gZQEe8ut8WBPnqPl6IMSPoayhi L8Uw== X-Gm-Message-State: AOJu0YzYTlaMooQ/CRwp1CwG/ccAmMCmPjSDGCj7XhI9TxFkZuUjnSYM t0giLpjMJ2aLvVt7iLxfKEwiD0i12ARcP/+zFs+oiMEElRqqqFRc4Oq3J7a+5GsuRdjBWZ02yA3 YWKrf2Q== X-Gm-Gg: AfdE7clB0B33kisYJx9Evo/5GvN8EZuSv99Hyax0V0U4CKUisTgakPKDyq6s/qKF+iw SLz+wBV6QuqdIYCX6iMh/uFrsgIOg7XDk8AAFkP4urAhvQU7swHJ/AIPMCTnyFPWRhdINSrf05i wtBdHsh8EwBm6XZcOffnUUmbdsnb853ObpOeiv5NhqoG+U09qIHYoxTUgXXV0QRCeK9FxYOYk0I 17cEfpKM9YCe6h5R8KQY+f925K1Qbohlz0A8V0H6UqE1iZ8HUWmWZML3AMV/r7vlyQmR+ZomJ/e e+nNSDRf4+V927bXy/G3pFDDrQhrmSZ0pOZWneIautY9HEFAMrLO7wqpwEX1Xct+LjRE3V0Ig6T yRKhfroIVQWUIl0qmVxB5XjXceo8gL0jGjknMI7La1pQjqCvv728A2WhkhvRErIY8Czyzo9MNr2 YGgyaQ0ocwqqiHoio6wafsfYCnrS3cw9p2BHQIQ2QMKCoTjVJxVss= X-Received: by 2002:a05:600c:608e:b0:493:b03c:5650 with SMTP id 5b1f17b1804b1-493f8820806mr75041905e9.19.1783929773498; Mon, 13 Jul 2026 01:02:53 -0700 (PDT) Received: from google.com (137.69.77.34.bc.googleusercontent.com. [34.77.69.137]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-493f2e77c2esm210021655e9.2.2026.07.13.01.02.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2026 01:02:52 -0700 (PDT) Date: Mon, 13 Jul 2026 09:02:48 +0100 From: Vincent Donnefort To: Mostafa Saleh Cc: linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, maz@kernel.org, oupton@kernel.org, seiden@linux.ibm.com, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, tabba@google.com Subject: Re: [PATCH] KVM: arm64: Avoid naming collision in tracing Message-ID: References: <20260712153835.2264905-1-smostafa@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20260712153835.2264905-1-smostafa@google.com> 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 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 > > ./arch/arm64/kvm/hyp/include/nvhe/clock.h:14:19: error: static declaration of ‘trace_clock’ follows non-static declaration > > 14 | static inline u64 trace_clock(void) { return 0; } > > | ^~~~~~~~~~~ > > on GCC and a linker error on LLVM (it seems to change the linkage to > global) > > Although that is not a problem at the moment, as no other files > include . That does not seem to be the intent of > this code and that will cause issues with more users as the SMMUv3 > driver. > > Signed-off-by: Mostafa Saleh > > -- > I did not add Fixes tag as this is currently dormant and not breaking > anything. > --- > arch/arm64/kvm/hyp/include/nvhe/clock.h | 8 ++++---- > arch/arm64/kvm/hyp/nvhe/clock.c | 4 ++-- > arch/arm64/kvm/hyp/nvhe/trace.c | 4 ++-- > 3 files changed, 8 insertions(+), 8 deletions(-) > > diff --git a/arch/arm64/kvm/hyp/include/nvhe/clock.h b/arch/arm64/kvm/hyp/include/nvhe/clock.h > index 9f429f5c0664..c2ccd0e8bf22 100644 > --- a/arch/arm64/kvm/hyp/include/nvhe/clock.h > +++ b/arch/arm64/kvm/hyp/include/nvhe/clock.h > @@ -6,11 +6,11 @@ > #include > > #ifdef CONFIG_NVHE_EL2_TRACING > -void trace_clock_update(u32 mult, u32 shift, u64 epoch_ns, u64 epoch_cyc); > -u64 trace_clock(void); > +void hyp_trace_clock_update(u32 mult, u32 shift, u64 epoch_ns, u64 epoch_cyc); > +u64 hyp_trace_clock(void); > #else > static inline void > -trace_clock_update(u32 mult, u32 shift, u64 epoch_ns, u64 epoch_cyc) { } > -static inline u64 trace_clock(void) { return 0; } > +hyp_trace_clock_update(u32 mult, u32 shift, u64 epoch_ns, u64 epoch_cyc) { } > +static inline u64 hyp_trace_clock(void) { return 0; } > #endif > #endif > diff --git a/arch/arm64/kvm/hyp/nvhe/clock.c b/arch/arm64/kvm/hyp/nvhe/clock.c > index a7fc61976fd0..8adefb0b696c 100644 > --- a/arch/arm64/kvm/hyp/nvhe/clock.c > +++ b/arch/arm64/kvm/hyp/nvhe/clock.c > @@ -30,7 +30,7 @@ static u64 __clock_mult_uint128(u64 cyc, u32 mult, u32 shift) > } > > /* Does not guarantee no reader on the modified bank. */ > -void trace_clock_update(u32 mult, u32 shift, u64 epoch_ns, u64 epoch_cyc) > +void hyp_trace_clock_update(u32 mult, u32 shift, u64 epoch_ns, u64 epoch_cyc) > { > struct clock_data *clock = &trace_clock_data; > u64 bank = clock->cur ^ 1; > @@ -48,7 +48,7 @@ void trace_clock_update(u32 mult, u32 shift, u64 epoch_ns, u64 epoch_cyc) > } > > /* Use untrusted host data */ > -u64 trace_clock(void) > +u64 hyp_trace_clock(void) > { > struct clock_data *clock = &trace_clock_data; > u64 bank = smp_load_acquire(&clock->cur); > diff --git a/arch/arm64/kvm/hyp/nvhe/trace.c b/arch/arm64/kvm/hyp/nvhe/trace.c > index e7e150ab265f..f2a32463c6c2 100644 > --- a/arch/arm64/kvm/hyp/nvhe/trace.c > +++ b/arch/arm64/kvm/hyp/nvhe/trace.c > @@ -35,7 +35,7 @@ static bool hyp_trace_buffer_loaded(struct hyp_trace_buffer *trace_buffer) > void *tracing_reserve_entry(unsigned long length) > { > return simple_ring_buffer_reserve(this_cpu_ptr(trace_buffer.simple_rbs), length, > - trace_clock()); > + hyp_trace_clock()); > } > > void tracing_commit_entry(void) > @@ -290,7 +290,7 @@ void __tracing_update_clock(u32 mult, u32 shift, u64 epoch_ns, u64 epoch_cyc) > } > > /* ...we can now override the old one and swap. */ > - trace_clock_update(mult, shift, epoch_ns, epoch_cyc); > + hyp_trace_clock_update(mult, shift, epoch_ns, epoch_cyc); > } > > int __tracing_reset(unsigned int cpu) > -- > 2.55.0.795.g602f6c329a-goog >