Re: [GIT pull] x86/urgent for v6.16-rc7

From: Linus Torvalds
Date: Sun Jul 20 2025 - 23:32:28 EST


On Sun, 20 Jul 2025 at 20:14, Ard Biesheuvel <ardb@xxxxxxxxxx> wrote:
>
> Just tried this: adding 'noinstr' to the declaration in asm/sev.h
> makes no difference at all.

Ok, thanks for checking. It does seem a strange bug.

That said, this area is a mess, and I really do think it's at least
partly *our* mess.

We should mark not only __sev_es_nmi_complete(), but the
sev_es_nmi_complete() inline function wrapper as being 'noinstr'.

But we can't do that, because 'noinstr' explicitly includes
'noinline', so we cannot do something sane like

static __always_inline noinstr void sev_es_nmi_complete(void) ..

for the wrapper, because the compiler will very correctly say "I'm
sorry Dave, I can't do that".

So I still suspect that yes, it may be a gcc bug, but we're really
doing some things that make me go "at some point you really can't
blame the compiler too much for being confused".

I guess it doesn't matter - the bug is fixed, but I'd personally
hesitate to make a gcc bug report simply because if I was a compiler
person, I would take one look at this code and say "you're insane".

Linus