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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1039C433EF for ; Tue, 28 Sep 2021 04:42:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7F82060FC0 for ; Tue, 28 Sep 2021 04:42:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7F82060FC0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 985EC900003; Tue, 28 Sep 2021 00:42:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9357F900002; Tue, 28 Sep 2021 00:42:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 823A8900003; Tue, 28 Sep 2021 00:42:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0019.hostedemail.com [216.40.44.19]) by kanga.kvack.org (Postfix) with ESMTP id 70B2E900002 for ; Tue, 28 Sep 2021 00:42:31 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 0AA6B30167 for ; Tue, 28 Sep 2021 04:42:31 +0000 (UTC) X-FDA: 78635736102.03.062FCF1 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf29.hostedemail.com (Postfix) with ESMTP id 870C99000163 for ; Tue, 28 Sep 2021 04:42:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=QhqndkOgZUxmdSOkmVYTLDB3+1GBg21QeCq/Vol6ZYQ=; b=kSH464FMdMBHdCq0PrEWepJMkm uRUp8GDw1x1dx7m1B52yQP25ZvFjt7hcTm/PXRy+130Da97dEruCddLTkXvvEBtPsT/ndukl52ylU Ai3oIbjnTOpKtMNyyPkY+YK6r7Do3DsK8bab2k+M7dimqlMMUfhaw431/XV+2sxqy+7xWZmrlLsiU 0EhRqOW7moURELpaeJ8YnTK5iruqbwjHKKf2V6pL65dC6gGRheU9l3fl620aGIhoaAkln2LrhGDR7 xjWmDbTqwKa831LX6HJVawyfExGMqk9TLT8mZ9VEeff05SBMWOAqucMJvXtWk3G+eIeezcCEuWCP5 ODeh0VCw==; Received: from hch by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mV4wR-00AUi0-1z; Tue, 28 Sep 2021 04:42:14 +0000 Date: Tue, 28 Sep 2021 05:42:07 +0100 From: Christoph Hellwig To: Anshuman Khandual Cc: Christoph Hellwig , linux-mm@kvack.org, Thomas Bogendoerfer , "David S. Miller" , Andrew Morton , linux-mips@vger.kernel.org, sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/mmap: Define index macros for protection_map[] Message-ID: References: <1632712920-8171-1-git-send-email-anshuman.khandual@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 870C99000163 X-Stat-Signature: isz15arnxxxisw44e9syhdg914qfkju9 Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=kSH464FM; dmarc=none; spf=none (imf29.hostedemail.com: domain of BATV+03a7d039a758371a0a13+6610+infradead.org+hch@casper.srs.infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=BATV+03a7d039a758371a0a13+6610+infradead.org+hch@casper.srs.infradead.org X-HE-Tag: 1632804150-7085 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Sep 28, 2021 at 08:24:43AM +0530, Anshuman Khandual wrote: > > simple switch statement provided by each architecture. See the below > > WIP which just works for x86 and without pagetable debugging for wher= e I > > think we should be going. >=20 > Sure, this will work as well but all platforms need to be changed at on= ce. > Is there any platform that would not subscribe ARCH_HAS_GET_PAGE_PROT a= nd > export its own vm_get_page_prot() ? AFAICS all platforms are required t= o > export __PXXX and __SXXX elements currently. >=20 > This seems to be a better idea than the current proposal. Probably all = the > vm_flags combinations, which will be used in those switch statements ca= n be > converted into macros just to improve readability. Are you planning to = send > this as a proper patch soon ? This was just a qu=D1=96ck WIP patch. If you have some spare time to tac= kle it for real I'd sugget the following approach: 1) Remove the direct references to protection_map in debug_vm_pgtable.c 2) add the ARCH_HAS_GET_PAGE_PROT symbol that lets architectures provide vm_get_page_prot itself and not define protection_map at all in this case 3) convert all architectures that touch protection_map to provide vm_get_page_prot themselves 4) mark protection_map static 5) convert all architectures that provide arch_filter_pgprot and/or arch_vm_get_page_prot to provide vm_get_page_prot directly and remove those hooks 6) remove the __S???/__P??? macros and the generic vm_get_page_prot after providing an arch implementation for every architecture. This can maybe simplified with a new generic version that directly looks at PAGE_* macros, but that will need further investigation first.