Re: [PATCH v3] perf evsel: Fix missing exclude_{host,guest} setting

From: Namhyung Kim
Date: Tue Nov 02 2021 - 19:08:57 EST


Hi Arnaldo,

On Mon, Nov 1, 2021 at 2:09 PM Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> wrote:
>
> Em Fri, Oct 29, 2021 at 03:49:29PM -0700, Namhyung Kim escreveu:
> > @@ -1900,10 +1935,17 @@ bool evsel__detect_missing_features(struct evsel *evsel)
> > perf_missing_features.mmap2 = true;
> > pr_debug2_peo("switching off mmap2\n");
> > return true;
> > - } else if (!perf_missing_features.exclude_guest &&
> > - (evsel->core.attr.exclude_guest || evsel->core.attr.exclude_host)) {
> > - perf_missing_features.exclude_guest = true;
> > - pr_debug2_peo("switching off exclude_guest, exclude_host\n");
> > + } else if ((evsel->core.attr.exclude_guest || evsel->core.attr.exclude_host) &&
> > + perf_missing_features.pmu != NULL &&
> > + !hashmap__find(perf_missing_features.pmu, evsel, NULL)) {
> > + uintptr_t pmu_features = PERF_MISSING_PMU_EXCLUDE_GUEST;
> > +
> > + hashmap__add(perf_missing_features.pmu, evsel, (void *)pmu_features);
>
> Can't hashmap__add() fail?

It can. I will add a check.

Thanks,
Namhyung