Re: [PATCH v5 02/10] x86/acpi: Move acpi_wakeup_cpu() and helpers to smpwakeup.c

From: Peter Zijlstra
Date: Mon Jun 30 2025 - 09:27:17 EST


On Mon, Jun 30, 2025 at 03:07:08PM +0300, Kirill A. Shutemov wrote:
> On Mon, Jun 30, 2025 at 01:03:16PM +0200, Peter Zijlstra wrote:
> > On Fri, Jun 27, 2025 at 08:35:08PM -0700, Ricardo Neri wrote:
> >
> > > - /*
> > > - * Wait for the CPU to wake up.
> > > - *
> > > - * The CPU being woken up is essentially in a spin loop waiting to be
> > > - * woken up. It should not take long for it wake up and acknowledge by
> > > - * zeroing out ->command.
> > > - *
> > > - * ACPI specification doesn't provide any guidance on how long kernel
> > > - * has to wait for a wake up acknowledgment. It also doesn't provide
> > > - * a way to cancel a wake up request if it takes too long.
> > > - *
> > > - * In TDX environment, the VMM has control over how long it takes to
> > > - * wake up secondary. It can postpone scheduling secondary vCPU
> > > - * indefinitely. Giving up on wake up request and reporting error opens
> > > - * possible attack vector for VMM: it can wake up a secondary CPU when
> > > - * kernel doesn't expect it. Wait until positive result of the wake up
> > > - * request.
> > > - */
> > > - while (READ_ONCE(acpi_mp_wake_mailbox->command))
> > > - cpu_relax();
> > > -
> > > - return 0;
> > > -}
> >
> > > + while (READ_ONCE(acpi_mp_wake_mailbox->command))
> > > + cpu_relax();
> > > +
> > > + return 0;
> > > +}
> >
> > So I realize this is just code movement at this point, but this will
> > hard lockup the machine if the AP doesn't come up, right?
>
> Correct.
>
> > IIRC we have some timeout in the regular SIPI bringup if the AP doesn't
> > respond.
>
> See the comment.

Doh, reading hard ;-) Thanks!