[CRIU] [PATCH 09/21] parasite: Switch parasite to daemon mode (v2)
Pavel Emelyanov
xemul at parallels.com
Fri May 24 12:23:17 EDT 2013
On 05/24/2013 04:20 PM, Andrey Vagin wrote:
> Parasite daemon mode it quite tricky. One may consider
> it as consisting of two parts
>
> - daemon mode for thread leader
> - daemon mode for regular threads
>
> Thread leader daemon
> --------------------
>
> Once thread leader parasite code switched initialized,
> it starts spinning on socket listening for commands
> to handle.
>
> If the command destination is the thread leader itself it
> handles it and replies back the ack to the caller (iow
> the main crtools code).
>
> If the recepient is not thread leader but one of threads,
> then thread leader wakes up the thread by futex and makes
> it to handle the command waiting on futex for result. Once
> result obtained, the ack is being sending back to caller.
>
> Thread daemon
> -------------
>
> On initialization thread daemon starts waiting a command on futex.
> The futex is triggered by thread leader daemon when command received.
> Once command is received and handled, the result is reported back to
> the thread leader daemon, which in turn send ack message.
>
> Both thread-leader and regular threads require own stack to operate
> on since they all are present in memory simultaneously. Thus we use
> call_daemon_thread() helper which takes care of providing stack
> to the callee.
>
> TODO:
>
> - ARM requires own wrappers on damonize/trap low-level code,
> at moment x86-64 is only covered
>
> v2: remove PARASITE_CMD_DAEMONIZED and s->ack
> parasite: use a propper command for getting ack
>
> Fixed-by: Andrey Vagin <avagin at openvz.org>
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
Applied
More information about the CRIU
mailing list