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 9EC4BEE4996 for ; Tue, 22 Aug 2023 10:00:35 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=l1oecsN3YCCwxvqh8BkwnXy3w0BIo47HS2O6RugcpMI=; b=OBGmBy/Ua81Kc8 6nkPm7RgnCCirQWyCWf30iXnARlKf+DY2RYHoetQhjxxXtFbTjBv3J8Lo6stvyWU5itNd4YMIQGNA snihwVQod2rriFR9VfQ1Ye/4YdXSGLmwVE4glvYz6kXPDyzyB/13DUdlUVytG5V31AjG4Cdd5X38w elq+WxGLpxZgN5jc9+qNbSeb0QE7zrraa0CnDTLbiSpKIGC72c2pd9Hmn/5Qqxvj0Mhk93wZGl9JV 4r/ivB3i2Yhe/6HzdbH+eRcAAP2B/qa+TbHQn/FPMsAuUTk21pQc6drwD2wiqMyQvu+N7w6/7KjD7 Sfmxy26NQAguBm8m5LQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qYOBE-00FafJ-35; Tue, 22 Aug 2023 10:00:08 +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 1qYOBC-00Faej-0x for linux-arm-kernel@lists.infradead.org; Tue, 22 Aug 2023 10:00:07 +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 80CEA61A1E; Tue, 22 Aug 2023 10:00:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED9B1C433C8; Tue, 22 Aug 2023 10:00:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692698404; bh=rtcBe0wMcJ7bn+plsUh8+W8tuYW9yWrtHpjLRSfJ4P8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=l8l9ZzCqdiFjkBKc00jp4AYVVM6IfvA6GT30hGvXdLxQZm6NirBsR5A+xTYPllwXy r253VNLCqH6/LRQmFXIzvgXv6YIXTyUB0veT1Ug/HLR3/CWs1ss7kPhvf8GvCBqRCm PDR55yrCpXi3sC/rJUbfXtx/LJI546LN2ONXFKZevw+niKK/MRd972bswqqm/ptXGq vP3kUUVSZWlOiJ00KDBn5C3pJTGphpWgxx8TpM7jicp0kGqTwvhhj9KefrlxPVXxeV rp1+y+pWX5T5SY01nS80NL3FlfeMydf6rwPcFM5Sz1sC8jfwWaNWv2uMyXnscCCsN6 fKNJZJwluwTpA== Date: Tue, 22 Aug 2023 10:59:59 +0100 From: Will Deacon To: Mark Rutland Cc: Marc Zyngier , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Huang Shijie , Leo Yan Subject: Re: [PATCH v2] KVM: arm64: pmu: Resync EL0 state on counter rotation Message-ID: <20230822095959.GB20667@willie-the-truck> References: <20230820090108.177817-1-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230822_030006_382278_290A492F X-CRM114-Status: GOOD ( 20.98 ) 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 Tue, Aug 22, 2023 at 07:48:28AM +0100, Mark Rutland wrote: > On Sun, Aug 20, 2023 at 10:01:08AM +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. > > > > In order to solve this, add yet another hook between the host PMU > > driver and KVM, re-applying the guest EL0 configuration if the > > right conditions apply (the host is VHE, we are in interrupt > > context, and we interrupted a running vcpu). This triggers a new > > vcpu request which will apply the correct configuration on guest > > reentry. > > > > With this, we have the correct counts, even when the counters are > > oversubscribed. > > > > Reported-by: Huang Shijie > > Suggested-by: Oliver Upton > > Tested_by: Huang Shijie > > Signed-off-by: Marc Zyngier > > Cc: Leo Yan > > Cc: Mark Rutland > > Cc: Will Deacon > > Link: https://lore.kernel.org/r/20230809013953.7692-1-shijie@os.amperecomputing.com > > This looks sane to me so: > > Acked-by: Mark Rutland > > It doesn't look like we have any PMU patches queued that would conflict, so if > Will's happy I reckon this should go through the KVM/arm64 tree. Fine by me! Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel