From patchwork Fri Sep 24 06:06:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guo Ren X-Patchwork-Id: 12513999 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=-16.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 86FF3C433EF for ; Fri, 24 Sep 2021 06:07:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 09C9A61214 for ; Fri, 24 Sep 2021 06:07:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 09C9A61214 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 448126B006C; Fri, 24 Sep 2021 02:07:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4035E6B0071; Fri, 24 Sep 2021 02:07:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2E65D900002; Fri, 24 Sep 2021 02:07:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0206.hostedemail.com [216.40.44.206]) by kanga.kvack.org (Postfix) with ESMTP id 1F0D36B006C for ; Fri, 24 Sep 2021 02:07:10 -0400 (EDT) Received: from smtpin40.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id C1A74183432CE for ; Fri, 24 Sep 2021 06:07:09 +0000 (UTC) X-FDA: 78621434178.40.0AC6A7B Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf12.hostedemail.com (Postfix) with ESMTP id 8080010000A5 for ; Fri, 24 Sep 2021 06:07:09 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id B7BAA60E97; Fri, 24 Sep 2021 06:07:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632463628; bh=mQgvLQUAYCNHQCu/wDtgBmgvIR6v7hDr+zZvd42AeyI=; h=From:To:Cc:Subject:Date:From; b=VwPIvCYDQzg2X+FPSGH2Qkn7V+T4MkGSt1iOoICTXBcUknFb/Notx+YfEviEOOXYJ 7OubZtXUQ+FsIf53rbf/5E2IwsGKpvHeUd6PBfGmxoSGxkkM3MgLO7RZS2QmW/MAme bzmeS6aaHzzjFIj11TZIctWR1dpwV7rtHIGIn0UyMKfnT3Aqq8EzdmQYtFuipv2LdK bypG0nzPvzUggTmXylZDxDalXZ5zwZwR9ZobBx15Jyx0n1prAD/YuzW8uqwdaCYhN/ MxsB0UzMWpUlNi59931npKPNDsbA06ZPtXKPrZcqQGNjwk5jKdBHwCO+g1VPNyfzY3 y4y9OR9h44IgA== From: guoren@kernel.org To: guoren@kernel.org, akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Guo Ren Subject: [PATCH] mm: debug_vm_pgtable: Don't use __P000 directly Date: Fri, 24 Sep 2021 14:06:54 +0800 Message-Id: <20210924060654.1137902-1-guoren@kernel.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 8080010000A5 X-Stat-Signature: 6czrasw6zt8sop8ccjzx9qqgw9bqaikr Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=VwPIvCYD; spf=pass (imf12.hostedemail.com: domain of guoren@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=guoren@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-HE-Tag: 1632463629-583391 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: From: Guo Ren The __Pxxx/__Sxxx macros are only for protection_map[] init. All usage of them in linux should come from protection_map array. Because a lot of architectures would re-initilize protection_map[] array, eg: x86-mem_encrypt, m68k-motorola, mips, arm, sparc. Using __P000 is not rigorous. Signed-off-by: Guo Ren Reviewed-by: Andrew Morton --- Changes since V2: - s/init protection_map[]/protection_map[] init/ - s/Becasue/Because/ - Remove unclear part - Replace __P000 and __S000 with protection_map[0] and protection_map[8] --- mm/debug_vm_pgtable.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c index 1403639302e4..228e3954b90c 100644 --- a/mm/debug_vm_pgtable.c +++ b/mm/debug_vm_pgtable.c @@ -1104,13 +1104,14 @@ 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 - * PROT_NONE permission as required for pxx_protnone_tests(). + * protection_map[0] (or even protection_map[8]) will help create + * page table entries with 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;