Re: [PATCH v1] perf evlist: Avoid frequency mode for the dummy event

From: Namhyung Kim
Date: Wed Oct 11 2023 - 12:14:59 EST


On Tue, Oct 3, 2023 at 4:02 PM Namhyung Kim <namhyung@xxxxxxxxxx> wrote:
>
> On Tue, Oct 3, 2023 at 3:36 PM Ian Rogers <irogers@xxxxxxxxxx> wrote:
> > With the PMU disabled, isn't there still a risk of an interrupt still
> > being in flight? In other words the disable doesn't prevent a race and
> > we'll catch this on the next timer call to
> > perf_adjust_freq_unthr_context. I think we can also improve the code
> > by just disabling a PMU once, we can take advantage of the
> > perf_event_pmu_context and disable that PMU, iterate its events and
> > then re-enable the PMU - i.e. no need for an enable and disable per
> > event. I'll put a patch together.
>
> Thanks, I was thinking about that too. It's also a side effect of
> the context rewrite. Maybe we could iterate pmu_ctx's active lists
> and skip pmus with PERF_PMU_CAP_NO_INTERRUPT and
> individual non-sampling events.

Or we can add pmu_ctx->nr_freq and check it before accessing
pmu MSRs.

Thanks,
Namhyung