[RFC v4][PATCH 3/9] x86 support for checkpoint/restart

Oren Laadan orenl at cs.columbia.edu
Tue Sep 9 16:23:19 PDT 2008



Ingo Molnar wrote:
> * Oren Laadan <orenl at cs.columbia.edu> wrote:
> 
>> +	/* for checkpoint in process context (from within a container)
>> +	   the GS and FS registers should be saved from the hardware;
>> +	   otherwise they are already sabed on the thread structure */
> 
> please use the correct comment style consistently throughout your 
> patches. The correct one is like this one:
> 
>> +	/*
>> +	 * for checkpoint in process context (from within a container),
>> +	 * the actual syscall is taking place at this very moment; so
>> +	 * we (optimistically) subtitute the future return value (0) of
>> +	 * this syscall into the orig_eax, so that upon restart it will
>> +	 * succeed (or it will endlessly retry checkpoint...)
>> +	 */
> 
> incorrect/inconsistent ones are like these:
> 
>> +		/* normally, no need to unlazy_fpu(), since TS_USEDFPU flag
>> +		 * have been cleared when task was conexted-switched out...
>> +		 * except if we are in process context, in which case we do */
> 
>> +		/* restore TLS by hand: why convert to struct user_desc if
>> +		 * sys_set_thread_entry() will convert it back ? */
> 
>> +			/* FIX: add sanity checks (eg. that values makes
>> +			 * sense, that we don't overwrite old values, etc */
> 
> (and there's many more examples throughout the series)
> 
>> +int cr_read_cpu_debug(struct cr_hdr_cpu *hh, struct task_struct *t)
>> +{
>> +	/* debug regs */
>> +
>> +	preempt_disable();
>> +
>> +	if (hh->uses_debug) {
>> +		set_debugreg(hh->debugreg0, 0);
>> +		set_debugreg(hh->debugreg1, 1);
>> +		/* ignore 4, 5 */
>> +		set_debugreg(hh->debugreg2, 2);
>> +		set_debugreg(hh->debugreg3, 3);
>> +		set_debugreg(hh->debugreg6, 6);
>> +		set_debugreg(hh->debugreg7, 7);
>> +	}
>> +
>> +	preempt_enable();
>> +
>> +	return 0;
>> +}
> 
> hm, the preemption disabling seems pointless here. What does it protect 
> against?

This is leftover from recovering; will clean up.

> 
>> +++ b/checkpoint/ckpt_arch.h
>> @@ -0,0 +1,7 @@
>> +#include <linux/ckpt.h>
>> +
>> +int cr_write_thread(struct cr_ctx *ctx, struct task_struct *t);
>> +int cr_write_cpu(struct cr_ctx *ctx, struct task_struct *t);
>> +
>> +int cr_read_thread(struct cr_ctx *ctx);
>> +int cr_read_cpu(struct cr_ctx *ctx);
> 
> please add 'extern' to prototypes in include files.
> 
>> @@ -15,6 +15,8 @@
>>  #include <linux/ckpt.h>
>>  #include <linux/ckpt_hdr.h>
>>  
>> +#include "ckpt_arch.h"
>> +
> 
> plsdntuseannyngabbrvtsngnrcd. [1]
> 
> "checkpoint_" should be just fine in most cases.
> 
> 	Ingo
> 
> [1] (please dont use annoying abbreviations in generic code)

:)

Oren.


More information about the Containers mailing list