From: Oren Laadan <orenl-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
To: "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: Linux Containers <containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org>
Subject: Re: [PATCH 2/3] restart debug: add final process tree status
Date: Thu, 01 Oct 2009 19:29:49 -0400 [thread overview]
Message-ID: <4AC53B6D.7000703@librato.com> (raw)
In-Reply-To: <20091001153356.GA20565-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Serge E. Hallyn wrote:
>
> Here:
>
> From 8cf006a1bf26a4b280841401302c99689d629e0a Mon Sep 17 00:00:00 2001
> From: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> Date: Thu, 1 Oct 2009 11:09:40 -0400
> Subject: [PATCH 1/1] restart debug: add final process tree status (v2)
>
> Have tasks in sys_restart keep some status in a list off
> of checkpoint_ctx, and print this info when the checkpoint_ctx
> is freed.
>
> This version is mainly just ported against ckpt-v18-hallyn.
>
> Sample output:
>
> [3519:2:c/r:free_per_task_status:207] 3 tasks registered, nr_tasks was 0 nr_total 0
> [3519:2:c/r:free_per_task_status:210] active pid was 1, ctx->errno 0
> [3519:2:c/r:free_per_task_status:212] kflags 6 uflags 0 oflags 1
> [3519:2:c/r:free_per_task_status:214] task 0 to run was 2
> [3519:2:c/r:free_per_task_status:217] pid 3517
> [3519:2:c/r:free_per_task_status:219] it was coordinator
> [3519:2:c/r:free_per_task_status:227] it was running
> [3519:2:c/r:free_per_task_status:217] pid 3519
> [3519:2:c/r:free_per_task_status:223] it was the root task
> [3519:2:c/r:free_per_task_status:229] it was a normal task
> [3519:2:c/r:free_per_task_status:217] pid 3520
> [3519:2:c/r:free_per_task_status:221] it was a ghost
>
> Signed-off-by: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Looks good.. I'll massage it a bit and add. Meanwhile, a
couple of questions:
[...]
> ---
> checkpoint/restart.c | 106 ++++++++++++++++++++++++++++++++++++++
> checkpoint/sys.c | 57 ++++++++++++++++++++
> include/linux/checkpoint_types.h | 20 +++++++
> 3 files changed, 183 insertions(+), 0 deletions(-)
>
> diff --git a/checkpoint/restart.c b/checkpoint/restart.c
> index b12c8bd..1f356c0 100644
> --- a/checkpoint/restart.c
> +++ b/checkpoint/restart.c
> @@ -26,6 +26,98 @@
> #include <linux/checkpoint.h>
> #include <linux/checkpoint_hdr.h>
>
> +#ifdef CONFIG_CHECKPOINT_DEBUG
> +static struct ckpt_task_status *ckpt_debug_checkin(struct ckpt_ctx *ctx)
> +{
> + struct ckpt_task_status *s;
> + s = kmalloc(sizeof(*s), GFP_KERNEL);
> + if (!s)
> + return NULL;
> + s->pid = current->pid;
> + s->error = 0;
> + s->flags = RESTART_DBG_WAITING;
> + if (current == ctx->root_task)
> + s->flags |= RESTART_DBG_ROOT;
> + list_add_tail(&s->list, &ctx->per_task_status);
> + return s;
> +}
The logic would be a bit simpler if you allow check-in to fail
(and then fail the restart) - you then don't need to test for
validity of @s everywhere.
> +
> +static struct ckpt_task_status *getme(struct ckpt_ctx *ctx)
> +{
> + struct ckpt_task_status *s = NULL;
> + list_for_each_entry(s, &ctx->per_task_status, list) {
> + if (s->pid == current->pid)
> + break;
> + }
> + if (!s || s->pid != current->pid)
> + return NULL;
Note that here @s is never NULL.
[...]
> @@ -680,11 +772,17 @@ static int do_ghost_task(void)
> if (IS_ERR(ctx))
> return PTR_ERR(ctx);
>
> + ckpt_debug_ghost(ctx);
> +
> + ckpt_debug_log_running(ctx);
> +
> current->flags |= PF_RESTARTING;
>
> ret = wait_event_interruptible(ctx->ghostq,
> all_tasks_activated(ctx) ||
> ckpt_test_ctx_error(ctx));
> +
> + ckpt_debug_log_error(ctx, 0);
Did you mean s/0/ret/ ?
[...]
> + list_for_each_entry_safe(s, p, &ctx->per_task_status, list) {
> + ckpt_debug("pid %d\n", s->pid);
> + if (s->flags & RESTART_DBG_COORD)
> + ckpt_debug("it was coordinator\n");
> + if (s->flags & RESTART_DBG_GHOST)
> + ckpt_debug("it was a ghost\n");
> + if (s->flags & RESTART_DBG_ROOT)
> + ckpt_debug("it was the root task\n");
> + if (s->flags & RESTART_DBG_WAITING)
> + ckpt_debug("it was still waiting to run restart\n");
> + if (s->flags & RESTART_DBG_RUNNING)
> + ckpt_debug("it was running\n");
> + if (s->flags & RESTART_DBG_NORMAL)
> + ckpt_debug("it was a normal task\n");
> + if (s->flags & RESTART_DBG_FAILED)
> + ckpt_debug("it finished with error %d\n", s->error);
> + if (s->flags & RESTART_DBG_FAILED)
s/FAILED/SUCCESS/ ... :p
[...]
Oren.
next prev parent reply other threads:[~2009-10-01 23:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-29 16:53 [PATCH 1/3] restart: make sure all tasks are in sys_restart Serge E. Hallyn
[not found] ` <20090929165342.GA10076-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-09-29 16:54 ` [PATCH 2/3] restart debug: add final process tree status Serge E. Hallyn
[not found] ` <20090929165402.GA10114-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-01 1:57 ` Oren Laadan
[not found] ` <4AC40CA0.8020305-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
2009-10-01 15:33 ` Serge E. Hallyn
[not found] ` <20091001153356.GA20565-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-01 23:29 ` Oren Laadan [this message]
2009-09-29 16:54 ` [PATCH 3/3] restart debug: splatter more ckpt_debugs about Serge E. Hallyn
[not found] ` <20090929165415.GB10114-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-01 1:54 ` Oren Laadan
2009-10-01 1:53 ` [PATCH 1/3] restart: make sure all tasks are in sys_restart Oren Laadan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AC53B6D.7000703@librato.com \
--to=orenl-rdfvbdnroixbdgjk7y7tuq@public.gmane.org \
--cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
--cc=serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox