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 mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by smtp.lore.kernel.org (Postfix) with ESMTP id A32CFC433F5 for ; Thu, 30 Dec 2021 20:01:20 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 1F26F49ECE; Thu, 30 Dec 2021 15:01:20 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@kernel.org Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7N6b8QXyC9hJ; Thu, 30 Dec 2021 15:01:18 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id CF02649E5F; Thu, 30 Dec 2021 15:01:18 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 93A9749DF6 for ; Thu, 30 Dec 2021 15:01:17 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SEpRNmW7UVQG for ; Thu, 30 Dec 2021 15:01:16 -0500 (EST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 2F80C40EE7 for ; Thu, 30 Dec 2021 15:01:16 -0500 (EST) 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 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 Cc: mingo@redhat.com, tglx@linutronix.de, will@kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu 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. _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm