Re: [PATCH v2] noinstr: Use asm_inline() in instrumentation_{begin,end}()
From: Peter Zijlstra
Date: Tue Apr 15 2025 - 03:49:02 EST
On Mon, Apr 14, 2025 at 05:27:11PM -0700, Josh Poimboeuf wrote:
> Use asm_inline() in the instrumentation begin/end macros to prevent the
> compiler from making poor inlining decisions based on the length of the
> objtool annotations.
>
> Without the objtool annotations, each macro resolves to a single NOP.
> Using inline_asm() seems obviously correct here as it accurately
> communicates the actual code size to the compiler.
>
> These macros are used by WARN() and lockdep, so this change can affect a
> lot of functions.
>
> For a defconfig kernel built with GCC 14.2.1, bloat-o-meter reports a
> 0.17% increase in text size:
>
> add/remove: 74/352 grow/shrink: 914/353 up/down: 80747/-47120 (33627)
> Total: Before=19460272, After=19493899, chg +0.17%
Hmm, I was surprised that defconfig was affected at all. Why does
defconfig have DEBUG_ENTRY on?