Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp372100rwb; Thu, 1 Dec 2022 03:21:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Pzcu0qfQQ4a2fSaupDTxRqTxq/YVhiYa7c04VHCqVH626/otnR3+3E3Jt65dlImvJYNyw X-Received: by 2002:a17:906:a0d9:b0:78d:b912:6a6c with SMTP id bh25-20020a170906a0d900b0078db9126a6cmr56572726ejb.124.1669893701366; Thu, 01 Dec 2022 03:21:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669893701; cv=none; d=google.com; s=arc-20160816; b=ArGGtTp2hv+uCwoPN021hZ6wK/RUKONQCrTWklIAeCX4id1Eizj7d5KMf/EdXTYp4j B7hxW8co6qcYFfptYIATIp1m6KiyZbBK1uTc1aQ19/2iTDxNbjoFrP2A8TDDfQUR3rJP 9sW7J2Exbc1lAPQihgqYG16bxVxhJRfLgWy6nmRrNOhZG1Qrq0pOGKxtCxsTrfTRo+BJ Pj0ZwlmrupGnotd8tzJLXpUDWhIsAuxkMo1bP2/RRQ2rOPkoWi1q4B0bDE7rVOI29GJA FZXmeR+4wgBSqUD20Fj//eOw+oXNBh4tbzcqQ6qafor4VSBqFNRPxJ78NWicatVazXep Jpwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature; bh=w3pkIqOqQVYXPEDWmcW2PGJ74Ofg1Xwbeci02vDgAvw=; b=aiCAs8yoAD/cDFF0fJp7IRbVwOHF0l06AG8mvw+1pfU2zVwKqSjhUzYSNLmc/Xsorp dEmObqQw72IXdp13fi1FhXe2NszLjGA4XZKD3V7e6LtGAAHE5tUPUiDeSgNaFwMu/5Up 5Ler2+oo3Kk2ve01uKY/7jDCJWjUD5vOPkO+mNPzZuoHvXK/zfcbCLfkKMiz6/f96cnU 7dfEwN0LmKuRcP/KwuacIo+I17Bw37lMYqF4jZIqXUwSV0vUxpFsxEd/9uCLecdkYR0S QEteIO8FIDdAonGvVSsroKCjyNpTyLcpv2vgq/tQXiv6Q2h/JLn5bbM4I0gwA0UqaZjN JsrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XjPGLWxm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds15-20020a170907724f00b007be53f03fa7si4049802ejc.211.2022.12.01.03.21.21; Thu, 01 Dec 2022 03:21:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XjPGLWxm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231354AbiLALLY (ORCPT + 82 others); Thu, 1 Dec 2022 06:11:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231258AbiLALK4 (ORCPT ); Thu, 1 Dec 2022 06:10:56 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04747CA14B for ; Thu, 1 Dec 2022 03:06:56 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id A8DB0B81EA5 for ; Thu, 1 Dec 2022 11:06:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68650C433D6; Thu, 1 Dec 2022 11:06:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669892814; bh=i2np9F56qLywDr0RX1dy9AOjTdnmeeEccNFFBfjcT8U=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=XjPGLWxmn9oQO4FFerUe64zD1DnnuQMWv5kw6ej4pQ+vum0dRpQfw5DIg/F5OmR98 M7B41ZUi93fNrJav4R2Vl+UtOfStKc/6AB89nUSjMXvaEt7Zv+qopXqYoQ+Z4B2RTr /yZiyEe+yCwd6i+6UOu6IEVb6iQzATF+tgN+mdIDFKhL+Hg113FREev30545rFbmw9 m8KlzYl5C/xNvwp1q9iL+WLFoqYt8wq6tjVLJ07UxZT4RFmZX5Q9jDxMRGk8PG6DnQ HDQE2C8VykJ7Q09bMsD/pLqfV8Q5kMyDe9qDdy2Gz8VdJ6HE4lB6Oyd7yWwN7SZykX YszOhHrZDq1+w== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.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 1p0hP0-009oHg-Qi; Thu, 01 Dec 2022 11:06:52 +0000 Date: Thu, 01 Dec 2022 11:06:50 +0000 Message-ID: <867czbmlh1.wl-maz@kernel.org> From: Marc Zyngier To: Akihiko Odaki Cc: linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, Mathieu Poirier , Oliver Upton , Suzuki K Poulose , Alexandru Elisei , James Morse , Will Deacon , Catalin Marinas , asahi@lists.linux.dev, Alyssa Rosenzweig , Sven Peter , Hector Martin Subject: Re: [PATCH 0/3] KVM: arm64: Handle CCSIDR associativity mismatches In-Reply-To: <20221201104914.28944-1-akihiko.odaki@daynix.com> References: <20221201104914.28944-1-akihiko.odaki@daynix.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 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: akihiko.odaki@daynix.com, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, mathieu.poirier@linaro.org, oliver.upton@linux.dev, suzuki.poulose@arm.com, alexandru.elisei@arm.com, james.morse@arm.com, will@kernel.org, catalin.marinas@arm.com, asahi@lists.linux.dev, alyssa@rosenzweig.io, sven@svenpeter.dev, marcan@marcan.st X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 01 Dec 2022 10:49:11 +0000, Akihiko Odaki wrote: Thanks for looking into this. > M2 MacBook Air has mismatched CCSIDR associativity bits, which makes the > bits a KVM vCPU sees inconsistent when migrating. Can you describe the actual discrepancy? Is that an issue between the two core types? In which case, nothing says that these two cluster should have the same cache topology. > It also makes QEMU fail restoring the vCPU registers because QEMU saves > and restores all of the registers including CCSIDRs, and if the vCPU > migrated among physical CPUs between saving and restoring, it tries to > restore CCSIDR values that mismatch with the current physical CPU, which > causes EFAULT. Well, QEMU will have plenty of other problems, starting with MIDRs, which always reflect the physical one. In general, KVM isn't well geared for VMs spanning multiple CPU types. It is improving, but there is a long way to go. > Trap CCSIDRs if there are CCSIDR value msimatches, and override the > associativity bits when handling the trap. TBH, I'd rather we stop reporting this stuff altogether. There is nothing a correctly written arm64 guest should do with any of this (this is only useful for set/way CMOs, which non-secure SW should never issue). It would be a lot better to expose a virtual topology (one set, one way, one level). It would also save us from the CCSIDRX silliness. The only complexity would be to still accept different topologies from userspace so that we can restore a VM saved before this virtual topology. Do you mind having a look at this? Thanks, M. -- Without deviation from the norm, progress is not possible.