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

Peter Zijlstra peterz at infradead.org
Thu Jul 11 04:51:23 PDT 2024


On Thu, Jul 11, 2024 at 01:42:33PM +0300, Adrian Hunter wrote:
> On 1/07/24 13:26, Peter Zijlstra wrote:
> > On Fri, Jun 28, 2024 at 09:51:00AM +0300, Adrian Hunter wrote:
> > 
> >> Add aux_paused to struct perf_event for AUX area events to keep track of
> >> the "paused" state. aux_paused is initialized to aux_start_paused.
> > 	
> >> @@ -798,6 +810,9 @@ struct perf_event {
> >>  	/* for aux_output events */
> >>  	struct perf_event		*aux_event;
> >>  
> >> +	/* for AUX area events */
> >> +	unsigned int			aux_paused;
> >> +
> >>  	void (*destroy)(struct perf_event *);
> >>  	struct rcu_head			rcu_head;
> >>  
> > 
> > Should this not be part of struct hw_perf_event for whatever hw event
> > implements this AUX stuff?
> > 
> > In fact, I would expect PERF_HES_PAUSED or something to go in
> > perf_event::hw::state.
> 
> Sorry for the slow reply due to vacation.
> 
> There doesn't seem to be anything preventing pause/resume from
> "racing" (PMI vs task context) with changes in the aux event state,
> so aux_paused must be separate from perf_event::hw::state.

So normally, context switching perf would be under pmu_disable(), which
should ensure no PMI happens while we're reprogramming the PMU.

That said, I think for the aux case we have perf_event_stop() that can
race vs PMI, so yeah, bummer.

Sticking it in hw_perf_event would be good though. Also perhaps add a
comment about exactly why this cannot be in ::state.



More information about the linux-arm-kernel mailing list