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 64D721FBEA6; Mon, 1 Dec 2025 16:33:32 +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=1764606812; cv=none; b=sJzl/ThkJBUWeV0k1Iq8WgcFsGT/tKRhKwLRsGjn/yojjNtglYWo+z6SDZLXCoafGp8cWoILOb3GCX88r/i5xODrvzO45YPullEWdTMPIu5oxK5pptx2cqh+rI8zuIDqlsltpvw6w/2miIMI0HE4DOxnl9/Ty39cdrzWNtubnrU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764606812; c=relaxed/simple; bh=mKAh6zoTfeyMrA3fhkg8tP6+y8PTWo7YVbnFxPAXZD8=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=n7mZ7LtX6+Cx5j6JMVHduEIgUOlU+QjQaJpGhZX/bS8SsAbHt02SfYRI01t9KETuiVGliXUbwRIUxvghFI+dpoYiNQnwObrZaOq/HaU5IcI5YzM/Ii2HNnzx8WwyOifLiibbNnAMol6R9zmpdAyO/FzjFEUUupnzayo7lKEYYCQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FaaesL99; 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="FaaesL99" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E15E5C4CEF1; Mon, 1 Dec 2025 16:33:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764606811; bh=mKAh6zoTfeyMrA3fhkg8tP6+y8PTWo7YVbnFxPAXZD8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=FaaesL99f3aylyjGWhobo5yy8gWh0sTHYUcDMseN5AN38SYx5q/uRK7ezEDTA2ZFk 9SHs2TIVg5xk1N6nyIjKdsxBJbVx9ZO7KUubuzjy2y+T9sPJQt9eYIJDNXwM0C1sTU P8rTQhJPVN8xE1f8dRS878TyldV2uz509ZYKJ598qQJ5aWZSuhMc8JllWfktFlN1GW hITjUZO4RNzPqocvqcx3jAUJqJE12ylkA5plINUmvEem2ZRKadlK8RYSwniC4bitIg Q69xwNJfklZR6yL3D2mXiJmE22dQlFRe2+CHQM7DxssgQIP73xkUW15fBXT7QOTNhr nbyljAXgWizvg== 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 1vQ6q9-00000009f9x-203m; Mon, 01 Dec 2025 16:33:29 +0000 Date: Mon, 01 Dec 2025 16:33:28 +0000 Message-ID: <86o6oip3fr.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 v8 26/28] KVM: arm64: Add hyp_enter/hyp_exit events to pKVM hyp In-Reply-To: References: <20251107093840.3779150-1-vdonnefort@google.com> <20251107093840.3779150-27-vdonnefort@google.com> <87345vfiqj.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-trace-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 Mon, 01 Dec 2025 16:04:07 +0000, Vincent Donnefort wrote: > > On Sun, Nov 30, 2025 at 07:00:52PM +0000, Marc Zyngier wrote: > > On Fri, 07 Nov 2025 09:38:38 +0000, > > Vincent Donnefort wrote: > > > > > > The hyp_enter and hyp_exit events are logged by the hypervisor any time > > > it is entered and exited. > > > > > > Signed-off-by: Vincent Donnefort > > > > > > diff --git a/arch/arm64/include/asm/kvm_hypevents.h b/arch/arm64/include/asm/kvm_hypevents.h > > > index d6e033c96c52..ce3953bc884a 100644 > > > --- a/arch/arm64/include/asm/kvm_hypevents.h > > > +++ b/arch/arm64/include/asm/kvm_hypevents.h > > > @@ -7,4 +7,21 @@ > > > #include > > > #endif > > > > > > +HYP_EVENT(hyp_enter, > > > + HE_PROTO(void), > > > + HE_STRUCT( > > > + ), > > > + HE_ASSIGN( > > > + ), > > > + HE_PRINTK() > > > +); > > > + > > > +HYP_EVENT(hyp_exit, > > > + HE_PROTO(void), > > > + HE_STRUCT( > > > + ), > > > + HE_ASSIGN( > > > + ), > > > + HE_PRINTK() > > > +); > > > #endif > > > diff --git a/arch/arm64/kvm/hyp/include/nvhe/arm-smccc.h b/arch/arm64/kvm/hyp/include/nvhe/arm-smccc.h > > > new file mode 100644 > > > index 000000000000..4b69d33e4f2d > > > --- /dev/null > > > +++ b/arch/arm64/kvm/hyp/include/nvhe/arm-smccc.h > > > @@ -0,0 +1,13 @@ > > > +/* SPDX-License-Identifier: GPL-2.0-only */ > > > + > > > +#include > > > + > > > +#include > > > + > > > +#undef arm_smccc_1_1_smc > > > +#define arm_smccc_1_1_smc(...) \ > > > + do { \ > > > + trace_hyp_exit(); \ > > > + __arm_smccc_1_1(SMCCC_SMC_INST, __VA_ARGS__); \ > > > + trace_hyp_enter(); \ > > > + } while (0) > > > > Huh. No, please. Don't override existing kernel constructs behind > > everybody's back. I know that tracing folks love to play that sort of > > game, but I really don't want any of that here. > > And you haven't seen what I had for arm_smccc_1_2_smc() I have the feeling that I don't want to see it at all! > > Just define a wrapper that is KVM-specific, and use that. > > > > Then from a semantic perspective, an SMC call, an ERET back to EL1 > > host, and an ERET back to EL1 guest are all very different events that > > you lump under the "exit" category. That's not right. Same thing for > > "enter". > > The idea of those events is just to know when we enter and exit the hypervisor, > purely from a timing point of view. In ACK, we already have other separated > events that can give the "cause" for entering or exiting the hypervisor. I > haven't added them to that series because I thought it was big enough. > > So happy to add now or do a follow-up, once we're done with that one? Fixed trace points are ABI AFAIC, so I'd rather we make them useful from the very start. What you have here is not very interesting, because it makes all entry and exit points equal -- they very much aren't. So get rid of these and implement the real thing. Thanks, M. -- Without deviation from the norm, progress is not possible.