Tofu: fix ENABLE_TOFU switching
Change-Id: Ib33323d4b59ea8fb4f5f40dff7ea25a36773d5e2
This commit is contained in:
@@ -168,7 +168,9 @@ struct program_load_desc {
|
||||
int uti_use_last_cpu; /* Work-around not to share CPU with OpenMP thread */
|
||||
int straight_map;
|
||||
size_t straight_map_threshold;
|
||||
#ifdef ENABLE_TOFU
|
||||
int enable_tofu;
|
||||
#endif
|
||||
int nr_processes;
|
||||
int process_rank;
|
||||
__cpu_set_unit cpu_set[PLD_CPU_SET_SIZE];
|
||||
@@ -215,7 +217,9 @@ struct syscall_response {
|
||||
unsigned long req_thread_status;
|
||||
long ret;
|
||||
unsigned long fault_address;
|
||||
#ifdef ENABLE_TOFU
|
||||
void *pde_data;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct syscall_ret_desc {
|
||||
|
||||
@@ -28,6 +28,7 @@ void *vdso_end;
|
||||
static struct vm_special_mapping (*vdso_spec)[2];
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_TOFU
|
||||
/* Tofu CQ and barrier gate release functions */
|
||||
struct file_operations *mcctrl_tof_utofu_procfs_ops_cq;
|
||||
int (*mcctrl_tof_utofu_release_cq)(struct inode *inode,
|
||||
@@ -35,6 +36,7 @@ int (*mcctrl_tof_utofu_release_cq)(struct inode *inode,
|
||||
struct file_operations *mcctrl_tof_utofu_procfs_ops_bch;
|
||||
int (*mcctrl_tof_utofu_release_bch)(struct inode *inode,
|
||||
struct file *filp);
|
||||
#endif
|
||||
|
||||
int arch_symbols_init(void)
|
||||
{
|
||||
@@ -52,6 +54,7 @@ int arch_symbols_init(void)
|
||||
return -EFAULT;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_TOFU
|
||||
mcctrl_tof_utofu_procfs_ops_cq =
|
||||
(void *)kallsyms_lookup_name("tof_utofu_procfs_ops_cq");
|
||||
if (WARN_ON(!mcctrl_tof_utofu_procfs_ops_cq))
|
||||
@@ -71,6 +74,7 @@ int arch_symbols_init(void)
|
||||
(void *)kallsyms_lookup_name("tof_utofu_release_bch");
|
||||
if (WARN_ON(!mcctrl_tof_utofu_release_bch))
|
||||
return -EFAULT;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -448,6 +452,7 @@ out:
|
||||
}
|
||||
|
||||
|
||||
#ifdef ENABLE_TOFU
|
||||
/*
|
||||
* Tofu CQ and BCH release handlers
|
||||
*/
|
||||
@@ -549,3 +554,4 @@ int __mcctrl_tof_utofu_release_bch(struct inode *inode, struct file *filp)
|
||||
return __mcctrl_tof_utofu_release_handler(inode, filp,
|
||||
mcctrl_tof_utofu_release_bch);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -50,7 +50,9 @@ extern void procfs_exit(int);
|
||||
extern void uti_attr_finalize(void);
|
||||
extern void binfmt_mcexec_init(void);
|
||||
extern void binfmt_mcexec_exit(void);
|
||||
#ifdef ENABLE_TOFU
|
||||
extern void mcctrl_file_to_pidfd_hash_init(void);
|
||||
#endif
|
||||
|
||||
extern int mcctrl_os_read_cpu_register(ihk_os_t os, int cpu,
|
||||
struct ihk_os_cpu_register *desc);
|
||||
@@ -325,7 +327,9 @@ static int __init mcctrl_init(void)
|
||||
}
|
||||
|
||||
binfmt_mcexec_init();
|
||||
#ifdef ENABLE_TOFU
|
||||
mcctrl_file_to_pidfd_hash_init();
|
||||
#endif
|
||||
|
||||
if ((ret = symbols_init()))
|
||||
goto error;
|
||||
|
||||
@@ -560,6 +560,7 @@ struct uti_futex_resp {
|
||||
wait_queue_head_t wq;
|
||||
};
|
||||
|
||||
#ifdef ENABLE_TOFU
|
||||
/*
|
||||
* Hash table to keep track of files and related processes
|
||||
* and file descriptors.
|
||||
@@ -585,3 +586,4 @@ struct mcctrl_file_to_pidfd *mcctrl_file_to_pidfd_hash_lookup(
|
||||
int mcctrl_file_to_pidfd_hash_remove(struct file *filp,
|
||||
ihk_os_t os, struct task_struct *group_leader, int fd);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1843,6 +1843,7 @@ static long pager_call(ihk_os_t os, struct syscall_request *req)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_TOFU
|
||||
struct list_head mcctrl_file_to_pidfd_hash[MCCTRL_FILE_2_PIDFD_HASH_SIZE];
|
||||
spinlock_t mcctrl_file_to_pidfd_hash_lock;
|
||||
|
||||
@@ -1971,7 +1972,7 @@ unlock_out:
|
||||
spin_unlock_irqrestore(&mcctrl_file_to_pidfd_hash_lock, irqflags);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void __return_syscall(ihk_os_t os, struct ikc_scd_packet *packet,
|
||||
long ret, int stid)
|
||||
@@ -2458,6 +2459,7 @@ int __do_in_kernel_syscall(ihk_os_t os, struct ikc_scd_packet *packet)
|
||||
|
||||
dprintk("%s: system call: %lx\n", __FUNCTION__, sc->args[0]);
|
||||
switch (sc->number) {
|
||||
#ifdef ENABLE_TOFU
|
||||
case __NR_close: {
|
||||
struct fd f;
|
||||
int fd;
|
||||
@@ -2478,6 +2480,7 @@ int __do_in_kernel_syscall(ihk_os_t os, struct ikc_scd_packet *packet)
|
||||
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case __NR_mmap:
|
||||
ret = pager_call(os, sc);
|
||||
break;
|
||||
|
||||
@@ -68,13 +68,13 @@
|
||||
#include <sys/user.h>
|
||||
#endif /* !__aarch64__ */
|
||||
#include <sys/prctl.h>
|
||||
#include "../../config.h"
|
||||
#include "../include/uprotocol.h"
|
||||
#include <ihk/ihk_host_user.h>
|
||||
#include "../include/uti.h"
|
||||
#include <getopt.h>
|
||||
#include "archdep.h"
|
||||
#include "arch_args.h"
|
||||
#include "../../config.h"
|
||||
#include <numa.h>
|
||||
#include <numaif.h>
|
||||
#include <spawn.h>
|
||||
@@ -204,7 +204,9 @@ static char *mpol_bind_nodes = NULL;
|
||||
static int uti_thread_rank = 0;
|
||||
static int uti_use_last_cpu = 0;
|
||||
static int enable_uti = 0;
|
||||
#ifdef ENABLE_TOFU
|
||||
static int enable_tofu = 0;
|
||||
#endif
|
||||
|
||||
/* Partitioned execution (e.g., for MPI) */
|
||||
static int nr_processes = 0;
|
||||
@@ -1787,12 +1789,14 @@ static struct option mcexec_options[] = {
|
||||
.flag = &enable_uti,
|
||||
.val = 1,
|
||||
},
|
||||
#ifdef ENABLE_TOFU
|
||||
{
|
||||
.name = "enable-tofu",
|
||||
.has_arg = no_argument,
|
||||
.flag = &enable_tofu,
|
||||
.val = 1,
|
||||
},
|
||||
#endif
|
||||
{
|
||||
.name = "debug-mcexec",
|
||||
.has_arg = no_argument,
|
||||
@@ -2816,7 +2820,9 @@ int main(int argc, char **argv)
|
||||
|
||||
desc->straight_map = straight_map;
|
||||
desc->straight_map_threshold = straight_map_threshold;
|
||||
#ifdef ENABLE_TOFU
|
||||
desc->enable_tofu = enable_tofu;
|
||||
#endif
|
||||
|
||||
/* user_start and user_end are set by this call */
|
||||
if (ioctl(fd, MCEXEC_UP_PREPARE_IMAGE, (unsigned long)desc) != 0) {
|
||||
|
||||
Reference in New Issue
Block a user