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 47BE5C77B7E for ; Tue, 2 May 2023 13:37:09 +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=jxqXXuEc/ghBs/s+DubcvgjCcasHKEYd09w2/cPF1nA=; b=XqEF9K0G7cbk3D WkIRVFXK7FL+E8RvggbU8W6K7hmLjzUzATpPdGd1mj1d0HAeRLtboXxzrc76OijQhXVX6Yr/6ZEAA m5IILPiqvWibW+zrw/ID0Twr+XARN+huhnJmGp4Zcnkhw1hrMyb0w5ihA2konxFjSVKpFmZUUoqv5 80nScJUr8HnRDv5IIcdtt8qCaahGPeTA9rjyqDfB0bi8u2CxcmfZUM0KzEdLxJp18L4TYMxX5VdsI bVveWVeHcsak0lfsxZKnIGcXJQQr1qfK4H5Ud8xUJYAj6ZoTB0kcUJp6tdWj4zynaURkn9Yp7gGdG 6+wSOL5PBfIgRjw/BrCg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1ptqAz-001d7V-23; Tue, 02 May 2023 13:36:17 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1ptqAw-001d4t-1h for linux-arm-kernel@lists.infradead.org; Tue, 02 May 2023 13:36:16 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4FC1C6247E; Tue, 2 May 2023 13:36:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC270C433D2; Tue, 2 May 2023 13:36:11 +0000 (UTC) Date: Tue, 2 May 2023 14:36:09 +0100 From: Catalin Marinas To: Mohamed Husain Noor Mohamed Cc: linux-arm-kernel@lists.infradead.org, Anshuman Khandual , Will Deacon Subject: Re: ARM64: Adding write-protect bit for Userfaultfd Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230502_063614_617720_2C61944F X-CRM114-Status: GOOD ( 18.06 ) 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 Fri, Apr 28, 2023 at 01:35:44PM -0400, Mohamed Husain Noor Mohamed wrote: > I am Mohamed Husain. I am a graduate student, working on a research > project using a userfaultfd for distributed shared memory. > We are trying to use Write-Protect mode in ARM64 but based on the > kernel commits we see the support only exists for the x86 kernel. > https://lwn.net/Articles/777258/ > > I am trying to add the write-protect support, so I am looking for the > unused bits in the PTE. Do you guys have any suggestions on the bits I > could use, or does it require hardware support? Unfortunately, we are pretty short on bits. The architecture only gives us bits 55 to 58 and they are all used. We could move PTE_PROT_NONE to another position (e.g. 60) since this is only used when !PTE_VALID and therefore doesn't affect the actual page attributes and free up a bit. Alternatively, we could hijack bits 59-62 but there may be out of tree patches making use of the PBHA imp def feature (AFAICT disabled on the mainline kernel). Well, I guess one could make the userfaultfd wp feature conditional. Cc'ing Anshuman as well, I think he looked at soft-dirty ptes for arm64 before for CRIU live migration and we concluded that userfaultfd was better but I didn't realise that the write-protect mechanism needs its own PTE bit as well. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel