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

From: Andi Kleen
Date: Fri Feb 09 2024 - 16:18:36 EST


> The writes to rb->aux_in_pause_resume must be done
> only once. It might be possible to get away without
> WRITE_ONCE(), but really the compiler should be informed
> not to make assumptions.

What stops the NMI from firing here?

> >> + if (READ_ONCE(rb->aux_in_pause_resume))
> >> + /* Guard against NMI, NMI loses here */
> >> + goto out_restore;
<----------------------- NMI
> >> + WRITE_ONCE(rb->aux_in_pause_resume, 1);


Even if it isn't racy it needs a clear comment.

-Andi