Re: [PATCH v3 01/22] x86/paravirt: Mark native pv_ops helpers notrace

From: Peter Zijlstra

Date: Wed Dec 02 2026 - 08:55:27 EST


On Tue, Dec 01, 2026 at 09:36:42AM -0500, Steven Rostedt wrote:
> On Tue, 1 Dec 2026 08:43:53 +0100
> Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> > On Mon, Nov 30, 2026 at 08:21:40PM -0800, Song Liu wrote:
> > > The native implementations of several pv_ops are static inline functions
> > > in headers. pv_ops stores their address, so with CONFIG_PARAVIRT_XXL the
> > > compiler emits an out-of-line copy of each one, and pv_ops calls go to
> > > that copy. Today these copies are not traced only because the inline
> > > macro implies notrace.
> > >
> > > Some callers of these helpers must not be traced:
> > > restore_processor_state() is notrace and runs during resume,
> > > __switch_to() is __notrace_funcgraph, and arch/x86/kernel/cpu/common.c
> > > and arch/x86/kernel/tsc.c, which call several of them, are built
> > > without -pg.
> > >
> > > Mark these helpers notrace explicitly, like native_write_msr() and
> > > native_write_msr_safe() already are, so they stay untraced if inline no
> > > longer implies notrace. No functional change.
> >
> > I must say.. I hate this with a passion. This is unmaintainable garbage.
>
> Can you elaborate more? What exactly do you hate? It's not much different
> than the noinstr code. That is, basically everything that should be noinstr
> should also be notrace. notrace may have a little bigger scope than noinstr
> but not by much.
>
> Note, if you really want something inlined, use "__always_inline" which
> will never be traced. But "inline" itself is leaving it up to the compiler
> to decide. Like noinstr, this means if you really do not want something
> traced, you need to use __always_inline or explicitly state notrace.

noinstr is validated by objtool. Nothing tells me if notrace is correct
or not.

This patch adds a gazillion non-obvious notrace annotations that *will*
get lost/broken/etc. as code changes.

There is no correctness guarantee anywhere near here.