Re: [PATCH v2 06/20] x86/alternative: use temporary mm for text poking

Peter Zijlstra
2019-02-05T13:30:19Z

On Tue, Feb 05, 2019 at 12:31:46PM +0100, Peter Zijlstra wrote:
> In general, text_poke() cannot fail:
>
> - suppose changing a single jump label requires poking multiple sites
> (not uncommon), we fail halfway through and then have to undo the
> first pokes, but those pokes fail again.
>
> - this then leaves us no way forward and no way back, we've got
> inconsistent text state -> FAIL.

Note that this exact fail scenario still exists in the CPU hotplug code.
See kernel/cpu.c:cpuhp_thread_fun():

/*
* If we fail on a rollback, we're up a creek without no
* paddle, no way forward, no way back. We loose, thanks for
* playing.
*/
WARN_ON_ONCE(st->rollback);