[CRIU] [PATCH 1/4] dump: Rework thread parasite dumping procedure
Cyrill Gorcunov
gorcunov at openvz.org
Tue Oct 30 17:57:36 EDT 2012
- rename parasite_dump_tid_info to parasite_dump_thread_info,
we will extend this structure to keep not only tid related
data
- make parasite_dump_thread_seized to work with parasite_dump_thread_info
directly, since there is no need to copy shared memory to and from
- rename PARASITE_CMD_DUMP_TID_ADDR to PARASITE_CMD_DUMP_THREAD_INFO,
as it will be extended as well
- all this allows to simplify parasite_dump_thread_seized code
The code poking is mostly because we need to save at least blocked
signals mask at first, then the routine will be extended to handle
more thread specific data which is not yet even addressed.
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
cr-dump.c | 10 +++++-----
include/parasite-syscall.h | 4 ++--
include/parasite.h | 4 ++--
parasite-syscall.c | 15 +++++----------
parasite.c | 6 +++---
5 files changed, 17 insertions(+), 22 deletions(-)
diff --git a/cr-dump.c b/cr-dump.c
index 84609e0..5f89645 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -1303,9 +1303,9 @@ try_again:
static int dump_task_thread(struct parasite_ctl *parasite_ctl, struct pid *tid)
{
+ struct parasite_dump_thread_info *info;
CoreEntry *core;
int ret = -1, fd_core;
- unsigned int *taddr;
pid_t pid = tid->real;
pr_info("\n");
@@ -1324,14 +1324,14 @@ static int dump_task_thread(struct parasite_ctl *parasite_ctl, struct pid *tid)
if (ret)
goto err_free;
- ret = parasite_dump_thread_seized(parasite_ctl, pid, &taddr, &tid->virt);
+ ret = parasite_dump_thread_seized(parasite_ctl, pid, &info);
if (ret) {
- pr_err("Can't dump tid address for pid %d", pid);
+ pr_err("Can't dump thread info for pid %d", pid);
goto err_free;
}
- pr_info("%d: tid_address=%p\n", pid, taddr);
- core->thread_info->clear_tid_addr = (u64) taddr;
+ pr_info("%d: tid_address=%p\n", pid, info->tid_addr);
+ core->thread_info->clear_tid_addr = (u64)info->tid_addr;
ret = dump_sched_info(pid, core->thread_core);
if (ret)
diff --git a/include/parasite-syscall.h b/include/parasite-syscall.h
index bf9792e..e1329ba 100644
--- a/include/parasite-syscall.h
+++ b/include/parasite-syscall.h
@@ -34,9 +34,9 @@ extern int parasite_dump_creds(struct parasite_ctl *ctl, CredsEntry *ce);
extern int parasite_dump_pages_seized(struct parasite_ctl *ctl,
struct list_head *vma_area_list,
struct cr_fdset *cr_fdset);
-struct parasite_dump_tid_info;
+struct parasite_dump_thread_info;
extern int parasite_dump_thread_seized(struct parasite_ctl *ctl, pid_t pid,
- unsigned int **tid_add, pid_t *tid);
+ struct parasite_dump_thread_info **info);
struct parasite_drain_fd;
struct fd_opts;
diff --git a/include/parasite.h b/include/parasite.h
index 29b5f63..3704522 100644
--- a/include/parasite.h
+++ b/include/parasite.h
@@ -30,7 +30,7 @@ enum {
PARASITE_CMD_DUMP_ITIMERS,
PARASITE_CMD_DUMP_MISC,
PARASITE_CMD_DUMP_CREDS,
- PARASITE_CMD_DUMP_TID_ADDR,
+ PARASITE_CMD_DUMP_THREAD_INFO,
PARASITE_CMD_DRAIN_FDS,
PARASITE_CMD_GET_PROC_FD,
PARASITE_CMD_DUMP_TTY,
@@ -89,7 +89,7 @@ struct parasite_dump_creds {
unsigned int groups[PARASITE_MAX_GROUPS];
};
-struct parasite_dump_tid_info {
+struct parasite_dump_thread_info {
unsigned int *tid_addr;
int tid;
};
diff --git a/parasite-syscall.c b/parasite-syscall.c
index e54a655..3070cbf 100644
--- a/parasite-syscall.c
+++ b/parasite-syscall.c
@@ -416,19 +416,14 @@ err:
}
int parasite_dump_thread_seized(struct parasite_ctl *ctl, pid_t pid,
- unsigned int **tid_addr, pid_t *tid)
+ struct parasite_dump_thread_info **info)
{
- struct parasite_dump_tid_info *args;
- int ret;
-
- args = parasite_args(ctl, struct parasite_dump_tid_info);
+ struct parasite_dump_thread_info *args;
- ret = parasite_execute_by_pid(PARASITE_CMD_DUMP_TID_ADDR, ctl, pid);
+ args = parasite_args(ctl, struct parasite_dump_thread_info);
+ *info = args;
- *tid_addr = args->tid_addr;
- *tid = args->tid;
-
- return ret;
+ return parasite_execute_by_pid(PARASITE_CMD_DUMP_THREAD_INFO, ctl, pid);
}
int parasite_dump_sigacts_seized(struct parasite_ctl *ctl, struct cr_fdset *cr_fdset)
diff --git a/parasite.c b/parasite.c
index 579e8d2..adf8374 100644
--- a/parasite.c
+++ b/parasite.c
@@ -348,7 +348,7 @@ grps_err:
return -1;
}
-static int dump_tid_info(struct parasite_dump_tid_info *args)
+static int dump_thread_info(struct parasite_dump_thread_info *args)
{
int ret;
@@ -574,8 +574,8 @@ int __used parasite_service(unsigned int cmd, void *args)
return dump_misc((struct parasite_dump_misc *)args);
case PARASITE_CMD_DUMP_CREDS:
return dump_creds((struct parasite_dump_creds *)args);
- case PARASITE_CMD_DUMP_TID_ADDR:
- return dump_tid_info((struct parasite_dump_tid_info *)args);
+ case PARASITE_CMD_DUMP_THREAD_INFO:
+ return dump_thread_info((struct parasite_dump_thread_info *)args);
case PARASITE_CMD_DRAIN_FDS:
return drain_fds((struct parasite_drain_fd *)args);
case PARASITE_CMD_GET_PROC_FD:
--
1.7.7.6
More information about the CRIU
mailing list