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 9B592C0015E for ; Tue, 15 Aug 2023 06:33:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8IySqMvRbEcNJvYYnOyUYfqiLVf5gw7BrwiGwpAeQR8=; b=n4PL9xTeyewOmQ wjVLdovGlACWTqmQyonEOSqK9omF5uV5ldNB6DiuDlt7VDgonEjUVD5iXTNAKaD2XnzxcFzKuVIf3 DVp5FE9GrfwDK9POoUBVWD2AfAH9l7io7Lkrv0LsSfBTPr+bd1IsAlJe2EbVt6KSGjzHfL0W84KKT is3ZOXQC1uJJsiHtaycC18I8YUPo2LlpJJLzCQEbS1r7NIo2DyJ8mwlgSiHte2fXwBP0SEZb/3nzS mhDfbQ2m0/O4PwRUhk88uks2DGKI9CEhz6LQYtj8oj3X5zrP7VKYnmimjU/+LQvNQCIMnbr9A6MvX tKZ7H+4iPoEhShltBKIA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qVnbf-0010Lo-2a; Tue, 15 Aug 2023 06:32:43 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qVnbd-0010L5-1Y for linux-arm-kernel@lists.infradead.org; Tue, 15 Aug 2023 06:32:42 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 59A1F64DCD; Tue, 15 Aug 2023 06:32:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 829BAC433C8; Tue, 15 Aug 2023 06:32:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692081155; bh=gX4mUsVyiwiQm7PAb3hyxRoJKQABWyQbLBTieIzG3YU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=sVgD0LQS3KIOPswacqqAKmylw89V2v6yvOOScQTXvpq7mHiDxTxvUrHxPqf5ijV6M MKyscoB8cEiKlogktnu1EU5no/v+26rNtcGENPAVkno75NHx8DPkBzvYCKB8eVsD/M BPhe/ONQwGrMGXAJQ4i/q9VKvQhfTZ/t3TLc6ZQnOQmvHBc+o5aaYAqfG30FJ/X4JU 5Mf35qhAektal00hU3yopWh++2kZLbP3R6WIkkk50QtDfLA2kb4qKTceIg4kxrWTCn heqNKwhcNLCnGHHlsyyri/xl3zF/zSV8KMqnN0amWtAvCkrJ0q+pxR/5d1t3FXjxDw VX1lKyiwOO8Vg== Received: from [194.182.8.86] (helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qVnbV-004u5j-6Z; Tue, 15 Aug 2023 07:32:33 +0100 Date: Tue, 15 Aug 2023 07:32:40 +0100 Message-ID: <87leecq0hj.wl-maz@kernel.org> From: Marc Zyngier To: Leo Yan Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Huang Shijie , Mark Rutland , Will Deacon Subject: Re: [PATCH] KVM: arm64: pmu: Resync EL0 state on counter rotation In-Reply-To: <20230814071627.GA3963214@leoy-huanghe> References: <20230811180520.131727-1-maz@kernel.org> <20230814071627.GA3963214@leoy-huanghe> 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/28.2 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 194.182.8.86 X-SA-Exim-Rcpt-To: leo.yan@linaro.org, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, shijie@os.amperecomputing.com, mark.rutland@arm.com, will@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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230814_233241_690172_730310F6 X-CRM114-Status: GOOD ( 25.72 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 14 Aug 2023 08:16:27 +0100, Leo Yan wrote: > > On Fri, Aug 11, 2023 at 07:05:20PM +0100, Marc Zyngier wrote: > > Huang Shijie reports that, when profiling a guest from the host > > with a number of events that exceeds the number of available > > counters, the reported counts are wildly inaccurate. Without > > the counter oversubscription, the reported counts are correct. > > > > Their investigation indicates that upon counter rotation (which > > takes place on the back of a timer interrupt), we fail to > > re-apply the guest EL0 enabling, leading to the counting of host > > events instead of guest events. > > Seems to me, it's not clear for why the counter rotation will cause > the issue. Maybe unclear to you, but rather clear to me (and most people else on Cc). > > In the example shared by Shijie in [1], the cycle counter is enabled > for both host and guest No. You're misreading the example. We're profiling the guest from the host, and the guest has no PMU access. > and cycle counter is a dedicated event > which does not share counter with other events. Even there have > counter rotation, it should not impact the cycle counter. Who says that we're counting cycles using the cycle counter? This is an event like any other, and it can be counted on any counter. > > I mean if we cannot explain clearly for this part, we don't find the > root cause, and this patch (and Shijie's patch) just walks around the > issue. We have the root cause. You just need to think a bit harder. M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel