From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 091923DF014; Thu, 9 Apr 2026 15:45:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775749507; cv=none; b=bifyNyW/hRZYCZ0HCJ6KugT7MNrz9kzIUL/1Y3YK8Nhc7qZiyRJ5UQCgJBnkDIKvrQe65OuC9drCWVKZ7Clzet8yiJDYL5oI0aCJYZvUW6QB+mpd5y9ddpr57ihI5lW3WVvmRIzH4UtAxCOdqYx3yRfr21vk+LXs4PItmaQV3BA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775749507; c=relaxed/simple; bh=J6uiOo4APYV7VEgCDfwDN+sbPUnXpMBRqqY6RsCKT5c=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=p1SuCXMOEsiyFwogG0SNaSszr6v6tQwz1FiW2bAp/56o6ZFZtgfl/CFT25GjgkZsebzpvch97zgvurrh0ORDO/hhMtfzW7015b4nyPthkWJa7QGH07f1XzB6UqcaiSY5Nj00ERw1w+uDtL09AZKYNWGQPPtNmZXu0nqvcCX3djw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Mh+SqBu9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Mh+SqBu9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 834E7C4CEF7; Thu, 9 Apr 2026 15:45:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775749506; bh=J6uiOo4APYV7VEgCDfwDN+sbPUnXpMBRqqY6RsCKT5c=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Mh+SqBu9kZ5UZJFuJAfr+D4QAjyXGfs1nMUS6KUL+ByVAfviO/LbQb8XMitubiSPY 5GO7pqYpIV7ylUi27n0wC2wz0UFjOb4xyRir1O+A6FNhaY7sMBWdJDF21nnwLixZRE MnqUR4yH/uv5m67n1AMRQAvbeKbUd0Py0sP3BS/jZ2j11kNKxh/xE5lEOxbS8LElTw ROP93FZzJ8tUzDB6A29zCYUI1A71zpGa1P5vyHJeJf8vtCU678wy6017pkbqZ5PKKS a/K6a37maNHR7Ijx1Y11S3JQpiLkvoAdd/rgtbkAUaXoj83BbeNVV8ZyPQWUiXdrBV m7fnDjRWAVTbQ== 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.98.2) (envelope-from ) id 1wArZ2-0000000AIrt-0Y6e; Thu, 09 Apr 2026 15:45:04 +0000 Date: Thu, 09 Apr 2026 16:45:03 +0100 Message-ID: <86tstk2l4w.wl-maz@kernel.org> From: Marc Zyngier To: David Woodhouse Cc: "Gutierrez Cantu, Bernardo" , alexandru.elisei@arm.com, alyssa@rosenzweig.io, asahi@lists.linux.dev, broonie@kernel.org, catalin.marinas@arm.com, james.morse@arm.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, marcan@marcan.st, mathieu.poirier@linaro.org, oliver.upton@linux.dev, suzuki.poulose@arm.com, sven@svenpeter.dev, will@kernel.org Subject: Re: [PATCH v7 7/7] KVM: arm64: Normalize cache configuration In-Reply-To: <254ca48a67779ccf9b9f60e2bb5796a305c03f95.camel@infradead.org> References: <20230112023852.42012-8-akihiko.odaki@daynix.com> <86wlyg2r3i.wl-maz@kernel.org> <254ca48a67779ccf9b9f60e2bb5796a305c03f95.camel@infradead.org> 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/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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: dwmw2@infradead.org, bercantu@amazon.de, alexandru.elisei@arm.com, alyssa@rosenzweig.io, asahi@lists.linux.dev, broonie@kernel.org, catalin.marinas@arm.com, james.morse@arm.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, marcan@marcan.st, mathieu.poirier@linaro.org, oliver.upton@linux.dev, suzuki.poulose@arm.com, sven@svenpeter.dev, will@kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Thu, 09 Apr 2026 15:51:59 +0100, David Woodhouse wrote: > > [1 ] > On Thu, 2026-04-09 at 14:36 +0100, Marc Zyngier wrote: > > On Thu, 09 Apr 2026 13:25:24 +0100, > > David Woodhouse wrote: > > > > > > On Thu, 12 Jan 2023 at 11:38:52 +0900, Akihiko Odaki wrote: > > > > Before this change, the cache configuration of the physical CPU was > > > > exposed to vcpus. This is problematic because the cache configuration a > > > > vcpu sees varies when it migrates between vcpus with different cache > > > > configurations. > > > > > > > > Fabricate cache configuration from the sanitized value, which holds the > > > > CTR_EL0 value the userspace sees regardless of which physical CPU it > > > > resides on. > > > > > > > > CLIDR_EL1 and CCSIDR_EL1 are now writable from the userspace so that > > > > the VMM can restore the values saved with the old kernel. > > > > > > (commit 7af0c2534f4c5) > > > > > > How does the VMM set the values that the old kernel would have set? > > > > By reading them at the source? > > Yes, but the VMM in EL0 *can't* read the source, can it? Again, this is designed for migration, and snapshoting the source values gives you the expected result. > > > > Let's say we're deploying a kernel with this change for the first time, > > > and we need to ensure that we provide a consistent environment to > > > guests, which can be live migrated back to an older host. > > > > We have never guaranteed host downgrade. It almost never works. > > Huh? Host downgrade absolutely *does* work; KVM on Arm isn't a toy. > We'd never be able to ship a new kernel if we didn't know we could roll > it *back* if we needed to. You have clearly been lucky so far, because I'd never such claim. > > I *know* that you know perfectly well that we actively test host > downgrades prior to every rollout of a new kernel. So I'm a little > confused about what you're trying to say here, Marc. I said exactly this: we make no effort to ensure that a guest started on a version of the kernel can be migrated to an older version -- the state space might be different. > > > > So for new launches, we need to provide the values that the old kernel > > > *would* have provided to the guest. A new launch isn't a migration; > > > there are no "values saved with the old kernel". > > > > And you can provide these values. > > If I know them, sure. But I don't, because: > > > > Userspace can't read the CLIDR_EL1 and CCSIDR_EL1 registers directly, > > > and AFAICT not everything we need to reconstitute them is in sysfs. How > > > is this supposed to work? > > > > > > Shouldn't this change have been made as a capability that the VMM can > > > explicitly opt in or out of? Environments that don't do cross-CPU > > > migration absolutely don't care about, and actively don't *want*, the > > > sanitisation that this commit inflicted on us, surely? > > > > I don't think a capability buys you anything. You want to expose > > something to the guest? Make it so. You are in the favourable > > situation to completely own the HW and the VMM. > > Now that the values are writable, but userspace can't easily see *what* > they would have been in the previous kernel. So having the capability > to ask KVM to set them to those values seems like it might be useful. Well, it's only a patch away. M. -- Without deviation from the norm, progress is not possible.