Re: [PATCH v2 1/1] x86/reboot: KVM: Guard nmi_shootdown_cpus_on_restart() with ifdeffery

From: Andy Shevchenko
Date: Tue Apr 08 2025 - 08:30:10 EST


On Mon, Nov 04, 2024 at 09:08:45PM +0200, Andy Shevchenko wrote:
> On Thu, Oct 10, 2024 at 02:37:59AM +0300, Andy Shevchenko wrote:
> > Wed, Oct 09, 2024 at 12:34:37PM -0700, Sean Christopherson kirjoitti:
> > > On Tue, Oct 08, 2024, Andy Shevchenko wrote:
> > > > The nmi_shootdown_cpus_on_restart() in some cases may be not used.
> > > > This, in particular, prevents kernel builds with clang, `make W=1`
> > > > and CONFIG_WERROR=y:
> > > >
> > > > arch/x86/kernel/reboot.c:957:20: error: unused function 'nmi_shootdown_cpus_on_restart' [-Werror,-Wunused-function]
> > > > 957 | static inline void nmi_shootdown_cpus_on_restart(void)
> > > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > >
> > > > Fix this by guarging the definitions with the respective KVM ifdeffery.
> > > >
> > > > See also commit 6863f5643dd7 ("kbuild: allow Clang to find unused static
> > > > inline functions for W=1 build").
> >
> > > Heh, I tried fixing this too, and have patches to clean things up, but I ended up
> > > not posting them because I decided the W=1 warning was less ugly than the resulting
> > > code in nmi_shootdown_cpus().
> >
> > CONFIG_WERROR=y is the default (at least in the current defconfigs for x86).
> > My goal is to match what ARM builds survive (to some extend?), i.e. W=1, so
> > may one apply either version I provided or yours?
> >
> > > If we're willing to take on a bit of weirdness in nmi_shootdown_cpus(), then much
> > > of the #ifdeffery can go away. Patches attached (lightly tested).
>
> So, what's the status either with the proposed change or with what Sean shared?
> Can we somehow move forward to fix the issue?

Any news here? Build error is still reproducible.

--
With Best Regards,
Andy Shevchenko