mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Leo Yan <leo.yan@arm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	"Liang, Kan" <kan.liang@linux.intel.com>,
	James Clark <james.clark@linaro.org>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/5] perf/core: Allow multiple AUX PMU events with the same module
Date: Tue, 6 Aug 2024 22:51:38 +0100	[thread overview]
Message-ID: <4d4bafc0-161c-4195-b177-c06d386a42be@arm.com> (raw)
In-Reply-To: <20240806211439.GB37996@noisy.programming.kicks-ass.net>

On 8/6/2024 10:14 PM, Peter Zijlstra wrote:
> On Tue, Aug 06, 2024 at 09:48:09PM +0100, Leo Yan wrote:
>> This commit changes the condition from checking the same PMU instance to
>> checking the same PMU driver module. This allows support for multiple
>> PMU events with the same driver module.
>>
>> As a result, more than one AUX event (e.g. arm_spe_0 and arm_spe_1) can
>> record trace into the AUX ring buffer.
>>
>> Signed-off-by: Leo Yan <leo.yan@arm.com>
>> ---
>>  kernel/events/core.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/kernel/events/core.c b/kernel/events/core.c
>> index aa3450bdc227..fdb8918e62a0 100644
>> --- a/kernel/events/core.c
>> +++ b/kernel/events/core.c
>> @@ -12344,9 +12344,10 @@ 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.
>>        */
>>       if (has_aux(event) && has_aux(output_event) &&
>> -         event->pmu != output_event->pmu)
>> +         event->pmu->module != output_event->pmu->module)
> 
> A very quick look at: arch/x86/events/intel/pt.c seems to suggest that
> doesn't set pmu->module. Which seems to suggest the above won't work for
> us.

Seems Intel PT and BTS drivers both do not set the pmu->module.

Either we assign the pmu->module for both drivers, or we can update this patch
like below:

        if (has_aux(event) && has_aux(output_event)) {
            /*
             * No idea the module for the PMU is pmu->module is NULL,
             * do not allow tracing for these two AUX event.
             */
            if (!event->pmu->module || !output_event->pmu->module)
                goto out;

            /*
             * Don't allow generate AUX trace data if PMUs don't come from
             * the same module.
             */
            if (event->pmu->module != output_event->pmu->module)
                goto out;
        }

How about you think?  Thanks for review!

Leo

  reply	other threads:[~2024-08-06 21:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-06 20:48 [PATCH v3 0/5] perf auxtrace: Support multiple AUX events Leo Yan
2024-08-06 20:48 ` [PATCH v3 1/5] perf/core: Allow multiple AUX PMU events with the same module Leo Yan
2024-08-06 21:14   ` Peter Zijlstra
2024-08-06 21:51     ` Leo Yan [this message]
2024-08-06 20:48 ` [PATCH v3 2/5] perf auxtrace: Introduce auxtrace_record__validate_events() Leo Yan
2024-08-06 20:48 ` [PATCH v3 3/5] perf auxtrace: Refactor evlist__enable_event_idx() Leo Yan
2024-08-06 20:48 ` [PATCH v3 4/5] perf auxtrace: Bails out after finding the event for the map index Leo Yan
2024-08-06 20:48 ` [PATCH v3 5/5] perf auxtrace: Iterate all AUX events when finish reading 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=4d4bafc0-161c-4195-b177-c06d386a42be@arm.com \
    --to=leo.yan@arm.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /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

all inboxes | Powered by JetHome®