[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4d4bafc0-161c-4195-b177-c06d386a42be@arm.com>
Date: Tue, 6 Aug 2024 22:51:38 +0100
From: Leo Yan <leo.yan@....com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Ingo Molnar <mingo@...hat.com>, Arnaldo Carvalho de Melo
 <acme@...nel.org>, Namhyung Kim <namhyung@...nel.org>,
 Mark Rutland <mark.rutland@....com>, Ian Rogers <irogers@...gle.com>,
 Adrian Hunter <adrian.hunter@...el.com>,
 "Liang, Kan" <kan.liang@...ux.intel.com>,
 James Clark <james.clark@...aro.org>, linux-perf-users@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 1/5] perf/core: Allow multiple AUX PMU events with the
 same module
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@....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
Powered by blists - more mailing lists
 
