linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Anshuman Khandual <anshuman.khandual@arm.com>
To: guoren@kernel.org, akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Guo Ren <guoren@linux.alibaba.com>
Subject: Re: [PATCH] mm: debug_vm_pgtable: Don't use __P000 directly
Date: Fri, 24 Sep 2021 09:01:33 +0530	[thread overview]
Message-ID: <ab52f71f-0419-fd22-d59e-a87713886cfd@arm.com> (raw)
In-Reply-To: <20210921201815.284412-1-guoren@kernel.org>

Hello Guo,

On 9/22/21 1:48 AM, guoren@kernel.org wrote:
> From: Guo Ren <guoren@linux.alibaba.com>
> 
> 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 <guoren@linux.alibaba.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> ---
>  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 <anshuman.khandual@arm.com>


  reply	other threads:[~2021-09-24  3:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-21 20:18 [PATCH] mm: debug_vm_pgtable: Don't use __P000 directly guoren
2021-09-24  3:31 ` Anshuman Khandual [this message]
2021-09-24  5:11   ` Guo Ren
  -- strict thread matches above, loose matches on Subject: below --
2021-09-24  6:06 guoren
2021-09-24  6:09 ` Guo Ren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ab52f71f-0419-fd22-d59e-a87713886cfd@arm.com \
    --to=anshuman.khandual@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=guoren@kernel.org \
    --cc=guoren@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).