From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793180342; b=5iulaeZe/3NHsjGkYwRvxYrJpNV0CXHlAJ5XMX8W7A5M54pJ6gfAAWn7IvCL8bAtNdwJ mokMAe0PG7+Xr9PX7hJtFRdMe4QkJenzLetJ+XMrVk6CVC7aqKTcVm1vEUcmGU0EwukwZ EoFyMEFpQnE/CCB8duw12OnTAIMemb4DQk6Y+K/NQDniafzCjghdBt6gCPJlEz86Yj612 BmWJCThJReyXnzZjaxAzF2WtiCKqMLCq3oS+d7v2OG/qTsH6DsWrY/qAyXSuVVCIYpWnz r+xi0ieIOuy1LkkFtjeVrl5Hy1Fw8V7jgPjUjKKAZ39RCYwc/kCaol1klhCIN8yHR0w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793180342; h=Received:DKIM-Signature:Received:Date:Message-ID:From:To:Cc:Subject: In-Reply-To:References:User-Agent:MIME-Version:Content-Type: X-SA-Exim-Connect-IP:X-SA-Exim-Rcpt-To:X-SA-Exim-Mail-From: X-SA-Exim-Scanned; bh=GZ4fmoMdxXfwUoOFuld7hs0LTpDmuflesBVVeT5Njog=; b=UPqY+3wfNdC6cvgsWq1WwyF1XaFmHOngRWhK8ROZOSInaI3qeu4c7u31HEcyZ16FGY0O vyU7r/l+MEVkw4UnlYu84D9CeFW8feT9+a0l4AakMEMEx9H3UvSIU1kPR7QDNWqFQA9pM O0DJpijvju5nXjhACfKffPvVMsK1pbEFBuVoypRtdLqAukOA84Jjf0knizJ40aGN36+Ev BJhLx75s0KJ8tCj4xQRtQkaNl41xAEscsh4xGfjX859R0FEc7pioZuMbhWh2+p59N7XTm 53F0hB3dx8vY9aYSUlUUCSuF66fmEYr/5bCNxtErMI5bXljpMypup4+MwSbtt/2GT8g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ZRbbjkH1; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC4CA606A31A for ; Wed, 28 Oct 2026 09:39:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ZRbbjkH1 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 485D21F01825; Wed, 28 Oct 2026 09:39:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793180341; bh=GZ4fmoMdxXfwUoOFuld7hs0LTpDmuflesBVVeT5Njog=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=ZRbbjkH1Q7SzQDJEBlNrVOLVyD3mv0cqZezAyJXcPyZ0cw1Dy2NOfJF1XMK6iP4U4 o2IY3b5nC0EPvTvZq9j5CkpV7USSixhP4jKIIA89PPlaY1WBmhAapR57i9sUIigfH/ xmR65WXLDnusF6Y/71emvVgst5i18sw4W3vTMaDSolo0nVwHtOXz2Zmk1TPNlZHWo0 /4fLa3bhaT2uCLVlOJZVuix7eqilXGXLIuKB2En5kaV4Rsmc4Ay2rmZ5oU4ypHgtBB LxGtndZvA/4upKMvXxmEaNWco6PHC3Yx7LeE/ln++SZD4QcCZZHEKlRrUWpurYRZrZ bFM8RdugOrbUg== 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 1xM07X-000000083T3-0RUB; Wed, 28 Oct 2026 09:38:59 +0000 Date: Wed, 28 Oct 2026 09:38:58 +0000 Message-ID: <86o6cexiz1.wl-maz@kernel.org> From: Marc Zyngier To: Oliver Upton Cc: kvmarm@lists.linux.dev, Steffen Eiden , Joey Gouly , Suzuki K Poulose , Zenghui Yu , Fuad Tabba , Mark Rutland Subject: Re: [PATCH] KVM: arm64: Don't let a guest overwrite HCRX_EL2.MCE2 In-Reply-To: References: <20261026082633.2515820-1-maz@kernel.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) X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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: oupton@kernel.org, kvmarm@lists.linux.dev, seiden@linux.ibm.com, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, fuad.tabba@linux.dev, mark.rutland@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Wed, 28 Oct 2026 00:12:00 +0000, Oliver Upton wrote: > > Hey, > > On Mon, Oct 26, 2026 at 08:26:33AM +0000, Marc Zyngier wrote: > > FEAT_MOPS is fun. CPUs are allowed to implement any of two ways to > > perform the memory copy, and the hypervisor is in charge of hiding > > the difference between implementation when the vcpu migrates from > > one to another. This is unhelpfully signalled with an exception, > > which KVM diligently handles. > > > > Today, we don't really make a good job of it in the sense that > > if L1 also has the trap bit set, we don't forward the trap as > > the architecture would require us to do. > > > > But there is no good reason to forward this to the L1 guest if > > L2 generates the "I'm on the wrong implementation". KVM can fix > > it up in place and return to L2 directly, as if the physical CPU > > was able to implement both options. > > > > Conversely, allowing L1 to clear HCRX_EL2.MCE2 is counter-productive, > > and violates the abstraction that KVM aims to give. > > What abstraction? :-) > > At least in the non-nested case we can blame the VMM since it's > responsible for scheduling vCPUs on the right pCPUs in a heterogeneous > system. The problem is that there is no ID register describing which architectural option is implemented on a given CPU. > There is a subtlety here where if the VMM does the right thing with > sched affinities then a MOPS exception taken from L2 is definitely the > L1's fault and architecturally visible. How? It isn't discoverable the first place. And migration breaks this entirely. The whole A/B thing is an absolute disaster. > > But oh well. We're obviously oriented towards presenting a homogeneous > set of vCPUs and anything else works by accident. > > > Implement this behaviour by never allowing the guest's view of > > HCRX_EL2.MCE2 to make it into the HW, and document that KVM is in > > charge of the A/B handling. > > > > Signed-off-by: Marc Zyngier > > Reviewed-by: Oliver Upton Thanks! M. -- Without deviation from the norm, progress is not possible.