Re: [PATCH v2 1/4] stacktrace: add interface based on shadow call stack

Andrew Morton
2022-03-25T20:46:39Z

On Wed, 23 Mar 2022 16:32:52 +0100 andrey.konovalov@linux.dev wrote:

> From: Andrey Konovalov <andreyknvl@google.com>
>
> Add a new interface stack_trace_save_shadow() for collecting stack traces
> by copying frames from the Shadow Call Stack.
>
> Collecting stack traces this way is significantly faster: boot time
> of a defconfig build with KASAN enabled gets descreased by ~30%.
>
> The few patches following this one add an implementation of
> stack_trace_save_shadow() for arm64.
>
> The implementation of the added interface is not meant to use
> stack_trace_consume_fn to avoid making a function call for each
> collected frame to further improve performance.
>
> ...
>
> @@ -108,4 +111,16 @@ static inline int stack_trace_save_tsk_reliable(struct task_struct *tsk,
> }
> #endif
>
> +#if defined(CONFIG_STACKTRACE) && defined(CONFIG_HAVE_SHADOW_STACKTRACE)
> +int stack_trace_save_shadow(unsigned long *store, unsigned int size,
> + unsigned int skipnr);
> +#else
> +static inline int stack_trace_save_shadow(unsigned long *store,
> + unsigned int size,
> + unsigned int skipnr)
> +{
> + return -ENOSYS;
> +}
> +#endif

checkpatch sayeth "WARNING: ENOSYS means 'invalid syscall nr' and
nothing else".

checkpatch also picked up a typo in a changelog. Useful thing to run,
is checkpatch.