The original huge_ptep_get() on ARM64 is just a wrapper of ptep_get(),
which will not take into account any contig-PTEs dirty and access bits.
Meanwhile we will implement a new ARM64-specific huge_ptep_get()
interface in following patch, which will take into account any contig-PTEs
dirty and access bits and only be allowed to pass the head pte of
a contig-PTE/PMD size page.
Thus change to use ptep_get() to get the pte value of a huge page as
a preparation.
Signed-off-by: Baolin Wang <[email protected]>
---
arch/arm64/mm/hugetlbpage.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
index ca8e65c..be5e2f3 100644
--- a/arch/arm64/mm/hugetlbpage.c
+++ b/arch/arm64/mm/hugetlbpage.c
@@ -172,7 +172,7 @@ static pte_t get_clear_flush(struct mm_struct *mm,
unsigned long pgsize,
unsigned long ncontig)
{
- pte_t orig_pte = huge_ptep_get(ptep);
+ pte_t orig_pte = ptep_get(ptep);
bool valid = pte_valid(orig_pte);
unsigned long i, saddr = addr;
@@ -385,7 +385,7 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
{
int ncontig;
size_t pgsize;
- pte_t orig_pte = huge_ptep_get(ptep);
+ pte_t orig_pte = ptep_get(ptep);
if (!pte_cont(orig_pte))
return ptep_get_and_clear(mm, addr, ptep);
@@ -408,11 +408,11 @@ static int __cont_access_flags_changed(pte_t *ptep, pte_t pte, int ncontig)
{
int i;
- if (pte_write(pte) != pte_write(huge_ptep_get(ptep)))
+ if (pte_write(pte) != pte_write(ptep_get(ptep)))
return 1;
for (i = 0; i < ncontig; i++) {
- pte_t orig_pte = huge_ptep_get(ptep + i);
+ pte_t orig_pte = ptep_get(ptep + i);
if (pte_dirty(pte) != pte_dirty(orig_pte))
return 1;
--
1.8.3.1
On Tue, May 10, 2022 at 07:12:52PM +0800, Baolin Wang wrote:
> The original huge_ptep_get() on ARM64 is just a wrapper of ptep_get(),
> which will not take into account any contig-PTEs dirty and access bits.
> Meanwhile we will implement a new ARM64-specific huge_ptep_get()
> interface in following patch, which will take into account any contig-PTEs
> dirty and access bits and only be allowed to pass the head pte of
> a contig-PTE/PMD size page.
IIUC, the huge_ptep_get() you have implemented in patch 2 could
handle non-head pte. It'll return the original pte without potential
AD bit. I admit it is more efficeent to use ptep_get() directly,
but the judgement here should be updated.
With this update.
Reviewed-by: Muchun Song <[email protected]>
Thanks.
> Thus change to use ptep_get() to get the pte value of a huge page as
> a preparation.
>
> Signed-off-by: Baolin Wang <[email protected]>
> ---
> arch/arm64/mm/hugetlbpage.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
> index ca8e65c..be5e2f3 100644
> --- a/arch/arm64/mm/hugetlbpage.c
> +++ b/arch/arm64/mm/hugetlbpage.c
> @@ -172,7 +172,7 @@ static pte_t get_clear_flush(struct mm_struct *mm,
> unsigned long pgsize,
> unsigned long ncontig)
> {
> - pte_t orig_pte = huge_ptep_get(ptep);
> + pte_t orig_pte = ptep_get(ptep);
> bool valid = pte_valid(orig_pte);
> unsigned long i, saddr = addr;
>
> @@ -385,7 +385,7 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
> {
> int ncontig;
> size_t pgsize;
> - pte_t orig_pte = huge_ptep_get(ptep);
> + pte_t orig_pte = ptep_get(ptep);
>
> if (!pte_cont(orig_pte))
> return ptep_get_and_clear(mm, addr, ptep);
> @@ -408,11 +408,11 @@ static int __cont_access_flags_changed(pte_t *ptep, pte_t pte, int ncontig)
> {
> int i;
>
> - if (pte_write(pte) != pte_write(huge_ptep_get(ptep)))
> + if (pte_write(pte) != pte_write(ptep_get(ptep)))
> return 1;
>
> for (i = 0; i < ncontig; i++) {
> - pte_t orig_pte = huge_ptep_get(ptep + i);
> + pte_t orig_pte = ptep_get(ptep + i);
>
> if (pte_dirty(pte) != pte_dirty(orig_pte))
> return 1;
> --
> 1.8.3.1
>
>
On 5/10/2022 11:55 PM, Muchun Song wrote:
> On Tue, May 10, 2022 at 07:12:52PM +0800, Baolin Wang wrote:
>> The original huge_ptep_get() on ARM64 is just a wrapper of ptep_get(),
>> which will not take into account any contig-PTEs dirty and access bits.
>> Meanwhile we will implement a new ARM64-specific huge_ptep_get()
>> interface in following patch, which will take into account any contig-PTEs
>> dirty and access bits and only be allowed to pass the head pte of
>> a contig-PTE/PMD size page.
>
> IIUC, the huge_ptep_get() you have implemented in patch 2 could
> handle non-head pte. It'll return the original pte without potential
> AD bit. I admit it is more efficeent to use ptep_get() directly,
> but the judgement here should be updated.
Ah, right. I missed the 'ncontig' will be 0 if a non-head pte passed.
Will update the commit message in next version. Thanks for reviewing.
>
> With this update.
>
> Reviewed-by: Muchun Song <[email protected]>