[<prev] [next>] [day] [month] [year] [list]
Message-ID: <DB7PR08MB3468AE078C09C8605477EE73964D0@DB7PR08MB3468.eurprd08.prod.outlook.com>
Date: Mon, 18 Nov 2019 11:29:18 +0000
From: Matthew Clarkson <Matthew.Clarkson@....com>
To: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-trace-devel@...r.kernel.org"
<linux-trace-devel@...r.kernel.org>
CC: "rostedt@...dmis.org" <rostedt@...dmis.org>,
"mingo@...hat.com" <mingo@...hat.com>,
"joelaf@...gle.com" <joelaf@...gle.com>
Subject: Invoke trace event in registration callback function
We are looking to introduce a power/gpu_frequency trace event for Mali GPUs. This integrates nicely with Google's Perfetto (https://perfetto.dev/) ftrace reader to provide a graph of the GPU frequency against GPU workloads.
Google would like for the trace event to output the current GPU frequency when the tracepoint is activated. This is so that if there is no frequency change during the trace the current GPU frequency is known and an unchanging frequency graph can be shown.
To do this we tried adding a registration function to the trace event:
DEFINE_EVENT_FN(gpu, gpu_frequency,
TP_PROTO(unsigned int frequency, unsigned int gpu_id),
TP_ARGS(frequency, gpu_id),
trace_gpu_frequency_register, // <-- added
trace_gpu_frequency_unregister
);
Which invokes the trace point when registered:
static void log_all_gpu_frequencies(void) {
// In production would log the actual current GPU frequency
printk("gpu: frequency: %lu\n", 5000);
trace_gpu_frequency(5000, 0);
}
int trace_gpu_frequency_register(void) {
printk("gpu: register\n");
log_all_gpu_frequencies();
return 0;
}
void trace_gpu_frequency_unregister(void) {
printk("gpu: unregister\n");
}
When performing a trace, there is no data received from the trace point even though the dmesg output shows that the registration callback was invoked. Perfetto also does not receive the event either.
$ sudo trace-cmd record -e power:gpu_frequency
/sys/kernel/tracing/events/power/gpu_frequency
Hit Ctrl^C to stop recording
$ dmesg
[Nov18 10:02] gpu: register
[ +0.002699] gpu: frequency: 5000
[ +7.783861] gpu: unregister
Is it acceptable to invoke a trace point in the registration callback? Is the trace point not full initialized at that point?
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
Powered by blists - more mailing lists