uti: util_indicate_clone: check --enable-uti mcexec option

Change-Id: Ic7474d01c18acd1edbc07844d7a7b010b2175f71
This commit is contained in:
Masamichi Takagi
2021-02-22 11:21:36 +09:00
parent 90895cfb1f
commit 19cb302d5f
7 changed files with 12 additions and 0 deletions

View File

@ -164,6 +164,7 @@ struct program_load_desc {
(sizeof(unsigned long) * 8)]; (sizeof(unsigned long) * 8)];
int thp_disable; int thp_disable;
int enable_uti;
int uti_thread_rank; /* N-th clone() spawns a thread on Linux CPU */ int uti_thread_rank; /* N-th clone() spawns a thread on Linux CPU */
int uti_use_last_cpu; /* Work-around not to share CPU with OpenMP thread */ int uti_use_last_cpu; /* Work-around not to share CPU with OpenMP thread */
int straight_map; int straight_map;

View File

@ -2816,6 +2816,7 @@ int main(int argc, char **argv)
desc->mpol_mode, desc->mpol_nodemask[0]); desc->mpol_mode, desc->mpol_nodemask[0]);
} }
desc->enable_uti = enable_uti;
desc->uti_thread_rank = uti_thread_rank; desc->uti_thread_rank = uti_thread_rank;
desc->uti_use_last_cpu = uti_use_last_cpu; desc->uti_use_last_cpu = uti_use_last_cpu;
desc->thp_disable = get_thp_disable(); desc->thp_disable = get_thp_disable();

View File

@ -563,6 +563,7 @@ static int process_msg_prepare_process(unsigned long rphys)
__func__, vm->numa_mem_policy, vm->numa_mask[0]); __func__, vm->numa_mem_policy, vm->numa_mask[0]);
} }
proc->enable_uti = pn->enable_uti;
proc->uti_thread_rank = pn->uti_thread_rank; proc->uti_thread_rank = pn->uti_thread_rank;
proc->uti_use_last_cpu = pn->uti_use_last_cpu; proc->uti_use_last_cpu = pn->uti_use_last_cpu;

View File

@ -565,6 +565,7 @@ struct process {
unsigned long mpol_bind_mask; unsigned long mpol_bind_mask;
int mpol_mode; int mpol_mode;
int enable_uti;
int uti_thread_rank; /* Spawn on Linux CPU when clone_count reaches this */ int uti_thread_rank; /* Spawn on Linux CPU when clone_count reaches this */
int uti_use_last_cpu; /* Work-around not to share CPU with OpenMP thread */ int uti_use_last_cpu; /* Work-around not to share CPU with OpenMP thread */
int clone_count; int clone_count;

View File

@ -235,6 +235,7 @@ struct program_load_desc {
(sizeof(unsigned long) * 8)]; (sizeof(unsigned long) * 8)];
int thp_disable; int thp_disable;
int enable_uti;
int uti_thread_rank; /* N-th clone() spawns a thread on Linux CPU */ int uti_thread_rank; /* N-th clone() spawns a thread on Linux CPU */
int uti_use_last_cpu; /* Work-around not to share CPU with OpenMP thread */ int uti_use_last_cpu; /* Work-around not to share CPU with OpenMP thread */
int straight_map; int straight_map;

View File

@ -122,6 +122,7 @@ init_process(struct process *proc, struct process *parent)
sizeof(struct rlimit) * MCK_RLIM_MAX); sizeof(struct rlimit) * MCK_RLIM_MAX);
memcpy(&proc->cpu_set, &parent->cpu_set, memcpy(&proc->cpu_set, &parent->cpu_set,
sizeof(proc->cpu_set)); sizeof(proc->cpu_set));
proc->enable_uti = parent->enable_uti;
} }
INIT_LIST_HEAD(&proc->hash_list); INIT_LIST_HEAD(&proc->hash_list);

View File

@ -10722,6 +10722,12 @@ SYSCALL_DECLARE(util_indicate_clone)
struct thread *thread = cpu_local_var(current); struct thread *thread = cpu_local_var(current);
struct uti_attr *kattr = NULL; struct uti_attr *kattr = NULL;
if (!thread->proc->enable_uti) {
kprintf("%s: error: --enable-uti mcexec option not specified\n",
__func__);
return -EINVAL;
}
if (mod != SPAWN_TO_LOCAL && if (mod != SPAWN_TO_LOCAL &&
mod != SPAWN_TO_REMOTE) mod != SPAWN_TO_REMOTE)
return -EINVAL; return -EINVAL;