Commit 5b7e3b8d authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

dump: Checkpoint per-thread blocked signals

I've moved dump_thread helper a bit lower in file
since I've to call for find_thread_state helper.
After all this groups all thread related functions
in one slab.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent f107e8e9
......@@ -1327,11 +1327,13 @@ 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, &taddr,
&tid->virt, &core->thread_core->blk_sigset);
if (ret) {
pr_err("Can't dump tid address for pid %d", pid);
goto err_free;
}
core->thread_core->has_blk_sigset = true;
pr_info("%d: tid_address=%p\n", pid, taddr);
core->thread_info->clear_tid_addr = (u64) taddr;
......
......@@ -36,7 +36,8 @@ extern int parasite_dump_pages_seized(struct parasite_ctl *ctl,
struct cr_fdset *cr_fdset);
struct parasite_dump_thread;
extern int parasite_dump_thread_seized(struct parasite_ctl *ctl, pid_t pid,
unsigned int **tid_add, pid_t *tid);
unsigned int **tid_add, pid_t *tid,
void *blocked);
struct parasite_drain_fd;
struct fd_opts;
......
......@@ -96,6 +96,7 @@ struct parasite_dump_creds {
struct parasite_dump_thread {
unsigned int *tid_addr;
pid_t tid;
k_rtsigset_t blocked;
};
#define PARASITE_MAX_FDS (PAGE_SIZE / sizeof(int))
......
......@@ -417,7 +417,8 @@ err:
}
int parasite_dump_thread_seized(struct parasite_ctl *ctl, pid_t pid,
unsigned int **tid_addr, pid_t *tid)
unsigned int **tid_addr, pid_t *tid,
void *blocked)
{
struct parasite_dump_thread *args;
int ret;
......@@ -426,6 +427,7 @@ int parasite_dump_thread_seized(struct parasite_ctl *ctl, pid_t pid,
ret = parasite_execute_by_pid(PARASITE_CMD_DUMP_THREAD, ctl, pid);
memcpy(blocked, &args->blocked, sizeof(args->blocked));
*tid_addr = args->tid_addr;
*tid = args->tid;
......
......@@ -322,19 +322,6 @@ grps_err:
return -1;
}
static int dump_thread(struct parasite_dump_thread *args)
{
int ret;
ret = sys_prctl(PR_GET_TID_ADDRESS, (unsigned long) &args->tid_addr, 0, 0, 0);
if (ret)
return ret;
args->tid = sys_gettid();
return 0;
}
static int drain_fds(struct parasite_drain_fd *args)
{
int ret;
......@@ -364,6 +351,29 @@ static struct tid_state_s *find_thread_state(pid_t tid)
return NULL;
}
static int dump_thread(struct parasite_dump_thread *args)
{
pid_t tid = sys_gettid();
struct tid_state_s *s;
int ret;
s = find_thread_state(tid);
if (!s)
return -ENOENT;
if (!s->use_sig_blocked)
return -EINVAL;
ret = sys_prctl(PR_GET_TID_ADDRESS, (unsigned long) &args->tid_addr, 0, 0, 0);
if (ret)
return ret;
args->blocked = s->sig_blocked;
args->tid = tid;
return 0;
}
static int init_thread(void)
{
k_rtsigset_t to_block;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment