All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue@us.ibm.com>
To: Christoffer Dall <christofferdall@christofferdall.dk>
Cc: containers <containers@lists.linux-foundation.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	rmk@arm.linux.org.uk
Subject: Re: [C/R ARM][PATCH 3/3] c/r: ARM implementation of checkpoint/restart
Date: Tue, 23 Mar 2010 11:09:33 -0500	[thread overview]
Message-ID: <20100323160933.GA4465@us.ibm.com> (raw)
In-Reply-To: <1269219965-23923-4-git-send-email-christofferdall@christofferdall.dk>

Quoting Christoffer Dall (christofferdall@christofferdall.dk):
> Implements architecture specific requirements for checkpoint/restart on
> ARM. The changes touch almost only c/r related code. Most of the work is
> done in arch/arm/checkpoint.c, which implements checkpointing of the CPU
> and necessary fields on the thread_info struct.
> 
> The ISA version (given by __LINUX_ARM_ARCH__) is checkpointed and verified
> against the machine architecture on restart. If they differ, an error is
> raised and restart aborted. It should be possible to restart on newer
> architectures, but further investigation is warranted.
> 
> Regarding ThumbEE, the thumbee_state field on the thread_info is stored
> in checkpoints when CONFIG_ARM_THUMBEE and 0 is stored otherwise. If
> a value different than 0 is checkpointed and CONFIG_ARM_THUMBEE is not
> set on the restore system, the restore is aborted. Feedback on this
> implementation is very welcome.
> 
> We checkpoint whether the system is running with CONFIG_MMU or not and
> require the same configuration for the system on which we restore the
> process. It might be possible to allow something more fine-grained,
> if it's worth the energy. Input on this item is also very welcome,
> specifically from someone who knows the exact meaning of the end_brk
> field.
> 
> Added support for syscall sys_checkpoint and sys_restart for ARM:
> __NR_checkpoint         367
> __NR_restart            368
> 
> 
> Cc: rmk@arm.linux.org.uk
> Signed-off-by: Christoffer Dall <christofferdall@christofferdall.dk>
> Acked-by: Oren Laadan <orenl@cs.columbia.edu>

In terms of the cr api I don't see any problems.  Two nits below,
but in any case

Acked-by: Serge Hallyn <serue@us.ibm.com>

thanks, this is really cool, especially how minimal it is :)
-serge

...

> +static int load_cpu_regs(struct ckpt_hdr_cpu *h, struct task_struct *t)
> +{
> +	int i;
> +	struct pt_regs *regs = task_pt_regs(t);
> +
> +	memcpy(regs, &h->uregs, sizeof(struct pt_regs));
> +
> +	for (i = 0; i < 16; i++)
> +		regs->uregs[i] = h->uregs[i];
> +
> +	/*
> +	 * Restore only user-writable bits on the CPSR
> +	 */
> +	regs->ARM_cpsr = regs->ARM_cpsr |
> +			 (h->ARM_cpsr & (PSR_N_BIT | PSR_Z_BIT |
> +					 PSR_C_BIT | PSR_V_BIT |
> +					 PSR_V_BIT | PSR_Q_BIT |
> +					 PSR_E_BIT | PSR_GE_BITS));
> +	regs->ARM_ORIG_r0 = h->ARM_ORIG_r0;
> +
> +	return 0;
> +}
> +
> +/* read the cpu state and registers for the current task */
> +int restore_cpu(struct ckpt_ctx *ctx)
> +{
> +	struct ckpt_hdr_cpu *h;
> +	struct task_struct *t = current;
> +	int ret;
> +
> +	h = ckpt_read_obj_type(ctx, sizeof(*h), CKPT_HDR_CPU);
> +	if (IS_ERR(h))
> +		return PTR_ERR(h);
> +
> +	ret = load_cpu_regs(h, t);

will load_cpu_regs() ever be changed to return anything but 0?  If
not both fns can be simplified.

...

> +int restore_mm_context(struct ckpt_ctx *ctx, struct mm_struct *mm)
> +{
> +	struct ckpt_hdr_mm_context *h;
> +	int ret = 0;
> +
> +	h = ckpt_read_obj_type(ctx, sizeof(*h), CKPT_HDR_MM_CONTEXT);
> +	if (IS_ERR(h))
> +		return PTR_ERR(h);
> +
> +#if !CONFIG_MMU
> +	mm->context.end_brk = h->end_brk;
> +#endif
> +
> +	ckpt_hdr_put(ctx, h);
> +	return ret;

Again ret doesn't seem needed here.

-serge

WARNING: multiple messages have this Message-ID (diff)
From: serue@us.ibm.com (Serge E. Hallyn)
To: linux-arm-kernel@lists.infradead.org
Subject: [C/R ARM][PATCH 3/3] c/r: ARM implementation of checkpoint/restart
Date: Tue, 23 Mar 2010 11:09:33 -0500	[thread overview]
Message-ID: <20100323160933.GA4465@us.ibm.com> (raw)
In-Reply-To: <1269219965-23923-4-git-send-email-christofferdall@christofferdall.dk>

Quoting Christoffer Dall (christofferdall at christofferdall.dk):
> Implements architecture specific requirements for checkpoint/restart on
> ARM. The changes touch almost only c/r related code. Most of the work is
> done in arch/arm/checkpoint.c, which implements checkpointing of the CPU
> and necessary fields on the thread_info struct.
> 
> The ISA version (given by __LINUX_ARM_ARCH__) is checkpointed and verified
> against the machine architecture on restart. If they differ, an error is
> raised and restart aborted. It should be possible to restart on newer
> architectures, but further investigation is warranted.
> 
> Regarding ThumbEE, the thumbee_state field on the thread_info is stored
> in checkpoints when CONFIG_ARM_THUMBEE and 0 is stored otherwise. If
> a value different than 0 is checkpointed and CONFIG_ARM_THUMBEE is not
> set on the restore system, the restore is aborted. Feedback on this
> implementation is very welcome.
> 
> We checkpoint whether the system is running with CONFIG_MMU or not and
> require the same configuration for the system on which we restore the
> process. It might be possible to allow something more fine-grained,
> if it's worth the energy. Input on this item is also very welcome,
> specifically from someone who knows the exact meaning of the end_brk
> field.
> 
> Added support for syscall sys_checkpoint and sys_restart for ARM:
> __NR_checkpoint         367
> __NR_restart            368
> 
> 
> Cc: rmk at arm.linux.org.uk
> Signed-off-by: Christoffer Dall <christofferdall@christofferdall.dk>
> Acked-by: Oren Laadan <orenl@cs.columbia.edu>

In terms of the cr api I don't see any problems.  Two nits below,
but in any case

Acked-by: Serge Hallyn <serue@us.ibm.com>

thanks, this is really cool, especially how minimal it is :)
-serge

...

> +static int load_cpu_regs(struct ckpt_hdr_cpu *h, struct task_struct *t)
> +{
> +	int i;
> +	struct pt_regs *regs = task_pt_regs(t);
> +
> +	memcpy(regs, &h->uregs, sizeof(struct pt_regs));
> +
> +	for (i = 0; i < 16; i++)
> +		regs->uregs[i] = h->uregs[i];
> +
> +	/*
> +	 * Restore only user-writable bits on the CPSR
> +	 */
> +	regs->ARM_cpsr = regs->ARM_cpsr |
> +			 (h->ARM_cpsr & (PSR_N_BIT | PSR_Z_BIT |
> +					 PSR_C_BIT | PSR_V_BIT |
> +					 PSR_V_BIT | PSR_Q_BIT |
> +					 PSR_E_BIT | PSR_GE_BITS));
> +	regs->ARM_ORIG_r0 = h->ARM_ORIG_r0;
> +
> +	return 0;
> +}
> +
> +/* read the cpu state and registers for the current task */
> +int restore_cpu(struct ckpt_ctx *ctx)
> +{
> +	struct ckpt_hdr_cpu *h;
> +	struct task_struct *t = current;
> +	int ret;
> +
> +	h = ckpt_read_obj_type(ctx, sizeof(*h), CKPT_HDR_CPU);
> +	if (IS_ERR(h))
> +		return PTR_ERR(h);
> +
> +	ret = load_cpu_regs(h, t);

will load_cpu_regs() ever be changed to return anything but 0?  If
not both fns can be simplified.

...

> +int restore_mm_context(struct ckpt_ctx *ctx, struct mm_struct *mm)
> +{
> +	struct ckpt_hdr_mm_context *h;
> +	int ret = 0;
> +
> +	h = ckpt_read_obj_type(ctx, sizeof(*h), CKPT_HDR_MM_CONTEXT);
> +	if (IS_ERR(h))
> +		return PTR_ERR(h);
> +
> +#if !CONFIG_MMU
> +	mm->context.end_brk = h->end_brk;
> +#endif
> +
> +	ckpt_hdr_put(ctx, h);
> +	return ret;

Again ret doesn't seem needed here.

-serge

  reply	other threads:[~2010-03-23 16:09 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-22  1:06 [C/R ARM][PATCH 0/3] Linux Checkpoint-Restart - ARM port Christoffer Dall
2010-03-22  1:06 ` Christoffer Dall
2010-03-22  1:06 ` [C/R ARM][PATCH 1/3] ARM: Rudimentary syscall interfaces Christoffer Dall
2010-03-22  1:06   ` Christoffer Dall
     [not found]   ` <1269219965-23923-2-git-send-email-christofferdall-77OGu6e99YhyO3AAkE1OcX9LOBIZ5rWg@public.gmane.org>
2010-03-23 20:53     ` Russell King - ARM Linux
2010-03-23 20:53   ` Russell King - ARM Linux
2010-03-23 20:53     ` Russell King - ARM Linux
     [not found]     ` <20100323205342.GA19572-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2010-03-24  2:03       ` Matt Helsley
2010-03-24  2:03     ` Matt Helsley
2010-03-24  2:03       ` Matt Helsley
     [not found]       ` <20100324020342.GB5704-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2010-03-24  4:57         ` Oren Laadan
2010-03-24  4:57           ` Oren Laadan
2010-03-24  4:57           ` Oren Laadan
     [not found]           ` <Pine.LNX.4.64.1003240055050.5867-CXF6herHY6ykSYb+qCZC/1i27PF6R63G9nwVQlTi/Pw@public.gmane.org>
2010-03-24 14:02             ` Matt Helsley
2010-03-24 14:02           ` Matt Helsley
2010-03-24 14:02             ` Matt Helsley
     [not found]             ` <20100324140252.GC5704-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2010-03-24 15:53               ` Oren Laadan
2010-03-24 15:53             ` Oren Laadan
2010-03-24 15:53               ` Oren Laadan
2010-03-24 19:36               ` Christoffer Dall
2010-03-24 19:36                 ` Christoffer Dall
2010-03-25  1:11                 ` Matt Helsley
2010-03-25  1:11                   ` Matt Helsley
2010-03-25  1:17                   ` Matt Helsley
2010-03-25  1:17                     ` Matt Helsley
     [not found]                     ` <20100325011753.GF5704-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2010-03-25 10:29                       ` Christoffer Dall
2010-03-25 10:29                     ` Christoffer Dall
2010-03-25 10:29                       ` Christoffer Dall
     [not found]                   ` <20100325011132.GE5704-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2010-03-25  1:17                     ` Matt Helsley
2010-03-25  1:35                     ` Oren Laadan
2010-03-25  1:35                   ` Oren Laadan
2010-03-25  1:35                     ` Oren Laadan
2010-03-25 10:34                     ` Christoffer Dall
2010-03-25 10:34                       ` Christoffer Dall
     [not found]                     ` <4BAABDF4.8070904-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2010-03-25 10:34                       ` Christoffer Dall
     [not found]                 ` <7d08b87d1003241236n2b45e6f4ife36da841351df9d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-03-25  1:11                   ` Matt Helsley
     [not found]               ` <4BAA3586.1020604-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2010-03-24 19:36                 ` Christoffer Dall
     [not found] ` <1269219965-23923-1-git-send-email-christofferdall-77OGu6e99YhyO3AAkE1OcX9LOBIZ5rWg@public.gmane.org>
2010-03-22  1:06   ` Christoffer Dall
2010-03-22  1:06   ` [C/R ARM][PATCH 2/3] ARM: Add the eclone system call Christoffer Dall
2010-03-22  1:06   ` [C/R ARM][PATCH 3/3] c/r: ARM implementation of checkpoint/restart Christoffer Dall
2010-03-22  1:06 ` [C/R ARM][PATCH 2/3] ARM: Add the eclone system call Christoffer Dall
2010-03-22  1:06   ` Christoffer Dall
     [not found]   ` <1269219965-23923-3-git-send-email-christofferdall-77OGu6e99YhyO3AAkE1OcX9LOBIZ5rWg@public.gmane.org>
2010-03-23 21:06     ` Russell King - ARM Linux
2010-03-23 21:06   ` Russell King - ARM Linux
2010-03-23 21:06     ` Russell King - ARM Linux
2010-03-24 18:19     ` Sukadev Bhattiprolu
2010-03-24 18:19       ` Sukadev Bhattiprolu
     [not found]     ` <20100323210616.GB19572-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2010-03-24 18:19       ` Sukadev Bhattiprolu
2010-03-24 19:42       ` Christoffer Dall
2010-03-24 19:42     ` Christoffer Dall
2010-03-24 19:42       ` Christoffer Dall
2010-03-22  1:06 ` [C/R ARM][PATCH 3/3] c/r: ARM implementation of checkpoint/restart Christoffer Dall
2010-03-22  1:06   ` Christoffer Dall
2010-03-23 16:09   ` Serge E. Hallyn [this message]
2010-03-23 16:09     ` Serge E. Hallyn
2010-03-24 19:46     ` Christoffer Dall
2010-03-24 19:46       ` Christoffer Dall
     [not found]     ` <20100323160933.GA4465-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-03-24 19:46       ` Christoffer Dall
2010-03-23 21:18   ` Russell King - ARM Linux
2010-03-23 21:18     ` Russell King - ARM Linux
     [not found]     ` <20100323211843.GC19572-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2010-03-24  1:53       ` Matt Helsley
2010-03-24 20:48       ` Christoffer Dall
2010-03-24  1:53     ` Matt Helsley
2010-03-24  1:53       ` Matt Helsley
2010-03-24 20:48     ` Christoffer Dall
2010-03-24 20:48       ` Christoffer Dall
     [not found]       ` <7d08b87d1003241348g347f092k1142318490e0bdcc-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-03-26  2:47         ` Jamie Lokier
2010-03-26  2:47       ` Jamie Lokier
2010-03-26  2:47         ` Jamie Lokier
     [not found]         ` <20100326024759.GN19308-yetKDKU6eevNLxjTenLetw@public.gmane.org>
2010-03-26  3:02           ` Paul Mundt
2010-03-26  3:02         ` Paul Mundt
2010-03-26  3:02           ` Paul Mundt
2010-03-26  3:55           ` Jamie Lokier
2010-03-26  3:55             ` Jamie Lokier
     [not found]           ` <20100326030208.GA5815-M7jkjyW5wf5g9hUCZPvPmw@public.gmane.org>
2010-03-26  3:55             ` Jamie Lokier
2010-03-28 22:55             ` Christoffer Dall
2010-03-28 22:55           ` Christoffer Dall
2010-03-28 22:55             ` Christoffer Dall
     [not found]   ` <1269219965-23923-4-git-send-email-christofferdall-77OGu6e99YhyO3AAkE1OcX9LOBIZ5rWg@public.gmane.org>
2010-03-23 16:09     ` Serge E. Hallyn
2010-03-23 21:18     ` Russell King - ARM Linux

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=20100323160933.GA4465@us.ibm.com \
    --to=serue@us.ibm.com \
    --cc=christofferdall@christofferdall.dk \
    --cc=containers@lists.linux-foundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk@arm.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.