[CRIU] [PATCH RFC] parasite: don't daemonize non-leader threads
Pavel Emelyanov
xemul at parallels.com
Sun May 26 15:25:14 EDT 2013
On 05/25/2013 01:33 AM, Andrey Vagin wrote:
> For dumping thread we need to execute only one command, so its
> demonization is overload.
>
> This patch blocks all signals and dumps all thread related parameters in
> PARASITE_CMD_INIT_THREAD, then registers are dumped for this thread and
> the last step is unblocking thread signals.
>
> This patch simplifies a parasite code, because it removes execution of
> commands for threads.
>
> Don't commit this patch. It's just proof of concept.
>
> Thanks Pavel for this idea.
>
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
Looks nice. One more wish inline:
> + if (id == 0)
> + ret = parasite_execute_daemon_by_id(PARASITE_CMD_DUMP_THREAD, ctl, id);
> + else {
> + user_regs_struct_t *regs_orig = &ctl->threads[id].regs_orig;
> + ctl->threads[id].tid = pid;
> +
> + args->id = id;
> +
> + ret = ptrace(PTRACE_GETREGS, pid, NULL, regs_orig);
> + if (ret) {
> + pr_perror("Can't obtain registers (pid: %d)", pid);
> + return -1;
> + }
> +
> + ret = parasite_execute_trap_by_id(PARASITE_CMD_INIT_THREAD, ctl, id);
> + if (ret) {
> + pr_err("Can't init thread in parasite %d\n", pid);
> + return -1;
> + }
> +
> + ctl->threads[id].use_sig_blocked = true;
> +
> + ret = get_task_regs(pid, *regs_orig, core);
> + if (ret)
> + pr_err("Can't obtain regs for thread %d\n", pid);
> +
> + if (parasite_execute_trap_by_id(PARASITE_CMD_FINI_THREAD, ctl, id)) {
Can we make it 1 command at all? Merging INIT and FINI?
> + pr_err("Can't init thread in parasite %d\n", pid);
> + return -1;
> + }
> + if (ret)
> + return -1;
> +
> + memcpy(&core->thread_core->blk_sigset,
> + &args->sig_blocked, sizeof(k_rtsigset_t));
> + core->thread_core->has_blk_sigset = true;
> + }
Other than this -- plz, cook the final patch.
Thanks,
Pavel
More information about the CRIU
mailing list