All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anshuman Khandual <anshuman.khandual@arm.com>
To: Tong Tiangen <tongtiangen@huawei.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	Pasha Tatashin <pasha.tatashin@soleen.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-arm-kernel@lists.infradead.org,
	linux-riscv@lists.infradead.org,
	Kefeng Wang <wangkefeng.wang@huawei.com>,
	Guohanjun <guohanjun@huawei.com>
Subject: Re: [PATCH -next v5 2/5] mm: page_table_check: move pxx_user_accessible_page into x86
Date: Fri, 22 Apr 2022 10:41:34 +0530	[thread overview]
Message-ID: <905f22d6-0671-21b2-a341-bdc5ba02e59c@arm.com> (raw)
In-Reply-To: <20220421082042.1167967-3-tongtiangen@huawei.com>

Similar to previous commits on the same file, the following subject
line format, would have been preferred.

mm/page_table_check: <description>

On 4/21/22 13:50, Tong Tiangen wrote:
> From: Kefeng Wang <wangkefeng.wang@huawei.com>
> 
> The pxx_user_accessible_page() check the PTE bit, it's

s/check/checks			 ^^^^

> architecture-specific code, move them into x86's pgtable.h
The commit message should have been more clear, atleast complete in
sentences. I dont want to be bike shedding here but this is definitely
incomplete. These helpers are being moved out to make the page table
check framework, platform independent. Hence the commit message should
mention this.

> 
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> Signed-off-by: Tong Tiangen <tongtiangen@huawei.com>
> Acked-by: Pasha Tatashin <pasha.tatashin@soleen.com>
> ---
>  arch/x86/include/asm/pgtable.h | 19 +++++++++++++++++++
>  mm/page_table_check.c          | 17 -----------------
>  2 files changed, 19 insertions(+), 17 deletions(-)
> 
> diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
> index b7464f13e416..564abe42b0f7 100644
> --- a/arch/x86/include/asm/pgtable.h
> +++ b/arch/x86/include/asm/pgtable.h
> @@ -1447,6 +1447,25 @@ static inline bool arch_has_hw_pte_young(void)
>  	return true;
>  }
>  
> +#ifdef CONFIG_PAGE_TABLE_CHECK
> +static inline bool pte_user_accessible_page(pte_t pte)
> +{
> +	return (pte_val(pte) & _PAGE_PRESENT) && (pte_val(pte) & _PAGE_USER);
> +}
> +
> +static inline bool pmd_user_accessible_page(pmd_t pmd)
> +{
> +	return pmd_leaf(pmd) && (pmd_val(pmd) & _PAGE_PRESENT) &&
> +		(pmd_val(pmd) & _PAGE_USER);
> +}
> +
> +static inline bool pud_user_accessible_page(pud_t pud)
> +{
> +	return pud_leaf(pud) && (pud_val(pud) & _PAGE_PRESENT) &&
> +		(pud_val(pud) & _PAGE_USER);

A line break is not really required here (and above as well). As single
complete line would still be within 100 characters.

> +}
> +#endif
> +
>  #endif	/* __ASSEMBLY__ */
>  
>  #endif /* _ASM_X86_PGTABLE_H */
> diff --git a/mm/page_table_check.c b/mm/page_table_check.c
> index eb0d0b71cdf6..3692bea2ea2c 100644
> --- a/mm/page_table_check.c
> +++ b/mm/page_table_check.c
> @@ -52,23 +52,6 @@ static struct page_table_check *get_page_table_check(struct page_ext *page_ext)
>  	return (void *)(page_ext) + page_table_check_ops.offset;
>  }
>  
> -static inline bool pte_user_accessible_page(pte_t pte)
> -{
> -	return (pte_val(pte) & _PAGE_PRESENT) && (pte_val(pte) & _PAGE_USER);
> -}
> -
> -static inline bool pmd_user_accessible_page(pmd_t pmd)
> -{
> -	return pmd_leaf(pmd) && (pmd_val(pmd) & _PAGE_PRESENT) &&
> -		(pmd_val(pmd) & _PAGE_USER);
> -}
> -
> -static inline bool pud_user_accessible_page(pud_t pud)
> -{
> -	return pud_leaf(pud) && (pud_val(pud) & _PAGE_PRESENT) &&
> -		(pud_val(pud) & _PAGE_USER);
> -}
> -
>  /*
>   * An enty is removed from the page table, decrement the counters for that page
>   * verify that it is of correct type and counters do not become negative.

With above mentioned code cleanup and commit message changes in place.

Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>

WARNING: multiple messages have this Message-ID (diff)
From: Anshuman Khandual <anshuman.khandual@arm.com>
To: Tong Tiangen <tongtiangen@huawei.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	Pasha Tatashin <pasha.tatashin@soleen.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-arm-kernel@lists.infradead.org,
	linux-riscv@lists.infradead.org,
	Kefeng Wang <wangkefeng.wang@huawei.com>,
	Guohanjun <guohanjun@huawei.com>
Subject: Re: [PATCH -next v5 2/5] mm: page_table_check: move pxx_user_accessible_page into x86
Date: Fri, 22 Apr 2022 10:41:34 +0530	[thread overview]
Message-ID: <905f22d6-0671-21b2-a341-bdc5ba02e59c@arm.com> (raw)
In-Reply-To: <20220421082042.1167967-3-tongtiangen@huawei.com>

Similar to previous commits on the same file, the following subject
line format, would have been preferred.

mm/page_table_check: <description>

On 4/21/22 13:50, Tong Tiangen wrote:
> From: Kefeng Wang <wangkefeng.wang@huawei.com>
> 
> The pxx_user_accessible_page() check the PTE bit, it's

s/check/checks			 ^^^^

> architecture-specific code, move them into x86's pgtable.h
The commit message should have been more clear, atleast complete in
sentences. I dont want to be bike shedding here but this is definitely
incomplete. These helpers are being moved out to make the page table
check framework, platform independent. Hence the commit message should
mention this.

> 
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> Signed-off-by: Tong Tiangen <tongtiangen@huawei.com>
> Acked-by: Pasha Tatashin <pasha.tatashin@soleen.com>
> ---
>  arch/x86/include/asm/pgtable.h | 19 +++++++++++++++++++
>  mm/page_table_check.c          | 17 -----------------
>  2 files changed, 19 insertions(+), 17 deletions(-)
> 
> diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
> index b7464f13e416..564abe42b0f7 100644
> --- a/arch/x86/include/asm/pgtable.h
> +++ b/arch/x86/include/asm/pgtable.h
> @@ -1447,6 +1447,25 @@ static inline bool arch_has_hw_pte_young(void)
>  	return true;
>  }
>  
> +#ifdef CONFIG_PAGE_TABLE_CHECK
> +static inline bool pte_user_accessible_page(pte_t pte)
> +{
> +	return (pte_val(pte) & _PAGE_PRESENT) && (pte_val(pte) & _PAGE_USER);
> +}
> +
> +static inline bool pmd_user_accessible_page(pmd_t pmd)
> +{
> +	return pmd_leaf(pmd) && (pmd_val(pmd) & _PAGE_PRESENT) &&
> +		(pmd_val(pmd) & _PAGE_USER);
> +}
> +
> +static inline bool pud_user_accessible_page(pud_t pud)
> +{
> +	return pud_leaf(pud) && (pud_val(pud) & _PAGE_PRESENT) &&
> +		(pud_val(pud) & _PAGE_USER);

A line break is not really required here (and above as well). As single
complete line would still be within 100 characters.

> +}
> +#endif
> +
>  #endif	/* __ASSEMBLY__ */
>  
>  #endif /* _ASM_X86_PGTABLE_H */
> diff --git a/mm/page_table_check.c b/mm/page_table_check.c
> index eb0d0b71cdf6..3692bea2ea2c 100644
> --- a/mm/page_table_check.c
> +++ b/mm/page_table_check.c
> @@ -52,23 +52,6 @@ static struct page_table_check *get_page_table_check(struct page_ext *page_ext)
>  	return (void *)(page_ext) + page_table_check_ops.offset;
>  }
>  
> -static inline bool pte_user_accessible_page(pte_t pte)
> -{
> -	return (pte_val(pte) & _PAGE_PRESENT) && (pte_val(pte) & _PAGE_USER);
> -}
> -
> -static inline bool pmd_user_accessible_page(pmd_t pmd)
> -{
> -	return pmd_leaf(pmd) && (pmd_val(pmd) & _PAGE_PRESENT) &&
> -		(pmd_val(pmd) & _PAGE_USER);
> -}
> -
> -static inline bool pud_user_accessible_page(pud_t pud)
> -{
> -	return pud_leaf(pud) && (pud_val(pud) & _PAGE_PRESENT) &&
> -		(pud_val(pud) & _PAGE_USER);
> -}
> -
>  /*
>   * An enty is removed from the page table, decrement the counters for that page
>   * verify that it is of correct type and counters do not become negative.

With above mentioned code cleanup and commit message changes in place.

Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

WARNING: multiple messages have this Message-ID (diff)
From: Anshuman Khandual <anshuman.khandual@arm.com>
To: Tong Tiangen <tongtiangen@huawei.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	Pasha Tatashin <pasha.tatashin@soleen.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-arm-kernel@lists.infradead.org,
	linux-riscv@lists.infradead.org,
	Kefeng Wang <wangkefeng.wang@huawei.com>,
	Guohanjun <guohanjun@huawei.com>
Subject: Re: [PATCH -next v5 2/5] mm: page_table_check: move pxx_user_accessible_page into x86
Date: Fri, 22 Apr 2022 10:41:34 +0530	[thread overview]
Message-ID: <905f22d6-0671-21b2-a341-bdc5ba02e59c@arm.com> (raw)
In-Reply-To: <20220421082042.1167967-3-tongtiangen@huawei.com>

Similar to previous commits on the same file, the following subject
line format, would have been preferred.

mm/page_table_check: <description>

On 4/21/22 13:50, Tong Tiangen wrote:
> From: Kefeng Wang <wangkefeng.wang@huawei.com>
> 
> The pxx_user_accessible_page() check the PTE bit, it's

s/check/checks			 ^^^^

> architecture-specific code, move them into x86's pgtable.h
The commit message should have been more clear, atleast complete in
sentences. I dont want to be bike shedding here but this is definitely
incomplete. These helpers are being moved out to make the page table
check framework, platform independent. Hence the commit message should
mention this.

> 
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> Signed-off-by: Tong Tiangen <tongtiangen@huawei.com>
> Acked-by: Pasha Tatashin <pasha.tatashin@soleen.com>
> ---
>  arch/x86/include/asm/pgtable.h | 19 +++++++++++++++++++
>  mm/page_table_check.c          | 17 -----------------
>  2 files changed, 19 insertions(+), 17 deletions(-)
> 
> diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
> index b7464f13e416..564abe42b0f7 100644
> --- a/arch/x86/include/asm/pgtable.h
> +++ b/arch/x86/include/asm/pgtable.h
> @@ -1447,6 +1447,25 @@ static inline bool arch_has_hw_pte_young(void)
>  	return true;
>  }
>  
> +#ifdef CONFIG_PAGE_TABLE_CHECK
> +static inline bool pte_user_accessible_page(pte_t pte)
> +{
> +	return (pte_val(pte) & _PAGE_PRESENT) && (pte_val(pte) & _PAGE_USER);
> +}
> +
> +static inline bool pmd_user_accessible_page(pmd_t pmd)
> +{
> +	return pmd_leaf(pmd) && (pmd_val(pmd) & _PAGE_PRESENT) &&
> +		(pmd_val(pmd) & _PAGE_USER);
> +}
> +
> +static inline bool pud_user_accessible_page(pud_t pud)
> +{
> +	return pud_leaf(pud) && (pud_val(pud) & _PAGE_PRESENT) &&
> +		(pud_val(pud) & _PAGE_USER);

A line break is not really required here (and above as well). As single
complete line would still be within 100 characters.

> +}
> +#endif
> +
>  #endif	/* __ASSEMBLY__ */
>  
>  #endif /* _ASM_X86_PGTABLE_H */
> diff --git a/mm/page_table_check.c b/mm/page_table_check.c
> index eb0d0b71cdf6..3692bea2ea2c 100644
> --- a/mm/page_table_check.c
> +++ b/mm/page_table_check.c
> @@ -52,23 +52,6 @@ static struct page_table_check *get_page_table_check(struct page_ext *page_ext)
>  	return (void *)(page_ext) + page_table_check_ops.offset;
>  }
>  
> -static inline bool pte_user_accessible_page(pte_t pte)
> -{
> -	return (pte_val(pte) & _PAGE_PRESENT) && (pte_val(pte) & _PAGE_USER);
> -}
> -
> -static inline bool pmd_user_accessible_page(pmd_t pmd)
> -{
> -	return pmd_leaf(pmd) && (pmd_val(pmd) & _PAGE_PRESENT) &&
> -		(pmd_val(pmd) & _PAGE_USER);
> -}
> -
> -static inline bool pud_user_accessible_page(pud_t pud)
> -{
> -	return pud_leaf(pud) && (pud_val(pud) & _PAGE_PRESENT) &&
> -		(pud_val(pud) & _PAGE_USER);
> -}
> -
>  /*
>   * An enty is removed from the page table, decrement the counters for that page
>   * verify that it is of correct type and counters do not become negative.

With above mentioned code cleanup and commit message changes in place.

Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-04-22  5:11 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21  8:20 [PATCH -next v5 0/5]mm: page_table_check: add support on arm64 and riscv Tong Tiangen
2022-04-21  8:20 ` Tong Tiangen
2022-04-21  8:20 ` Tong Tiangen
2022-04-21  8:20 ` [PATCH -next v5 1/5] mm: page_table_check: using PxD_SIZE instead of PxD_PAGE_SIZE Tong Tiangen
2022-04-21  8:20   ` Tong Tiangen
2022-04-21  8:20   ` Tong Tiangen
2022-04-21 15:28   ` Pasha Tatashin
2022-04-21 15:28     ` Pasha Tatashin
2022-04-21 15:28     ` Pasha Tatashin
2022-04-21 18:40     ` Pasha Tatashin
2022-04-21 18:40       ` Pasha Tatashin
2022-04-21 18:40       ` Pasha Tatashin
2022-04-22  4:46       ` Anshuman Khandual
2022-04-22  4:46         ` Anshuman Khandual
2022-04-22  4:46         ` Anshuman Khandual
2022-04-22  4:41   ` Anshuman Khandual
2022-04-22  4:41     ` Anshuman Khandual
2022-04-22  4:41     ` Anshuman Khandual
2022-04-21  8:20 ` [PATCH -next v5 2/5] mm: page_table_check: move pxx_user_accessible_page into x86 Tong Tiangen
2022-04-21  8:20   ` Tong Tiangen
2022-04-21  8:20   ` Tong Tiangen
2022-04-22  5:11   ` Anshuman Khandual [this message]
2022-04-22  5:11     ` Anshuman Khandual
2022-04-22  5:11     ` Anshuman Khandual
2022-04-22  6:30     ` Tong Tiangen
2022-04-22  6:30       ` Tong Tiangen
2022-04-22  6:30       ` Tong Tiangen
2022-04-21  8:20 ` [PATCH -next v5 3/5] mm: page_table_check: add hooks to public helpers Tong Tiangen
2022-04-21  8:20   ` Tong Tiangen
2022-04-21  8:20   ` Tong Tiangen
2022-04-22  6:05   ` Anshuman Khandual
2022-04-22  6:05     ` Anshuman Khandual
2022-04-22  6:05     ` Anshuman Khandual
2022-04-24  4:10     ` Tong Tiangen
2022-04-24  4:10       ` Tong Tiangen
2022-04-24  4:10       ` Tong Tiangen
2022-04-25  5:52       ` Anshuman Khandual
2022-04-25  5:52         ` Anshuman Khandual
2022-04-25  5:52         ` Anshuman Khandual
2022-04-25 11:34         ` Tong Tiangen
2022-04-25 11:34           ` Tong Tiangen
2022-04-25 11:34           ` Tong Tiangen
2022-04-21  8:20 ` [PATCH -next v5 4/5] arm64: mm: add support for page table check Tong Tiangen
2022-04-21  8:20   ` Tong Tiangen
2022-04-21  8:20   ` Tong Tiangen
2022-04-22  6:45   ` Anshuman Khandual
2022-04-22  6:45     ` Anshuman Khandual
2022-04-22  6:45     ` Anshuman Khandual
2022-04-24  4:14     ` Tong Tiangen
2022-04-24  4:14       ` Tong Tiangen
2022-04-24  4:14       ` Tong Tiangen
2022-04-25  5:41       ` Anshuman Khandual
2022-04-25  5:41         ` Anshuman Khandual
2022-04-25  5:41         ` Anshuman Khandual
2022-04-25  7:34         ` Tong Tiangen
2022-04-25  7:34           ` Tong Tiangen
2022-04-25  7:34           ` Tong Tiangen
2022-04-21  8:20 ` [PATCH -next v5 5/5] riscv: " Tong Tiangen
2022-04-21  8:20   ` Tong Tiangen
2022-04-21  8:20   ` Tong Tiangen

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=905f22d6-0671-21b2-a341-bdc5ba02e59c@arm.com \
    --to=anshuman.khandual@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=guohanjun@huawei.com \
    --cc=hpa@zytor.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=mingo@redhat.com \
    --cc=palmer@dabbelt.com \
    --cc=pasha.tatashin@soleen.com \
    --cc=paul.walmsley@sifive.com \
    --cc=tglx@linutronix.de \
    --cc=tongtiangen@huawei.com \
    --cc=wangkefeng.wang@huawei.com \
    --cc=will@kernel.org \
    --cc=x86@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.