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 91ACB19E97B; Sun, 30 Nov 2025 18:15:26 +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=1764526526; cv=none; b=L3EoyaKbWi2YMGbwndMnF3G+bcfxIE8Ug3BE7MWR3e3QnVelqJdsOniwzj7kNlssztGv+yneSVkZcghu6mueBNL3dTTAF5dj9dE5/jLwPTzAMJ9CncpYVCD7YAmVwhyIRCi0salvVog1DfZN0TpJGwno7jyCx+cCfSMPOJM6JGc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764526526; c=relaxed/simple; bh=QLjiei/aj1hM85e6RP3JXwOChsIkW+/RduS7s2r5j0Q=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=FwFvRRhF+pg2w/BOHTI/9RVF5dbedGBKE+dUHGuh1ABGb+uWFmg6S8/7IzPft7OAR9Dk34rJ2D0HtnxiYkxOFxpa5s7eBnMvL0y62YGLDesTC5XpYHxAJFOCEn1VcBeDB1l4yqIKcVsGc05hbX3Gd5e9Uia80ij+OMBuYQg+8G0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WM4XF6kp; 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="WM4XF6kp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 028F4C4CEF8; Sun, 30 Nov 2025 18:15:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764526526; bh=QLjiei/aj1hM85e6RP3JXwOChsIkW+/RduS7s2r5j0Q=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=WM4XF6kp1mvCYskm2Xb1pdoQdN053QIK+wCY9Y+7gCxT54sUqxa1eUU5UGvE0MbuY PtrpPWMhqk9DdUUwe26ivALxlDzQscK3tbZrFRcmEip5zusPGg6/y9ikqhEnS8REq0 aYGil/7YU+RYwMt+fiYw05HJ0g62p1ScC9lo12dRYWDew0G294k7FdduekmLiyJKIC fGKahG/RGps05ZLccKzq1d9vooRu4N1HKTiNmFqRF+FqoyVOQIS5dLFZ0ZXUS3gBTD wzYp9xoIwITtQzXd7/4HJRJBwtCMXGJRxtDnc1XG7KGP5FvbQMNWQgmV9GxsCYtHf+ nI1tIuS82n+oQ== Received: from sofa.misterjones.org ([185.219.108.64] helo=lobster-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 1vPlxD-00000009RHO-18JD; Sun, 30 Nov 2025 18:15:23 +0000 Date: Sun, 30 Nov 2025 18:15:22 +0000 Message-ID: <878qfnfkud.wl-maz@kernel.org> From: Marc Zyngier To: Vincent Donnefort Cc: g@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 Subject: Re: [PATCH v8 20/28] KVM: arm64: Add clock support for the pKVM hyp In-Reply-To: References: <20251107093840.3779150-1-vdonnefort@google.com> <20251107093840.3779150-21-vdonnefort@google.com> <86cy5erprc.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, g@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 Thu, 20 Nov 2025 11:36:16 +0000, Vincent Donnefort wrote: > > [...] > > > > +/* Using host provided data. Do not use for anything else than debugging. */ > > > +u64 trace_clock(void) > > > +{ > > > + struct clock_data *clock = &trace_clock_data; > > > + u64 bank = smp_load_acquire(&clock->cur); > > > + u64 cyc, ns; > > > + > > > + cyc = __arch_counter_get_cntpct() - clock->data[bank].epoch_cyc; > > > > I can only imagine that you don't care about the broken systems that > > do not have a monotonic counter, and that will happily have their > > counter swing back and forth? > > I haven't used the _stable() variant for the affected devices... Hum this will > not be trivial from the hypervisor. I'll see what I can do. In all honestly, simply disabling tracing when you don't have a stable counter should be enough. I don't think there is much to be gained with supporting that on sub-standard HW (the bar is low enough). > > Also, you may want to document why you are using the physical counter > > instead of the virtual one. I guess that you don't want CNTVOFF_EL2 to > > apply when HCR_EL2.E2H==0, but given that you never allow anything > > else for pKVM, this is slightly odd. > > You mean I might as well use __arch_counter_get_cntvct() as CNTVOFF_EL2 will > always be ignored in the pKVM case? That, plus the fact that CNTVOFF_EL2 is only evaluated at EL2 when E2H=0 (and that case is going to disappear over time). M. -- Jazz isn't dead. It just smells funny.