OpenVZ Forum - RDF feed
type: channel
items: [RFC PATCH v8 0/5] IPC: checkpoint/restore in userspace enhancements
items: [PATCH v8 5/5] test: IPC message queue copy feture test
items: Re: [RFC PATCH v8 0/5] IPC: checkpoint/restore in userspace enhancements

[RFC PATCH v8 0/5] IPC: checkpoint/restore in userspace enhancements
type: item
description: v8: This respin of the patch set was significantly reworked. Most part of new API was replaced by sysctls (by one per messages, semaphores and shared memory), allowing to preset desired id for next new IPC object. This patch set is aimed to provide additional functionality for all IPC objects, which is required for migration of these objects by user-space checkpoint/restore utils (CRIU). The main problem here was impossibility to set up object id. This patch set solves the problem by adding new sysctls for preset of desired id for new IPC object. Another problem was to peek messages from queues without deleting them. This was achived by introducing of new MSG_COPY flag for sys_msgrcv(). If MSG_COPY flag is set, then msgtyp is interpreted as message number. The following series implements... --- Stanislav Kinsbursky (5): ipc: remove forced assignment of selected message ipc: add sysctl to specify desired next object id ipc: message queue receive cleanup ipc: message queue copy feature introduced test: IPC message queue copy feture test include/linux/ipc_namespace.h | 1 include/linux/msg.h | 5 - include/uapi/linux/msg.h | 1 ipc/compat.c | 45 +++---- ipc/ipc_sysctl.c | 28 ++++ ipc/msg.c | 99 +++++++++++---- ipc/msgutil.c | 38 ++++++ ipc/util.c | 16 ++ ipc/util.h | 2 tools/testing/selftests/ipc/Makefile | 25 ++++ tools/testing/selftests/ipc/msgque.c | 231 ++++++++++++++++++++++++++++++++++ 11 files changed, 432 insertions(+), 59 deletions(-) create mode 100644 tools/testing/selftests/ipc/Makefile create mode 100644 tools/testing/selftests/ipc/msgque.c
creator: Stanislav Kinsbursky
date: 2012-10-24T15:34:51-00:00

[PATCH v8 5/5] test: IPC message queue copy feture test
type: item
description: This test can be used to check wheither kernel supports IPC message queue copy and restore features (required by CRIU project). Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> --- tools/testing/selftests/ipc/Makefile | 25 ++++ tools/testing/selftests/ipc/msgque.c | 231 ++++++++++++++++++++++++++++++++++ 2 files changed, 256 insertions(+), 0 deletions(-) create mode 100644 tools/testing/selftests/ipc/Makefile create mode 100644 tools/testing/selftests/ipc/msgque.c diff --git a/tools/testing/selftests/ipc/Makefile b/tools/testing/selftests/ipc/Makefile new file mode 100644 index 0000000..5386fd7 --- /dev/null +++ b/tools/testing/selftests/ipc/Makefile @@ -0,0 +1,25 @@ +uname_M := $(shell uname -m 2>/dev/null || echo not) +ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/) +ifeq ($(ARCH),i386) + ARCH := X86 + CFLAGS := -DCONFIG_X86_32 -D__i386__ +endif +ifeq ($(ARCH),x86_64) + ARCH := X86 + CFLAGS := -DCONFIG_X86_64 -D__x86_64__ +endif + +CFLAGS += -I../../../../usr/include/ + +all: +ifeq ($(ARCH),X86) + gcc $(CFLAGS) msgque.c -o msgque_test +else + echo "Not an x86 target, can't build msgque selftest" +endif + +run_tests: all + ./msgque_test + +clean: + rm -fr ./msgque_test diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c new file mode 100644 index 0000000..e2d6a64 --- /dev/null +++ b/tools/testing/selftests/ipc/msgque.c @@ -0,0 +1,231 @@ +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <linux/msg.h> + +#define MAX_MSG_SIZE 32 + +struct msg1 { + int msize; + long mtype; + char mtext[MAX_MSG_SIZE]; +}; + +#define TEST_STRING "Test sysv5 msg" +#define MSG_TYPE 1 + +#define ANOTHER_TEST_STRING "Yet another test sysv5 msg" +#define ANOTHER_MSG_TYPE 26538 + +struct msgque_data { + int msq_id; + int qbytes; + int kern_id; + int qnum; + int mode; + struct msg1 *messages; +}; + +int restore_queue(struct msgque_data *msgque) +{ + struct msqid_ds ds; + int id, i; + + id = msgg…
creator: Stanislav Kinsbursky
date: 2012-10-24T15:35:25-00:00

Re: [RFC PATCH v8 0/5] IPC: checkpoint/restore in userspace enhancements
type: item
description: On Wed, 24 Oct 2012 19:34:51 +0400 Stanislav Kinsbursky <skinsbursky@parallels.com> wrote: > This respin of the patch set was significantly reworked. Most part of new API > was replaced by sysctls (by one per messages, semaphores and shared memory), > allowing to preset desired id for next new IPC object. > > This patch set is aimed to provide additional functionality for all IPC > objects, which is required for migration of these objects by user-space > checkpoint/restore utils (CRIU). > > The main problem here was impossibility to set up object id. This patch set > solves the problem by adding new sysctls for preset of desired id for new IPC > object. > > Another problem was to peek messages from queues without deleting them. > This was achived by introducing of new MSG_COPY flag for sys_msgrcv(). If > MSG_COPY flag is set, then msgtyp is interpreted as message number. OK, thanks, I grabbed these. They're not the worst c/r patches I've ever seen ;) I'm not seeing any evidence that anyone else has reviewed or tested these?
creator: akpm
date: 2012-10-24T21:42:30-00:00