From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 07F5015853B; Fri, 23 Jan 2026 12:47:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769172462; cv=none; b=EyLxI7HEh7xMcgExGQvt7p44l93m2JpERyGWCR/Ol/YvHnjMyhCkYbtYPJi5DiLhvDP+NW0qcauHc7Z8FJtCrrrBm8v2vwHhoArLNc7ve8+HLh7nOAG9cL6GPArYOphprNFlU0LxS/NIyiiW7CWwb48AFm2/UlOsO7MbTQT+Iv8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769172462; c=relaxed/simple; bh=W0JXEqdFkknxnY80SKobVw6uWbZ5fonni3fohUHvIIE=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=VIyiGH/votmFrmnQD+sJkj1v78E1tWKslTGW/HYiyHGWoAatvX4GNja0zRmfZBfMNhwbEL4bVLD0Kpr/aSn6usjZSfcj+9xJlWLIyx1AJ6zllZLpy1sjUUQgZqNQwrSUEMqBJhBtGw99wPeDLBy+SzRLXUjIBRs0b2CIBHu34mc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=j9nKCbYz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="j9nKCbYz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D0B0C19421; Fri, 23 Jan 2026 12:47:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1769172461; bh=W0JXEqdFkknxnY80SKobVw6uWbZ5fonni3fohUHvIIE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=j9nKCbYzJANFAx6sZYkqZxDkD0nhP//6TR3P0kvaxyOpVaOl2Gq7Ejvhau1K5YKTc Kv9UVXpaFr4gB1qsml4zeyPxqHUxv6JEOB1e83wX0TA/iaqaoaGhY5+N6laTTaiAuz /tZLbA8cjU1e1qbD1+xaWI1251TORCrqqT9/KNr6WNBMtd1Xl0nUrK5CTXz2KBVLLg KW8hdWPOuHyAp+Nr74NKU7RdS/xQlPengcwH25sF8BIKBGjBdJg0UUZJdUP1NckCF4 g+U4nUiH4xf6yNEorex09Oc8d0zHYuP6cjw6FynQQUGNf9Ldh19oUCcIDPQiaUVV4e x9Z0kZFFsAqRw== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vjGZf-000000053Mp-2ggF; Fri, 23 Jan 2026 12:47:39 +0000 Date: Fri, 23 Jan 2026 12:47:39 +0000 Message-ID: <86ms24bims.wl-maz@kernel.org> From: Marc Zyngier To: Vincent Donnefort Cc: rostedt@goodmis.org, mhiramat@kernel.org, mathieu.desnoyers@efficios.com, linux-trace-kernel@vger.kernel.org, oliver.upton@linux.dev, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, jstultz@google.com, qperret@google.com, will@kernel.org, aneesh.kumar@kernel.org, kernel-team@android.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v9 29/30] KVM: arm64: Add selftest event support to nVHE/pKVM hyp In-Reply-To: References: <20251202093623.2337860-1-vdonnefort@google.com> <20251202093623.2337860-30-vdonnefort@google.com> <868qe9mnx5.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: vdonnefort@google.com, rostedt@goodmis.org, mhiramat@kernel.org, mathieu.desnoyers@efficios.com, linux-trace-kernel@vger.kernel.org, oliver.upton@linux.dev, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, jstultz@google.com, qperret@google.com, will@kernel.org, aneesh.kumar@kernel.org, kernel-team@android.com, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Fri, 23 Jan 2026 12:21:04 +0000, Vincent Donnefort wrote: > > On Fri, Jan 23, 2026 at 12:14:34PM +0000, Vincent Donnefort wrote: > > On Wed, Jan 07, 2026 at 03:40:22PM +0000, Marc Zyngier wrote: > > > On Tue, 02 Dec 2025 09:36:22 +0000, > > > Vincent Donnefort wrote: > > > > > > > > Add a selftest event that can be triggered from a `write_event` tracefs > > > > file. This intends to be used by trace remote selftests. > > > > > > > > Signed-off-by: Vincent Donnefort > > > > > > > > diff --git a/arch/arm64/include/asm/kvm_asm.h b/arch/arm64/include/asm/kvm_asm.h > > > > index 37c015b54ff6..e2de7ad64938 100644 > > > > --- a/arch/arm64/include/asm/kvm_asm.h > > > > +++ b/arch/arm64/include/asm/kvm_asm.h > > > > @@ -96,6 +96,7 @@ enum __kvm_host_smccc_func { > > > > __KVM_HOST_SMCCC_FUNC___tracing_update_clock, > > > > __KVM_HOST_SMCCC_FUNC___tracing_reset, > > > > __KVM_HOST_SMCCC_FUNC___tracing_enable_event, > > > > + __KVM_HOST_SMCCC_FUNC___tracing_write_event, > > > > }; > > > > > > > > #define DECLARE_KVM_VHE_SYM(sym) extern char sym[] > > > > diff --git a/arch/arm64/include/asm/kvm_hypevents.h b/arch/arm64/include/asm/kvm_hypevents.h > > > > index 268b3cd7a1b2..c276fd28e0bf 100644 > > > > --- a/arch/arm64/include/asm/kvm_hypevents.h > > > > +++ b/arch/arm64/include/asm/kvm_hypevents.h > > > > @@ -42,4 +42,15 @@ HYP_EVENT(hyp_exit, > > > > ), > > > > HE_PRINTK("reason=%s", __hyp_enter_exit_reason_str(__entry->reason)) > > > > ); > > > > + > > > > +HYP_EVENT(selftest, > > > > + HE_PROTO(u64 id), > > > > + HE_STRUCT( > > > > + he_field(u64, id) > > > > + ), > > > > + HE_ASSIGN( > > > > + __entry->id = id; > > > > + ), > > > > + RE_PRINTK("id=%llu", __entry->id) > > > > > > Not strictly related to this patch, but I find that the trace itself > > > lacks context. For example: > > > > > > [001] 323.847422: hyp_enter reason=hvc > > > [001] 323.847423: hyp_exit reason=eret_host > > > [001] 323.847688: hyp_enter reason=hvc > > > [001] 323.847688: hyp_exit reason=eret_host > > > [001] 323.847706: hyp_enter reason=hvc > > > [001] 323.847707: hyp_exit reason=eret_host > > > [001] 323.847722: hyp_enter reason=hvc > > > [001] 323.847723: hyp_exit reason=eret_host > > > > > > That's all fine as long as I'm dealing with a single guest, or even > > > with a single vcpu. Trying to trace multiple guests, or even multiple > > > vcpus makes the whole thing completely unusable, because I have no > > > idea what I'm looking at. > > > > > > To make this useful, having some context provided by the host really > > > is required. > > > > I could add to the event header the VM pid related to the currently loaded vCPU > > (if any). I can access it easily with host_kvm->userspace_pid. WDYS? > > Or actually directly kvm_vcpu->pid? More like it indeed. M. -- Without deviation from the norm, progress is not possible.