mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-24 02:29:23 +00:00
Hardware breakpoints were originally intended to speed up the resume process by stopping the process at a specific point in the pie code. However, it turned out that they don't provide a significant speedup and, in some cases, can even slow it down. This is especially critical for hosts with a large number of CPUs. Hardware Breakpoint Restore Performance Benchmark ================================================== System: Linux 6.17.0-1007-gcp x86_64 CPU: INTEL(R) XEON(R) PLATINUM 8581C CPU @ 2.10GHz Virt: google CRIU: Version: 4.2 Iterations per data point: 5 Threads With BP (us) Without BP (us) Diff (%) -------- ------------ --------------- -------- >>> Benchmarking with 1 thread(s)... 1 391 326 19.9% >>> Benchmarking with 10 thread(s)... 10 1098 695 58.0% >>> Benchmarking with 50 thread(s)... 50 3772 2344 60.9% >>> Benchmarking with 100 thread(s)... 100 6740 4504 49.6% >>> Benchmarking with 500 thread(s)... 500 31382 19982 57.1% >>> Benchmarking with 1000 thread(s)... 1000 58617 40568 44.5% Notes: 'With BP' = hardware breakpoints enabled (current default) 'Without BP' = CRIU_FAULT=130 (FI_NO_BREAKPOINTS, uses PTRACE_SYSCALL) Positive diff% means breakpoints are slower Signed-off-by: Andrei Vagin <avagin@google.com>
80 lines
2.5 KiB
C
80 lines
2.5 KiB
C
#ifndef __COMPEL_INFECT_PRIV_H__
|
|
#define __COMPEL_INFECT_PRIV_H__
|
|
|
|
#include <stdbool.h>
|
|
|
|
#define BUILTIN_SYSCALL_SIZE 8
|
|
|
|
struct thread_ctx {
|
|
k_rtsigset_t sigmask;
|
|
user_regs_struct_t regs;
|
|
#ifdef ARCH_HAS_PTRACE_GET_THREAD_AREA
|
|
tls_t tls;
|
|
#endif
|
|
user_fpregs_struct_t ext_regs;
|
|
};
|
|
|
|
/* parasite control block */
|
|
struct parasite_ctl {
|
|
int rpid; /* Real pid of the victim */
|
|
void *remote_map;
|
|
void *local_map;
|
|
unsigned long map_length;
|
|
|
|
struct infect_ctx ictx;
|
|
|
|
/* thread leader data */
|
|
bool daemonized;
|
|
|
|
struct thread_ctx orig;
|
|
|
|
void *rstack; /* thread leader stack*/
|
|
struct rt_sigframe *sigframe;
|
|
struct rt_sigframe *rsigframe; /* address in a parasite */
|
|
|
|
void *r_thread_stack; /* stack for non-leader threads */
|
|
|
|
unsigned long parasite_ip; /* service routine start ip */
|
|
|
|
unsigned int *cmd; /* address for command */
|
|
void *args; /* address for arguments */
|
|
unsigned long args_size;
|
|
int tsock; /* transport socket for transferring fds */
|
|
|
|
struct parasite_blob_desc pblob;
|
|
};
|
|
|
|
struct parasite_thread_ctl {
|
|
int tid;
|
|
struct parasite_ctl *ctl;
|
|
struct thread_ctx th;
|
|
};
|
|
|
|
#define MEMFD_FNAME "CRIUMFD"
|
|
#define MEMFD_FNAME_SZ sizeof(MEMFD_FNAME)
|
|
|
|
struct ctl_msg;
|
|
int parasite_wait_ack(int sockfd, unsigned int cmd, struct ctl_msg *m);
|
|
|
|
extern void parasite_setup_regs(unsigned long new_ip, void *stack, user_regs_struct_t *regs);
|
|
extern void *remote_mmap(struct parasite_ctl *ctl, void *addr, size_t length, int prot, int flags, int fd,
|
|
off_t offset);
|
|
extern bool arch_can_dump_task(struct parasite_ctl *ctl);
|
|
/*
|
|
* @regs: general purpose registers
|
|
* @ext_regs: extended register set (fpu/mmx/sse/etc)
|
|
* for task that is NULL, restored by sigframe on rt_sigreturn()
|
|
* @save: callback to dump all info
|
|
* @flags: see INFECT_* in infect_ctx::flags
|
|
* @pid: mystery
|
|
*/
|
|
extern int compel_get_task_regs(pid_t pid, user_regs_struct_t *regs, user_fpregs_struct_t *ext_regs, save_regs_t save,
|
|
void *arg, unsigned long flags);
|
|
extern int compel_set_task_ext_regs(pid_t pid, user_fpregs_struct_t *ext_regs);
|
|
extern int compel_set_task_gcs_regs(pid_t pid, user_fpregs_struct_t *ext_regs);
|
|
extern int arch_fetch_sas(struct parasite_ctl *ctl, struct rt_sigframe *s);
|
|
extern int sigreturn_prep_regs_plain(struct rt_sigframe *sigframe, user_regs_struct_t *regs,
|
|
user_fpregs_struct_t *fpregs);
|
|
extern int sigreturn_prep_fpu_frame_plain(struct rt_sigframe *sigframe, struct rt_sigframe *rsigframe);
|
|
extern int compel_execute_syscall(struct parasite_ctl *ctl, user_regs_struct_t *regs, const char *code_syscall);
|
|
#endif
|