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 0171D145B0F for ; Fri, 5 Jul 2024 12:08:54 +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=1720181335; cv=none; b=Ia9UKkLf/9NavUi1pD9es4PqW9Ply8DrMbH0YC+I76BGaXHDCpBnSwXcMCwg+gVTTtbWx/W6Af4QeI0LLGGhmSHoIvt94i9hoz4JqAkeRxwheQcQ/jyXjtVhh/7va2iI7YR9LBlT9YZC1ueAfKtPT8N0QQ/4m1KA4Vd+S12bwKc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720181335; c=relaxed/simple; bh=0V6C9qkhhtx70gyUjFPxOUyTBxZUI1Z54qiQ6pL9Avc=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=EMqERAQBcBj6THqIGP48BWvUU5g5FIarADfNqABEDevydy+6tVCuxw0x1tE/kg1OGjS4vP4VvQM0hNE5w7w7n3EggBreViqcL4/xi09jrwsTOupPhEcihRqVRteYf2k1+lwc0KFvaqQkjR3BI06i9IGQDArw1T7KwkekNLR4EP8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SVtgr4AX; 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="SVtgr4AX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73AFBC116B1; Fri, 5 Jul 2024 12:08:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720181334; bh=0V6C9qkhhtx70gyUjFPxOUyTBxZUI1Z54qiQ6pL9Avc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=SVtgr4AXv7n3jLj0YRiVeHfS+iM1S7k7SABfgjEpOv5v7XdFItzacLo8FpO0dgBFH 5mDkTUR06xAWoSOohOT/MqQV4CIE+WmdXTHPvMMP30SIHWtH6lG3gXui0/OgXHqO+z ZK0notQJGE3+ooL03hq8GS5QzjUC2kqfOD2oUwMkSRuKAU7xUHvf72wxWiLgOMZyQA n2CuO7SQXTbksQ/6zqbJOiFqDKSAzEz8Ch/8oWIvULw2zMQ6Jivj2ZgY1sb8aM7ih7 bMhNBwDKKUeJXib9MMdJzgNMAHZlxroTaVP+UDSU+l3MAGHDPp+vFMSCFpUYi8gXQ8 RC7tm560jdl7A== 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 1sPhkC-00A31j-3f; Fri, 05 Jul 2024 13:08:52 +0100 Date: Fri, 05 Jul 2024 13:08:51 +0100 Message-ID: <86bk3c3uss.wl-maz@kernel.org> From: Marc Zyngier To: Oliver Upton Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Joey Gouly , James Morse , Zenghui Yu , Suzuki K Poulose , Anshuman Khandual Subject: Re: [PATCH] KVM: arm64: nv: Fix RESx behaviour of disabled FGTs with negative polarity In-Reply-To: <171839668434.686757.6430070893119235107.b4-ty@linux.dev> References: <20240614125858.78361-1-maz@kernel.org> <171839668434.686757.6430070893119235107.b4-ty@linux.dev> 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/29.3 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: kvmarm@lists.linux.dev 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: oliver.upton@linux.dev, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, joey.gouly@arm.com, james.morse@arm.com, yuzenghui@huawei.com, suzuki.poulose@arm.com, anshuman.khandual@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 Fri, 14 Jun 2024 21:24:51 +0100, Oliver Upton wrote: > > On Fri, 14 Jun 2024 13:58:58 +0100, Marc Zyngier wrote: > > The Fine Grained Trap extension is pretty messy as it doesn't > > consistently use the same polarity for all trap bits. A bunch > > of them, added later in the life of the architecture, have a > > *negative* priority. > > > > So if these bits are disabled, they must be RES1 and not RES0. > > But that's not what the code implements, making the traps for > > these negative trap bits being always on instead of disabled. > > > > [...] > > Applied to kvmarm/next, thanks! > > [1/1] KVM: arm64: nv: Fix RESx behaviour of disabled FGTs with negative polarity > https://git.kernel.org/kvmarm/kvmarm/c/eb9d53d4a949 [+ Anshuman, as I've pointed him to this patch in the past] OK, I think I have come to my senses, and came to the conclusion that: - I am officially losing the plot (blame the political climate) - this "fix" is total b*ll*cks and must be dropped/reverted Let remember how this whole thing works. A "negative" trap bit has two essential properties: - it is writable - it has an effect when set to 0 If the bit isn't implemented, it is RES0. Only RES0. Not RES1, which this patch enforces. None of the FGT bits are ever RES1. So at least on this front, this patch is broken and results in observable nonsense on the guest side. But there is more! We are already capable of distinguishing a bit that traps because it is set to 0 from a bit that is RES0. check_fgt_bit() already has all the logic, which is evaluated on any trap. So we already have the proper filtering in place (a RES0 bit won't result in a trap forwarded to a nested guest), the original code was correct, and forcing FGT bits to RES1 is just a stupid regression. Oliver, can you please drop or revert this patch from the kvmarm/next branch please? Thanks and sorry for the noise. M. -- Without deviation from the norm, progress is not possible.