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 60CB5C4345F for ; Mon, 29 Apr 2024 16:34:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HbaSR26xfsZIgZSSC2Z0R770i8G29MZrJff5JBv5YJ0=; b=FHJZBy0QwVBSKF 5dtuqCqmU7VqGT+NM4xijk0OHz3z8rMqlZBfcsIHCexh0E8FF9LtAfPAY69GxDXnjWN72KAJrciq7 7vB2NBq46BXCJg72q7dRVqIsYQ5BTjoLG1tZUpVoaUD73jQBrcrcdcLnHzWNvn9ufq+GlYr/d58uS n1y8qSx+gz0xhECUxLaSP1v2MhMUUAGyZjJkaYl1bgFRZyUUSBay+Z66ruQUVHIyucYcj9DWHsb0s +bVVoEBCVkCQfKsci2wQ/XJxV8FVC+vjOGZNkYOjbPY18b7ca45RU3vsgEl5C0aTfRTHwJ2znJLHB /IMT13IKGrrO0GmB8RDg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1TxD-00000003b6B-3Jav; Mon, 29 Apr 2024 16:34:11 +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 1s1TxB-00000003b5O-0QG6 for linux-arm-kernel@lists.infradead.org; Mon, 29 Apr 2024 16:34:10 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 4CA22CE013B; Mon, 29 Apr 2024 16:34:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D787C113CD; Mon, 29 Apr 2024 16:34:04 +0000 (UTC) Date: Mon, 29 Apr 2024 17:34:01 +0100 From: Catalin Marinas To: Ryan Roberts Cc: Will Deacon , Joey Gouly , Ard Biesheuvel , Mark Rutland , Anshuman Khandual , David Hildenbrand , Peter Xu , Mike Rapoport , Shivansh Vij , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/3] arm64/mm: Move PTE_INVALID to overlay PTE_NS Message-ID: References: <20240429140208.238056-1-ryan.roberts@arm.com> <20240429140208.238056-3-ryan.roberts@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240429140208.238056-3-ryan.roberts@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240429_093409_335244_492B7FE1 X-CRM114-Status: GOOD ( 19.00 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Apr 29, 2024 at 03:02:06PM +0100, Ryan Roberts wrote: > PTE_INVALID was previously occupying bit 59, which when a PTE is valid > can either be IGNORED, PBHA[0] or AttrIndex[3], depending on the HW > configuration. In practice this is currently not a problem because > PTE_INVALID can only be 1 when PTE_VALID=0 and upstream Linux always > requires the bit set to 0 for a valid pte. > > However, if in future Linux wants to use the field (e.g. AttrIndex[3]) > then we could end up with confusion when PTE_INVALID comes along and > corrupts the field - we would ideally want to preserve it even for an > invalid (but present) pte. > > The other problem with bit 59 is that it prevents the offset field of a > swap entry within a swap pte from growing beyond 51 bits. By moving > PTE_INVALID to a low bit we can lay the swap pte out so that the > offset field could grow to 53 bits in future. > > So let's move PTE_INVALID to overlay PTE_NS (bit 5). PTE_NS is res0 for > SW outside of the secure state so Linux will never need to touch it. > > These are both marginal benefits, but make things a bit tidier in my > opinion. > > Signed-off-by: Ryan Roberts Reviewed-by: Catalin Marinas (subject to renaming PTE_INVALID to PTE_PRESENT_INVALID) _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel