OpenVZ Forum - RDF feed
type: channel
items: [PATCH 0/2][cryo] Save/restore pipe state
items: [PATCH 1/2][cryo] Save/restore state of unnamed pipes
items: [PATCH 2/2] Support Non-consecutive and dup pipe fds
items: Re: [PATCH 1/2][cryo] Save/restore state of unnamed pipes

[PATCH 0/2][cryo] Save/restore pipe state
type: item
description: [PATCH 1/2] Save/restore state of unnamed pipes Basic infrastructure to save/restore pipe state with assumptions about order of fds. [PATCH 2/2] Support Non-consecutive and dup pipe fds Remove above assumptions about order of fds and support dups of pipe fds. _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: Sukadev Bhattiprolu
date: 2008-06-24T03:23:43-00:00

[PATCH 1/2][cryo] Save/restore state of unnamed pipes
type: item
description: >From e513f8bc0fe808425264ad01210ac610f6453047 Mon Sep 17 00:00:00 2001 From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> Date: Mon, 16 Jun 2008 18:41:05 -0700 Subject: [PATCH] Save/restore state of unnamed pipes Design: Current Linux kernels provide ability to read/write contents of FIFOs using /proc. i.e 'cat /proc/pid/fd/read-side-fd' prints the unread data in the FIFO. Similarly, 'cat foo > /proc/pid/fd/read-sid-fd' appends the contents of 'foo' to the unread contents of the FIFO. So to save/restore the state of the pipe, a simple implementation is to read the from the unnamed pipe's fd and save to the checkpoint-file. When restoring, create a pipe (using PT_PIPE()) in the child process, read the contents of the pipe from the checkpoint file and write it to the newly created pipe. Its fairly straightforward, except for couple of notes: - when we read contents of '/proc/pid/fd/read-side-fd' we drain the pipe such that when the checkpointed application resumes, it will not find any data. To fix this, we read from the 'read-side-fd' and write it back to the 'read-side-fd' in addition to writing to the checkpoint file. - there does not seem to be a mechanism to determine the count of unread bytes in the file. Current implmentation assumes a maximum of 64K bytes (PIPE_BUFS * PAGE_SIZE on i386) and fails if the pipe is not fully drained. Changelog:[v1]: - [Serge Hallyn]: use || instead of && in ensure_fifo_has_drained - [Serge Hallyn, Matt Helsley]: Use dup2() to restore fds and remove assumptions about order of read and write fds (addressed in PATCH 2/2). Some unit-testing done at this point (using tests/pipe.c). TODO: - Additional testing (with multiple-processes and multiple-pipes) - Named-pipes --- cr.c | 217 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 205 insertions(+), 12 deletions(-) diff --git a/cr.c b/cr.c index c7e3332..716cc86 100644 --- a/cr.c +++ b/cr.c @@ -88,6 +88,11 @@ typedef struct fdinfo_t { char name[128…
creator: Sukadev Bhattiprolu
date: 2008-06-24T03:25:36-00:00

[PATCH 2/2] Support Non-consecutive and dup pipe fds
type: item
description: >From a80c5215763f757840214465277e911e46e01219 Mon Sep 17 00:00:00 2001 From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> Date: Mon, 23 Jun 2008 20:13:57 -0700 Subject: [PATCH] Support Non-consecutive and dup pipe fds PATCH 1/1 provides basic infrastructure to save/restore state of pipes. This patch removes assumptions about order of the pipe-fds and also supports existence of 'dups' of pipe-fds. This logic has been separated from PATCH 1/1 for easier review and the two patches could be combined into a single one. Thanks to Matt Helsley for the optimized logic/code in match_pipe_ends(). TODO: There are few TODO's marked out in the patch. Hopefully these can be addressed without significant impact to the central-logic of saving/restoring pipes. - Temporarily using a regular-file's fd as 'trampoline-fd' when all fds are in use - Maybe read all fdinfo into memory during restart, so we can reduce the information we save into the checkpoint-file (see comments near 'struct fdinfo'). - Check logic of detecting 'dup's of pipe fds (any hidden gotchas ?) See pair_pipe_fds() - Alloc ppi_list[] dynamically (see getfdinfo()). - Use getrlimit() to compute max-open-fds (see near caller of pair_pipe_fds()). - [Oleg Nesterov]: SIGIO/inotify() issues associated with writing-back to pipes (fixing this would require some assitance from kernel ?) Ran several unit-test cases (see test-patches). Additional cases to be developed/executed. Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com> --- cr.c | 262 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 240 insertions(+), 22 deletions(-) diff --git a/cr.c b/cr.c index 716cc86..f40a4fb 100644 --- a/cr.c +++ b/cr.c @@ -79,8 +79,25 @@ typedef struct isockinfo_t { char tcpstate[TPI_LEN]; } isockinfo_t; +/* + * TODO: restore_fd() processes each fd as it reads it of the checkpoint + * file. To avoid making a second-pass at the file, we store following + * fields during checkpoint (for now). + * + * peer…
creator: Sukadev Bhattiprolu
date: 2008-06-24T03:26:20-00:00

Re: [PATCH 1/2][cryo] Save/restore state of unnamed pipes
type: item
description: | + } else | + ERROR("Unexpected item, '%s'\n", item); | + } | + DEBUG("restore_fifo() fd %d, len %d, got 'END FIFO'\n", | + fifofdinfo->fi_fd, fifofdinfo->fi_length); | + return 0; | +} fifofdinfo can be NULL if application does not have any fifos and the above DEBUG() will SIGSEGV. Following updated patch fixes this. Thanks Serge for reporting the bug. --- >From bdb9d8f20abd412a46a4e3951ed084ca5690e7d2 Mon Sep 17 00:00:00 2001 From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> Date: Mon, 16 Jun 2008 18:41:05 -0700 Subject: [PATCH] Save/restore state of unnamed pipes Design: Current Linux kernels provide ability to read/write contents of FIFOs using /proc. i.e 'cat /proc/pid/fd/read-side-fd' prints the unread data in the FIFO. Similarly, 'cat foo > /proc/pid/fd/read-sid-fd' appends the contents of 'foo' to the unread contents of the FIFO. So to save/restore the state of the pipe, a simple implementation is to read the from the unnamed pipe's fd and save to the checkpoint-file. When restoring, create a pipe (using PT_PIPE()) in the child process, read the contents of the pipe from the checkpoint file and write it to the newly created pipe. Its fairly straightforward, except for couple of notes: - when we read contents of '/proc/pid/fd/read-side-fd' we drain the pipe such that when the checkpointed application resumes, it will not find any data. To fix this, we read from the 'read-side-fd' and write it back to the 'read-side-fd' in addition to writing to the checkpoint file. - there does not seem to be a mechanism to determine the count of unread bytes in the file. Current implmentation assumes a maximum of 64K bytes (PIPE_BUFS * PAGE_SIZE on i386) and fails if the pipe is not fully drained. Changelog:[v1]: - [Serge Hallyn]: use || instead of && in ensure_fifo_has_drained - [Serge Hallyn, Matt Helsley]: Use dup2() to restore fds and remove assumptions about order of read and write fds (addressed in PATCH 2/2). Basic unit-testing done at this point (using tests/pi…
creator: Sukadev Bhattiprolu
date: 2008-06-24T16:15:31-00:00

Re: [PATCH 1/2][cryo] Save/restore state of unnamed pipes
type: item
description: Quoting sukadev@us.ibm.com (sukadev@us.ibm.com): > | + } else > | + ERROR("Unexpected item, '%s'\n", item); > | + } > | + DEBUG("restore_fifo() fd %d, len %d, got 'END FIFO'\n", > | + fifofdinfo->fi_fd, fifofdinfo->fi_length); > | + return 0; > | +} > > fifofdinfo can be NULL if application does not have any fifos and > the above DEBUG() will SIGSEGV. Following updated patch fixes this. > Thanks Serge for reporting the bug. Thanks, Suka. This version works for both pipe and sleep testcases. Though, interestingly, it segfaults on the -lxc kernel. It succeeds on a recent -git from Linus' tree, though. So I'm about to apply these on git://git.sr71.net/~hallyn/cryodev.git thanks, -serge > >From bdb9d8f20abd412a46a4e3951ed084ca5690e7d2 Mon Sep 17 00:00:00 2001 > From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> > Date: Mon, 16 Jun 2008 18:41:05 -0700 > Subject: [PATCH] Save/restore state of unnamed pipes > > Design: > > Current Linux kernels provide ability to read/write contents of FIFOs > using /proc. i.e 'cat /proc/pid/fd/read-side-fd' prints the unread data > in the FIFO. Similarly, 'cat foo > /proc/pid/fd/read-sid-fd' appends > the contents of 'foo' to the unread contents of the FIFO. > > So to save/restore the state of the pipe, a simple implementation is > to read the from the unnamed pipe's fd and save to the checkpoint-file. > When restoring, create a pipe (using PT_PIPE()) in the child process, > read the contents of the pipe from the checkpoint file and write it to > the newly created pipe. > > Its fairly straightforward, except for couple of notes: > > - when we read contents of '/proc/pid/fd/read-side-fd' we drain > the pipe such that when the checkpointed application resumes, > it will not find any data. To fix this, we read from the > 'read-side-fd' and write it back to the 'read-side-fd' in > addition to writing to the checkpoint file. > > - there does not seem to be a mechanism to determine the count > of unread bytes in the file. Current implmentat…
creator: serue
date: 2008-06-24T17:38:04-00:00

Re: [PATCH 1/2][cryo] Save/restore state of unnamed pipes
type: item
description: Serge E. Hallyn [serue@us.ibm.com] wrote: | Quoting sukadev@us.ibm.com (sukadev@us.ibm.com): | > | + } else | > | + ERROR("Unexpected item, '%s'\n", item); | > | + } | > | + DEBUG("restore_fifo() fd %d, len %d, got 'END FIFO'\n", | > | + fifofdinfo->fi_fd, fifofdinfo->fi_length); | > | + return 0; | > | +} | > | > fifofdinfo can be NULL if application does not have any fifos and | > the above DEBUG() will SIGSEGV. Following updated patch fixes this. | > Thanks Serge for reporting the bug. | | Thanks, Suka. This version works for both pipe and sleep testcases. | | Though, interestingly, it segfaults on the -lxc kernel. It succeeds on | a recent -git from Linus' tree, though. I have been testing 2.6.25-mm1. I run into the semun_undo underflow bug with -lxc. Is that the same bug you are running into ? | | So I'm about to apply these on git://git.sr71.net/~hallyn/cryodev.git | Thanks, Suka _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: Sukadev Bhattiprolu
date: 2008-06-24T17:58:53-00:00

Re: [PATCH 1/2][cryo] Save/restore state of unnamed pipes
type: item
description: Quoting sukadev@us.ibm.com (sukadev@us.ibm.com): > Serge E. Hallyn [serue@us.ibm.com] wrote: > | Quoting sukadev@us.ibm.com (sukadev@us.ibm.com): > | > | + } else > | > | + ERROR("Unexpected item, '%s'\n", item); > | > | + } > | > | + DEBUG("restore_fifo() fd %d, len %d, got 'END FIFO'\n", > | > | + fifofdinfo->fi_fd, fifofdinfo->fi_length); > | > | + return 0; > | > | +} > | > > | > fifofdinfo can be NULL if application does not have any fifos and > | > the above DEBUG() will SIGSEGV. Following updated patch fixes this. > | > Thanks Serge for reporting the bug. > | > | Thanks, Suka. This version works for both pipe and sleep testcases. > | > | Though, interestingly, it segfaults on the -lxc kernel. It succeeds on > | a recent -git from Linus' tree, though. > > I have been testing 2.6.25-mm1. > > I run into the semun_undo underflow bug with -lxc. Is that the same > bug you are running into ? I'm not sure... Not looking into it too deeply. Hopefully Kathy is coming out with a new -lxc in the next few days, and if it still causes me problems then I'll really look into it. -serge _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: serue
date: 2008-06-24T19:36:59-00:00