Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp630479pxb; Tue, 1 Feb 2022 07:19:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJwB57H3cW5lM5Hf9aIofBG7biXpMMhd0FjqmPfeLNrjY+dD02FXRBtlodX0CU7ZP6JXElYT X-Received: by 2002:a17:907:9812:: with SMTP id ji18mr17419787ejc.200.1643728751911; Tue, 01 Feb 2022 07:19:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643728751; cv=none; d=google.com; s=arc-20160816; b=AcJgMgT/irAXh7jCywGQEAcAPBSCBwVcgNan0IblHZ3uCLcn14KVScldISb3vW76Cq oYj4ZVsT89o3CAE5JkUr0RieAbcUTc3Ku7TLYV2VsC5sFPCJ5ssczkz0F7HB/sjlEAlF cpi2p+8+YgQMvgVvJ3ezHi6W21nFRDXADNDBLRBP2zDi7R3J7ONk7mUKUbYKjMTdKWoF 80vRKfGVXmN5oYSeWFUWBNp3/RerGGMTPt3vCmkwUPiE9/8WBAMnXz8bnebk15jm3ez+ /Q7RfK7eYn30NmqkDqldDGb4Uj+dzMqMt4jeBjX9uKQHM7s+Ds3HdA9Lu2xHRiiOQCIE IHiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=uoknIB5WOpZwKqH/P0zYlrxsXiaEzug8V6lCUZIR124=; b=VuaCvDTRq9IKX181/5DYtyqSmKHARXJA+kCIU4W2CXwoaXk3tQ1TOu6Lx+RAJfKpUR LDyF1ssg9JOmw4XNo35V0BX4h9gA5zL/dtSYcrAzHvKTLUf7auD06UxlGQa+OoTTSaW8 ygGyPVFG5a7yl2hchbOThOc3NuWxatcTewZoqXjgqiF0s6CX9HX4bV4o0RniQB0z9fAp 3V30s7yvpcN027bpPGxjpmyNXMy+jtyv1Wv7DaPakTMeCMTson8ymfm0MPK1CiOBk5Ro KGsoSV/qyChEjg4eZqVvFYAEhxqFkMbFtJl6/XMHa+w4iBbA5GpJ7IgbzMCptAc3C1QC 2eww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cr15si13140340ejc.690.2022.02.01.07.18.44; Tue, 01 Feb 2022 07:19:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237200AbiAaDft (ORCPT + 99 others); Sun, 30 Jan 2022 22:35:49 -0500 Received: from foss.arm.com ([217.140.110.172]:54302 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229885AbiAaDfs (ORCPT ); Sun, 30 Jan 2022 22:35:48 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AA62BED1; Sun, 30 Jan 2022 19:35:47 -0800 (PST) Received: from [10.163.44.9] (unknown [10.163.44.9]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BC6B53F774; Sun, 30 Jan 2022 19:35:45 -0800 (PST) Subject: Re: [RFC V1 00/31] mm/mmap: Drop protection_map[] and platform's __SXXX/__PXXX requirements To: Mike Rapoport Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, hch@infradead.org, akpm@linux-foundation.org References: <1643029028-12710-1-git-send-email-anshuman.khandual@arm.com> From: Anshuman Khandual Message-ID: <45a5562d-9eaa-b9ea-62e0-4518e5a09046@arm.com> Date: Mon, 31 Jan 2022 09:05:43 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/27/22 6:08 PM, Mike Rapoport wrote: > Hi Anshuman, > > On Mon, Jan 24, 2022 at 06:26:37PM +0530, Anshuman Khandual wrote: >> protection_map[] is an array based construct that translates given vm_flags >> combination. This array contains page protection map, which is populated by >> the platform via [__S000 .. __S111] and [__P000 .. __P111] exported macros. >> Primary usage for protection_map[] is for vm_get_page_prot(), which is used >> to determine page protection value for a given vm_flags. vm_get_page_prot() >> implementation, could again call platform overrides arch_vm_get_page_prot() >> and arch_filter_pgprot(). Some platforms override protection_map[] that was >> originally built with __SXXX/__PXXX with different runtime values. >> >> Currently there are multiple layers of abstraction i.e __SXXX/__PXXX macros >> , protection_map[], arch_vm_get_page_prot() and arch_filter_pgprot() built >> between the platform and generic MM, finally defining vm_get_page_prot(). >> >> Hence this series proposes to drop all these abstraction levels and instead >> just move the responsibility of defining vm_get_page_prot() to the platform >> itself making it clean and simple. >> >> This first introduces ARCH_HAS_VM_GET_PAGE_PROT which enables the platforms >> to define custom vm_get_page_prot(). This starts converting platforms that >> either change protection_map[] or define the overrides arch_filter_pgprot() >> or arch_vm_get_page_prot() which enables for those constructs to be dropped >> off completely. This series then converts remaining platforms which enables >> for __SXXX/__PXXX constructs to be dropped off completely. Finally it drops >> the generic vm_get_page_prot() and then ARCH_HAS_VM_GET_PAGE_PROT as every >> platform now defines their own vm_get_page_prot(). > > I generally like the idea, I just think the conversion can be more straight > forward. Rather than adding ARCH_HAS_VM_GET_PAGE_PROT and then dropping it, > why won't me make the generic vm_get_page_prot() __weak, then add per-arch > implementation and in the end drop the generic one? > Is not the ARCH_HAS_ config based switch over a relatively better method ? IIUC some existing platform overrides could have been implemented via __weak identifier, although ARCH_HAS_ method was preferred. But I might be missing something here.