From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 EA98C2E7F11 for ; Fri, 23 Jan 2026 12:21:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769170873; cv=none; b=t9SI/9YawYf3AkiytDxhMKXbSdz8k6FajljTDojsSa4c9AkdinRtMmNVYBRCKyANUkeBoq4co/ohLWgm7r4dHXlN/JHDZuEoPS6TcpIPbP5J5t1whr7/e5le2bjxiFgaRLNSC0mRW2tOUP5QGGJE7qB+Awb1AR5OCgpIfxUCwlM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769170873; c=relaxed/simple; bh=qrrNz70FFr4gK34AJyCd9eOVfmuimB0x+lUYBwlFvF8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UzyugFRTy9HzTOtbLQVb5wymA4KkDm+HFlis7OEUxYfOMpkkhcVAJV2SetAr57e++Bt9bPdWLxJ9jV2GxEyqLWOKSXOzD0YV+kGEdcACgRaMt1GlmdK6UXCvtlIfnoTIq/LPaTDP1eqy0zgXYma9Q3TrdZvFB+Hn89w2jq5pDn4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=PL/vJg5C; arc=none smtp.client-ip=209.85.128.45 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=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="PL/vJg5C" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-47f5c2283b6so16103365e9.1 for ; Fri, 23 Jan 2026 04:21:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1769170869; x=1769775669; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=u8vx9GwQUjLh0uv6iY/ZSwwZRSPo2xMq3kygdhRNHoE=; b=PL/vJg5ChsfoXED/SD0DchsJnUHky5owm+ZoaanvI4LwEz8ooY3Hg0coPRh75ECIVp Z/1Dvtrc1Y7i5BBBr0ys9/+6bjnbFGTA+uWjAaxcbjx/dkjul4XhPD8ku2hpz6lqWxNp se+2Xa3tV2q52gwmuyiXxI/9GSx4ZzIzrypfTmyzchuJP07O37ZAD5dbBlahvBAf6Ya4 9QWKrC8I39r3r5g76Nd/zijg4VFuwh15A9U4qIohW7LJzs1kmzfYTWQW/tgcrNzGaSfv TyDsianWP4oE9ddRbQpbmkr5aHbnJfPjcOLK9JTPcSfPZGDGvgCx315Zkz2qEo8FIv/x XT7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769170869; x=1769775669; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=u8vx9GwQUjLh0uv6iY/ZSwwZRSPo2xMq3kygdhRNHoE=; b=hnV49j7jIya2pPUPShXtcn1o42EKcpQ6iO19d3cPoBXWbGclgDHAstCXGU1268pFCL YNXfjDT+iVQ/JF9X8gR2dmrvp5697Q47GN3NFnoBGIOCMjWRR9H16LC9hO+PXKPrQU6M MAtPyEYCTAsn2yPOPLySfOp7/r8YlkjFg3UMWwbER19ebygf4LGAJKB8BXMn9D7vn3AW JZE9IB2ObEx2L/S5qXuTDnE4EPdXJuQx4KyJ9DGg1Vyk29JWxpiqIKZ8wjBWgB9prqzc s3DsgiMH7wZwnPLdJrwZbbzF9kGwV6yPekvsX49qaHA2uWlQH3d6vxLlSn6nghdGsgFs fGWg== X-Forwarded-Encrypted: i=1; AJvYcCXjjuFOVUa8kL2ZmY8E+jAHhnbGZVEroiddHiNw9jlS2gmuNxpYTA1XwOVp7rHtsTeFaMaPbrQGdcuNP50=@vger.kernel.org X-Gm-Message-State: AOJu0Yzclb92Pyadlg7Hd4oC9JpC8AzHbk9TgPLiDmUy74aeSlTpQFNM JRN+KTWTGYim7w1fYO4w3YKEeS9fssFJ2cxV1gDOLMa0goTpPRMveM3iOXbcMQTcFA== X-Gm-Gg: AZuq6aKLqgBbY9QWOctUDxn3jngrus9BKlXLhBqhrh0D102NQy2auGTgny0LtdmAHIT noU6RF9Hu/EQ38JaHVREQxAFBwyYEVFfzz6xr3j4C4021luZKFqYwDS7SF+A8HnNLcQOMfI24LM zABcuJUvzWI/lJlaLptIH9pKQK1DnmLg70tmSAwUzMUtWJjPb7mx2arqcAT1wEO9RQD0F81PN6j Su1CzPgGo9rFYMxiTKx4DkemwaHGOeS0Czx1oixwOKvrllNdQ814Fp2u2JaWIHizjr7ryDpksNS NkWabcdu7+fnqVl2FarvUgdpWvu9x1147rCWMAI0WsnhO7A6fUALUSZ4WcrA9MHRx+yGdPEDT4v AaWX0DKByIcenlO1pDuaebGvoCUrZftE3mfKWIl+PSvc4ZtcZVccNzrQ4ekp399d1RvzHUu7iT+ 5FnBtH6MsoBdNq5icqRQr6GmM4cT/G6y1HUX4zR3IIRXBHJZCpuhIWE3DRy2cl X-Received: by 2002:a05:600c:3f0f:b0:479:1348:c614 with SMTP id 5b1f17b1804b1-4804c9c09efmr42530825e9.26.1769170868562; Fri, 23 Jan 2026 04:21:08 -0800 (PST) Received: from google.com (44.145.34.34.bc.googleusercontent.com. [34.34.145.44]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4804d61f1f8sm22563715e9.5.2026.01.23.04.21.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jan 2026 04:21:08 -0800 (PST) Date: Fri, 23 Jan 2026 12:21:04 +0000 From: Vincent Donnefort To: Marc Zyngier 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 Message-ID: References: <20251202093623.2337860-1-vdonnefort@google.com> <20251202093623.2337860-30-vdonnefort@google.com> <868qe9mnx5.wl-maz@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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? > > > > > Thanks, > > > > M. > > > > -- > > Without deviation from the norm, progress is not possible.