From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9D5C4C30658 for ; Fri, 5 Jul 2024 12:09:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=AyvHM1MkFClNW5U8ueCOY2Kj7vVVrG0Xt/0r9k97ldM=; b=OmUbiNogtKOk0ntQFkJa4PztWy ueamW9BP3IdaSi8YTeULe0F6zCFsI3ALnCPsJZ8MuHEEi12wBSgozPjwL0lf2ZRoYvv9Zq0JlC26j t2TQihId7lXuUXkcx7IIBoaf+9Zjly8g0kP+R7pdEIfF7SeqYsgMXl+h+O71oO2NXPRwGA2lgXSlT FCIbV7lVEjMf8Ki7zFkuQ1yAzeWuWo9cLcQj+cc2imzTDl4UcauOGeeDdRMl3MtKhnBW3gdusQhOx 61DF4c1XzoTsJkegDgiT4yAwrggB9Qr17Pe/NDxc0N/xIo0eVwycbzM2TIu8roiGCZRJLlOtNWNfR 3SsZ+HaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPhkY-0000000Fs76-21TU; Fri, 05 Jul 2024 12:09:14 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPhkJ-0000000Fs5T-2vpf for linux-arm-kernel@lists.infradead.org; Fri, 05 Jul 2024 12:09:01 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 2BC24CE3D8B; Fri, 5 Jul 2024 12:08:55 +0000 (UTC) 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) 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240705_050900_117934_44ECDE8D X-CRM114-Status: GOOD ( 24.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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.