From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (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 7B09926ED4F for ; Mon, 13 Jul 2026 15:01:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783954869; cv=none; b=p5DYcrizEqTChaznDx8YJir5PJKCU+GbB9H0jDgyrhM//LmA/b8UU54pDt0wyduJLSdNzM+sbniUgmewhRUBBhfRDsyEllVfTxNKWJ3bYxUjWWpZl51O0PDUxQPWIuTpsNAT4IvqXTEqbxOMwT1zoBYRkCxdm1ELr/Lxq4+3Lok= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783954869; c=relaxed/simple; bh=hlqIiRhZlkCHvonvTzLKSXIZj3XHXhx7E+Rk4m9S1RE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=cc04nWCjcq3ZrujR2AQDyXQXDfHSbKUzBAftnv5p0W+lHZSsXEdFhFrn6+LCO4n3KdS6wAZVHDqUrIcSvyOir/Auxr/N5HX6q7AKg6dLl5XypsVBuWLjpSS6ra1CbvXTN0PPNoXbT8YpnNYLZqEpKpe3DR421seEkC17B/nM50U= 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=kssLdLYc; arc=none smtp.client-ip=209.85.128.51 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="kssLdLYc" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-493e4cccd8dso77195e9.2 for ; Mon, 13 Jul 2026 08:01:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1783954866; x=1784559666; 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=d/zUrdSLYFP5PkDzH1dLf/JMl5TUcm+CxvXCyHNk/cg=; b=kssLdLYcekG9FLry5T83k0tGGrLZIVA2wlH1bIoetqJVsh+kVRae2hLQS3QRFD4ftm nKLrKZTJpbxrE1p7j3bRJ2mdywUnHrTQsprlxtElDI9djn9J/WKim22OppzRSBgCUlIr lMIxLtm3xyvf0WYQ2MDY6y9qrfenptPcsoKYAsI45ZKMxqvz+Gm1r/GEITiImmQPoRjU 6Yzx+wIR7Kow3OeXpCSSHEp7tRxbQC0qW3MxvKW3oBSM7b+L+2n6BZKgJF9SFUWjZOcU OICdcmJBLn9JYRfsEDzblka3+ciBbrzA6mwpwf9GVulczWM5WsUrolp3DtVLsCDz8r4W zfVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783954866; x=1784559666; 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=d/zUrdSLYFP5PkDzH1dLf/JMl5TUcm+CxvXCyHNk/cg=; b=rvpUARcmglo+R2NcHCSJEnY1rwDflJZk5TpI7G8LnXsRaYXuZsRXpJSHl30ZeEc1TV 49+XWfoe3nyp7AugfXMggHxhZeosnfkcdlofH/pqxYU2nnve5VlhDbPavJEIxRvREAkk BR8L4qPys4AHDZ/e9zMm24pgmCvBYqXHOfFrdbkPb+v7UYa6SJb4bdIKIXsNi0OH94Xp RC4QBAOUWKuclwxDIxDNUzEHdRG6baWQn+7dZQxLpe6gGO05/RBpjVVCnEIe/i0SLcO/ 0yJdT0Q50t504DdO2dKdr2vPkvVWAyEINxAPchXcuhj+ieQRvo7/JnlK5TxWvZ83wvjd L6MQ== X-Gm-Message-State: AOJu0Yx7F8kkzNBuXpd3u1hLOgzk22WXpaQ84GEv+imyiLqnb1s+at8v 3Ss3et9ogY5mm+suTHRitLPt1uAt+eJYOozjuviys2O9tgR7chxPCskwPIvLJkFWZQ== X-Gm-Gg: AfdE7cl883AFFeq5k4uzdCuapGDCtsq9M14rePL/C5pUqOKF84c2nlj+7niNSSgI7jM UIDMwdnb1IBtwJvSd6nO2QCERMI2w8rp506HE9dfZ1wNaaM6HIv7/jfAwWWw/+SSL+aGi5qPKNd b1j889xWWXOArT5BRM8Oy6vl4tKGrdOmi3K6DxDCDomfv8vcT42McCVsVyX2qBhI3P4qz0thcxR A41E23diAyRF7zUKubLVb1ydcY3LXGYVoMbmVyJ8YRwAzeWNcc+M220gyb76J2Pe4GCiP1iGbhV VagY0O3tfXc2NMfEr4YuCnhWYZLUGojlVWdio7heqcywIZLDnBkin6k1ZHOj2oCGd3vbQy640QU 6G5Ei4gNrv6aO8QOte2LZQo0s3L+q5ujuLQ78g8jw+xeK8wmEnGXKcxGWgj7QM5XwiYZaGn3gJc Oc3strDphRWNEEtZRW502X4tq15P1sroFJcfSMsDCY7N+psnceadLc/SCc+KSj5Q== X-Received: by 2002:a5d:588e:0:b0:47d:f43d:8947 with SMTP id ffacd0b85a97d-47f2dce306dmr11031006f8f.47.1783954864981; Mon, 13 Jul 2026 08:01:04 -0700 (PDT) Received: from google.com (137.69.77.34.bc.googleusercontent.com. [34.77.69.137]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47f2465ae8bsm29830623f8f.36.2026.07.13.08.01.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2026 08:01:04 -0700 (PDT) Date: Mon, 13 Jul 2026 16:01:01 +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, Fuad Tabba Subject: Re: [PATCH v2] KVM: arm64: Avoid naming collision in tracing Message-ID: References: <20260713141320.4065600-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: <20260713141320.4065600-1-smostafa@google.com> On Mon, Jul 13, 2026 at 02:13:20PM +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. > > 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: > > ./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 > Reviewed-by: Fuad Tabba > Tested-by: Fuad Tabba < fuad.tabba@linux.dev> > > --- > I did not add Fixes tag as this is currently dormant and not breaking > anything. Thanks for the respin Reviewed-by: Vincent Donnefort > --- > 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..ae03ec6965af 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 trace_hyp_clock_update(u32 mult, u32 shift, u64 epoch_ns, u64 epoch_cyc); > +u64 trace_hyp_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; } > +trace_hyp_clock_update(u32 mult, u32 shift, u64 epoch_ns, u64 epoch_cyc) { } > +static inline u64 trace_hyp_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..f3e2619db4e4 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 trace_hyp_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 trace_hyp_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..65be6c9fb379 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()); > + trace_hyp_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); > + trace_hyp_clock_update(mult, shift, epoch_ns, epoch_cyc); > } > > int __tracing_reset(unsigned int cpu) > -- > 2.55.0.795.g602f6c329a-goog >