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 23723C433F5 for ; Thu, 6 Jan 2022 12:09:08 +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=TRbwOtf55+hYDGt/0jzRmHTijOuePDoRt6wIkt2jcoE=; b=bm3t0qzCOvkqzx svzlowlVCddYG7lcBNUwIgFKQYu8IgNUiBwUYJg9Dcg/4TKGSkDSDCpQ+JbYO8/xbiVIbgvxAajQj x79X3/ofVrAan54KYdLIqYz71R2hv0SITvq4Lt5X3b+01IOwGxutGnXJrH2DP4XrwB+r56X8jSGok Zesak1cRqD7zm6M8HbBF1OXImykaXUxfx0tqywgjFlXMtlhUEiDRTAIgjiVPxWWlNHbpMr3w+h7O1 0SwPsBnOKqS5FeJbFCABWeQwxMjT8Y8So1gtGouMdcK7QnLVFKQaNKe+fFGRyMKmbEl6GECwgkY7Z 8HgpFQFvk4MWn6+5UW1g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5RYQ-00HZI4-JO; Thu, 06 Jan 2022 12:07:38 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5RYM-00HZHD-Tq for linux-arm-kernel@lists.infradead.org; Thu, 06 Jan 2022 12:07:36 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 81CB312FC; Thu, 6 Jan 2022 04:07:33 -0800 (PST) Received: from monolith.localdoman (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6FAF43F774; Thu, 6 Jan 2022 04:07:31 -0800 (PST) Date: Thu, 6 Jan 2022 12:07:38 +0000 From: Alexandru Elisei To: Marc Zyngier Cc: james.morse@arm.com, suzuki.poulose@arm.com, will@kernel.org, mark.rutland@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, tglx@linutronix.de, mingo@redhat.com, peter.maydell@linaro.org Subject: Re: [PATCH v3 0/4] KVM: arm64: Improve PMU support on heterogeneous systems Message-ID: References: <20211213152309.158462-1-alexandru.elisei@arm.com> <87bl0xzwu1.wl-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <87bl0xzwu1.wl-maz@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220106_040735_076618_FA8558B7 X-CRM114-Status: GOOD ( 30.36 ) 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 Hi Marc, On Thu, Dec 30, 2021 at 08:01:10PM +0000, Marc Zyngier wrote: > Alex, > > On Mon, 13 Dec 2021 15:23:05 +0000, > Alexandru Elisei wrote: > > > > (CC'ing Peter Maydell in case this might be of interest to qemu) > > > > The series can be found on a branch at [1], and the kvmtool support at [2]. > > The kvmtool patches are also on the mailing list [3] and haven't changed > > since v1. > > > > Detailed explanation of the issue and symptoms that the patches attempt to > > correct can be found in the cover letter for v1 [4]. > > > > A summary of the problem is that on heterogeneous systems KVM will always > > use the same PMU for creating the VCPU events for *all* VCPUs regardless of > > the physical CPU on which the VCPU is running, leading to events suddenly > > stopping and resuming in the guest as the VCPU thread gets migrated across > > different CPUs. > > > > This series proposes to fix this behaviour by allowing the user to specify > > which physical PMU is used when creating the VCPU events needed for guest > > PMU emulation. When the PMU is set, KVM will refuse to the VCPU on a > > physical which is not part of the supported CPUs for the specified PMU. The > > restriction is that all VCPUs must use the same PMU to avoid emulating an > > asymmetric platform. > > > > The default behaviour stays the same - without userspace setting the PMU, > > events will stop counting if the VCPU is scheduled on the wrong CPU. > > > > Tested with a hacked version of kvmtool that does the PMU initialization > > from the VCPU thread as opposed to from the main thread. Tested on > > rockpro64 by testing what happens when all VCPUs having the same PMU, one > > random VCPU having a different PMU than the other VCPUs and one random VCPU > > not having the PMU set (each test was run 1,000 times on the little cores > > and 1,000 times on the big cores). > > > > Also tested on an Altra by testing all VCPUs having the same PMU, all VCPUs > > not having a PMU set, and one random VCPU not having the PMU set; the VM > > had 64 threads in each of the tests and each test was run 10,000 times. > > Came back to this series, and found more problems. On top of the > remarks I had earlier (the per-CPU data structures that really should > per VM, the disappearing attribute size), what happens when event > filters are already registered and that you set a specific PMU? This is a good point. When I looked at how the PMU event filter works, I saw that KVM doesn't attempt to check that the events are actually implemented on the PMU, but somehow skipped over the fact that the PMU affects the total number of events available. Thanks, Alex > > I took the matter in my own hands (the joy of being in quarantine) and > wrote whatever fixes I thought were necessary[1]. > > Please have a look. > > M. > > [1] https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/log/?h=kvm-arm64/pmu-bl > > -- > 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