Re: [patch V4 12/36] entry: Inline irqentry_enter/exit_from/to_user_mode()
From: Thomas Gleixner
Date: Tue Sep 09 2025 - 10:12:45 EST
On Tue, Sep 09 2025 at 09:38, Mathieu Desnoyers wrote:
> On 2025-09-08 17:31, Thomas Gleixner wrote:
>> There is no point to have this as a function which just inlines
>> enter_from_user_mode(). The function call overhead is larger than the
>> function itself.
>
> I'm wondering if there is a reason for making those actual functions and
> not inlines.
>
> The functions sit in kernel/entry/common.c, which are built with
> specific compiler flags in kernel/entry/Makefile:
>
> # Prevent the noinstr section from being pestered by sanitizer and other
> goodies
> # as long as these things cannot be disabled per function.
> KASAN_SANITIZE := n
> UBSAN_SANITIZE := n
> KCOV_INSTRUMENT := n
>
> # Branch profiling isn't noinstr-safe
> ccflags-$(CONFIG_TRACE_BRANCH_PROFILING) += -DDISABLE_BRANCH_PROFILING
>
> CFLAGS_REMOVE_common.o = -fstack-protector -fstack-protector-strong
> CFLAGS_common.o += -fno-stack-protector
>
> So I wonder if we're not breaking something in the area of "noinstr"
> tagging by inlining those into their caller ?
No, because the call sites have to be non-instrumented as well.