Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5244480rwb; Sun, 11 Dec 2022 02:40:10 -0800 (PST) X-Google-Smtp-Source: AA0mqf6FCBCYkJR+xgzcjijsgjZECNzQETXG72V0sPlBNZrlelNbu5mS4Dwc28fAIKqVYPYpdE9G X-Received: by 2002:a05:6a21:1505:b0:a3:ef0f:ce6d with SMTP id nq5-20020a056a21150500b000a3ef0fce6dmr15824225pzb.58.1670755210374; Sun, 11 Dec 2022 02:40:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670755210; cv=none; d=google.com; s=arc-20160816; b=DH2j1D6B9Yk38RBo6sMLO9n0qDorxav77tKXI9TqhAgBbS5OZVGoX3wfqidFVBESXU r4vVevqe1kTd8mnBMjX/I1YYDPgErZ4m9aq866+cPeFmzm4eThVZxtNhohNLA/v2px5j IJW4SsrSnzrDLMuQngs5AeQQ+0VedMA4p2SQYngAtXINWx85Ub1moJ2wAz+HJGuyNwSw wDmr2kKLy50EdcuZFXSywbyJXZN2OBlBlttvbuqRgLkhnyGw1tcelJyEqMhJmrh4lWw/ 8w7PXE1f6QUCmdRcdCImEiSP4tj79UTw0Id/yKmHJyiSzroS9DobDAZHN+wrmrBdUe9j wTjg== 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=LbrI6od+k5p5xHDc13uxvM2sUKya6GD//K1J1OcU3X8=; b=NxJ09RMFmrcVLB1pAKVtOD4m2DHXxpGMsA5x3qfwkuu/3R1Ms97hA7PjQ1FsYqttVA 8spuEP1CfvdSfQZRJE8BZIVss/jOV7w6hg6NoUSUXCUjw2IAPivYpz3Z0fk8U+ViYRj/ Wd95xo2NtLusCax/ajP3a35gvXGFaRX26K9OdJmtMSGqLCm+yQIvWDzxcFt7wTvzKy5g DlML/AEqoPkdSAHLTOD/3qHFPR+yVqazqEkVghhGjsmGAn2IMiDFH53NxeIM3rgQkFcv b7txJRrMQYJ/Pa0gxz14Y3ggToVJ8DeZZTlNPQouxyo+J6nPa9U2N9wiMHsynAEmsGwi MsJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KjBSr1RP; 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 h71-20020a63834a000000b00478d43abcdcsi6386551pge.149.2022.12.11.02.39.52; Sun, 11 Dec 2022 02:40:10 -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=KjBSr1RP; 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 S229896AbiLKKVO (ORCPT + 78 others); Sun, 11 Dec 2022 05:21:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229568AbiLKKVL (ORCPT ); Sun, 11 Dec 2022 05:21:11 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44BFA659D for ; Sun, 11 Dec 2022 02:21:10 -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 dfw.source.kernel.org (Postfix) with ESMTPS id B570C60DC6 for ; Sun, 11 Dec 2022 10:21:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16432C433D2; Sun, 11 Dec 2022 10:21:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670754069; bh=1G9KSqe0vdq9ccr1X0nvxLfUQZTSlSthV652SmeztGU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=KjBSr1RPXnBgQP+doaOlXWMGKT9NRaZxT1yTIy8xiKOKM2MSU8iaU4dSvudHWF6sX 4qQ87mxy8dTdx90Aslihda8OBwoHAoh5dqUz/P9Yj59UAZ3QfT+4O1XFtTh8QMHabv lfPS9qBBDRD5iXHot7Pj0rxMGjKzVPCOZwejwN8b7cEjeatnoFpNgMYnxzLZWz7RNG p0l10zRrLQfuUiKXQg9Csb2rI0S27bYWyR52MtXFCk5YnOOHoUaROUi97hehd5X2/C FKrwQoUAajE+5fmt77Gp/2xhSXzD1yiJYsqLMNFwEj/YBOn6HeBoVVrmGxT7nT9fUm FlM5v0YtVAbeQ== 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 1p4JSE-00Btdg-Ph; Sun, 11 Dec 2022 10:21:06 +0000 Date: Sun, 11 Dec 2022 10:21:06 +0000 Message-ID: <868rjeqm0d.wl-maz@kernel.org> From: Marc Zyngier To: Akihiko Odaki Cc: Akihiko Odaki , 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: <88bdcca8-4df4-15ff-2e88-c53255b1fe30@daynix.com> References: <20221201104914.28944-1-akihiko.odaki@daynix.com> <867czbmlh1.wl-maz@kernel.org> <50499ee9-33fe-4f5d-9d0a-76ceef038333@daynix.com> <87lenqu37t.wl-maz@kernel.org> <525ff263-90b3-5b12-da31-171b09f9ad1b@daynix.com> <87h6yeta8b.wl-maz@kernel.org> <87bkojtdvy.wl-maz@kernel.org> <88bdcca8-4df4-15ff-2e88-c53255b1fe30@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, akihiko.odaki@gmail.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 Sun, 11 Dec 2022 05:25:31 +0000, Akihiko Odaki wrote: > > On 2022/12/04 23:57, Marc Zyngier wrote: > > On Fri, 02 Dec 2022 09:55:24 +0000, > > Akihiko Odaki wrote: > >> > >> On 2022/12/02 18:40, Marc Zyngier wrote: > >>> On Fri, 02 Dec 2022 05:17:12 +0000, > >>> Akihiko Odaki wrote: > >>>> > >>>>>> On M2 MacBook Air, I have seen no other difference in standard ID > >>>>>> registers and CCSIDRs are exceptions. Perhaps Apple designed this way > >>>>>> so that macOS's Hypervisor can freely migrate vCPU, but I can't assure > >>>>>> that without more analysis. This is still enough to migrate vCPU > >>>>>> running Linux at least. > >>>>> > >>>>> I guess that MacOS hides more of the underlying HW than KVM does. And > >>>>> KVM definitely doesn't hide the MIDR_EL1 registers, which *are* > >>>>> different between the two clusters. > >>>> > >>>> It seems KVM stores a MIDR value of a CPU and reuse it as "invariant" > >>>> value for ioctls while it exposes the MIDR value each physical CPU > >>>> owns to vCPU. > >>> > >>> This only affects the VMM though, and not the guest which sees the > >>> MIDR of the CPU it runs on. The problem is that at short of pinning > >>> the vcpus, you don't know where they will run. So any value is fair > >>> game. > >> > >> Yes, my concern is that VMM can be confused if it sees something > >> different from what the guest on the vCPU sees. > > > > Well, this has been part of the ABI for about 10 years, since Rusty > > introduced this notion of invariant, so userspace is already working > > around it if that's an actual issue. > > In that case, I think it is better to document that the interface is > not working properly and deprecated. This means nothing. Deprecating an API doesn't mean we don't support it and doesn't solve any issue for existing userspace. I'd rather not change anything, TBH. Existing userspace already knows how to deal with this, > > > > > This would be easily addressed though, and shouldn't result in any > > issue. The following should do the trick (only lightly tested on an > > M1). > > This can be problematic when restoring vcpu state saved with the old > kernel. A possible solution is to allow the userspace to overwrite > MIDR_EL1 as proposed for CCSIDR_EL1. That would break most guests for obvious reasons. At best what can be done is to make the MIDR WI. M. -- Without deviation from the norm, progress is not possible.