Re: [PATCH v2] entry/kvm: Make vCPU tasks exit to userspace when a livepatch is pending

From: Seth Forshee
Date: Tue May 03 2022 - 13:54:03 EST


On Tue, May 03, 2022 at 12:49:34PM -0500, Seth Forshee wrote:
> A task can be livepatched only when it is sleeping or it exits to
> userspace. This may happen infrequently for a heavily loaded vCPU task,
> leading to livepatch transition failures.
>
> Fake signals will be sent to tasks which fail patching via stack
> checking. This will cause running vCPU tasks to exit guest mode, but
> since no signal is pending they return to guest execution without
> exiting to userspace. Fix this by treating a pending livepatch migration
> like a pending signal, exiting to userspace with EINTR. This allows the
> task to be patched, and userspace should re-excecute KVM_RUN to resume
> guest execution.
>
> In my testing, systems where livepatching would timeout after 60 seconds
> were able to load livepatches within a couple of seconds with this
> change.
>
> Signed-off-by: Seth Forshee <sforshee@xxxxxxxxxxxxxxxx>
> ---
> Changes in v2:
> - Added _TIF_SIGPENDING to XFER_TO_GUEST_MODE_WORK

Clearly I meant _TIF_PATCH_PENDING here and not _TIF_SIGPENDING.