[RFC V1 04/16] perf/events: Replace READ_ONCE() with standard pgtable accessors
Anshuman Khandual
anshuman.khandual at arm.com
Tue Feb 24 04:53:06 PST 2026
On 24/02/26 3:38 PM, Mark Rutland wrote:
> On Tue, Feb 24, 2026 at 10:41:41AM +0530, Anshuman Khandual wrote:
>> Replace READ_ONCE() with standard page table accessors i.e pxdp_get() which
>> anyways default into READ_ONCE() in cases where platform do not override.
>
> For each of the patches where you make this sort of change, please
> explain in the commit message *why* it is necessary to do this.
Sure will explain the intent better for these patches.
> > IIUC the entire point of this is that in subsequent patches, arm64 will
> need to use something other than READ_ONCE() for all pXX levels in order
> to support D128 translation tables.
Right.
>
> Spelling that out in the commit message makes it much easier for
> reviewers to see what's going on, and to focus any discussion/questions,
> e.g. *why* won't READ_ONCE() work?
Got it.
>
> Mark.
>
>>
>> Cc: Peter Zijlstra <peterz at infradead.org>
>> Cc: Ingo Molnar <mingo at redhat.com>
>> Cc: Arnaldo Carvalho de Melo <acme at kernel.org>
>> Cc: Namhyung Kim <namhyung at kernel.org>
>> Cc: linux-perf-users at vger.kernel.org
>> Cc: linux-kernel at vger.kernel.org
>> Signed-off-by: Anshuman Khandual <anshuman.khandual at arm.com>
>> ---
>> kernel/events/core.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/kernel/events/core.c b/kernel/events/core.c
>> index ac70d68217b6..4ee151cd2c6d 100644
>> --- a/kernel/events/core.c
>> +++ b/kernel/events/core.c
>> @@ -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;
>>
>> --
>> 2.43.0
>>
More information about the linux-arm-kernel
mailing list