[PATCH V5 01/12] perf/core: Add aux_pause, aux_resume, aux_start_paused

Andi Kleen ak at linux.intel.com
Fri Feb 9 01:49:25 PST 2024


On Fri, Feb 09, 2024 at 10:14:44AM +0200, Adrian Hunter wrote:
> On 9/02/24 02:13, Andi Kleen wrote:
> >> +static void __perf_event_aux_pause(struct perf_event *event, bool pause)
> >> +{
> >> +	if (pause) {
> >> +		if (!READ_ONCE(event->aux_paused)) {
> >> +			WRITE_ONCE(event->aux_paused, 1);
> >> +			event->pmu->stop(event, PERF_EF_PAUSE);
> >> +		}
> >> +	} else {
> >> +		if (READ_ONCE(event->aux_paused)) {
> >> +			WRITE_ONCE(event->aux_paused, 0);
> >> +			event->pmu->start(event, PERF_EF_RESUME);
> >> +		}
> > 
> > This doesn't look atomic. Either the READ/WRITE once are not needed,
> > or you need an actually atomic construct.
> 
> Yes READ_ONCE / WRITE_ONCE is not really needed here.

Normally you are supposed to add a comment on what the interaction
is (similar to what is done for spinlock declarations)

-Andi



More information about the linux-arm-kernel mailing list