Re: objtool warning for next-20221118
From: Josh Poimboeuf
Date: Wed Nov 23 2022 - 12:03:53 EST
On Wed, Nov 23, 2022 at 10:52:09AM +0000, Andrew Cooper wrote:
> > Well, if you return from arch_cpu_idle_dead() you're back in the idle
> > loop -- exactly where you would be if you were to bootstrap the whole
> > CPU -- provided you have it remember the whole state (easier with a
> > vCPU).
play_dead() really needs sane semantics. Not only does it introduce a
surprise to the offlining code in do_idle(), it also skips the entire
hotplug state machine. Not sure if that introduces any bugs, but at the
very least it's subtle and surprising.
> > But maybe I'm missing something, lets add Xen folks on.
>
> Calling VCPUOP_down on oneself always succeeds, but all it does is
> deschedule the vCPU.
>
> It can be undone at a later point by a different vcpu issuing VCPUOP_up
> against the previously-downed CPU, at which point the vCPU gets rescheduled.
>
> This is why the VCPUOP_down hypercall returns normally. All state
> really is intact.
>
> As for what Linux does, this is how xen_pv_cpu_up() currently behaves.
> If you want to make Xen behave more everything else, then bug a BUG()
> after VCPUOP_down, and adjust xen_pv_cpu_up() to skip its initialised
> check and always use VCPUOP_initialise to bring the vCPU back online.
Or we could do what sev_es_play_dead() does and just call start_cpu0()
after the hypercall returns?
Though, start_cpu0() seems very suspect, it just uses the stack of the
idle task of whatever CPU happened to be last brought up via cpu_up().
Which means we now have two idle tasks sharing the same stack? How is
start_cpu0() not broken???
--
Josh