Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD1C3C433FE for ; Fri, 24 Sep 2021 03:30:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1F40360EE0 for ; Fri, 24 Sep 2021 03:30:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1F40360EE0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 906E76B006C; Thu, 23 Sep 2021 23:30:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 88FEC900002; Thu, 23 Sep 2021 23:30:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7578C6B0073; Thu, 23 Sep 2021 23:30:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0253.hostedemail.com [216.40.44.253]) by kanga.kvack.org (Postfix) with ESMTP id 600E66B006C for ; Thu, 23 Sep 2021 23:30:30 -0400 (EDT) Received: from smtpin34.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 0ECB318293214 for ; Fri, 24 Sep 2021 03:30:30 +0000 (UTC) X-FDA: 78621039420.34.2D6794E Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf15.hostedemail.com (Postfix) with ESMTP id 86A28D000099 for ; Fri, 24 Sep 2021 03:30:29 +0000 (UTC) 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 8EED9D6E; Thu, 23 Sep 2021 20:30:28 -0700 (PDT) Received: from [10.163.73.119] (unknown [10.163.73.119]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D554E3F59C; Thu, 23 Sep 2021 20:30:26 -0700 (PDT) Subject: Re: [PATCH] mm: debug_vm_pgtable: Don't use __P000 directly To: guoren@kernel.org, akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Guo Ren References: <20210921201815.284412-1-guoren@kernel.org> From: Anshuman Khandual Message-ID: Date: Fri, 24 Sep 2021 09:01:33 +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: <20210921201815.284412-1-guoren@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 86A28D000099 X-Stat-Signature: mbbkoz1chefdda85hwga4q5y9mk3qhik Authentication-Results: imf15.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf15.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com X-HE-Tag: 1632454229-37295 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: Hello Guo, On 9/22/21 1:48 AM, guoren@kernel.org wrote: > From: Guo Ren > > The __Pxxx/__Sxxx macros are only for init protection_map[]. All s/init protection_map[]/protection_map[] int/ Or rephrase with something similar. > usage of them in linux should come from protection_map array. Agreed. > > Becasue a lot of architectures would re-initilize protection_map[] s/Becasue/Because/ ./scripts/checkpatch.pl ./0001-mm-debug_vm_pgtable-Don-t-use-__P000-directly.patch WARNING: 'Becasue' may be misspelled - perhaps 'Because'? #9: Becasue a lot of architectures would re-initilize protection_map[] ^^^^^^^ total: 0 errors, 1 warnings, 15 lines checked > array, eg: x86-mem_encrypt, m68k-motorola, mips, arm, sparc. > > Using __P000 maybe won't cause bug because hw would deny access Not very clear. Could you please rephrase. > with PROT_NONE permission, but it's not rigorous. Agreed. > > Signed-off-by: Guo Ren > Cc: Andrew Morton > --- > mm/debug_vm_pgtable.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c > index 1403639302e4..a6ebbf6e53dd 100644 > --- a/mm/debug_vm_pgtable.c > +++ b/mm/debug_vm_pgtable.c > @@ -1104,13 +1104,13 @@ static int __init init_args(struct pgtable_debug_args *args) > /* > * Initialize the debugging data. > * > - * __P000 (or even __S000) will help create page table entries with > + * __P000 (protection_map[0]) will help create page table entries with Please just replace __P000 and __S000 with protection_map[0] and protection_map[8] respectively. Also reformat this comment section if required. > * PROT_NONE permission as required for pxx_protnone_tests(). > */ > memset(args, 0, sizeof(*args)); > args->vaddr = get_random_vaddr(); > args->page_prot = vm_get_page_prot(VMFLAGS); > - args->page_prot_none = __P000; > + args->page_prot_none = protection_map[0]; > args->is_contiguous_page = false; > args->pud_pfn = ULONG_MAX; > args->pmd_pfn = ULONG_MAX; > With the above changes in place. Reviewed-by: Anshuman Khandual