From nobody Sat Jul 25 21:22:49 2026 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 5B9DD2D060D for ; Mon, 13 Jul 2026 14:13:30 +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=1783952011; cv=none; b=f3WLtMSuF0lYy+4wTT0UUGTTVgcoBPNB6IzZowMb8FIWPyYuygO1rRPInr97Mxwp0hTgDaQIKRROqN7CS/sxuM2Ci11m4TriJ97xo7xYCRB6zcFK9imoYJu3+JO+8gkYbJ0KqeylCqLLapiBIJmShaZMk1fHKK75NbNAUpmvczA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783952011; c=relaxed/simple; bh=FKDIwVSYjBERwvoYzAiPGNs0iOqLa4NYZ8QsY0Y2wyc=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=MTCFiYR4nWVUIKsw4WSlG1cd7d9DOxEobbgj8SviGposTCorWdwKAXZD9Vw1LiuPh/rYQPanlr/twL4rqBSuAYPrKbD13osbRBejdl0LPaMhdas1KQND4rJbJy1k/UB0MD+opV7Bv1POLSuNILKp/TFGPm8DR45SrlfBFDYK6Rg= 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=n0ReowMQ; 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="n0ReowMQ" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-493bdaf8549so32239715e9.2 for ; Mon, 13 Jul 2026 07:13:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1783952009; x=1784556809; 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=8EAfjYCZ+mdecM/2UWmz0mAoe+dOmM9YeKRDVlIVuZo=; b=n0ReowMQhx5kSTqYiQyqVhbf//y/3hHueoeGimBxAAjhcA0G8DXe5win+PXX+ShQJB 0o0YQrpVwsA1FEvUsgsLMaIENJr1rob9RPJ8s1gtp5zLUuCDXEIBhQIk+cdmOItECm35 G3B5c4OWQZIgLY1592yd10A7rXEnEEeILMtI3Ur6p1hETYL4xjFJEGscpxe6EkGlVSBd 8NB1B06hoQOK0fEvAGCRAGqCWNQjX9GFhLexsofXzx391ckSC5kEj3hn4RI5IBKWPZW7 OsCsZHjpNfij6G4ykSCRCV3LDZU0NNKDWtHYXo74t5B8MwKYLI8oqB2UKNc7XRT4LPZu mn1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783952009; x=1784556809; 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=8EAfjYCZ+mdecM/2UWmz0mAoe+dOmM9YeKRDVlIVuZo=; b=PR495xobVjtJFjCRbTZGMED2Ij64bC8jT33K5W3tQZ+jU0k7nf2BSKSvJhM7stoYSX 7nIcoBIPxCuzTqJVOVUQ6UV7msADDFEOZi4VibVcQVL3XjTEhWk00qi3OSVxleJdPOIa hoBJA7Fy0q1/lYcKlQGzYOFVtACl+cSBHVdmVJXTwL565OTVHsWwbp2E+wNpAPojmEIA ff+Uv5v3qQ3l/enk6yf2U9607OphFigO7kstBFW/FClAY/HuS0g5YbYUXr0pAwCqIiZX jYCY75THmrOefWKYHR2fX0Zz1/oRotiHHuBdFD02TEY9NdyirTaC9lkYwW2lucHzXlNQ 72Mg== X-Gm-Message-State: AOJu0Yye8igOH7MDkwBh+i5CiFSyJCDtK7QLwGmGgAEtCdHn1mAfh0/U xCIMrVrMJ8p4WVBjc4z3hEIzgtHfzIYwCttWV+IvG16RyB5O7OK17FGJ/Gk1jpVPS2GO7CJqg11 MypSdqrd/rP+xOqYi1VKPlYKZWY+aifTbFdtui5WIOcO/9VNmbeKjld17eFmEi4m0KufEwLGDsb DaA+Wh9yuO8ATDIV7Y3rFivmYe3Y6uZnw8DOy8gaqElawPQDlky0diGlo= X-Received: from wmxt9-n2.prod.google.com ([2002:a05:600d:8649:20b0:493:f85a:3733]) (user=smostafa job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:190f:b0:492:4e09:9fc1 with SMTP id 5b1f17b1804b1-493f87e5b7fmr103931935e9.15.1783952008431; Mon, 13 Jul 2026 07:13:28 -0700 (PDT) Date: Mon, 13 Jul 2026 14:13:20 +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: <20260713141320.4065600-1-smostafa@google.com> Subject: [PATCH v2] 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 , Fuad Tabba Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Fuad Tabba Tested-by: Fuad Tabba < fuad.tabba@linux.dev> Reviewed-by: Vincent Donnefort --- 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..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 =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 trace_hyp_clock_update(u32 mult, u32 shift, u64 epoch_ns, u64 epoch_c= yc); +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/cloc= k.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 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 trace_hyp_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 trace_hyp_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..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_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()); + trace_hyp_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); + trace_hyp_clock_update(mult, shift, epoch_ns, epoch_cyc); } =20 int __tracing_reset(unsigned int cpu) --=20 2.55.0.795.g602f6c329a-goog