Re: [PATCH 1/3] perf pmu: Limit PMU cpumask to online CPUs

From: Ian Rogers
Date: Tue Jun 04 2024 - 10:13:22 EST


On Tue, Jun 4, 2024 at 4:12 AM Yicong Yang <yangyicong@xxxxxxxxxx> wrote:
>
> On 2024/6/4 0:52, Ian Rogers wrote:
> > On Mon, Jun 3, 2024 at 2:33 AM Yicong Yang <yangyicong@xxxxxxxxxx> wrote:
> > Fwiw, the tool will determine whether the mask is for all valid or a
> > hint by using the notion of a PMU being "core" or not. That notion
> > considers whether the mask was loading from a "cpumask" or "cpus"
> > file:
> > https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/util/pmu.c?h=perf-tools-next#n810
> >
>
> I see, you're correct on this. Maybe I didn't mention it clearly in the commit,
> this patch doesn't intend to change the case that user specify the CPUs explicitly.
> It'll have difference in case user doesn't specify the CPU list while the PMU's
> 'cpus' or 'cpumask' contains offline CPUs: with this patch we'll use the online
> CPUs in the PMU's 'cpus' or 'cpumask' but before this we may use the offline CPUs.
> We still honor the user's input by the handling in __perf_evlist__propagate_maps().

Thanks Yicong,

I'm having a hard time believing this bug has been there all along
(forever) and also what's happening with BIG.little/hybrid that
advertise CPUs in similar ways. I do see that on armv8_pmuv3_0 the
"cpus" file will have offline cpus while on x86 a lack of such a file
causes a fallback on using the set of online CPUs. So there is a
divergence in the PMUs behavior that may well manifest itself in the
perf tool like this. If the "cpus" file were empty we might fix the
behavior but I don't think that's what's wanted. I also wonder that a
PMU driver change will mean the perf tool is still not working
correctly for people who don't rebuild their kernel.

I'm still thinking about this but thanks for the updates,
Ian