Re: [PATCHv5.1 14/16] x86/smp: Add smp_ops.stop_this_cpu() callback

From: Huang, Kai
Date: Mon Jan 08 2024 - 22:04:27 EST



> > > @@ -835,6 +835,13 @@ void __noreturn stop_this_cpu(void *dummy)
> > > */
> > > cpumask_clear_cpu(cpu, &cpus_stop_mask);
> > >
> > > +#ifdef CONFIG_SMP
> > > + if (smp_ops.stop_this_cpu) {
> > > + smp_ops.stop_this_cpu();
> > > + unreachable();
> > > + }
> > > +#endif
> >
> > If I read correctly this will result in stop_this_cpu() having different
> > behaviour for SMP and !SMP build for TDX guest. For example, AFAICT
> > machine_halt() also calls stop_this_cpu() on local cpu after it stops other
> > cpus. So for the local cpu, in SMP build it will calls into BIOS's reset vector
> > but in !SMP it will call native_halt().
>
> It doesn't make a difference in practice: both halt and giving CPU to
> BIOS will be unrecoverable operation. Both are equally acceptable for
> machine_halt().
>

OK fair enough. :-)