From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) (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 494E215687D for ; Sun, 12 Jul 2026 15:38:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783870730; cv=none; b=sYwJd8jGW91QqUNxg/ohtV4Gqa5PmaeROPAlsK8W9AnIM7ZNGf+1g22V+gS528631EmYVJccMsR6Y38l/9bjtWiezNBUig9o5N+Dq6y6ppJMRMJV7ncv5iHSWVAyaSfngtsor6pFdn7+aYGpIIWhcgDb96hATRIilXB82DDBA+g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783870730; c=relaxed/simple; bh=FmQDkaXVosTaBGvaCFFP1YMXKMODSo63wIgdXG4YCMw=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=IV2SLmsm0MsaP44vxvw5UriMYRI0IZFCCqWf+7PmI6XEQ/71aJPO92w4fd/Jak9VI+NPQBQY4V1ZHNB75Qg3bh99PRtL6FbN16eCQ6obgx9cLNjX1BvkcvOdILD8nb+ufr9YjiSDEEprbaBzIhp10H+zhDanoxINfUdVndkb2AA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--smostafa.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=rIFWtACO; arc=none smtp.client-ip=209.85.128.74 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=flex--smostafa.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="rIFWtACO" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-493fd9ce0faso3863925e9.0 for ; Sun, 12 Jul 2026 08:38:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1783870728; x=1784475528; darn=vger.kernel.org; h=content-transfer-encoding:content-type:cc:to:from:subject :message-id:mime-version:date:from:to:cc:subject:date:message-id :reply-to:content-type; bh=Q4E9hh3K2pv4VCZFsG0zDJ0k6GBrQNGUvEBLw2wLUQw=; b=rIFWtACOeciDKRXkP53hXnrfiSLW4qstNSKO1sFJR8dH2bvkqfSdMsD94Z4Jv/5KaR wtF3Bm9TrqnIeM9e2GsYf1BYZndKyi9Ng4x3u12cBv8eBF45P/GkBmMe645CcTQomcgy gHE6qbRzL/Wwzb5vHS//P7itiT9am394kMu6HA2IYA3b/1w2doEx3ujGq2S4pzIZ/uYX hF2n3jLLTbKrzaIzhz6k1iW5PstCE0oDdrCFMAOg/as4p67xoq9tc0FitXrAViJgjFy9 8aOu35aRDd9Ct/nyxyR5FbsoFy14az7Q2fnU3VrmX5Bx9s4cL1F/U7ZCkCWqgjDKLJPW 246g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783870728; x=1784475528; h=content-transfer-encoding:content-type:cc:to:from:subject :message-id:mime-version:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to:content-type; bh=Q4E9hh3K2pv4VCZFsG0zDJ0k6GBrQNGUvEBLw2wLUQw=; b=kAkqgE1wCD+NzaGoxVqxN5a61XCGN2vVXNPBOoAVo5UfsRjYkw9zrjhK0fldQJ0Is+ QuBAHcAJuDFdTZWO9qhF6sjVTHzBzFZ+tIwPfpa3eQgbR+DdZouXwg913iIv/C+h7yoP AgdrYGzsCRBaf68gnWfSv1/1izAnnMpepLD+9gN2S+ne28HpsBhWyhCXDAjVCwBQYX31 CW20hijnEASXgOnEo2vbZhY+D00+c6YRyy3Z1SNaxZj6nY/NhaNh3r+Ki76UbbXkO7a6 BmrgKE4ceuMt3iSjTrwyd2rLz+/p0Tq4LHBSnR99vtvuCYNZp25QH8xqoLW20dEsMet1 o5uw== X-Gm-Message-State: AOJu0YxrHb6nv267l4FU9c2RpPpNYp7Z9vA4xBiQr/ywdAC2DXwFD4kz /8+y0YsmNbbWCDDzPNTDA38HogPEBKe16pDS8CZMy3FzFCnLOW+cnHOaz1GMmyaevOhkDumcs8A BTXfhGqhR7UiqvvxdZon/8w7UXn7rm8mGTV7b62o5MDUYGJEH5kVP0TKe1P2c1FNIMiZ/OZFQx3 teXdh/SACdmjQZgrH2kDi+BVqE6gKqiMq+lPYIryPK74djKu8aq1GTGRI= X-Received: from wmpm32.prod.google.com ([2002:a05:600c:920:b0:493:b55e:f03f]) (user=smostafa job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:4688:b0:493:d9f7:a3cf with SMTP id 5b1f17b1804b1-493f87f1ff4mr58578045e9.17.1783870727433; Sun, 12 Jul 2026 08:38:47 -0700 (PDT) Date: Sun, 12 Jul 2026 15:38:35 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.55.0.795.g602f6c329a-goog Message-ID: <20260712153835.2264905-1-smostafa@google.com> Subject: [PATCH] KVM: arm64: Avoid naming collision in tracing From: Mostafa Saleh To: linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org Cc: 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, vdonnefort@google.com, tabba@google.com, Mostafa Saleh Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 =E2=80=98trace_clock=E2=80=99 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/i= nclude/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 =20 #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_c= yc); +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/cloc= k.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 sh= ift) } =20 /* 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_c= yc) { struct clock_data *clock =3D &trace_clock_data; u64 bank =3D clock->cur ^ 1; @@ -48,7 +48,7 @@ void trace_clock_update(u32 mult, u32 shift, u64 epoch_ns= , u64 epoch_cyc) } =20 /* Use untrusted host data */ -u64 trace_clock(void) +u64 hyp_trace_clock(void) { struct clock_data *clock =3D &trace_clock_data; u64 bank =3D smp_load_acquire(&clock->cur); diff --git a/arch/arm64/kvm/hyp/nvhe/trace.c b/arch/arm64/kvm/hyp/nvhe/trac= e.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_buff= er *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()); } =20 void tracing_commit_entry(void) @@ -290,7 +290,7 @@ void __tracing_update_clock(u32 mult, u32 shift, u64 ep= och_ns, u64 epoch_cyc) } =20 /* ...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); } =20 int __tracing_reset(unsigned int cpu) --=20 2.55.0.795.g602f6c329a-goog