perf/events: Replace READ_ONCE() with standard pgtable accessors
Subsystems (2)
PATCH 1/1 perf/events: Replace READ_ONCE() with standard pgtable accessors
Replace raw READ_ONCE() dereferences of pgtable entries with corresponding standard page table accessors pxdp_get() in perf_get_pgtable_size(). These accessors default to READ_ONCE() on platforms that don't override them. So there is no functional change on such platforms.
However arm64 platform is being extended to support 128 bit page tables via a new architecture feature i.e FEAT_D128 in which case READ_ONCE() will not provide required single copy atomic access for 128 bit page table entries. Although pxdp_get() accessors can later be overridden on arm64 platform to extend required single copy atomicity support on 128 bit entries.
---
This patch applies both on v7.0-rc1 and mm-unstable.
Part of the D128 series but independent. Hence could be considered on its own.
https://lore.kernel.org/all/[email protected]/
Collected Peter's tag from an off list conversation.
kernel/events/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/events/core.c +3 -3
@@ -8422,7 +8422,7 @@ static u64 perf_get_pgtable_size(struct mm_struct *mm, unsigned long addr)pte_t *ptep, pte; pgdp =pgd_offset (mm, addr); - pgd =READ_ONCE (*pgdp); + pgd =pgdp_get (pgdp);if (pgd_none (pgd))return 0 ;
@@ -8430,7 +8430,7 @@ static u64 perf_get_pgtable_size(struct mm_struct *mm, unsigned long addr)return pgd_leaf_size (pgd); p4dp =p4d_offset_lockless (pgdp, pgd, addr); - p4d =READ_ONCE (*p4dp); + p4d =p4dp_get (p4dp);if (!p4d_present (p4d))return 0 ;
@@ -8438,7 +8438,7 @@ static u64 perf_get_pgtable_size(struct mm_struct *mm, unsigned long addr)return p4d_leaf_size (p4d); pudp =pud_offset_lockless (p4dp, p4d, addr); - pud =READ_ONCE (*pudp); + pud =pudp_get (pudp);if (!pud_present (pud))return 0 ;
Signature · 1 line
2.30.2
Quoted 22 lines · Anshuman Khandual
Replace raw
READ_ONCE()dereferences of pgtable entries with corresponding standard page table accessorspxdp_get()inperf_get_pgtable_size(). These accessors default toREAD_ONCE()on platforms that don't override them. So there is no functional change on such platforms.However arm64 platform is being extended to support 128 bit page tables via a new architecture feature i.e
FEAT_D128in which caseREAD_ONCE()will not provide required single copy atomic access for 128 bit page table entries. Althoughpxdp_get()accessors can later be overridden on arm64 platform to extend required single copy atomicity support on 128 bit entries.Cc Andrew Morton <[email protected]>Cc David Hildenbrand <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Ingo Molnar <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc Namhyung Kim <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>
Quoted 1 line
---
Signature · 3 lines
Cheers, David
Quoted 11 lines · On Fri, 27 Feb 2026 06:27:44 +0000 Anshuman Khandual…
Replace raw
READ_ONCE()dereferences of pgtable entries with corresponding standard page table accessorspxdp_get()inperf_get_pgtable_size(). These accessors default toREAD_ONCE()on platforms that don't override them. So there is no functional change on such platforms.However arm64 platform is being extended to support 128 bit page tables via a new architecture feature i.e
FEAT_D128in which caseREAD_ONCE()will not provide required single copy atomic access for 128 bit page table entries. Althoughpxdp_get()accessors can later be overridden on arm64 platform to extend required single copy atomicity support on 128 bit entries.
Quoted 11 lines
Cc Andrew Morton <[email protected]>Cc David Hildenbrand <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Ingo Molnar <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc Namhyung Kim <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>
Thanks,
SJ
[...]
Quoted 57 lines · Anshuman Khandual
Replace raw
READ_ONCE()dereferences of pgtable entries with corresponding standard page table accessorspxdp_get()inperf_get_pgtable_size(). These accessors default toREAD_ONCE()on platforms that don't override them. So there is no functional change on such platforms.However arm64 platform is being extended to support 128 bit page tables via a new architecture feature i.e
FEAT_D128in which caseREAD_ONCE()will not provide required single copy atomic access for 128 bit page table entries. Althoughpxdp_get()accessors can later be overridden on arm64 platform to extend required single copy atomicity support on 128 bit entries.Cc Andrew Morton <[email protected]>Cc David Hildenbrand <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Ingo Molnar <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc Namhyung Kim <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>---
This patch applies both on v7.0-rc1 and mm-unstable.Part of the D128 series but independent. Hence could be considered on its own.
https://lore.kernel.org/all/[email protected]/
Collected Peter's tag from an off list conversation.
kernel/events/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)kernel/events/core.c +2
-2@@ -8422,7 +8422,7 @@ static u64 perf_get_pgtable_size(struct mm_struct *mm, unsigned long addr)pte_t *ptep, pte; pgdp =pgd_offset (mm, addr); - pgd =READ_ONCE (*pgdp); + pgd =pgdp_get (pgdp);if (pgd_none (pgd))return 0 ;@@ -8430,7 +8430,7 @@ static u64 perf_get_pgtable_size(struct mm_struct *mm, unsigned long addr)return pgd_leaf_size (pgd); p4dp =p4d_offset_lockless (pgdp, pgd, addr); - p4d =READ_ONCE (*p4dp); + p4d =p4dp_get (p4dp);if (!p4d_present (p4d))return 0 ;
kernel/events/core.c static u64 perf_get_pgtable_size(struct mm_struct *mm, unsigned long addr) · line 8444
Quoted 8 lines
kernel/events/core.c +1
-1@@ -8438,7 +8438,7 @@ static u64 perf_get_pgtable_size(struct mm_struct *mm, unsigned long addr)return p4d_leaf_size (p4d); pudp =pud_offset_lockless (p4dp, p4d, addr); - pud =READ_ONCE (*pudp); + pud =pudp_get (pudp);if (!pud_present (pud))return 0 ;
Don't see this patch in next-20260306. Is not this being picked for testing ?
Quoted 22 lines · Anshuman Khandual
Replace raw
READ_ONCE()dereferences of pgtable entries with corresponding standard page table accessorspxdp_get()inperf_get_pgtable_size(). These accessors default toREAD_ONCE()on platforms that don't override them. So there is no functional change on such platforms.However arm64 platform is being extended to support 128 bit page tables via a new architecture feature i.e
FEAT_D128in which caseREAD_ONCE()will not provide required single copy atomic access for 128 bit page table entries. Althoughpxdp_get()accessors can later be overridden on arm64 platform to extend required single copy atomicity support on 128 bit entries.Cc Andrew Morton <[email protected]>Cc David Hildenbrand <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Ingo Molnar <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc Namhyung Kim <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>
Quoted 8 lines
---
This patch applies both on v7.0-rc1 and mm-unstable.Part of the D128 series but independent. Hence could be considered on its own.
https://lore.kernel.org/all/[email protected]/
Collected Peter's tag from an off list conversation.
Gentle ping.
Still don't see this patch in latest next-20260406. Hence just wondering which tree and branch this patch is being picked up ?
Thank you
- Anshuman
Quoted 35 lines
kernel/events/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)kernel/events/core.c +3
-3@@ -8422,7 +8422,7 @@ static u64 perf_get_pgtable_size(struct mm_struct *mm, unsigned long addr)pte_t *ptep, pte; pgdp =pgd_offset (mm, addr); - pgd =READ_ONCE (*pgdp); + pgd =pgdp_get (pgdp);if (pgd_none (pgd))return 0 ;@@ -8430,7 +8430,7 @@ static u64 perf_get_pgtable_size(struct mm_struct *mm, unsigned long addr)return pgd_leaf_size (pgd); p4dp =p4d_offset_lockless (pgdp, pgd, addr); - p4d =READ_ONCE (*p4dp); + p4d =p4dp_get (p4dp);if (!p4d_present (p4d))return 0 ;@@ -8438,7 +8438,7 @@ static u64 perf_get_pgtable_size(struct mm_struct *mm, unsigned long addr)return p4d_leaf_size (p4d); pudp =pud_offset_lockless (p4dp, p4d, addr); - pud =READ_ONCE (*pudp); + pud =pudp_get (pudp);if (!pud_present (pud))return 0 ;
Quoted 30 lines · Anshuman Khandual
Quoted 27 lines · Anshuman Khandual
Replace raw
READ_ONCE()dereferences of pgtable entries with corresponding standard page table accessorspxdp_get()inperf_get_pgtable_size(). These accessors default toREAD_ONCE()on platforms that don't override them. So there is no functional change on such platforms.However arm64 platform is being extended to support 128 bit page tables via a new architecture feature i.e
FEAT_D128in which caseREAD_ONCE()will not provide required single copy atomic access for 128 bit page table entries. Althoughpxdp_get()accessors can later be overridden on arm64 platform to extend required single copy atomicity support on 128 bit entries.Cc Andrew Morton <[email protected]>Cc David Hildenbrand <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Ingo Molnar <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc Namhyung Kim <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>---
This patch applies both on v7.0-rc1 and mm-unstable.Part of the D128 series but independent. Hence could be considered on its own.
Quoted 8 lines
Quoted 3 lines
https://lore.kernel.org/all/[email protected]/
Collected Peter's tag from an off list conversation.
Gentle ping.
Still don't see this patch in latest next-20260406. Hence just wondering which tree and branch this patch is being picked up ?
It's a trivial change and the last generic code change required for you arm64 D128 change, right?
I would assume this to go through the tip tree, but if Peter agrees we could route this (mm) patch through the MM tree.
Signature · 3 lines
Cheers, David
Quoted 35 lines · David Hildenbrand (Arm)
Quoted 34 lines · Anshuman Khandual
Quoted 30 lines · Anshuman Khandual
Replace raw
READ_ONCE()dereferences of pgtable entries with corresponding standard page table accessorspxdp_get()inperf_get_pgtable_size(). These accessors default toREAD_ONCE()on platforms that don't override them. So there is no functional change on such platforms.However arm64 platform is being extended to support 128 bit page tables via a new architecture feature i.e
FEAT_D128in which caseREAD_ONCE()will not provide required single copy atomic access for 128 bit page table entries. Althoughpxdp_get()accessors can later be overridden on arm64 platform to extend required single copy atomicity support on 128 bit entries.Cc Andrew Morton <[email protected]>Cc David Hildenbrand <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Ingo Molnar <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc Namhyung Kim <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>---
This patch applies both on v7.0-rc1 and mm-unstable.Part of the D128 series but independent. Hence could be considered on its own.
https://lore.kernel.org/all/[email protected]/
Collected Peter's tag from an off list conversation.
Quoted 7 lines
Quoted 4 lines
Gentle ping.
Still don't see this patch in latest next-20260406. Hence just wondering which tree and branch this patch is being picked up ?
It's a trivial change and the last generic code change required for you arm64 D128 change, right?
Right.
Quoted 4 lines
I would assume this to go through the tip tree, but if Peter agrees we could route this (mm) patch through the MM tree.
Sure
Peter Zijlstra
maintainerQuoted 37 lines · David Hildenbrand (Arm)
Quoted 36 lines · Anshuman Khandual
Quoted 22 lines · Anshuman Khandual
Replace raw
READ_ONCE()dereferences of pgtable entries with corresponding standard page table accessorspxdp_get()inperf_get_pgtable_size(). These accessors default toREAD_ONCE()on platforms that don't override them. So there is no functional change on such platforms.However arm64 platform is being extended to support 128 bit page tables via a new architecture feature i.e
FEAT_D128in which caseREAD_ONCE()will not provide required single copy atomic access for 128 bit page table entries. Althoughpxdp_get()accessors can later be overridden on arm64 platform to extend required single copy atomicity support on 128 bit entries.Cc Andrew Morton <[email protected]>Cc David Hildenbrand <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Ingo Molnar <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc Namhyung Kim <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>Quoted 8 lines
---
This patch applies both on v7.0-rc1 and mm-unstable.Part of the D128 series but independent. Hence could be considered on its own.
https://lore.kernel.org/all/[email protected]/
Collected Peter's tag from an off list conversation.
Gentle ping.
Quoted 8 lines
Quoted 2 lines
Still don't see this patch in latest next-20260406. Hence just wondering which tree and branch this patch is being picked up ?
It's a trivial change and the last generic code change required for you arm64 D128 change, right?
I would assume this to go through the tip tree, but if Peter agrees we could route this (mm) patch through the MM tree.
Right, I thought this was part of a larger series and figured it would ride along with whatever other patches.
If you still want me to pick this up, I can, just state clearly where this ought to go.
Quoted 44 lines · Peter Zijlstra
Quoted 43 lines · David Hildenbrand (Arm)
Quoted 30 lines · Anshuman Khandual
Quoted 27 lines · Anshuman Khandual
Replace raw
READ_ONCE()dereferences of pgtable entries with corresponding standard page table accessorspxdp_get()inperf_get_pgtable_size(). These accessors default toREAD_ONCE()on platforms that don't override them. So there is no functional change on such platforms.However arm64 platform is being extended to support 128 bit page tables via a new architecture feature i.e
FEAT_D128in which caseREAD_ONCE()will not provide required single copy atomic access for 128 bit page table entries. Althoughpxdp_get()accessors can later be overridden on arm64 platform to extend required single copy atomicity support on 128 bit entries.Cc Andrew Morton <[email protected]>Cc David Hildenbrand <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Ingo Molnar <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc Namhyung Kim <[email protected]>Signed-off-by Anshuman Khandual <[email protected]>---
This patch applies both on v7.0-rc1 and mm-unstable.Part of the D128 series but independent. Hence could be considered on its own.
Quoted 8 lines
Quoted 3 lines
https://lore.kernel.org/all/[email protected]/
Collected Peter's tag from an off list conversation.
Gentle ping.
Still don't see this patch in latest next-20260406. Hence just wondering which tree and branch this patch is being picked up ?
It's a trivial change and the last generic code change required for you arm64 D128 change, right?
Quoted 8 lines
Quoted 2 lines
I would assume this to go through the tip tree, but if Peter agrees we could route this (mm) patch through the MM tree.
Right, I thought this was part of a larger series and figured it would ride along with whatever other patches.
If you still want me to pick this up, I can, just state clearly where this ought to go.
It would be great if you could pick this up. Thanks !
Peter Zijlstra
maintainerQuoted 1 line · Anshuman Khandual
It would be great if you could pick this up. Thanks !
OK done. Should be in tomorrow's -next I suppose.
Quoted 6 lines · On Tue, 7 Apr 2026 08:58:46 +0530 Anshuman Khandual…
Quoted 5 lines · Anshuman Khandual
Replace raw
READ_ONCE()dereferences of pgtable entries with corresponding standard page table accessorspxdp_get()inperf_get_pgtable_size(). These accessors default toREAD_ONCE()on platforms that don't override them. So there is no functional change on such platforms.
Quoted 6 lines
Quoted 5 lines
However arm64 platform is being extended to support 128 bit page tables via a new architecture feature i.e
FEAT_D128in which caseREAD_ONCE()will not provide required single copy atomic access for 128 bit page table entries. Althoughpxdp_get()accessors can later be overridden on arm64 platform to extend required single copy atomicity support on 128 bit entries.
Did you consider enhancing READ_ONCE() to support 128bit accesses on arm64?
David
Quoted 9 lines · David Laight
Quoted 6 lines · On Tue, 7 Apr 2026 08:58:46 +0530 Anshuman Khandual…
Quoted 5 lines · Anshuman Khandual
Replace raw
READ_ONCE()dereferences of pgtable entries with corresponding standard page table accessorspxdp_get()inperf_get_pgtable_size(). These accessors default toREAD_ONCE()on platforms that don't override them. So there is no functional change on such platforms.
Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
However arm64 platform is being extended to support 128 bit page tables via a new architecture feature i.e
FEAT_D128in which caseREAD_ONCE()will not provide required single copy atomic access for 128 bit page table entries. Althoughpxdp_get()accessors can later be overridden on arm64 platform to extend required single copy atomicity support on 128 bit entries.Did you consider enhancing
READ_ONCE()to support 128bit accesses on arm64?
Yes although it does not really meet all requirements for 128 bit page table access.
The following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 5a84b600050c5f16b8bba25dd0e7aea845880407 Gitweb: https://git.kernel.org/tip/5a84b600050c5f16b8bba25dd0e7aea845880407 Author: Anshuman Khandual <[email protected]> AuthorDate: Fri, 27 Feb 2026 06:27:44 Committer: Peter Zijlstra <[email protected]> CommitterDate: Wed, 08 Apr 2026 13:11:46 +02:00
perf/events: Replace READ_ONCE() with standard pgtable accessors
Replace raw READ_ONCE() dereferences of pgtable entries with corresponding standard page table accessors pxdp_get() in perf_get_pgtable_size(). These accessors default to READ_ONCE() on platforms that don't override them. So there is no functional change on such platforms.
However arm64 platform is being extended to support 128 bit page tables via a new architecture feature i.e FEAT_D128 in which case READ_ONCE() will not provide required single copy atomic access for 128 bit page table entries. Although pxdp_get() accessors can later be overridden on arm64 platform to extend required single copy atomicity support on 128 bit entries.
--- kernel/events/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/events/core.c +3 -3
@@ -8421,7 +8421,7 @@ static u64 perf_get_pgtable_size(struct mm_struct *mm, unsigned long addr)pte_t *ptep, pte; pgdp =pgd_offset (mm, addr); - pgd =READ_ONCE (*pgdp); + pgd =pgdp_get (pgdp);if (pgd_none (pgd))return 0 ;
@@ -8429,7 +8429,7 @@ static u64 perf_get_pgtable_size(struct mm_struct *mm, unsigned long addr)return pgd_leaf_size (pgd); p4dp =p4d_offset_lockless (pgdp, pgd, addr); - p4d =READ_ONCE (*p4dp); + p4d =p4dp_get (p4dp);if (!p4d_present (p4d))return 0 ;
@@ -8437,7 +8437,7 @@ static u64 perf_get_pgtable_size(struct mm_struct *mm, unsigned long addr)return p4d_leaf_size (p4d); pudp =pud_offset_lockless (p4dp, p4d, addr); - pud =READ_ONCE (*pudp); + pud =pudp_get (pudp);if (!pud_present (pud))return 0 ;