Re: [PATCH v2 3/3] ftrace: Add sample with custom ops

From: Guenter Roeck
Date: Mon Feb 06 2023 - 17:25:23 EST


On Tue, Jan 03, 2023 at 12:49:12PM +0000, Mark Rutland wrote:
> When reworking core ftrace code or architectural ftrace code, it's often
> necessary to test/analyse/benchmark a number of ftrace_ops
> configurations. This patch adds a module which can be used to explore
> some of those configurations.
>
> I'm using this to benchmark various options for changing the way
> trampolines and handling of ftrace_ops work on arm64, and ensuring other
> architectures aren't adversely affected.
>
> For example, in a QEMU+KVM VM running on a 2GHz Xeon E5-2660
> workstation, loading the module in various configurations produces:
>
...

> +++ b/samples/ftrace/ftrace-ops.c

...

> +static int __init ftrace_ops_sample_init(void)
> +{
> + unsigned long flags = 0;
> + ktime_t start, end;
> + u64 period;
> +
...
> +
> + period = ktime_to_ns(ktime_sub(end, start));
> +
> + pr_info("Attempted %u calls to %ps in %lluns (%lluns / call)\n",
> + nr_function_calls, tracee_relevant,
> + period, period / nr_function_calls);
^^^^^^^^^^^^^^^^^^^^^^^^^^

Building csky:allmodconfig ... failed
--------------
Error log:
ERROR: modpost: "__udivdi3" [samples/ftrace/ftrace-ops.ko] undefined!

Guenter