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 7EDC4C433EF for ; Thu, 30 Dec 2021 20:02:41 +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=vwuilO1fit9upKketejWxxp0+wIXt6OEtuMJvnXfVq8=; b=RhvGYO2zcXXUV3 bYoOXm3eCQt158GPbi2WEXYIUQflT4am9CHOvJ+QSya8HWB2FMam6pxpdAIhm/cBsraol+WVp1jtk ZCBr8d82/jcjtRUQ3Z94J17Y3isSQhPw35t9z4cZW52qr0YmgsHSUdlzv0x9A+uTLqSVUmEa5hpSZ dfpokehU07krpqI9Zuvzl+TXn/uDTgH8Wga7P+UTOy6F9zFn4nXvzcBZsiNHksAEqOro3oBJD+6h6 7CCRCBidbqfsmOLpTil7+hfDhjOUs5WzexzpFVB2M9ceROWFH9t5OArTX99zrZZkbayJAJ5+ahf07 vUSDAqr+HHqFbLhUfPyw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n31bz-005CyC-UJ; Thu, 30 Dec 2021 20:01:20 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n31bw-005CwY-80 for linux-arm-kernel@lists.infradead.org; Thu, 30 Dec 2021 20:01:17 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1926B61758; Thu, 30 Dec 2021 20:01:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FDDFC36AEB; Thu, 30 Dec 2021 20:01:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1640894473; bh=LDnZSKMUJT7bNIohYHrCC1tyFQVO37nTsa29YNLdcng=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ctcUv2/eyN6NfS0+rJzFYqK4rFfvZs7qhW7ODWByD9rzia1K0QELctwXfivBCl0LN BKZ1L46DeNd3EpgZiyx1sma+/YEZKvSCPNQNPgVDWr1tzUoc+MbZc2m9Kuhx37DHCc lSx11sZxTKoo+XayCdhKEBhuV3a198nc9CJ2cOn7XoejE2ZdaQoB7dKcTYvS1iDx0W M+KrLphtKcYWYndfY/7zY9HEclpOHZYbwp1AwMXCPnvve644uG5Z1UtbLFavNxNUCM ve7nMNFzKpyPO/4n1IDDJ64RgSdjMVAWmKsbgd3oRGgn07sVFhaJ2ngrAXsSRC6WH3 xWsMzysTDeReA== Received: from cfbb000407.r.cam.camfibre.uk ([185.219.108.64] 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.94.2) (envelope-from ) id 1n31br-00F9ip-8j; Thu, 30 Dec 2021 20:01:11 +0000 Date: Thu, 30 Dec 2021 20:01:10 +0000 Message-ID: <87bl0xzwu1.wl-maz@kernel.org> From: Marc Zyngier To: Alexandru Elisei 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 In-Reply-To: <20211213152309.158462-1-alexandru.elisei@arm.com> References: <20211213152309.158462-1-alexandru.elisei@arm.com> 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/27.1 (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: 185.219.108.64 X-SA-Exim-Rcpt-To: alexandru.elisei@arm.com, 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 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-20211230_120116_394590_54C47624 X-CRM114-Status: GOOD ( 27.73 ) 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 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? 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