Linux-Trace-Devel Archive on lore.kernel.org
 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 (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.

^ 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 lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-trace-devel/0 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/ https://lore.kernel.org/linux-trace-devel \
		linux-trace-devel@vger.kernel.org
	public-inbox-index linux-trace-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-trace-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git