Linux-Trace-Devel Archive on
 help / color / Atom feed
* Invoke trace event in registration callback function
@ 2019-11-18 11:29 Matthew Clarkson
  0 siblings, 0 replies; only message in thread
From: Matthew Clarkson @ 2019-11-18 11:29 UTC (permalink / raw)
  To: linux-kernel, linux-trace-devel; +Cc: rostedt, mingo, joelaf

We are looking to introduce a power/gpu_frequency trace event for Mali GPUs. This integrates nicely with Google's Perfetto ( 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

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");
                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
        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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-18 11:29 Invoke trace event in registration callback function Matthew Clarkson

Linux-Trace-Devel Archive on

Archives are clonable:
	git clone --mirror linux-trace-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-trace-devel linux-trace-devel/ \
	public-inbox-index linux-trace-devel

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone