From: Adrian Hunter <adrian.hunter@intel.com>
To: Leo Yan <leo.yan@arm.com>, Peter Zijlstra <peterz@infradead.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Mark Rutland <mark.rutland@arm.com>, Jiri Olsa <jolsa@kernel.org>,
Ian Rogers <irogers@google.com>,
"Liang, Kan" <kan.liang@linux.intel.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Mike Leach <mike.leach@linaro.org>,
James Clark <james.clark@linaro.org>,
John Garry <john.g.garry@oracle.com>,
Will Deacon <will@kernel.org>,
Yicong Yang <yangyicong@hisilicon.com>,
Jonathan Cameron <jonathan.cameron@huawei.com>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org
Subject: Re: [PATCH v6 1/8] perf/core: Allow multiple AUX PMU events with the same module
Date: Thu, 5 Sep 2024 10:13:00 +0300 [thread overview]
Message-ID: <3c95c9d3-a46d-4ce5-b10c-c3261a94f9ee@intel.com> (raw)
In-Reply-To: <adfbd1ba-62ca-49c9-893a-3c10780ee186@arm.com>
On 4/09/24 22:35, Leo Yan wrote:
> On 9/3/2024 11:06 AM, Adrian Hunter wrote:
>>> @@ -12345,9 +12345,16 @@ perf_event_set_output(struct perf_event *event, struct perf_event *output_event)
>>>
>>> /*
>>> * If both events generate aux data, they must be on the same PMU
>>> + * module but can be with different PMU instances.
>>> + *
>>> + * For a built-in PMU module, the 'pmu->module' pointer is NULL,
>>> + * thus it is not feasible to compare the module pointers when
>>> + * AUX PMU drivers are built into the kernel image. Instead,
>>> + * comparing the .setup_aux() callback pointer can determine if
>>> + * the two PMU events come from the same PMU driver.
>>> */
>>> if (has_aux(event) && has_aux(output_event) &&
>>> - event->pmu != output_event->pmu)
>>> + event->pmu->setup_aux != output_event->pmu->setup_aux)
>>
>> It is not very flexible and risks someone adding aux PMUs that
>> do not want that rule but accidentally support it. Another
>> option is to add a PMU callback, but really you need to Peter's
>> feedback.
>
> Thanks a lot for sharing opinion, Adrian!
>
> How about below code? An alternative way is to compare the PMU's parent
> device driver, e.g. for Arm SPE PMU events, this can compare if two PMU
> events are using the Arm SPE driver.
IMHO, in the general case, whether 2 AUX area events can
output to the same buffer isn't really related to the device
hierarchy, driver or module.
>
> /*
> * If both events generate aux data, they must be on the same PMU
> * module but can be with different PMU instances.
> */
> if (has_aux(event) && has_aux(output_event)) {
> /* It isn't allowed if it fails to find driver pointer */
> if (!event->pmu->parent || !event->pmu->parent->driver)
> goto out;
>
> if (!output_event->pmu->parent || !output_event->pmu->parent->driver)
> goto out;
>
> /*
> * It isn't allowed if aux events are not same type of PMU
> * device. This is determined by comparing the associated
> * driver pointers.
> */
> if (event->pmu->parent->driver != output_event->pmu->parent->driver)
> goto out;
> }
>
> I verified the code above, it also works well at my side.
>
> @Peter.Z, Please let me know if this is okay for you.
>
> Thanks,
> Leo
next prev parent reply other threads:[~2024-09-05 7:13 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-23 11:32 [PATCH v6 0/8] perf auxtrace: Support multiple AUX events Leo Yan
2024-08-23 11:32 ` [PATCH v6 1/8] perf/core: Allow multiple AUX PMU events with the same module Leo Yan
2024-08-23 11:40 ` Leo Yan
2024-09-03 10:06 ` Adrian Hunter
2024-09-04 19:35 ` Leo Yan
2024-09-05 7:13 ` Adrian Hunter [this message]
2024-08-23 11:33 ` [PATCH v6 2/8] perf auxtrace: Use evsel__is_aux_event() for checking AUX event Leo Yan
2024-08-23 11:33 ` [PATCH v6 3/8] perf auxtrace: Remove unused 'pmu' pointer from struct auxtrace_record Leo Yan
2024-08-23 11:33 ` [PATCH v6 4/8] perf auxtrace: Introduce auxtrace_record__validate_events() Leo Yan
2024-09-03 15:26 ` Adrian Hunter
2024-09-04 21:13 ` Leo Yan
2024-09-05 6:44 ` Adrian Hunter
2024-08-23 11:33 ` [PATCH v6 5/8] perf auxtrace: Refactor evlist__enable_event_idx() Leo Yan
2024-09-03 18:39 ` Adrian Hunter
2024-08-23 11:33 ` [PATCH v6 6/8] perf auxtrace: Bails out after finding the event for the map index Leo Yan
2024-09-03 18:41 ` Adrian Hunter
2024-08-23 11:33 ` [PATCH v6 7/8] perf auxtrace: Iterate all AUX events when finish reading Leo Yan
2024-08-23 11:33 ` [PATCH v6 8/8] perf arm-spe: Support multiple events in arm_spe_evsel_is_auxtrace() Leo Yan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3c95c9d3-a46d-4ce5-b10c-c3261a94f9ee@intel.com \
--to=adrian.hunter@intel.com \
--cc=acme@kernel.org \
--cc=coresight@lists.linaro.org \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=john.g.garry@oracle.com \
--cc=jolsa@kernel.org \
--cc=jonathan.cameron@huawei.com \
--cc=kan.liang@linux.intel.com \
--cc=leo.yan@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mike.leach@linaro.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=suzuki.poulose@arm.com \
--cc=will@kernel.org \
--cc=yangyicong@hisilicon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).