Messages in this thread | | | Date | Thu, 23 Jul 2020 12:57:35 +0200 | From | Vincent Whitchurch <> | Subject | Re: [PATCH] dynamic debug: allow printing to trace event |
| |
On Wed, Jul 22, 2020 at 05:28:23PM +0200, Steven Rostedt wrote: > For you, I made this quick patch. If this works for you, I can make it > into a formal patch. It includes a test use case in do_sys_openat2() to > show the file name and file descriptor. Obviously, that wont be part of > the final patch.
Thank you. I had to replace the inline with an __attribute__((unused)) because otherwise my GCC errors out with "error: function 'find_vprintk_len' can never be inlined because it uses variable argument lists".
Apart from that it works fine, but the several calls to vsnprintf() take their toll and this method is twice as slow as the buffer-on-stack implementation (and ftrace_vprintk()). If I pass in a fixed size for the __dynamic_array I get the same performance as the buffer-on-stack method, but that's probably not surprising.
I know a dedicated trace event or a binary trace_printk() at the call site of pr_debug() is always going to be more performant, but it would be nice to avoid the extra slowdown if possible.
It's hard to guarantee that 256 bytes on the stack is safe on all systems since these functions are called from lots of places.
Would it be acceptable to just use a fixed size for the event? At least for my own debugging use cases it's preferable to just have to increase the trace buffer size in case it's insufficient, rather than to have to restort to one-off debugging code.
| |