Re: [PATCH v2] ftrace: Introduce PERMANENT ftrace_ops flag

From: Petr Mladek
Date: Mon Oct 14 2019 - 10:26:26 EST


On Mon 2019-10-14 12:59:23, Miroslav Benes wrote:
> Livepatch uses ftrace for redirection to new patched functions. It means
> that if ftrace is disabled, all live patched functions are disabled as
> well. Toggling global 'ftrace_enabled' sysctl thus affect it directly.
> It is not a problem per se, because only administrator can set sysctl
> values, but it still may be surprising.
>
> Introduce PERMANENT ftrace_ops flag to amend this. If the
> FTRACE_OPS_FL_PERMANENT is set on any ftrace ops, the tracing cannot be
> disabled by disabling ftrace_enabled. Equally, a callback with the flag
> set cannot be registered if ftrace_enabled is disabled.
>
> Signed-off-by: Miroslav Benes <mbenes@xxxxxxx>

Looks fine to me. I finally understand which ftrace_enabled toggle
we are talking about ;-)

Reviewed-by: Petr Mladek <pmladek@xxxxxxxx>

> ---
> - return codes. I chose EBUSY, because it seemed the least
> inappropriate. I usually pick the wrong one, so suggestions are
> welcome.

-EBUSY is perfectly fine in ftrace_enable_sysctl(). It is not ideal
in __register_ftrace_function(). But it still looks better than
-ENODEV there.

Best Regards,
Petr