Re: [PATCH] perf/events: replace READ_ONCE() with standard page table accessors

From: Peter Zijlstra

Date: Mon Oct 06 2025 - 04:48:36 EST


On Mon, Oct 06, 2025 at 02:10:14PM +0530, Anshuman Khandual wrote:

> These accessors provide platforms the opportunity to override and have different
> implementations other than READ_ONCE() when required.

When would this be required? Traditionally the only case that was weird
was Alpha, since it needed the dereference barrier, but since we folded
that into READ_ONCE(), that has all gone away.

[ also, historically we trusted GCC to emit singe loads for word sized
accesses -- something we've walked back from as C compilers have started
to be more agressive ]

Anyway, READ_ONCE() is the only sane way to dereference a page-table
pointers, doubly so in the face of lockless access.

There should be no need for architectures to be 'funny' here.