From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 40FD4D116F1 for ; Mon, 1 Dec 2025 16:33:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=BbeJ3ulp05RlunmastigKLaHSHWRQLN9kmG9sLI60FA=; b=nDBijBp/WWr/Z5xZ9ClLXMn//c U8Yzl4qf8n7pZoTdpIakJxEXTllAyawpli0NV4thJcY5gJ3UF9D5mSl7oZZu0yBXVNziCIy3DWU+c 1lVwz1M5zGFMXeyxgdUTBWwjfNh4/uZCUEac5alVedytclLPacP2mG5Zv3TXXMMDlZL9QSiPSQMnh 2s9qCoeDh9APN6XVjuTy5+cQZibhtE5Bu5k8Mh7UnWRLnve/dPCgZi4s5Cffvw2/jfvhBVNXsEqCa mMb4VAQftuJL+phZLTwlxE7f5nigrB2+ThFJsGA+pfPRNpldB4zo304rIxRUjlDNZcPqonphu8P5q MIta0DFQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vQ6qG-00000004H7f-0UC7; Mon, 01 Dec 2025 16:33:36 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vQ6qE-00000004H66-1lbU for linux-arm-kernel@lists.infradead.org; Mon, 01 Dec 2025 16:33:34 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 40BE460133; Mon, 1 Dec 2025 16:33:32 +0000 (UTC) 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) 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 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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.