[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7f1014fc-eb0a-4989-8efa-245d5b6937cd@linux.intel.com>
Date: Wed, 24 Apr 2024 11:30:14 -0400
From: "Liang, Kan" <kan.liang@...ux.intel.com>
To: Ian Rogers <irogers@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Namhyung Kim <namhyung@...nel.org>, Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>, Adrian Hunter <adrian.hunter@...el.com>,
James Clark <james.clark@....com>, linux-perf-users@...r.kernel.org,
linux-kernel@...r.kernel.org, bpf@...r.kernel.org,
Atish Patra <atishp@...osinc.com>, linux-riscv@...ts.infradead.org,
Beeman Strong <beeman@...osinc.com>
Subject: Re: [PATCH v2 13/16] perf parse-events: Improvements to modifier
parsing
On 2024-04-24 11:18 a.m., Ian Rogers wrote:
> On Fri, Apr 19, 2024 at 6:20 AM Liang, Kan <kan.liang@...ux.intel.com> wrote:
>>
>>
>>
>> On 2024-04-19 2:22 a.m., Ian Rogers wrote:
>>>>> + /* Simple modifiers copied to the evsel. */
>>>>> + if (mod.precise) {
>>>>> + u8 precise = evsel->core.attr.precise_ip + mod.precise;
>>>>> + /*
>>>>> + * precise ip:
>>>>> + *
>>>>> + * 0 - SAMPLE_IP can have arbitrary skid
>>>>> + * 1 - SAMPLE_IP must have constant skid
>>>>> + * 2 - SAMPLE_IP requested to have 0 skid
>>>>> + * 3 - SAMPLE_IP must have 0 skid
>>>>> + *
>>>>> + * See also PERF_RECORD_MISC_EXACT_IP
>>>>> + */
>>>>> + if (precise > 3) {
>>>> The pmu_max_precise() should return the max precise the current kernel
>>>> supports. It checks the /sys/devices/cpu/caps/max_precise.
>>>>
>>>> I think we should use that value rather than hard code it to 3.
>>> I'll add an extra patch to do that. I'm a bit concerned it may break
>>> event parsing on platforms not supporting max_precise of 3.
>>
>> The kernel already rejects the precise_ip > max_precise (using the same
>> x86_pmu_max_precise()). It should be fine to apply the same logic in the
>> tool.
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/x86/events/core.c#n566
>>
>> Will the extra patch be sent separately?
>
> Let's do it separately. I'm concerned about the behavior on AMD (and
> possibly similar architectures) where certain events support precision
> like cycles, as they detour to the IBS PMU, but not all events support
> it. The max_precise should reflect that AMD's Zen core PMU does
> support precision as a consequence of detouring to IBS, but maybe
> things in sysfs aren't set up correctly.
>
The x86_pmu_max_precise() is a generic function for X86. It should apply
to AMD as well.
A separate patch looks good to me.
Thanks,
Kan
Powered by blists - more mailing lists