Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 542418b1fc | |||
| b95a2fcfab | |||
| 1b11496f26 | |||
| 7c0e624b13 | |||
| 0b66bab992 | |||
| 63ed4e7af0 | |||
| d7cf39883f | |||
| 40f8091fab | |||
| a20e1acf01 | |||
| b3d7bbda56 | |||
| 9a60997ea0 | |||
| 4b66373813 | |||
| b44b11ace7 | |||
| ebc91cea0e | |||
| 58106d791a | |||
| 56b51d4f97 | |||
| bafe540d86 | |||
| d78a0fd05d | |||
| 999bc91b4f | |||
| b3bd2ea9b3 | |||
| d3d9e2400d |
@ -10,7 +10,7 @@ project(mckernel C ASM)
|
||||
set(MCKERNEL_VERSION "1.7.0")
|
||||
|
||||
# See "Fedora Packaging Guidlines -- Versioning"
|
||||
set(MCKERNEL_RELEASE "0.5")
|
||||
set(MCKERNEL_RELEASE "0.9")
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
|
||||
# for rpmbuild
|
||||
|
||||
3
NEWS.md
3
NEWS.md
@ -535,3 +535,6 @@ Restrictions on McKernel
|
||||
|
||||
25. The behaviors of madvise and mbind are changed to do nothing and
|
||||
report success as a workaround for Fugaku.
|
||||
|
||||
26. mmap() allows unlimited overcommit. Note that it corresponds to
|
||||
setting sysctl ``vm.overcommit_memory`` to 1.
|
||||
|
||||
31
README.md
31
README.md
@ -64,7 +64,7 @@ First, the proxy process is compiled as a position independent binary, which ena
|
||||
|
||||
For a smooth experience, we recommend the following combination of OS distributions and platforms:
|
||||
|
||||
- CentOS 7.3+ running on Intel Xeon / Xeon Phi
|
||||
- CentOS 7.3+ running on Intel Xeon, Xeon Phi, Fujitsu A64FX
|
||||
|
||||
|
||||
##### 1. Change SELinux settings
|
||||
@ -85,7 +85,12 @@ sudo reboot
|
||||
You will need the following packages installed:
|
||||
|
||||
~~~~
|
||||
sudo yum install cmake kernel-devel binutils-devel systemd-devel numactl-devel gcc make nasm git
|
||||
sudo yum install cmake kernel-devel binutils-devel systemd-devel numactl-devel gcc make nasm git libdwarf-devel
|
||||
~~~~
|
||||
|
||||
Note that to install libdwarf-devel to RHEL-8.2, you need to enable the CodeReady Linux Builder (CLB) repository and the EPEL repository with the following commands:
|
||||
~~~~
|
||||
sudo subscription-manager repos --enable codeready-builder-for-rhel-8-$(/bin/arch)-rpms
|
||||
~~~~
|
||||
|
||||
Grant read permission to the System.map file of your kernel version:
|
||||
@ -128,7 +133,7 @@ The IHK kernel modules and McKernel kernel image should be installed under the *
|
||||
|
||||
###### 4.2 Install with rpm
|
||||
|
||||
Configure, compile and build rpm:
|
||||
Build rpm:
|
||||
|
||||
~~~~
|
||||
mkdir -p build && cd build
|
||||
@ -179,7 +184,7 @@ IHK/McKernel booted.
|
||||
~~~~
|
||||
|
||||
|
||||
##### 5. Run a simple program on McKernel
|
||||
##### 6. Run a simple program on McKernel
|
||||
|
||||
The mcexec command line tool (which is also the Linux proxy process) can be used for executing applications on McKernel:
|
||||
|
||||
@ -189,7 +194,7 @@ centos-vm
|
||||
~~~~
|
||||
|
||||
|
||||
##### 6. Shutdown McKernel
|
||||
##### 7. Shutdown McKernel
|
||||
|
||||
Finally, to shutdown McKernel and release CPU/memory resources back to Linux use the following command:
|
||||
|
||||
@ -197,27 +202,27 @@ Finally, to shutdown McKernel and release CPU/memory resources back to Linux use
|
||||
sudo ./sbin/mcstop+release.sh
|
||||
~~~~
|
||||
|
||||
##### 7. Advanced: Enable Utility Thread offloading Interface (UTI)
|
||||
##### 8. Advanced: Enable Utility Thread offloading Interface (UTI)
|
||||
|
||||
UTI enables a runtime such as MPI runtime to spawn utility threads such as MPI asynchronous progress threads to Linux cores.
|
||||
|
||||
1. Install capstone
|
||||
###### 8.1 Install capstone
|
||||
|
||||
Install EPEL capstone-devel:
|
||||
|
||||
~~~~
|
||||
sudo yum install epel-release
|
||||
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
|
||||
sudo yum install capstone-devel
|
||||
~~~~
|
||||
|
||||
2. Install syscall_intercept
|
||||
###### 8.2 Install syscall_intercept
|
||||
|
||||
~~~~
|
||||
git clone https://github.com/RIKEN-SysSoft/syscall_intercept.git
|
||||
cmake ../arch/aarch64 -DCMAKE_INSTALL_PREFIX=<syscall-intercept-install> -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc -DTREAT_WARNINGS_AS_ERRORS=OFF
|
||||
~~~~
|
||||
|
||||
3. Install UTI for McKernel
|
||||
###### 8.3 Install UTI for McKernel
|
||||
|
||||
Install:
|
||||
|
||||
@ -228,19 +233,19 @@ mkdir build && cd build
|
||||
make && make install
|
||||
~~~~
|
||||
|
||||
4. Install McKernel
|
||||
###### 8.4 Install McKernel
|
||||
|
||||
~~~~
|
||||
CMAKE_PREFIX_PATH=<syscall-intercept-install> cmake -DCMAKE_INSTALL_PREFIX=${HOME}/ihk+mckernel -DENABLE_UTI=ON $HOME/src/ihk+mckernel/mckernel
|
||||
~~~~
|
||||
|
||||
5. Run executable
|
||||
###### 8.5 Run executable
|
||||
|
||||
~~~~
|
||||
mcexec --enable-uti <command>
|
||||
~~~~
|
||||
|
||||
6. Install UTI for Linux for performance comparison
|
||||
###### 8.6 Install UTI for Linux for performance comparison
|
||||
|
||||
Install by make:
|
||||
|
||||
|
||||
@ -1279,7 +1279,7 @@ long ihk_mc_show_cpuinfo(char *buf, size_t buf_size, unsigned long read_off, int
|
||||
|
||||
/* generate strings */
|
||||
loff += scnprintf(lbuf + loff, lbuf_size - loff,
|
||||
"processor\t: %d\n", cpuinfo->hwid);
|
||||
"processor\t: %d\n", i);
|
||||
loff += scnprintf(lbuf + loff, lbuf_size - loff, "Features\t:");
|
||||
|
||||
for (j = 0; hwcap_str[j]; j++) {
|
||||
|
||||
@ -85,7 +85,11 @@ enum __rlimit_resource
|
||||
__RLIMIT_RTPRIO = 14,
|
||||
#define RLIMIT_RTPRIO __RLIMIT_RTPRIO
|
||||
|
||||
__RLIMIT_NLIMITS = 15,
|
||||
/* timeout for RT tasks in us */
|
||||
__RLIMIT_RTTIME = 15,
|
||||
#define RLIMIT_RTTIME __RLIMIT_RTTIME
|
||||
|
||||
__RLIMIT_NLIMITS = 16,
|
||||
__RLIM_NLIMITS = __RLIMIT_NLIMITS
|
||||
#define RLIMIT_NLIMITS __RLIMIT_NLIMITS
|
||||
#define RLIM_NLIMITS __RLIM_NLIMITS
|
||||
|
||||
@ -83,6 +83,7 @@ SYSCALL_HANDLED(175, geteuid)
|
||||
SYSCALL_HANDLED(176, getgid)
|
||||
SYSCALL_HANDLED(177, getegid)
|
||||
SYSCALL_HANDLED(178, gettid)
|
||||
SYSCALL_HANDLED(179, sysinfo)
|
||||
SYSCALL_DELEGATED(188, msgrcv)
|
||||
SYSCALL_DELEGATED(189, msgsnd)
|
||||
SYSCALL_DELEGATED(192, semtimedop)
|
||||
@ -117,6 +118,7 @@ SYSCALL_HANDLED(241, perf_event_open)
|
||||
SYSCALL_DELEGATED(241, perf_event_open)
|
||||
#endif // PERF_ENABLE
|
||||
SYSCALL_HANDLED(260, wait4)
|
||||
SYSCALL_HANDLED(261, prlimit64)
|
||||
SYSCALL_HANDLED(270, process_vm_readv)
|
||||
SYSCALL_HANDLED(271, process_vm_writev)
|
||||
SYSCALL_HANDLED(281, execveat)
|
||||
@ -142,3 +144,9 @@ SYSCALL_HANDLED(1045, signalfd)
|
||||
SYSCALL_DELEGATED(1049, stat)
|
||||
SYSCALL_DELEGATED(1060, getpgrp)
|
||||
SYSCALL_HANDLED(1062, time)
|
||||
SYSCALL_DELEGATED(1069, epoll_wait)
|
||||
|
||||
/* Do not edit the lines including this comment and
|
||||
* EOF just after it because those are used as a
|
||||
* robust marker for the autotest patch.
|
||||
*/
|
||||
|
||||
@ -142,17 +142,6 @@ int obtain_clone_cpuid(cpu_set_t *cpu_set, int use_last)
|
||||
return min_cpu;
|
||||
}
|
||||
|
||||
int
|
||||
arch_clear_host_user_space()
|
||||
{
|
||||
struct thread *th = cpu_local_var(current);
|
||||
|
||||
/* XXX: might be unnecessary */
|
||||
clear_host_pte(th->vm->region.user_start,
|
||||
(th->vm->region.user_end - th->vm->region.user_start), 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* archtecture-depended syscall handlers */
|
||||
extern unsigned long do_fork(int clone_flags, unsigned long newsp,
|
||||
unsigned long parent_tidptr, unsigned long child_tidptr,
|
||||
@ -185,33 +174,6 @@ SYSCALL_DECLARE(clone)
|
||||
return ret;
|
||||
}
|
||||
|
||||
SYSCALL_DECLARE(rt_sigaction)
|
||||
{
|
||||
int sig = ihk_mc_syscall_arg0(ctx);
|
||||
const struct sigaction *act = (const struct sigaction *)ihk_mc_syscall_arg1(ctx);
|
||||
struct sigaction *oact = (struct sigaction *)ihk_mc_syscall_arg2(ctx);
|
||||
size_t sigsetsize = ihk_mc_syscall_arg3(ctx);
|
||||
struct k_sigaction new_sa, old_sa;
|
||||
int rc;
|
||||
|
||||
if (sigsetsize != sizeof(sigset_t))
|
||||
return -EINVAL;
|
||||
|
||||
if(act)
|
||||
if(copy_from_user(&new_sa.sa, act, sizeof new_sa.sa)){
|
||||
goto fault;
|
||||
}
|
||||
rc = do_sigaction(sig, act? &new_sa: NULL, oact? &old_sa: NULL);
|
||||
if(rc == 0 && oact)
|
||||
if(copy_to_user(oact, &old_sa.sa, sizeof old_sa.sa)){
|
||||
goto fault;
|
||||
}
|
||||
|
||||
return rc;
|
||||
fault:
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
SYSCALL_DECLARE(prctl)
|
||||
{
|
||||
struct process *proc = cpu_local_var(current)->proc;
|
||||
@ -1368,70 +1330,6 @@ out:
|
||||
return restart;
|
||||
}
|
||||
|
||||
static struct sig_pending *
|
||||
getsigpending(struct thread *thread, int delflag){
|
||||
struct list_head *head;
|
||||
mcs_rwlock_lock_t *lock;
|
||||
struct mcs_rwlock_node_irqsave mcs_rw_node;
|
||||
struct sig_pending *next;
|
||||
struct sig_pending *pending;
|
||||
__sigset_t w;
|
||||
|
||||
w = thread->sigmask.__val[0];
|
||||
|
||||
lock = &thread->sigcommon->lock;
|
||||
head = &thread->sigcommon->sigpending;
|
||||
for(;;) {
|
||||
if (delflag) {
|
||||
mcs_rwlock_writer_lock(lock, &mcs_rw_node);
|
||||
}
|
||||
else {
|
||||
mcs_rwlock_reader_lock(lock, &mcs_rw_node);
|
||||
}
|
||||
|
||||
list_for_each_entry_safe(pending, next, head, list){
|
||||
if(!(pending->sigmask.__val[0] & w)){
|
||||
if(delflag)
|
||||
list_del(&pending->list);
|
||||
|
||||
if (delflag) {
|
||||
mcs_rwlock_writer_unlock(lock, &mcs_rw_node);
|
||||
}
|
||||
else {
|
||||
mcs_rwlock_reader_unlock(lock, &mcs_rw_node);
|
||||
}
|
||||
return pending;
|
||||
}
|
||||
}
|
||||
|
||||
if (delflag) {
|
||||
mcs_rwlock_writer_unlock(lock, &mcs_rw_node);
|
||||
}
|
||||
else {
|
||||
mcs_rwlock_reader_unlock(lock, &mcs_rw_node);
|
||||
}
|
||||
|
||||
if(lock == &thread->sigpendinglock)
|
||||
return NULL;
|
||||
|
||||
lock = &thread->sigpendinglock;
|
||||
head = &thread->sigpending;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct sig_pending *
|
||||
hassigpending(struct thread *thread)
|
||||
{
|
||||
if (list_empty(&thread->sigpending) &&
|
||||
list_empty(&thread->sigcommon->sigpending)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return getsigpending(thread, 0);
|
||||
}
|
||||
|
||||
int
|
||||
interrupt_from_user(void *regs0)
|
||||
{
|
||||
@ -1455,191 +1353,6 @@ void save_syscall_return_value(int num, unsigned long rc)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
check_signal(unsigned long rc, void *regs0, int num)
|
||||
{
|
||||
__check_signal(rc, regs0, num, 0);
|
||||
}
|
||||
|
||||
void
|
||||
check_signal_irq_disabled(unsigned long rc, void *regs0, int num)
|
||||
{
|
||||
__check_signal(rc, regs0, num, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
__check_signal(unsigned long rc, void *regs0, int num, int irq_disabled)
|
||||
{
|
||||
ihk_mc_user_context_t *regs = regs0;
|
||||
struct thread *thread;
|
||||
struct sig_pending *pending;
|
||||
int irqstate;
|
||||
|
||||
if(clv == NULL)
|
||||
return;
|
||||
thread = cpu_local_var(current);
|
||||
|
||||
if(thread == NULL || thread->proc->pid == 0){
|
||||
struct thread *t;
|
||||
|
||||
irqstate = cpu_disable_interrupt_save();
|
||||
ihk_mc_spinlock_lock_noirq(&(cpu_local_var(runq_lock)));
|
||||
list_for_each_entry(t, &(cpu_local_var(runq)), sched_list){
|
||||
if(t->proc->pid <= 0)
|
||||
continue;
|
||||
if(t->status == PS_INTERRUPTIBLE &&
|
||||
hassigpending(t)){
|
||||
t->status = PS_RUNNING;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ihk_mc_spinlock_unlock_noirq(&(cpu_local_var(runq_lock)));
|
||||
cpu_restore_interrupt(irqstate);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if(regs != NULL && !interrupt_from_user(regs)) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (list_empty(&thread->sigpending) &&
|
||||
list_empty(&thread->sigcommon->sigpending)) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for(;;){
|
||||
/* When this function called from check_signal_irq_disabled,
|
||||
* return with interrupt invalid.
|
||||
* This is to eliminate signal loss.
|
||||
*/
|
||||
if (irq_disabled == 1) {
|
||||
irqstate = cpu_disable_interrupt_save();
|
||||
}
|
||||
pending = getsigpending(thread, 1);
|
||||
if(!pending) {
|
||||
dkprintf("check_signal,queue is empty\n");
|
||||
goto out;
|
||||
}
|
||||
if (irq_disabled == 1) {
|
||||
cpu_restore_interrupt(irqstate);
|
||||
}
|
||||
if (do_signal(rc, regs, thread, pending, num)) {
|
||||
num = -1;
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
return;
|
||||
}
|
||||
|
||||
static int
|
||||
check_sig_pending_thread(struct thread *thread)
|
||||
{
|
||||
int found = 0;
|
||||
struct list_head *head;
|
||||
mcs_rwlock_lock_t *lock;
|
||||
struct mcs_rwlock_node_irqsave mcs_rw_node;
|
||||
struct sig_pending *next;
|
||||
struct sig_pending *pending;
|
||||
__sigset_t w;
|
||||
__sigset_t x;
|
||||
int sig = 0;
|
||||
struct k_sigaction *k;
|
||||
struct cpu_local_var *v;
|
||||
|
||||
v = get_this_cpu_local_var();
|
||||
w = thread->sigmask.__val[0];
|
||||
|
||||
lock = &thread->sigcommon->lock;
|
||||
head = &thread->sigcommon->sigpending;
|
||||
for (;;) {
|
||||
mcs_rwlock_reader_lock(lock, &mcs_rw_node);
|
||||
|
||||
list_for_each_entry_safe(pending, next, head, list) {
|
||||
for (x = pending->sigmask.__val[0], sig = 0; x;
|
||||
sig++, x >>= 1)
|
||||
;
|
||||
k = thread->sigcommon->action + sig - 1;
|
||||
if ((sig != SIGCHLD &&
|
||||
sig != SIGURG &&
|
||||
sig != SIGCONT) ||
|
||||
(k->sa.sa_handler != SIG_IGN &&
|
||||
k->sa.sa_handler != NULL)) {
|
||||
if (!(pending->sigmask.__val[0] & w)) {
|
||||
if (pending->interrupted == 0) {
|
||||
pending->interrupted = 1;
|
||||
found = 1;
|
||||
if (sig != SIGCHLD &&
|
||||
sig != SIGURG &&
|
||||
sig != SIGCONT &&
|
||||
!k->sa.sa_handler) {
|
||||
found = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mcs_rwlock_reader_unlock(lock, &mcs_rw_node);
|
||||
|
||||
if (found == 2) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (lock == &thread->sigpendinglock) {
|
||||
break;
|
||||
}
|
||||
|
||||
lock = &thread->sigpendinglock;
|
||||
head = &thread->sigpending;
|
||||
}
|
||||
|
||||
if (found == 2) {
|
||||
ihk_mc_spinlock_unlock(&v->runq_lock, v->runq_irqstate);
|
||||
terminate_mcexec(0, sig);
|
||||
return 1;
|
||||
}
|
||||
else if (found == 1) {
|
||||
ihk_mc_spinlock_unlock(&v->runq_lock, v->runq_irqstate);
|
||||
interrupt_syscall(thread, 0);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
check_sig_pending(void)
|
||||
{
|
||||
struct thread *thread;
|
||||
struct cpu_local_var *v;
|
||||
|
||||
if (clv == NULL)
|
||||
return;
|
||||
|
||||
v = get_this_cpu_local_var();
|
||||
repeat:
|
||||
v->runq_irqstate = ihk_mc_spinlock_lock(&v->runq_lock);
|
||||
list_for_each_entry(thread, &(v->runq), sched_list) {
|
||||
|
||||
if (thread == NULL || thread == &cpu_local_var(idle)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (thread->in_syscall_offload == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (thread->proc->group_exit_status & 0x0000000100000000L) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (check_sig_pending_thread(thread))
|
||||
goto repeat;
|
||||
}
|
||||
ihk_mc_spinlock_unlock(&v->runq_lock, v->runq_irqstate);
|
||||
}
|
||||
|
||||
unsigned long
|
||||
do_kill(struct thread * thread, int pid, int tid, int sig, siginfo_t *info, int ptracecont)
|
||||
{
|
||||
|
||||
@ -84,7 +84,11 @@ enum __rlimit_resource
|
||||
__RLIMIT_RTPRIO = 14,
|
||||
#define RLIMIT_RTPRIO __RLIMIT_RTPRIO
|
||||
|
||||
__RLIMIT_NLIMITS = 15,
|
||||
/* timeout for RT tasks in us */
|
||||
__RLIMIT_RTTIME = 15,
|
||||
#define RLIMIT_RTTIME __RLIMIT_RTTIME
|
||||
|
||||
__RLIMIT_NLIMITS = 16,
|
||||
__RLIM_NLIMITS = __RLIMIT_NLIMITS
|
||||
#define RLIMIT_NLIMITS __RLIMIT_NLIMITS
|
||||
#define RLIM_NLIMITS __RLIM_NLIMITS
|
||||
|
||||
@ -74,6 +74,7 @@ SYSCALL_DELEGATED(89, readlink)
|
||||
SYSCALL_HANDLED(96, gettimeofday)
|
||||
SYSCALL_HANDLED(97, getrlimit)
|
||||
SYSCALL_HANDLED(98, getrusage)
|
||||
SYSCALL_HANDLED(99, sysinfo)
|
||||
SYSCALL_HANDLED(100, times)
|
||||
SYSCALL_HANDLED(101, ptrace)
|
||||
SYSCALL_HANDLED(102, getuid)
|
||||
@ -157,6 +158,7 @@ SYSCALL_HANDLED(289, signalfd4)
|
||||
#ifdef ENABLE_PERF
|
||||
SYSCALL_HANDLED(298, perf_event_open)
|
||||
#endif
|
||||
SYSCALL_HANDLED(302, prlimit64)
|
||||
#ifdef DCFA_KMOD
|
||||
SYSCALL_HANDLED(303, mod_call)
|
||||
#endif
|
||||
@ -179,4 +181,8 @@ SYSCALL_HANDLED(802, linux_mlock)
|
||||
SYSCALL_HANDLED(803, suspend_threads)
|
||||
SYSCALL_HANDLED(804, resume_threads)
|
||||
SYSCALL_HANDLED(811, linux_spawn)
|
||||
/**** End of File ****/
|
||||
|
||||
/* Do not edit the lines including this comment and
|
||||
* EOF just after it because those are used as a
|
||||
* robust marker for the autotest patch.
|
||||
*/
|
||||
|
||||
@ -147,44 +147,6 @@ int obtain_clone_cpuid(cpu_set_t *cpu_set, int use_last) {
|
||||
return min_cpu;
|
||||
}
|
||||
|
||||
int
|
||||
arch_clear_host_user_space()
|
||||
{
|
||||
struct thread *th = cpu_local_var(current);
|
||||
|
||||
/* XXX: might be unnecessary */
|
||||
clear_host_pte(th->vm->region.user_start,
|
||||
(th->vm->region.user_end - th->vm->region.user_start), 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYSCALL_DECLARE(rt_sigaction)
|
||||
{
|
||||
int sig = ihk_mc_syscall_arg0(ctx);
|
||||
const struct sigaction *act = (const struct sigaction *)ihk_mc_syscall_arg1(ctx);
|
||||
struct sigaction *oact = (struct sigaction *)ihk_mc_syscall_arg2(ctx);
|
||||
size_t sigsetsize = ihk_mc_syscall_arg3(ctx);
|
||||
struct k_sigaction new_sa, old_sa;
|
||||
int rc;
|
||||
|
||||
if (sigsetsize != sizeof(sigset_t))
|
||||
return -EINVAL;
|
||||
|
||||
if(act)
|
||||
if(copy_from_user(&new_sa.sa, act, sizeof new_sa.sa)){
|
||||
goto fault;
|
||||
}
|
||||
rc = do_sigaction(sig, act? &new_sa: NULL, oact? &old_sa: NULL);
|
||||
if(rc == 0 && oact)
|
||||
if(copy_to_user(oact, &old_sa.sa, sizeof old_sa.sa)){
|
||||
goto fault;
|
||||
}
|
||||
|
||||
return rc;
|
||||
fault:
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
SYSCALL_DECLARE(prctl)
|
||||
{
|
||||
struct process *proc = cpu_local_var(current)->proc;
|
||||
@ -1039,82 +1001,6 @@ out:
|
||||
return restart;
|
||||
}
|
||||
|
||||
static struct sig_pending *
|
||||
getsigpending(struct thread *thread, int delflag){
|
||||
struct list_head *head;
|
||||
mcs_rwlock_lock_t *lock;
|
||||
struct mcs_rwlock_node_irqsave mcs_rw_node;
|
||||
struct sig_pending *next;
|
||||
struct sig_pending *pending;
|
||||
__sigset_t w;
|
||||
__sigset_t x;
|
||||
int sig;
|
||||
struct k_sigaction *k;
|
||||
|
||||
w = thread->sigmask.__val[0];
|
||||
|
||||
lock = &thread->sigcommon->lock;
|
||||
head = &thread->sigcommon->sigpending;
|
||||
for(;;) {
|
||||
if (delflag) {
|
||||
mcs_rwlock_writer_lock(lock, &mcs_rw_node);
|
||||
}
|
||||
else {
|
||||
mcs_rwlock_reader_lock(lock, &mcs_rw_node);
|
||||
}
|
||||
|
||||
list_for_each_entry_safe(pending, next, head, list){
|
||||
for(x = pending->sigmask.__val[0], sig = 0; x; sig++, x >>= 1);
|
||||
k = thread->sigcommon->action + sig - 1;
|
||||
if(delflag ||
|
||||
(sig != SIGCHLD &&
|
||||
sig != SIGURG &&
|
||||
sig != SIGCONT) ||
|
||||
(k->sa.sa_handler != (void *)1 &&
|
||||
k->sa.sa_handler != NULL)){
|
||||
if(!(pending->sigmask.__val[0] & w)){
|
||||
if(delflag)
|
||||
list_del(&pending->list);
|
||||
|
||||
if (delflag) {
|
||||
mcs_rwlock_writer_unlock(lock, &mcs_rw_node);
|
||||
}
|
||||
else {
|
||||
mcs_rwlock_reader_unlock(lock, &mcs_rw_node);
|
||||
}
|
||||
return pending;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (delflag) {
|
||||
mcs_rwlock_writer_unlock(lock, &mcs_rw_node);
|
||||
}
|
||||
else {
|
||||
mcs_rwlock_reader_unlock(lock, &mcs_rw_node);
|
||||
}
|
||||
|
||||
if(lock == &thread->sigpendinglock)
|
||||
return NULL;
|
||||
|
||||
lock = &thread->sigpendinglock;
|
||||
head = &thread->sigpending;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct sig_pending *
|
||||
hassigpending(struct thread *thread)
|
||||
{
|
||||
if (list_empty(&thread->sigpending) &&
|
||||
list_empty(&thread->sigcommon->sigpending)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return getsigpending(thread, 0);
|
||||
}
|
||||
|
||||
int
|
||||
interrupt_from_user(void *regs0)
|
||||
{
|
||||
@ -1129,175 +1015,6 @@ void save_syscall_return_value(int num, unsigned long rc)
|
||||
return;
|
||||
}
|
||||
|
||||
/** \brief check arrived signals and processing
|
||||
*
|
||||
* @param rc return value of syscall
|
||||
* @param regs0 context
|
||||
* @param num syscall number (-1: Not called on exiting system call)
|
||||
*/
|
||||
void
|
||||
check_signal(unsigned long rc, void *regs0, int num)
|
||||
{
|
||||
struct x86_user_context *regs = regs0;
|
||||
struct thread *thread;
|
||||
struct sig_pending *pending;
|
||||
int irqstate;
|
||||
|
||||
if(clv == NULL)
|
||||
return;
|
||||
thread = cpu_local_var(current);
|
||||
|
||||
if(thread == NULL || thread == &cpu_local_var(idle)){
|
||||
struct thread *t;
|
||||
|
||||
irqstate = cpu_disable_interrupt_save();
|
||||
ihk_mc_spinlock_lock_noirq(&(cpu_local_var(runq_lock)));
|
||||
list_for_each_entry(t, &(cpu_local_var(runq)), sched_list){
|
||||
if(t == &cpu_local_var(idle))
|
||||
continue;
|
||||
if(t->status == PS_INTERRUPTIBLE &&
|
||||
hassigpending(t)){
|
||||
t->status = PS_RUNNING;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ihk_mc_spinlock_unlock_noirq(&(cpu_local_var(runq_lock)));
|
||||
cpu_restore_interrupt(irqstate);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if(regs != NULL && !interrupt_from_user(regs)) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (list_empty(&thread->sigpending) &&
|
||||
list_empty(&thread->sigcommon->sigpending)) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for(;;){
|
||||
pending = getsigpending(thread, 1);
|
||||
if(!pending) {
|
||||
dkprintf("check_signal,queue is empty\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (do_signal(rc, regs, thread, pending, num)) {
|
||||
num = -1;
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
return;
|
||||
}
|
||||
|
||||
static int
|
||||
check_sig_pending_thread(struct thread *thread)
|
||||
{
|
||||
int found = 0;
|
||||
struct list_head *head;
|
||||
mcs_rwlock_lock_t *lock;
|
||||
struct mcs_rwlock_node_irqsave mcs_rw_node;
|
||||
struct sig_pending *next;
|
||||
struct sig_pending *pending;
|
||||
__sigset_t w;
|
||||
__sigset_t x;
|
||||
int sig = 0;
|
||||
struct k_sigaction *k;
|
||||
struct cpu_local_var *v;
|
||||
|
||||
v = get_this_cpu_local_var();
|
||||
w = thread->sigmask.__val[0];
|
||||
|
||||
lock = &thread->sigcommon->lock;
|
||||
head = &thread->sigcommon->sigpending;
|
||||
for (;;) {
|
||||
mcs_rwlock_reader_lock(lock, &mcs_rw_node);
|
||||
|
||||
list_for_each_entry_safe(pending, next, head, list){
|
||||
for (x = pending->sigmask.__val[0], sig = 0; x;
|
||||
sig++, x >>= 1);
|
||||
k = thread->sigcommon->action + sig - 1;
|
||||
if ((sig != SIGCHLD &&
|
||||
sig != SIGURG &&
|
||||
sig != SIGCONT) ||
|
||||
(k->sa.sa_handler != (void *)1 &&
|
||||
k->sa.sa_handler != NULL)) {
|
||||
if (!(pending->sigmask.__val[0] & w)) {
|
||||
if (pending->interrupted == 0) {
|
||||
pending->interrupted = 1;
|
||||
found = 1;
|
||||
if (sig != SIGCHLD &&
|
||||
sig != SIGURG &&
|
||||
sig != SIGCONT &&
|
||||
!k->sa.sa_handler) {
|
||||
found = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mcs_rwlock_reader_unlock(lock, &mcs_rw_node);
|
||||
|
||||
if (found == 2) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (lock == &thread->sigpendinglock) {
|
||||
break;
|
||||
}
|
||||
|
||||
lock = &thread->sigpendinglock;
|
||||
head = &thread->sigpending;
|
||||
}
|
||||
|
||||
if (found == 2) {
|
||||
ihk_mc_spinlock_unlock(&v->runq_lock, v->runq_irqstate);
|
||||
terminate_mcexec(0, sig);
|
||||
return 1;
|
||||
}
|
||||
else if (found == 1) {
|
||||
ihk_mc_spinlock_unlock(&v->runq_lock, v->runq_irqstate);
|
||||
interrupt_syscall(thread, 0);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
check_sig_pending(void)
|
||||
{
|
||||
struct thread *thread;
|
||||
struct cpu_local_var *v;
|
||||
|
||||
if (clv == NULL)
|
||||
return;
|
||||
|
||||
v = get_this_cpu_local_var();
|
||||
repeat:
|
||||
v->runq_irqstate = ihk_mc_spinlock_lock(&v->runq_lock);
|
||||
list_for_each_entry(thread, &(v->runq), sched_list) {
|
||||
|
||||
if (thread == NULL || thread == &cpu_local_var(idle)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (thread->in_syscall_offload == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (thread->proc->group_exit_status & 0x0000000100000000L) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (check_sig_pending_thread(thread))
|
||||
goto repeat;
|
||||
}
|
||||
ihk_mc_spinlock_unlock(&v->runq_lock, v->runq_irqstate);
|
||||
}
|
||||
|
||||
unsigned long
|
||||
do_kill(struct thread *thread, int pid, int tid, int sig, siginfo_t *info,
|
||||
int ptracecont)
|
||||
|
||||
@ -94,7 +94,6 @@ struct get_cpu_set_arg {
|
||||
char *req_cpu_list; // Requested by user-space
|
||||
int req_cpu_list_len; // Lenght of request string
|
||||
int *process_rank;
|
||||
pid_t ppid;
|
||||
void *cpu_set;
|
||||
size_t cpu_set_size; // Size in bytes
|
||||
int *target_core;
|
||||
|
||||
@ -587,14 +587,13 @@ extern int mckernel_cpu_2_linux_cpu(struct mcctrl_usrdata *udp, int cpu_id);
|
||||
static long mcexec_get_cpuset(ihk_os_t os, unsigned long arg)
|
||||
{
|
||||
struct mcctrl_usrdata *udp = ihk_host_os_get_usrdata(os);
|
||||
struct mcctrl_part_exec *pe = NULL, *pe_itr;
|
||||
struct mcctrl_part_exec *pe;
|
||||
struct get_cpu_set_arg req;
|
||||
struct mcctrl_cpu_topology *cpu_top, *cpu_top_i;
|
||||
struct cache_topology *cache_top;
|
||||
int cpu, cpus_assigned, cpus_to_assign, cpu_prev;
|
||||
int ret = 0;
|
||||
int mcexec_linux_numa;
|
||||
int pe_list_len = 0;
|
||||
cpumask_t *mcexec_cpu_set = NULL;
|
||||
cpumask_t *cpus_used = NULL;
|
||||
cpumask_t *cpus_to_use = NULL;
|
||||
@ -615,7 +614,7 @@ static long mcexec_get_cpuset(ihk_os_t os, unsigned long arg)
|
||||
}
|
||||
|
||||
if (copy_from_user(&req, (void *)arg, sizeof(req))) {
|
||||
pr_err("%s: error copying user request\n", __func__);
|
||||
printk("%s: error copying user request\n", __FUNCTION__);
|
||||
ret = -EINVAL;
|
||||
goto put_out;
|
||||
}
|
||||
@ -692,49 +691,19 @@ static long mcexec_get_cpuset(ihk_os_t os, unsigned long arg)
|
||||
goto put_out;
|
||||
}
|
||||
|
||||
mutex_lock(&udp->part_exec_lock);
|
||||
/* Find part_exec having same node_proxy */
|
||||
list_for_each_entry_reverse(pe_itr, &udp->part_exec_list, chain) {
|
||||
pe_list_len++;
|
||||
if (pe_itr->node_proxy_pid == req.ppid) {
|
||||
pe = pe_itr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!pe) {
|
||||
/* First process to enter CPU partitioning */
|
||||
pr_debug("%s: pe_list_len:%d\n", __func__, pe_list_len);
|
||||
if (pe_list_len >= PE_LIST_MAXLEN) {
|
||||
/* delete head entry of pe_list */
|
||||
pe_itr = list_first_entry(&udp->part_exec_list,
|
||||
struct mcctrl_part_exec, chain);
|
||||
list_del(&pe_itr->chain);
|
||||
kfree(pe_itr);
|
||||
}
|
||||
|
||||
pe = kzalloc(sizeof(struct mcctrl_part_exec), GFP_KERNEL);
|
||||
if (!pe) {
|
||||
mutex_unlock(&udp->part_exec_lock);
|
||||
ret = -ENOMEM;
|
||||
goto put_out;
|
||||
}
|
||||
/* Init part_exec */
|
||||
mutex_init(&pe->lock);
|
||||
INIT_LIST_HEAD(&pe->pli_list);
|
||||
pe->nr_processes = req.nr_processes;
|
||||
pe->nr_processes_left = req.nr_processes;
|
||||
pe->nr_processes_joined = 0;
|
||||
pe->node_proxy_pid = req.ppid;
|
||||
|
||||
list_add_tail(&pe->chain, &udp->part_exec_list);
|
||||
dprintk("%s: nr_processes: %d (partitioned exec starts)\n",
|
||||
__func__, pe->nr_processes);
|
||||
}
|
||||
mutex_unlock(&udp->part_exec_lock);
|
||||
pe = &udp->part_exec;
|
||||
|
||||
mutex_lock(&pe->lock);
|
||||
|
||||
/* First process to enter CPU partitioning */
|
||||
if (pe->nr_processes == -1) {
|
||||
pe->nr_processes = req.nr_processes;
|
||||
pe->nr_processes_left = req.nr_processes;
|
||||
dprintk("%s: nr_processes: %d (partitioned exec starts)\n",
|
||||
__FUNCTION__,
|
||||
pe->nr_processes);
|
||||
}
|
||||
|
||||
if (pe->nr_processes != req.nr_processes) {
|
||||
printk("%s: error: requested number of processes"
|
||||
" doesn't match current partitioned execution\n",
|
||||
@ -743,15 +712,7 @@ static long mcexec_get_cpuset(ihk_os_t os, unsigned long arg)
|
||||
goto put_and_unlock_out;
|
||||
}
|
||||
|
||||
if (pe->nr_processes_joined >= pe->nr_processes) {
|
||||
printk("%s: too many processes have joined to the group of %d\n",
|
||||
__func__, req.ppid);
|
||||
ret = -EINVAL;
|
||||
goto put_and_unlock_out;
|
||||
}
|
||||
|
||||
--pe->nr_processes_left;
|
||||
++pe->nr_processes_joined;
|
||||
dprintk("%s: nr_processes: %d, nr_processes_left: %d\n",
|
||||
__FUNCTION__,
|
||||
pe->nr_processes,
|
||||
@ -837,6 +798,8 @@ static long mcexec_get_cpuset(ihk_os_t os, unsigned long arg)
|
||||
wake_up_interruptible(&pli_next->pli_wq);
|
||||
}
|
||||
|
||||
/* Reset process counter to start state */
|
||||
pe->nr_processes = -1;
|
||||
ret = -ETIMEDOUT;
|
||||
goto put_and_unlock_out;
|
||||
}
|
||||
@ -1084,8 +1047,16 @@ next_cpu:
|
||||
/* Commit used cores to OS structure */
|
||||
memcpy(&pe->cpus_used, cpus_used, sizeof(*cpus_used));
|
||||
|
||||
/* If not last process, wake up next process in list */
|
||||
if (pe->nr_processes_left != 0) {
|
||||
/* Reset if last process */
|
||||
if (pe->nr_processes_left == 0) {
|
||||
dprintk("%s: nr_processes: %d (partitioned exec ends)\n",
|
||||
__FUNCTION__,
|
||||
pe->nr_processes);
|
||||
pe->nr_processes = -1;
|
||||
memset(&pe->cpus_used, 0, sizeof(pe->cpus_used));
|
||||
}
|
||||
/* Otherwise wake up next process in list */
|
||||
else {
|
||||
++pe->process_rank;
|
||||
pli_next = list_first_entry(&pe->pli_list,
|
||||
struct process_list_item, list);
|
||||
|
||||
@ -513,7 +513,6 @@ int prepare_ikc_channels(ihk_os_t os)
|
||||
|
||||
init_waitqueue_head(&usrdata->wq_procfs);
|
||||
mutex_init(&usrdata->reserve_lock);
|
||||
mutex_init(&usrdata->part_exec_lock);
|
||||
|
||||
for (i = 0; i < MCCTRL_PER_PROC_DATA_HASH_SIZE; ++i) {
|
||||
INIT_LIST_HEAD(&usrdata->per_proc_data_hash[i]);
|
||||
@ -522,8 +521,10 @@ int prepare_ikc_channels(ihk_os_t os)
|
||||
|
||||
INIT_LIST_HEAD(&usrdata->cpu_topology_list);
|
||||
INIT_LIST_HEAD(&usrdata->node_topology_list);
|
||||
INIT_LIST_HEAD(&usrdata->part_exec_list);
|
||||
|
||||
mutex_init(&usrdata->part_exec.lock);
|
||||
INIT_LIST_HEAD(&usrdata->part_exec.pli_list);
|
||||
usrdata->part_exec.nr_processes = -1;
|
||||
INIT_LIST_HEAD(&usrdata->wakeup_descs_list);
|
||||
spin_lock_init(&usrdata->wakeup_descs_lock);
|
||||
|
||||
@ -579,18 +580,6 @@ void destroy_ikc_channels(ihk_os_t os)
|
||||
|
||||
kfree(usrdata->channels);
|
||||
kfree(usrdata->ikc2linux);
|
||||
|
||||
mutex_lock(&usrdata->part_exec_lock);
|
||||
while (!list_empty(&usrdata->part_exec_list)) {
|
||||
struct mcctrl_part_exec *pe;
|
||||
|
||||
pe = list_first_entry(&usrdata->part_exec_list,
|
||||
struct mcctrl_part_exec, chain);
|
||||
list_del(&pe->chain);
|
||||
kfree(pe);
|
||||
}
|
||||
mutex_unlock(&usrdata->part_exec_lock);
|
||||
|
||||
kfree(usrdata);
|
||||
}
|
||||
|
||||
|
||||
@ -324,20 +324,13 @@ struct process_list_item {
|
||||
wait_queue_head_t pli_wq;
|
||||
};
|
||||
|
||||
#define PE_LIST_MAXLEN 5
|
||||
|
||||
struct mcctrl_part_exec {
|
||||
struct mutex lock;
|
||||
int nr_processes;
|
||||
/* number of processes to let in / out the synchronization point */
|
||||
int nr_processes_left;
|
||||
/* number of processes which have joined the partition */
|
||||
int nr_processes_joined;
|
||||
int process_rank;
|
||||
pid_t node_proxy_pid;
|
||||
cpumask_t cpus_used;
|
||||
struct list_head pli_list;
|
||||
struct list_head chain;
|
||||
};
|
||||
|
||||
#define CPU_LONGS (((NR_CPUS) + (BITS_PER_LONG) - 1) / (BITS_PER_LONG))
|
||||
@ -360,7 +353,6 @@ struct mcctrl_usrdata {
|
||||
int job_pos;
|
||||
int mcctrl_dma_abort;
|
||||
struct mutex reserve_lock;
|
||||
struct mutex part_exec_lock;
|
||||
unsigned long last_thread_exec;
|
||||
wait_queue_head_t wq_procfs;
|
||||
struct list_head per_proc_data_hash[MCCTRL_PER_PROC_DATA_HASH_SIZE];
|
||||
@ -376,7 +368,7 @@ struct mcctrl_usrdata {
|
||||
nodemask_t numa_online;
|
||||
struct list_head cpu_topology_list;
|
||||
struct list_head node_topology_list;
|
||||
struct list_head part_exec_list;
|
||||
struct mcctrl_part_exec part_exec;
|
||||
int perf_event_num;
|
||||
};
|
||||
|
||||
|
||||
@ -539,7 +539,11 @@ retry_alloc:
|
||||
#define USE_VM_INSERT_PFN 1
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
|
||||
#if defined(RHEL_RELEASE_CODE) && RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(8, 2)
|
||||
static vm_fault_t rus_vm_fault(struct vm_fault *vmf)
|
||||
#else
|
||||
static int rus_vm_fault(struct vm_fault *vmf)
|
||||
#endif
|
||||
{
|
||||
struct vm_area_struct *vma = vmf->vma;
|
||||
#else
|
||||
|
||||
@ -1322,7 +1322,8 @@ void init_sigaction(void)
|
||||
|
||||
master_tid = gettid();
|
||||
for (i = 1; i <= 64; i++) {
|
||||
if (i != SIGKILL && i != SIGSTOP && i != SIGCHLD) {
|
||||
if (i != SIGKILL && i != SIGSTOP && i != SIGCHLD &&
|
||||
i != SIGTSTP && i != SIGTTIN && i != SIGTTOU) {
|
||||
struct sigaction act;
|
||||
|
||||
sigaction(i, NULL, &act);
|
||||
@ -2546,7 +2547,6 @@ int main(int argc, char **argv)
|
||||
cpu_set_arg.cpu_set = (void *)&desc->cpu_set;
|
||||
cpu_set_arg.cpu_set_size = sizeof(desc->cpu_set);
|
||||
cpu_set_arg.nr_processes = nr_processes;
|
||||
cpu_set_arg.ppid = getppid();
|
||||
cpu_set_arg.target_core = &target_core;
|
||||
cpu_set_arg.process_rank = &process_rank;
|
||||
cpu_set_arg.mcexec_linux_numa = &mcexec_linux_numa;
|
||||
|
||||
2
ihk
2
ihk
Submodule ihk updated: 1a6150c5bb...df12c9102c
@ -139,7 +139,6 @@ static void hugefileobj_free(struct memobj *memobj)
|
||||
struct memobj_ops hugefileobj_ops = {
|
||||
.free = hugefileobj_free,
|
||||
.get_page = hugefileobj_get_page,
|
||||
|
||||
};
|
||||
|
||||
void hugefileobj_cleanup(void)
|
||||
|
||||
@ -72,4 +72,11 @@
|
||||
#define MS_INVALIDATE 0x02
|
||||
#define MS_SYNC 0x04
|
||||
|
||||
/* include/uapi/linux/mman.h */
|
||||
#define OVERCOMMIT_GUESS 0
|
||||
#define OVERCOMMIT_ALWAYS 1
|
||||
#define OVERCOMMIT_NEVER 2
|
||||
|
||||
extern int sysctl_overcommit_memory;
|
||||
|
||||
#endif /* HEADER_MMAN_H */
|
||||
|
||||
@ -505,10 +505,12 @@ struct process {
|
||||
// PS_STOPPED -----+
|
||||
// (PS_TRACED)
|
||||
|
||||
/* Store exit_status for a group of threads when stopped by SIGSTOP.
|
||||
exit_status can't be used because values of exit_status of threads
|
||||
might divert while the threads are exiting by group_exit(). */
|
||||
int group_exit_status;
|
||||
/* Store exit_status for a group of threads when stopped by SIGSTOP. */
|
||||
/* exit_status can't be used because values of exit_status of threads */
|
||||
/* might divert while the threads are exiting by group_exit(). */
|
||||
/* The upper 4 bytes of group_exit_status is the confirmation flag of */
|
||||
/* exit status. The lower 4 bytes is the exit status. */
|
||||
unsigned long group_exit_status;
|
||||
|
||||
/* Manage ptraced processes in the separate list to make it easy to
|
||||
restore the orginal parent child relationship when
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#include <ihk/ihk_monitor.h>
|
||||
#include <ihk/debug.h>
|
||||
#include <memory.h>
|
||||
#include <mman.h>
|
||||
|
||||
#ifdef ENABLE_RUSAGE
|
||||
|
||||
@ -56,6 +57,24 @@ rusage_total_memory_add(unsigned long size)
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
rusage_get_total_memory()
|
||||
{
|
||||
return rusage.total_memory;
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
rusage_get_free_memory()
|
||||
{
|
||||
return rusage.total_memory - rusage.total_memory_usage;
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
rusage_get_usage_memory()
|
||||
{
|
||||
return rusage.total_memory_usage;
|
||||
}
|
||||
|
||||
static inline void
|
||||
rusage_rss_add(unsigned long size)
|
||||
{
|
||||
@ -293,6 +312,9 @@ rusage_check_overmap(size_t len, int pgshift)
|
||||
{
|
||||
int npages = 0, remain_pages = 0;
|
||||
|
||||
if (sysctl_overcommit_memory == OVERCOMMIT_ALWAYS)
|
||||
return 0;
|
||||
|
||||
npages = (len + (1UL << pgshift) - 1) >> pgshift;
|
||||
remain_pages = (rusage.total_memory - rusage.total_memory_usage)
|
||||
>> pgshift;
|
||||
@ -399,6 +421,24 @@ rusage_rss_add(unsigned long size)
|
||||
{
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
rusage_get_total_memory()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
rusage_get_free_memory()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
rusage_get_usage_memory()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void
|
||||
rusage_rss_sub(unsigned long size)
|
||||
{
|
||||
|
||||
@ -443,6 +443,22 @@ struct rusage {
|
||||
long ru_nivcsw;
|
||||
};
|
||||
|
||||
struct sysinfo {
|
||||
long uptime; /* Seconds since boot */
|
||||
unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
|
||||
unsigned long totalram; /* Total usable main memory size */
|
||||
unsigned long freeram; /* Available memory size */
|
||||
unsigned long sharedram; /* Amount of shared memory */
|
||||
unsigned long bufferram; /* Memory used by buffers */
|
||||
unsigned long totalswap; /* Total swap space size */
|
||||
unsigned long freeswap; /* swap space still available */
|
||||
unsigned short procs; /* Number of current processes */
|
||||
unsigned long totalhigh; /* Total high memory size */
|
||||
unsigned long freehigh; /* Available high memory size */
|
||||
unsigned int mem_unit; /* Memory unit size in bytes */
|
||||
char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding for libc5 */
|
||||
};
|
||||
|
||||
extern void terminate(int, int);
|
||||
|
||||
struct tod_data_s {
|
||||
@ -635,4 +651,6 @@ extern int (*linux_clock_gettime)(clockid_t clk_id, struct timespec *tp);
|
||||
#define COREDUMP_TO_BE_WOKEN 2
|
||||
|
||||
extern void terminate_host(int pid, struct thread *thread);
|
||||
struct sig_pending *getsigpending(struct thread *thread, int delflag);
|
||||
int interrupt_from_user(void *regs0);
|
||||
#endif
|
||||
|
||||
@ -62,6 +62,7 @@ extern int interrupt_from_user(void *);
|
||||
struct tlb_flush_entry tlb_flush_vector[IHK_TLB_FLUSH_IRQ_VECTOR_SIZE];
|
||||
|
||||
int anon_on_demand = 0;
|
||||
int sysctl_overcommit_memory = OVERCOMMIT_ALWAYS;
|
||||
|
||||
static struct ihk_mc_pa_ops *pa_ops;
|
||||
|
||||
|
||||
@ -2176,13 +2176,62 @@ static int do_page_fault_process_vm(struct process_vm *vm, void *fault_addr0, ui
|
||||
{
|
||||
int error;
|
||||
const uintptr_t fault_addr = (uintptr_t)fault_addr0;
|
||||
struct vm_range *range;
|
||||
struct vm_range *range = NULL;
|
||||
struct thread *thread = cpu_local_var(current);
|
||||
int locked = 0;
|
||||
|
||||
dkprintf("[%d]do_page_fault_process_vm(%p,%lx,%lx)\n",
|
||||
ihk_mc_get_processor_id(), vm, fault_addr0, reason);
|
||||
|
||||
/* grow stack */
|
||||
if (fault_addr >= thread->vm->region.stack_start &&
|
||||
fault_addr < thread->vm->region.stack_end) {
|
||||
range = lookup_process_memory_range(vm,
|
||||
thread->vm->region.stack_end - 1,
|
||||
thread->vm->region.stack_end);
|
||||
if (range == NULL) {
|
||||
error = -EFAULT;
|
||||
ekprintf("%s: vm: %p, addr: %p, reason: %lx):"
|
||||
"stack not found: %d\n",
|
||||
__func__, vm, fault_addr0, reason, error);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* don't grow if replaced with hugetlbfs */
|
||||
if (range->memobj) {
|
||||
goto skip;
|
||||
}
|
||||
|
||||
if (fault_addr >= range->start) {
|
||||
goto skip;
|
||||
}
|
||||
|
||||
if (thread->vm->is_memory_range_lock_taken == -1 ||
|
||||
thread->vm->is_memory_range_lock_taken !=
|
||||
ihk_mc_get_processor_id()) {
|
||||
ihk_rwspinlock_write_lock_noirq(&vm->memory_range_lock);
|
||||
locked = 1;
|
||||
}
|
||||
|
||||
if (range->pgshift) {
|
||||
range->start = fault_addr &
|
||||
~((1UL << range->pgshift) - 1);
|
||||
} else {
|
||||
range->start = fault_addr & PAGE_MASK;
|
||||
}
|
||||
|
||||
if (locked) {
|
||||
ihk_rwspinlock_write_unlock_noirq(&vm->memory_range_lock);
|
||||
locked = 0;
|
||||
}
|
||||
|
||||
dkprintf("%s: addr: %lx, reason: %lx, range: %lx-%lx:"
|
||||
"stack found\n",
|
||||
__func__, (unsigned long)fault_addr, reason,
|
||||
range->start, range->end);
|
||||
}
|
||||
skip:
|
||||
|
||||
if (thread->vm->is_memory_range_lock_taken == -1 ||
|
||||
thread->vm->is_memory_range_lock_taken != ihk_mc_get_processor_id()) {
|
||||
ihk_rwspinlock_read_lock_noirq(&vm->memory_range_lock);
|
||||
@ -2197,14 +2246,17 @@ static int do_page_fault_process_vm(struct process_vm *vm, void *fault_addr0, ui
|
||||
goto out;
|
||||
}
|
||||
|
||||
range = lookup_process_memory_range(vm, fault_addr, fault_addr+1);
|
||||
if (!range) {
|
||||
range = lookup_process_memory_range(vm, fault_addr,
|
||||
fault_addr+1);
|
||||
if (range == NULL) {
|
||||
error = -EFAULT;
|
||||
dkprintf("do_page_fault_process_vm(): vm: %p, addr: %p, reason: %lx):"
|
||||
dkprintf("%s: vm: %p, addr: %p, reason: %lx):"
|
||||
"out of range: %d\n",
|
||||
vm, fault_addr0, reason, error);
|
||||
__func__, vm, fault_addr0, reason, error);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
if (((range->flag & VR_PROT_MASK) == VR_PROT_NONE)
|
||||
|| (((reason & PF_WRITE) && !(reason & PF_PATCH))
|
||||
@ -2367,16 +2419,15 @@ int init_process_stack(struct thread *thread, struct program_load_desc *pn,
|
||||
size = minsz;
|
||||
}
|
||||
size = (size + USER_STACK_PREPAGE_SIZE - 1) & USER_STACK_PAGE_MASK;
|
||||
dkprintf("%s: stack_premap: %lu, rlim_cur: %lu, minsz: %lu, size: %lu\n",
|
||||
__FUNCTION__,
|
||||
pn->stack_premap,
|
||||
dkprintf("%s: stack_premap: %lu, rlim_cur: %lu, minsz: %lu, size: %lu, maxsz: %lx\n",
|
||||
__func__, pn->stack_premap,
|
||||
proc->rlimit[MCK_RLIMIT_STACK].rlim_cur,
|
||||
minsz, size);
|
||||
start = (end - size) & USER_STACK_PAGE_MASK;
|
||||
minsz, size, maxsz);
|
||||
start = (end - minsz) & USER_STACK_PAGE_MASK;
|
||||
|
||||
/* Apply user allocation policy to stacks */
|
||||
/* TODO: make threshold kernel or mcexec argument */
|
||||
ap_flag = (size >= proc->mpol_threshold &&
|
||||
ap_flag = (minsz >= proc->mpol_threshold &&
|
||||
!(proc->mpol_flags & MPOL_NO_STACK)) ? IHK_MC_AP_USER : 0;
|
||||
dkprintf("%s: max size: %lu, mapped size: %lu %s\n",
|
||||
__FUNCTION__, size, minsz,
|
||||
@ -2508,7 +2559,7 @@ int init_process_stack(struct thread *thread, struct program_load_desc *pn,
|
||||
ihk_mc_modify_user_context(thread->uctx, IHK_UCR_STACK_POINTER,
|
||||
end + sizeof(unsigned long) * s_ind);
|
||||
thread->vm->region.stack_end = end;
|
||||
thread->vm->region.stack_start = start;
|
||||
thread->vm->region.stack_start = (end - size) & USER_STACK_PAGE_MASK;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
567
kernel/syscall.c
567
kernel/syscall.c
@ -120,7 +120,6 @@ extern int num_processors;
|
||||
extern unsigned long ihk_mc_get_ns_per_tsc(void);
|
||||
extern int ptrace_detach(int pid, int data);
|
||||
extern void debug_log(unsigned long);
|
||||
extern int arch_clear_host_user_space();
|
||||
extern long arch_ptrace(long request, int pid, long addr, long data);
|
||||
extern struct cpu_local_var *clv;
|
||||
|
||||
@ -449,34 +448,59 @@ static int wait_stopped(struct thread *thread, struct process *child, struct thr
|
||||
thread->proc->pid, child->pid, options);
|
||||
int ret;
|
||||
|
||||
/* Copy exit_status created in do_signal */
|
||||
int *exit_status;
|
||||
|
||||
if (c_thread) {
|
||||
exit_status = &c_thread->exit_status;
|
||||
}
|
||||
else if (child->status & (PS_STOPPED | PS_DELAY_STOPPED)) {
|
||||
exit_status = &child->group_exit_status;
|
||||
}
|
||||
else {
|
||||
exit_status = &child->main_thread->exit_status;
|
||||
}
|
||||
|
||||
/* Skip this process because exit_status has been reaped. */
|
||||
if (!*exit_status) {
|
||||
if (!c_thread->exit_status) {
|
||||
ret = 0;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* TODO: define 0x7f in kernel/include/process.h */
|
||||
if (status) {
|
||||
*status = (*exit_status << 8) | 0x7f;
|
||||
*status = (c_thread->exit_status << 8) | 0x7f;
|
||||
}
|
||||
|
||||
/* Reap exit_status. signal_flags is reaped on receiving signal
|
||||
in do_kill(). */
|
||||
/* Reap exit_status. signal_flags is reaped on receiving */
|
||||
/* signal in do_kill(). */
|
||||
if (!(options & WNOWAIT)) {
|
||||
*exit_status = 0;
|
||||
c_thread->exit_status = 0;
|
||||
}
|
||||
}
|
||||
else if (child->status & (PS_STOPPED | PS_DELAY_STOPPED)) {
|
||||
/* Skip this process because exit_status has been reaped. */
|
||||
if (!child->group_exit_status) {
|
||||
ret = 0;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* TODO: define 0x7f in kernel/include/process.h */
|
||||
if (status) {
|
||||
*status = (child->group_exit_status << 8) | 0x7f;
|
||||
}
|
||||
|
||||
/* Reap exit_status. signal_flags is reaped on receiving */
|
||||
/* signal in do_kill(). */
|
||||
if (!(options & WNOWAIT)) {
|
||||
child->group_exit_status = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Skip this process because exit_status has been reaped. */
|
||||
if (!child->main_thread->exit_status) {
|
||||
ret = 0;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* TODO: define 0x7f in kernel/include/process.h */
|
||||
if (status) {
|
||||
*status = (child->main_thread->exit_status << 8) | 0x7f;
|
||||
}
|
||||
|
||||
/* Reap exit_status. signal_flags is reaped on receiving */
|
||||
/* signal in do_kill(). */
|
||||
if (!(options & WNOWAIT)) {
|
||||
child->main_thread->exit_status = 0;
|
||||
}
|
||||
}
|
||||
|
||||
dkprintf("wait_stopped,child->pid=%d,status=%08x\n",
|
||||
@ -2654,10 +2678,8 @@ static int do_execveat(ihk_mc_user_context_t *ctx, int dirfd,
|
||||
}
|
||||
|
||||
/* Clear host user space PTEs */
|
||||
if (arch_clear_host_user_space()) {
|
||||
kprintf("execve(): ERROR: clearing PTEs in host process\n");
|
||||
panic("");
|
||||
}
|
||||
clear_host_pte(vm->region.user_start,
|
||||
(vm->region.user_end - vm->region.user_start), 0);
|
||||
|
||||
/* Request host to transfer ELF image */
|
||||
request.number = __NR_execve;
|
||||
@ -3218,7 +3240,6 @@ SYSCALL_DECLARE(kill)
|
||||
return error;
|
||||
}
|
||||
|
||||
// see linux-2.6.34.13/kernel/signal.c
|
||||
SYSCALL_DECLARE(tgkill)
|
||||
{
|
||||
int tgid = ihk_mc_syscall_arg0(ctx);
|
||||
@ -3227,16 +3248,15 @@ SYSCALL_DECLARE(tgkill)
|
||||
struct thread *thread = cpu_local_var(current);
|
||||
struct siginfo info;
|
||||
|
||||
if (tgid <= 0 || tid <= 0) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
memset(&info, '\0', sizeof info);
|
||||
info.si_signo = sig;
|
||||
info.si_code = SI_TKILL;
|
||||
info._sifields._kill.si_pid = thread->proc->pid;
|
||||
|
||||
if(tid <= 0)
|
||||
return -EINVAL;
|
||||
if(tgid <= 0 && tgid != -1)
|
||||
return -EINVAL;
|
||||
|
||||
return do_kill(thread, tgid, tid, sig, &info, 0);
|
||||
}
|
||||
|
||||
@ -3511,9 +3531,15 @@ SYSCALL_DECLARE(setpgid)
|
||||
|
||||
/* Ignore the registration by start_thread() (in pthread_create.c)
|
||||
because McKernel doesn't unlock mutex-es held by the thread which has been killed. */
|
||||
#define ROBUST_LIST_HEAD_SIZE 24
|
||||
SYSCALL_DECLARE(set_robust_list)
|
||||
{
|
||||
// Palliative fix. wait for impl.
|
||||
size_t len = (size_t)ihk_mc_syscall_arg1(ctx);
|
||||
|
||||
if (len != ROBUST_LIST_HEAD_SIZE) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -5134,6 +5160,37 @@ SYSCALL_DECLARE(rt_sigsuspend)
|
||||
return do_sigsuspend(thread, &wset);
|
||||
}
|
||||
|
||||
SYSCALL_DECLARE(rt_sigaction)
|
||||
{
|
||||
int sig = ihk_mc_syscall_arg0(ctx);
|
||||
const struct sigaction *act =
|
||||
(const struct sigaction *)ihk_mc_syscall_arg1(ctx);
|
||||
struct sigaction *oact = (struct sigaction *)ihk_mc_syscall_arg2(ctx);
|
||||
size_t sigsetsize = ihk_mc_syscall_arg3(ctx);
|
||||
struct k_sigaction new_sa, old_sa;
|
||||
int rc;
|
||||
|
||||
if (sigsetsize != sizeof(sigset_t))
|
||||
return -EINVAL;
|
||||
|
||||
if (act) {
|
||||
if (copy_from_user(&new_sa.sa, act, sizeof(new_sa.sa))) {
|
||||
goto fault;
|
||||
}
|
||||
}
|
||||
|
||||
rc = do_sigaction(sig, act ? &new_sa : NULL, oact ? &old_sa : NULL);
|
||||
if (rc == 0 && oact) {
|
||||
if (copy_to_user(oact, &old_sa.sa, sizeof(old_sa.sa))) {
|
||||
goto fault;
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
fault:
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
SYSCALL_DECLARE(sigaltstack)
|
||||
{
|
||||
struct thread *thread = cpu_local_var(current);
|
||||
@ -6538,71 +6595,162 @@ static int rlimits[] = {
|
||||
#endif
|
||||
};
|
||||
|
||||
SYSCALL_DECLARE(setrlimit)
|
||||
static int do_prlimit64(int pid, int resource, struct rlimit *_new_limit,
|
||||
struct rlimit *old_limit)
|
||||
{
|
||||
int rc;
|
||||
int resource = ihk_mc_syscall_arg0(ctx);
|
||||
struct rlimit *rlm = (struct rlimit *)ihk_mc_syscall_arg1(ctx);
|
||||
struct thread *thread = cpu_local_var(current);
|
||||
struct rlimit new_limit;
|
||||
int resource_found;
|
||||
int i;
|
||||
struct rlimit new_rlim;
|
||||
int mcresource;
|
||||
struct process *proc;
|
||||
struct resource_set *rset = cpu_local_var(resource_set);
|
||||
int hash;
|
||||
struct process_hash *phash = rset->process_hash;
|
||||
struct mcs_rwlock_node exist_lock;
|
||||
struct mcs_rwlock_node update_lock;
|
||||
unsigned long irqstate;
|
||||
int found;
|
||||
int ret;
|
||||
ihk_mc_user_context_t ctx;
|
||||
|
||||
if (copy_from_user(&new_rlim, rlm, sizeof(*rlm))) {
|
||||
return -EFAULT;
|
||||
}
|
||||
if (new_rlim.rlim_cur > new_rlim.rlim_max) {
|
||||
if (resource < 0 || resource >= RLIMIT_NLIMITS) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (_new_limit) {
|
||||
if (copy_from_user(&new_limit, _new_limit,
|
||||
sizeof(struct rlimit))) {
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
if (new_limit.rlim_cur > new_limit.rlim_max) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* update Linux side value as well */
|
||||
switch (resource) {
|
||||
case RLIMIT_FSIZE:
|
||||
case RLIMIT_NOFILE:
|
||||
case RLIMIT_LOCKS:
|
||||
case RLIMIT_MSGQUEUE:
|
||||
rc = syscall_generic_forwarding(__NR_setrlimit, ctx);
|
||||
if(rc < 0)
|
||||
return rc;
|
||||
ihk_mc_syscall_arg0(&ctx) = pid;
|
||||
ihk_mc_syscall_arg1(&ctx) = resource;
|
||||
ihk_mc_syscall_arg2(&ctx) =
|
||||
(unsigned long)_new_limit;
|
||||
ihk_mc_syscall_arg3(&ctx) =
|
||||
(unsigned long)old_limit;
|
||||
ret = syscall_generic_forwarding(__NR_prlimit64, &ctx);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for(i = 0; i < sizeof(rlimits) / sizeof(int); i += 2)
|
||||
/* translate resource */
|
||||
resource_found = 0;
|
||||
for (i = 0; i < sizeof(rlimits) / sizeof(int); i += 2) {
|
||||
if (rlimits[i] == resource) {
|
||||
mcresource = rlimits[i + 1];
|
||||
resource_found = 1;
|
||||
break;
|
||||
}
|
||||
if(i >= sizeof(rlimits) / sizeof(int)){
|
||||
return syscall_generic_forwarding(__NR_setrlimit, ctx);
|
||||
}
|
||||
|
||||
memcpy(thread->proc->rlimit + mcresource, &new_rlim,
|
||||
sizeof(new_rlim));
|
||||
if (!resource_found) {
|
||||
ihk_mc_syscall_arg0(&ctx) = pid;
|
||||
ihk_mc_syscall_arg1(&ctx) = resource;
|
||||
ihk_mc_syscall_arg2(&ctx) =
|
||||
(unsigned long)_new_limit;
|
||||
ihk_mc_syscall_arg3(&ctx) =
|
||||
(unsigned long)old_limit;
|
||||
return syscall_generic_forwarding(__NR_prlimit64, &ctx);
|
||||
}
|
||||
|
||||
return 0;
|
||||
/* find process */
|
||||
found = 0;
|
||||
|
||||
if (pid == 0) {
|
||||
struct thread *thread = cpu_local_var(current);
|
||||
|
||||
pid = thread->proc->pid;
|
||||
}
|
||||
|
||||
irqstate = cpu_disable_interrupt_save();
|
||||
hash = process_hash(pid);
|
||||
mcs_rwlock_reader_lock_noirq(&phash->lock[hash], &exist_lock);
|
||||
|
||||
list_for_each_entry(proc, &phash->list[hash], hash_list) {
|
||||
if (proc->pid == pid) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
mcs_rwlock_reader_unlock_noirq(&phash->lock[hash], &exist_lock);
|
||||
cpu_restore_interrupt(irqstate);
|
||||
return -ESRCH;
|
||||
}
|
||||
|
||||
if (_new_limit) {
|
||||
mcs_rwlock_writer_lock_noirq(&proc->update_lock, &update_lock);
|
||||
} else {
|
||||
mcs_rwlock_reader_lock_noirq(&proc->update_lock, &update_lock);
|
||||
}
|
||||
|
||||
if (old_limit) {
|
||||
if (copy_to_user(old_limit, proc->rlimit + mcresource,
|
||||
sizeof(struct rlimit))) {
|
||||
ret = -EFAULT;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
if (_new_limit) {
|
||||
memcpy(proc->rlimit + mcresource, &new_limit,
|
||||
sizeof(struct rlimit));
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
out:
|
||||
if (_new_limit) {
|
||||
mcs_rwlock_writer_unlock_noirq(&proc->update_lock,
|
||||
&update_lock);
|
||||
} else {
|
||||
mcs_rwlock_reader_unlock_noirq(&proc->update_lock,
|
||||
&update_lock);
|
||||
}
|
||||
|
||||
mcs_rwlock_reader_unlock_noirq(&phash->lock[hash], &exist_lock);
|
||||
cpu_restore_interrupt(irqstate);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
SYSCALL_DECLARE(setrlimit)
|
||||
{
|
||||
int resource = ihk_mc_syscall_arg0(ctx);
|
||||
struct rlimit *new_limit = (struct rlimit *)ihk_mc_syscall_arg1(ctx);
|
||||
|
||||
return do_prlimit64(0, resource, new_limit, NULL);
|
||||
}
|
||||
|
||||
SYSCALL_DECLARE(getrlimit)
|
||||
{
|
||||
int resource = ihk_mc_syscall_arg0(ctx);
|
||||
struct rlimit *rlm = (struct rlimit *)ihk_mc_syscall_arg1(ctx);
|
||||
struct thread *thread = cpu_local_var(current);
|
||||
int i;
|
||||
int mcresource;
|
||||
struct rlimit *old_limit = (struct rlimit *)ihk_mc_syscall_arg1(ctx);
|
||||
|
||||
for(i = 0; i < sizeof(rlimits) / sizeof(int); i += 2)
|
||||
if(rlimits[i] == resource){
|
||||
mcresource = rlimits[i + 1];
|
||||
break;
|
||||
}
|
||||
if(i >= sizeof(rlimits) / sizeof(int)){
|
||||
return syscall_generic_forwarding(__NR_getrlimit, ctx);
|
||||
return do_prlimit64(0, resource, NULL, old_limit);
|
||||
}
|
||||
|
||||
// TODO: check limit
|
||||
if(copy_to_user(rlm, thread->proc->rlimit + mcresource, sizeof(struct rlimit)))
|
||||
return -EFAULT;
|
||||
SYSCALL_DECLARE(prlimit64)
|
||||
{
|
||||
int pid = ihk_mc_syscall_arg0(ctx);
|
||||
int resource = ihk_mc_syscall_arg1(ctx);
|
||||
struct rlimit *new_limit = (struct rlimit *)ihk_mc_syscall_arg2(ctx);
|
||||
struct rlimit *old_limit = (struct rlimit *)ihk_mc_syscall_arg3(ctx);
|
||||
|
||||
return 0;
|
||||
return do_prlimit64(pid, resource, new_limit, old_limit);
|
||||
}
|
||||
|
||||
SYSCALL_DECLARE(getrusage)
|
||||
@ -6680,6 +6828,27 @@ SYSCALL_DECLARE(getrusage)
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYSCALL_DECLARE(sysinfo)
|
||||
{
|
||||
struct sysinfo *sysinfo = (struct sysinfo *)ihk_mc_syscall_arg0(ctx);
|
||||
struct sysinfo __sysinfo;
|
||||
int ret = 0;
|
||||
|
||||
memset(&__sysinfo, '\0', sizeof(struct sysinfo));
|
||||
|
||||
__sysinfo.totalram = rusage_get_total_memory();
|
||||
__sysinfo.freeram = rusage_get_free_memory();
|
||||
__sysinfo.mem_unit = 1; // always one unit for McKernel
|
||||
|
||||
if (copy_to_user(sysinfo, &__sysinfo, sizeof(struct sysinfo))) {
|
||||
ret = -EFAULT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern int ptrace_traceme(void);
|
||||
extern void set_single_step(struct thread *thread);
|
||||
|
||||
@ -10335,3 +10504,275 @@ long syscall(int num, ihk_mc_user_context_t *ctx)
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
static int
|
||||
check_sig_pending_thread(struct thread *thread)
|
||||
{
|
||||
int found = 0;
|
||||
struct list_head *head;
|
||||
mcs_rwlock_lock_t *lock;
|
||||
struct mcs_rwlock_node_irqsave mcs_rw_node;
|
||||
struct sig_pending *next;
|
||||
struct sig_pending *pending;
|
||||
__sigset_t w;
|
||||
__sigset_t x;
|
||||
int sig = 0;
|
||||
struct k_sigaction *k;
|
||||
struct cpu_local_var *v;
|
||||
|
||||
v = get_this_cpu_local_var();
|
||||
w = thread->sigmask.__val[0];
|
||||
|
||||
lock = &thread->sigcommon->lock;
|
||||
head = &thread->sigcommon->sigpending;
|
||||
for (;;) {
|
||||
mcs_rwlock_reader_lock(lock, &mcs_rw_node);
|
||||
|
||||
list_for_each_entry_safe(pending, next, head, list) {
|
||||
for (x = pending->sigmask.__val[0], sig = 0; x;
|
||||
sig++, x >>= 1) {
|
||||
}
|
||||
k = thread->sigcommon->action + sig - 1;
|
||||
if ((sig != SIGCHLD &&
|
||||
sig != SIGURG &&
|
||||
sig != SIGCONT) ||
|
||||
(k->sa.sa_handler != SIG_IGN &&
|
||||
k->sa.sa_handler != NULL)) {
|
||||
if (!(pending->sigmask.__val[0] & w)) {
|
||||
if (pending->interrupted == 0) {
|
||||
pending->interrupted = 1;
|
||||
found = 1;
|
||||
if (sig != SIGCHLD &&
|
||||
sig != SIGURG &&
|
||||
sig != SIGCONT &&
|
||||
!k->sa.sa_handler) {
|
||||
found = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mcs_rwlock_reader_unlock(lock, &mcs_rw_node);
|
||||
|
||||
if (found == 2) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (lock == &thread->sigpendinglock) {
|
||||
break;
|
||||
}
|
||||
|
||||
lock = &thread->sigpendinglock;
|
||||
head = &thread->sigpending;
|
||||
}
|
||||
|
||||
if (found == 2) {
|
||||
ihk_mc_spinlock_unlock(&v->runq_lock, v->runq_irqstate);
|
||||
terminate_mcexec(0, sig);
|
||||
return 1;
|
||||
}
|
||||
else if (found == 1) {
|
||||
ihk_mc_spinlock_unlock(&v->runq_lock, v->runq_irqstate);
|
||||
interrupt_syscall(thread, 0);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct sig_pending *
|
||||
getsigpending(struct thread *thread, int delflag)
|
||||
{
|
||||
struct list_head *head;
|
||||
mcs_rwlock_lock_t *lock;
|
||||
struct mcs_rwlock_node_irqsave mcs_rw_node;
|
||||
struct sig_pending *next;
|
||||
struct sig_pending *pending;
|
||||
__sigset_t w;
|
||||
__sigset_t x;
|
||||
int sig;
|
||||
struct k_sigaction *k;
|
||||
|
||||
w = thread->sigmask.__val[0];
|
||||
|
||||
lock = &thread->sigcommon->lock;
|
||||
head = &thread->sigcommon->sigpending;
|
||||
for (;;) {
|
||||
if (delflag) {
|
||||
mcs_rwlock_writer_lock(lock, &mcs_rw_node);
|
||||
}
|
||||
else {
|
||||
mcs_rwlock_reader_lock(lock, &mcs_rw_node);
|
||||
}
|
||||
|
||||
list_for_each_entry_safe(pending, next, head, list) {
|
||||
for (x = pending->sigmask.__val[0], sig = 0; x;
|
||||
sig++, x >>= 1) {
|
||||
}
|
||||
k = thread->sigcommon->action + sig - 1;
|
||||
if (delflag ||
|
||||
(sig != SIGCHLD &&
|
||||
sig != SIGURG &&
|
||||
sig != SIGCONT) ||
|
||||
(k->sa.sa_handler != (void *)1 &&
|
||||
k->sa.sa_handler != NULL)){
|
||||
if (!(pending->sigmask.__val[0] & w)) {
|
||||
if (delflag)
|
||||
list_del(&pending->list);
|
||||
|
||||
if (delflag) {
|
||||
mcs_rwlock_writer_unlock(
|
||||
lock,
|
||||
&mcs_rw_node);
|
||||
}
|
||||
else {
|
||||
mcs_rwlock_reader_unlock(
|
||||
lock,
|
||||
&mcs_rw_node);
|
||||
}
|
||||
return pending;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (delflag) {
|
||||
mcs_rwlock_writer_unlock(lock, &mcs_rw_node);
|
||||
}
|
||||
else {
|
||||
mcs_rwlock_reader_unlock(lock, &mcs_rw_node);
|
||||
}
|
||||
|
||||
if (lock == &thread->sigpendinglock) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
lock = &thread->sigpendinglock;
|
||||
head = &thread->sigpending;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct sig_pending *
|
||||
hassigpending(struct thread *thread)
|
||||
{
|
||||
if (list_empty(&thread->sigpending) &&
|
||||
list_empty(&thread->sigcommon->sigpending)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return getsigpending(thread, 0);
|
||||
}
|
||||
|
||||
void
|
||||
check_sig_pending(void)
|
||||
{
|
||||
struct thread *thread;
|
||||
struct cpu_local_var *v;
|
||||
|
||||
if (clv == NULL)
|
||||
return;
|
||||
|
||||
v = get_this_cpu_local_var();
|
||||
repeat:
|
||||
v->runq_irqstate = ihk_mc_spinlock_lock(&v->runq_lock);
|
||||
list_for_each_entry(thread, &(v->runq), sched_list) {
|
||||
|
||||
if (thread == NULL || thread == &cpu_local_var(idle)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (thread->in_syscall_offload == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (thread->proc->group_exit_status & 0x0000000100000000L) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (check_sig_pending_thread(thread))
|
||||
goto repeat;
|
||||
}
|
||||
ihk_mc_spinlock_unlock(&v->runq_lock, v->runq_irqstate);
|
||||
}
|
||||
|
||||
static void
|
||||
__check_signal(unsigned long rc, void *regs0, int num, int irq_disabled)
|
||||
{
|
||||
ihk_mc_user_context_t *regs = regs0;
|
||||
struct thread *thread;
|
||||
struct sig_pending *pending;
|
||||
int irqstate;
|
||||
|
||||
if (clv == NULL) {
|
||||
return;
|
||||
}
|
||||
thread = cpu_local_var(current);
|
||||
|
||||
if (thread == NULL || thread->proc->pid == 0) {
|
||||
struct thread *t;
|
||||
|
||||
irqstate = cpu_disable_interrupt_save();
|
||||
ihk_mc_spinlock_lock_noirq(&(cpu_local_var(runq_lock)));
|
||||
list_for_each_entry(t, &(cpu_local_var(runq)), sched_list) {
|
||||
if (t->proc->pid <= 0) {
|
||||
continue;
|
||||
}
|
||||
if (t->status == PS_INTERRUPTIBLE &&
|
||||
hassigpending(t)) {
|
||||
t->status = PS_RUNNING;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ihk_mc_spinlock_unlock_noirq(&(cpu_local_var(runq_lock)));
|
||||
cpu_restore_interrupt(irqstate);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (regs != NULL && !interrupt_from_user(regs)) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (list_empty(&thread->sigpending) &&
|
||||
list_empty(&thread->sigcommon->sigpending)) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
/* When this function called from check_signal_irq_disabled,
|
||||
* return with interrupt invalid.
|
||||
* This is to eliminate signal loss.
|
||||
*/
|
||||
if (irq_disabled == 1) {
|
||||
irqstate = cpu_disable_interrupt_save();
|
||||
}
|
||||
pending = getsigpending(thread, 1);
|
||||
if (!pending) {
|
||||
dkprintf("check_signal,queue is empty\n");
|
||||
goto out;
|
||||
}
|
||||
if (irq_disabled == 1) {
|
||||
cpu_restore_interrupt(irqstate);
|
||||
}
|
||||
if (do_signal(rc, regs, thread, pending, num)) {
|
||||
num = -1;
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
check_signal(unsigned long rc, void *regs0, int num)
|
||||
{
|
||||
__check_signal(rc, regs0, num, 0);
|
||||
}
|
||||
|
||||
void
|
||||
check_signal_irq_disabled(unsigned long rc, void *regs0, int num)
|
||||
{
|
||||
__check_signal(rc, regs0, num, 1);
|
||||
}
|
||||
|
||||
|
||||
@ -23,6 +23,8 @@ Summary: IHK/McKernel
|
||||
License: GPLv2
|
||||
Source0: mckernel-%{version}.tar.gz
|
||||
|
||||
Requires: systemd-libs numactl-libs libdwarf
|
||||
|
||||
# kernel_module_package macro does not handle cross build...
|
||||
%if "%{?_host_cpu}" == "x86_64" && "%{?_target_cpu}" == "aarch64"
|
||||
%define cross_compile 1
|
||||
@ -34,7 +36,7 @@ Requires: kernel = %{krequires}
|
||||
Requires(post): /usr/sbin/depmod
|
||||
Requires(postun): /usr/sbin/depmod
|
||||
%else
|
||||
BuildRequires: systemd-devel numactl-devel binutils-devel kernel-devel
|
||||
BuildRequires: systemd-devel numactl-devel binutils-devel kernel-devel libdwarf-devel
|
||||
# Friendly reminder of the fact that kernel-rpm-macros is no longer included in kernel-devel
|
||||
%if 0%{?rhel} >= 8
|
||||
BuildRequires: redhat-rpm-config kernel-rpm-macros elfutils-libelf-devel kmod
|
||||
|
||||
56
test/issues/1377/C1377.sh
Normal file
56
test/issues/1377/C1377.sh
Normal file
@ -0,0 +1,56 @@
|
||||
#!/bin/sh
|
||||
USELTP=1
|
||||
USEOSTEST=0
|
||||
|
||||
. ../../common.sh
|
||||
|
||||
################################################################################
|
||||
if [ ! -f "$LTPBIN/dirtyc0w" ]; then
|
||||
echo BAD environment: LTP is too old >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "*** C1377T01 start"
|
||||
ng=0
|
||||
ok=0
|
||||
tp=dirtyc0w
|
||||
for ((i=0; i<20; i++)); do
|
||||
for ((j=0; j<50; j++)); do
|
||||
sudo PATH=$PATH:$LTPBIN $MCEXEC $LTPBIN/$tp > $tp.txt 2>&1
|
||||
wok=`grep PASS $tp.txt | wc -l`
|
||||
wng=`grep FAIL $tp.txt | wc -l`
|
||||
if [ $wng != 0 ]; then
|
||||
echo -n '*'
|
||||
ng=`expr $ng + 1`
|
||||
elif [ $wok == 0 ]; then
|
||||
echo -n '?'
|
||||
else
|
||||
echo -n '.'
|
||||
ok=`expr $ok + 1`
|
||||
fi
|
||||
done
|
||||
echo
|
||||
done
|
||||
|
||||
if [ $ng != 0 ]; then
|
||||
echo "*** C1377T01 FAILED ok: $ok, ng: $ng"
|
||||
else
|
||||
echo "*** C1377T01 PASS ok: $ok"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
for i in wait02:02 wait401:03 waitpid01:04 waitpid02:05 waitpid04:06 \
|
||||
waitpid05:07 waitpid06:08 waitpid07:09 waitpid08:10 waitpid09:11 \
|
||||
waitpid10:12 waitpid11:13 waitpid12:14 waitpid13:15; do
|
||||
tp=`echo $i|sed 's/:.*//'`
|
||||
id=`echo $i|sed 's/.*://'`
|
||||
sudo PATH=$PATH:$LTPBIN $MCEXEC $LTPBIN/$tp 2>&1 | tee $tp.txt
|
||||
ok=`grep PASS $tp.txt | wc -l`
|
||||
ng=`grep FAIL $tp.txt | wc -l`
|
||||
if [ $ng = 0 ]; then
|
||||
echo "*** C1377T$id: $tp PASS ($ok)"
|
||||
else
|
||||
echo "*** C1377T$id: $tp FAIL (ok=$ok ng=$ng)"
|
||||
fi
|
||||
done
|
||||
179
test/issues/1377/C1377_arm64.txt
Normal file
179
test/issues/1377/C1377_arm64.txt
Normal file
@ -0,0 +1,179 @@
|
||||
Script started on Tue 16 Jun 2020 02:42:48 PM JST
|
||||
[shirasawa@apollo04 1377]$ make test
|
||||
sh ./C1377.sh
|
||||
mcstop+release.sh ... done
|
||||
mcreboot.sh -c 2-31 -m 2G@0,2G@1 -O ... done
|
||||
*** C1377T01 start
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
*** C1377T01 PASS ok: 1000
|
||||
wait02 1 TPASS : wait(&status) returned 78343
|
||||
*** C1377T02: wait02 PASS (1)
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
wait401.c:55: PASS: waitpid() returned correct pid 78457
|
||||
wait401.c:64: PASS: WIFEXITED() is set in status
|
||||
wait401.c:69: PASS: WEXITSTATUS() == 0
|
||||
|
||||
Summary:
|
||||
passed 3
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1377T03: wait401 PASS (3)
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
waitpid01.c:51: PASS: waitpid() returned correct pid 78571
|
||||
waitpid01.c:60: PASS: WIFSIGNALED() set in status
|
||||
waitpid01.c:68: PASS: WTERMSIG() == SIGALRM
|
||||
|
||||
Summary:
|
||||
passed 3
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1377T04: waitpid01 PASS (3)
|
||||
waitpid02 1 TPASS : received expected pid
|
||||
waitpid02 2 TPASS : received expected signal
|
||||
waitpid02 3 TPASS : received expected exit value
|
||||
*** C1377T05: waitpid02 PASS (3)
|
||||
waitpid04 1 TPASS : condition 1 test passed
|
||||
waitpid04 2 TPASS : condition 2 test passed
|
||||
waitpid04 3 TPASS : condition 3 test passed
|
||||
*** C1377T06: waitpid04 PASS (3)
|
||||
waitpid05 1 TPASS : received expected pid.
|
||||
waitpid05 2 TPASS : received expected exit number.
|
||||
waitpid05 3 TPASS : received expected pid.
|
||||
waitpid05 4 TPASS : received expected exit number.
|
||||
waitpid05 5 TPASS : received expected pid.
|
||||
waitpid05 6 TPASS : received expected exit number.
|
||||
waitpid05 7 TPASS : received expected pid.
|
||||
waitpid05 8 TPASS : received expected exit number.
|
||||
waitpid05 9 TPASS : received expected pid.
|
||||
waitpid05 10 TPASS : received expected exit number.
|
||||
waitpid05 11 TPASS : received expected pid.
|
||||
waitpid05 12 TPASS : received expected exit number.
|
||||
waitpid05 13 TPASS : received expected pid.
|
||||
waitpid05 14 TPASS : received expected exit number.
|
||||
waitpid05 15 TPASS : received expected pid.
|
||||
waitpid05 16 TPASS : received expected exit number.
|
||||
waitpid05 17 TPASS : received expected pid.
|
||||
waitpid05 18 TPASS : received expected exit number.
|
||||
waitpid05 19 TPASS : received expected pid.
|
||||
waitpid05 20 TPASS : received expected exit number.
|
||||
waitpid05 21 TPASS : received expected pid.
|
||||
waitpid05 22 TPASS : received expected exit number.
|
||||
waitpid05 23 TPASS : received expected pid.
|
||||
waitpid05 24 TPASS : received expected exit number.
|
||||
*** C1377T07: waitpid05 PASS (24)
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
waitpid06.c:54: PASS: Test PASSED
|
||||
|
||||
Summary:
|
||||
passed 1
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1377T08: waitpid06 PASS (1)
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
waitpid07.c:59: PASS: Test PASSED
|
||||
|
||||
Summary:
|
||||
passed 1
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1377T09: waitpid07 PASS (1)
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 80073
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 80105
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 80137
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 80169
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 80201
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 80233
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 80266
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 80298
|
||||
waitpid08.c:62: PASS: Test PASSED
|
||||
|
||||
Summary:
|
||||
passed 1
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1377T10: waitpid08 PASS (1)
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
waitpid09.c:83: PASS: waitpid(pid, WNOHANG) = 0 for a running child
|
||||
waitpid09.c:123: PASS: waitpid(pid, WNOHANG) = pid for an exited child
|
||||
waitpid09.c:143: PASS: waitpid(-1, 0) = -1 with ECHILD if no children
|
||||
waitpid09.c:162: PASS: waitpid(-1, WNOHANG) = -1 with ECHILD if no children
|
||||
|
||||
Summary:
|
||||
passed 4
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1377T11: waitpid09 PASS (4)
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
waitpid10.c:62: PASS: Test PASSED
|
||||
|
||||
Summary:
|
||||
passed 1
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1377T12: waitpid10 PASS (1)
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
waitpid11.c:60: PASS: Test PASSED
|
||||
|
||||
Summary:
|
||||
passed 1
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1377T13: waitpid11 PASS (1)
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
waitpid12.c:70: PASS: Test PASSED
|
||||
|
||||
Summary:
|
||||
passed 1
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1377T14: waitpid12 PASS (1)
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 85038
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 85070
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 85102
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 85134
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 84910
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 84942
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 84974
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 85006
|
||||
waitpid13.c:70: PASS: Test PASSED
|
||||
|
||||
Summary:
|
||||
passed 1
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1377T15: waitpid13 PASS (1)
|
||||
[shirasawa@apollo04 1377]$ exit
|
||||
exit
|
||||
|
||||
Script done on Tue 16 Jun 2020 03:02:48 PM JST
|
||||
179
test/issues/1377/C1377_x86_64.txt
Normal file
179
test/issues/1377/C1377_x86_64.txt
Normal file
@ -0,0 +1,179 @@
|
||||
Script started on Tue Jun 16 15:36:06 2020
|
||||
bash-4.2$ make test
|
||||
sh ./C1377.sh
|
||||
mcstop+release.sh ... done
|
||||
mcreboot.sh -c 1-7,9-15,17-23,25-31 -m 10G@0,10G@1 -r 1-7:0+9-15:8+17-23:16+25-31:24 ... done
|
||||
*** C1377T01 start
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
..................................................
|
||||
*** C1377T01 PASS ok: 1000
|
||||
wait02 1 TPASS : wait(&status) returned 32240
|
||||
*** C1377T02: wait02 PASS (1)
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
wait401.c:55: PASS: waitpid() returned correct pid 32347
|
||||
wait401.c:64: PASS: WIFEXITED() is set in status
|
||||
wait401.c:69: PASS: WEXITSTATUS() == 0
|
||||
|
||||
Summary:
|
||||
passed 3
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1377T03: wait401 PASS (3)
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
waitpid01.c:51: PASS: waitpid() returned correct pid 32454
|
||||
waitpid01.c:60: PASS: WIFSIGNALED() set in status
|
||||
waitpid01.c:68: PASS: WTERMSIG() == SIGALRM
|
||||
|
||||
Summary:
|
||||
passed 3
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1377T04: waitpid01 PASS (3)
|
||||
waitpid02 1 TPASS : received expected pid
|
||||
waitpid02 2 TPASS : received expected signal
|
||||
waitpid02 3 TPASS : received expected exit value
|
||||
*** C1377T05: waitpid02 PASS (3)
|
||||
waitpid04 1 TPASS : condition 1 test passed
|
||||
waitpid04 2 TPASS : condition 2 test passed
|
||||
waitpid04 3 TPASS : condition 3 test passed
|
||||
*** C1377T06: waitpid04 PASS (3)
|
||||
waitpid05 1 TPASS : received expected pid.
|
||||
waitpid05 2 TPASS : received expected exit number.
|
||||
waitpid05 3 TPASS : received expected pid.
|
||||
waitpid05 4 TPASS : received expected exit number.
|
||||
waitpid05 5 TPASS : received expected pid.
|
||||
waitpid05 6 TPASS : received expected exit number.
|
||||
waitpid05 7 TPASS : received expected pid.
|
||||
waitpid05 8 TPASS : received expected exit number.
|
||||
waitpid05 9 TPASS : received expected pid.
|
||||
waitpid05 10 TPASS : received expected exit number.
|
||||
waitpid05 11 TPASS : received expected pid.
|
||||
waitpid05 12 TPASS : received expected exit number.
|
||||
waitpid05 13 TPASS : received expected pid.
|
||||
waitpid05 14 TPASS : received expected exit number.
|
||||
waitpid05 15 TPASS : received expected pid.
|
||||
waitpid05 16 TPASS : received expected exit number.
|
||||
waitpid05 17 TPASS : received expected pid.
|
||||
waitpid05 18 TPASS : received expected exit number.
|
||||
waitpid05 19 TPASS : received expected pid.
|
||||
waitpid05 20 TPASS : received expected exit number.
|
||||
waitpid05 21 TPASS : received expected pid.
|
||||
waitpid05 22 TPASS : received expected exit number.
|
||||
waitpid05 23 TPASS : received expected pid.
|
||||
waitpid05 24 TPASS : received expected exit number.
|
||||
*** C1377T07: waitpid05 PASS (24)
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
waitpid06.c:54: PASS: Test PASSED
|
||||
|
||||
Summary:
|
||||
passed 1
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1377T08: waitpid06 PASS (1)
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
waitpid07.c:59: PASS: Test PASSED
|
||||
|
||||
Summary:
|
||||
passed 1
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1377T09: waitpid07 PASS (1)
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 1524
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 1554
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 1584
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 1614
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 1644
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 1674
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 1704
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 1734
|
||||
waitpid08.c:62: PASS: Test PASSED
|
||||
|
||||
Summary:
|
||||
passed 1
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1377T10: waitpid08 PASS (1)
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
waitpid09.c:83: PASS: waitpid(pid, WNOHANG) = 0 for a running child
|
||||
waitpid09.c:123: PASS: waitpid(pid, WNOHANG) = pid for an exited child
|
||||
waitpid09.c:143: PASS: waitpid(-1, 0) = -1 with ECHILD if no children
|
||||
waitpid09.c:162: PASS: waitpid(-1, WNOHANG) = -1 with ECHILD if no children
|
||||
|
||||
Summary:
|
||||
passed 4
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1377T11: waitpid09 PASS (4)
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
waitpid10.c:62: PASS: Test PASSED
|
||||
|
||||
Summary:
|
||||
passed 1
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1377T12: waitpid10 PASS (1)
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
waitpid11.c:60: PASS: Test PASSED
|
||||
|
||||
Summary:
|
||||
passed 1
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1377T13: waitpid11 PASS (1)
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
waitpid12.c:70: PASS: Test PASSED
|
||||
|
||||
Summary:
|
||||
passed 1
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1377T14: waitpid12 PASS (1)
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 6219
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 6249
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 6279
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 6309
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 6099
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 6129
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 6159
|
||||
waitpid_common.h:142: INFO: Sending SIGCONT to 6189
|
||||
waitpid13.c:70: PASS: Test PASSED
|
||||
|
||||
Summary:
|
||||
passed 1
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1377T15: waitpid13 PASS (1)
|
||||
bash-4.2$ exit
|
||||
exit
|
||||
|
||||
Script done on Tue Jun 16 15:55:52 2020
|
||||
9
test/issues/1377/Makefile
Normal file
9
test/issues/1377/Makefile
Normal file
@ -0,0 +1,9 @@
|
||||
CC = gcc
|
||||
|
||||
all::
|
||||
|
||||
test:: all
|
||||
sh ./C1377.sh
|
||||
|
||||
clean::
|
||||
rm -f $(TARGET) *.o
|
||||
38
test/issues/1377/README
Normal file
38
test/issues/1377/README
Normal file
@ -0,0 +1,38 @@
|
||||
【Issue#1377 動作確認】
|
||||
□ テスト内容
|
||||
1. Issue 指摘事項の再現確認
|
||||
現象はタイミングに依存し、ARM64環境でdirtyc0wを繰り返し実行した際に、
|
||||
数回〜数十回に1回程度発生する。
|
||||
問題の発生はタイミングに依存するため、dirtyc0wを十分な回数繰り返し
|
||||
実行し、問題が再発しないことを確認する。
|
||||
|
||||
C1377T01 dirtyc0wを1000回連続実行し、全てPASSすることを確認
|
||||
|
||||
2. LTP を用いて既存処理に影響しないことを確認
|
||||
プロセスの終了ステータスを変更したため、修正が既存処理に影響しないことを
|
||||
wait系システムコールのLTPを用いて確認する。
|
||||
C1377T02 wait02: waitの基本機能の確認
|
||||
C1377T03 wait401: wait4の基本機能の確認
|
||||
C1377T04 waitpid01: waitpidの基本機能の確認
|
||||
C1377T05 waitpid02: waitpidの基本機能の確認
|
||||
C1377T06 waitpid04: waitpidの基本機能の確認
|
||||
C1377T07 waitpid05: waitpidの基本機能の確認
|
||||
C1377T08 waitpid06: waitpidの基本機能の確認
|
||||
C1377T09 waitpid07: waitpidの基本機能の確認
|
||||
C1377T10 waitpid08: waitpidの基本機能の確認
|
||||
C1377T11 waitpid09: waitpidの基本機能の確認
|
||||
C1377T12 waitpid10: waitpidの基本機能の確認
|
||||
C1377T13 waitpid11: waitpidの基本機能の確認
|
||||
C1377T14 waitpid12: waitpidの基本機能の確認
|
||||
C1377T15 waitpid13: waitpidの基本機能の確認
|
||||
|
||||
□ 実行手順
|
||||
$ make test
|
||||
|
||||
McKernelのインストール先や LTP の配置場所は、$HOME/.mck_test_config を
|
||||
参照する。.mck_test_config は、McKernel をビルドした際に生成される
|
||||
mck_test_config.sample ファイルを $HOME にコピーし、適宜編集すること。
|
||||
|
||||
□ 実行結果
|
||||
C1377_x86_64.txt(x86_64実行結果)、C1377_arm64.txt(arm64実行結果)参照。
|
||||
全ての項目が PASS していることを確認。
|
||||
26
test/issues/1380/C1380.sh
Executable file
26
test/issues/1380/C1380.sh
Executable file
@ -0,0 +1,26 @@
|
||||
#/bin/sh
|
||||
|
||||
USELTP=1
|
||||
USEOSTEST=0
|
||||
|
||||
. ../../common.sh
|
||||
|
||||
issue="1380"
|
||||
tid=01
|
||||
|
||||
for tp in tgkill03 tgkill01 tkill01 tkill02
|
||||
do
|
||||
tname=`printf "C${issue}T%02d" ${tid}`
|
||||
echo "*** ${tname} start *******************************"
|
||||
sudo $MCEXEC $LTPBIN/$tp 2>&1 | tee $tp.txt
|
||||
ok=`grep PASS $tp.txt | wc -l`
|
||||
ng=`grep FAIL $tp.txt | wc -l`
|
||||
if [ $ng = 0 ]; then
|
||||
echo "*** ${tname} PASSED ($ok)"
|
||||
else
|
||||
echo "*** ${tname} FAILED (ok=$ok ng=$ng)"
|
||||
fi
|
||||
let tid++
|
||||
echo ""
|
||||
done
|
||||
|
||||
@ -6,6 +6,6 @@ TARGET=
|
||||
all: $(TARGET)
|
||||
|
||||
test: all
|
||||
./C929.sh
|
||||
./C1380.sh
|
||||
clean:
|
||||
rm -f $(TARGET) *.o *.txt
|
||||
21
test/issues/1380/README
Normal file
21
test/issues/1380/README
Normal file
@ -0,0 +1,21 @@
|
||||
【Issue#1324 動作確認】
|
||||
□ テスト内容
|
||||
1. 以下のLTPを用いてIssueで報告された症状が発生しないことを確認
|
||||
- tgkill03
|
||||
|
||||
3. 以下のLTPを用いて既存機能に影響が無いことを確認
|
||||
- tgkill01
|
||||
- tkill01
|
||||
- tkill02
|
||||
|
||||
□ 実行手順
|
||||
$ make test
|
||||
|
||||
McKernelのインストール先や、OSTEST, LTPの配置場所は、
|
||||
$HOME/.mck_test_config を参照している
|
||||
.mck_test_config は、McKernelをビルドした際に生成されるmck_test_config.sample ファイルを
|
||||
$HOMEにコピーし、適宜編集する
|
||||
|
||||
□ 実行結果
|
||||
x86_64_result.log aarch64_result.log 参照。
|
||||
すべての項目をPASSしていることを確認。
|
||||
37
test/issues/1380/aarch64_result.log
Normal file
37
test/issues/1380/aarch64_result.log
Normal file
@ -0,0 +1,37 @@
|
||||
*** C1380T01 start *******************************
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
tgkill03.c:92: PASS: Invalid tgid failed as expected: EINVAL
|
||||
tgkill03.c:92: PASS: Invalid tid failed as expected: EINVAL
|
||||
tgkill03.c:92: PASS: Invalid signal failed as expected: EINVAL
|
||||
tgkill03.c:92: PASS: Defunct tid failed as expected: ESRCH
|
||||
tgkill03.c:92: PASS: Defunct tgid failed as expected: ESRCH
|
||||
tgkill03.c:99: PASS: Valid tgkill call succeeded
|
||||
|
||||
Summary:
|
||||
passed 6
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1380T01 PASSED (6)
|
||||
|
||||
*** C1380T02 start *******************************
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
tgkill01.c:99: PASS: SIGUSR1 delivered to correct threads
|
||||
|
||||
Summary:
|
||||
passed 1
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1380T02 PASSED (1)
|
||||
|
||||
*** C1380T03 start *******************************
|
||||
tkill01 1 TPASS : tkill call succeeded
|
||||
tkill01 2 TPASS : tkill call succeeded
|
||||
*** C1380T03 PASSED (2)
|
||||
|
||||
*** C1380T04 start *******************************
|
||||
tkill02 1 TPASS : tkill(-1, SIGUSR1) failed as expected: TEST_ERRNO=EINVAL(22): Invalid argument
|
||||
tkill02 2 TPASS : tkill(29822, SIGUSR1) failed as expected: TEST_ERRNO=ESRCH(3): No such process
|
||||
*** C1380T04 PASSED (2)
|
||||
|
||||
37
test/issues/1380/x86_64_result.log
Normal file
37
test/issues/1380/x86_64_result.log
Normal file
@ -0,0 +1,37 @@
|
||||
*** C1380T01 start *******************************
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
tgkill03.c:92: PASS: Invalid tgid failed as expected: EINVAL
|
||||
tgkill03.c:92: PASS: Invalid tid failed as expected: EINVAL
|
||||
tgkill03.c:92: PASS: Invalid signal failed as expected: EINVAL
|
||||
tgkill03.c:92: PASS: Defunct tid failed as expected: ESRCH
|
||||
tgkill03.c:92: PASS: Defunct tgid failed as expected: ESRCH
|
||||
tgkill03.c:99: PASS: Valid tgkill call succeeded
|
||||
|
||||
Summary:
|
||||
passed 6
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1380T01 PASSED (6)
|
||||
|
||||
*** C1380T02 start *******************************
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
tgkill01.c:99: PASS: SIGUSR1 delivered to correct threads
|
||||
|
||||
Summary:
|
||||
passed 1
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1380T02 PASSED (1)
|
||||
|
||||
*** C1380T03 start *******************************
|
||||
tkill01 1 TPASS : tkill call succeeded
|
||||
tkill01 2 TPASS : tkill call succeeded
|
||||
*** C1380T03 PASSED (2)
|
||||
|
||||
*** C1380T04 start *******************************
|
||||
tkill02 1 TPASS : tkill(-1, SIGUSR1) failed as expected: TEST_ERRNO=EINVAL(22): Invalid argument
|
||||
tkill02 2 TPASS : tkill(32768, SIGUSR1) failed as expected: TEST_ERRNO=ESRCH(3): No such process
|
||||
*** C1380T04 PASSED (2)
|
||||
|
||||
43
test/issues/1389/C1389.sh
Executable file
43
test/issues/1389/C1389.sh
Executable file
@ -0,0 +1,43 @@
|
||||
#/bin/sh
|
||||
|
||||
USELTP=1
|
||||
USEOSTEST=0
|
||||
|
||||
BOOTPARAM="-c 1-7 -m 10G@0,10G@1 -O"
|
||||
. ../../common.sh
|
||||
|
||||
issue="1389"
|
||||
tid=01
|
||||
|
||||
for tsuf in "01" "02.sh"
|
||||
do
|
||||
tname=`printf "C${issue}T%02d" ${tid}`
|
||||
echo "*** ${tname} start *******************************"
|
||||
${MCEXEC} ./C1389T${tsuf}
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "*** ${tname} PASSED ******************************"
|
||||
else
|
||||
echo "*** ${tname} FAILED ******************************"
|
||||
fi
|
||||
let tid++
|
||||
echo ""
|
||||
done
|
||||
|
||||
for tp in "mtest01 -p80" "mtest01 -p80 -w" "mem01"
|
||||
do
|
||||
tname=`printf "C${issue}T%02d" ${tid}`
|
||||
echo "*** ${tname} start *******************************"
|
||||
echo ${tp}
|
||||
sudo $MCEXEC $LTPBIN/$tp 2>&1 | tee ${tname}.txt
|
||||
ok=`grep PASS ${tname}.txt | wc -l`
|
||||
ng=`grep FAIL ${tname}.txt | wc -l`
|
||||
if [ $ng = 0 ]; then
|
||||
echo "*** ${tname} PASSED ($ok)"
|
||||
else
|
||||
echo "*** ${tname} FAILED (ok=$ok ng=$ng)"
|
||||
fi
|
||||
let tid++
|
||||
echo ""
|
||||
done
|
||||
|
||||
65
test/issues/1389/C1389T01.c
Normal file
65
test/issues/1389/C1389T01.c
Normal file
@ -0,0 +1,65 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <sys/sysinfo.h>
|
||||
#include <errno.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
struct sysinfo *info;
|
||||
int ret = 0, rc = 0;
|
||||
unsigned long assigned_mem = (20UL << 30);
|
||||
unsigned long _totalram, _freeram;
|
||||
unsigned int _mem_unit;
|
||||
|
||||
info = malloc(sizeof(struct sysinfo));
|
||||
rc = sysinfo(info);
|
||||
if (rc) {
|
||||
perror("sysinfo fail: ");
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
_totalram = info->totalram;
|
||||
_freeram = info->freeram;
|
||||
_mem_unit = info->mem_unit;
|
||||
|
||||
// Check totalram
|
||||
if (0.95 * assigned_mem < _totalram &&
|
||||
_totalram < assigned_mem) {
|
||||
printf("[OK] totalram: %ld\n", _totalram);
|
||||
}
|
||||
else {
|
||||
printf("[NG] unexpected totalram: %ld\n", _totalram);
|
||||
printf(" expected range: %ld - %ld\n",
|
||||
(unsigned long)(0.95 * assigned_mem),
|
||||
assigned_mem);
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
// Check freeram
|
||||
if (0.95 * _totalram < _freeram &&
|
||||
_freeram < _totalram) {
|
||||
printf("[OK] freeram: %ld\n", _freeram);
|
||||
}
|
||||
else {
|
||||
printf("[NG] unexpected freeram: %ld\n", _freeram);
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
// Check mem_unit
|
||||
if (_mem_unit == 1) {
|
||||
printf("[OK] mem_unit: %ld\n", _mem_unit);
|
||||
}
|
||||
else {
|
||||
printf("[NG] unexpected mem_unit: %ld\n", _mem_unit);
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
free(info);
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
88
test/issues/1389/C1389T02.sh
Executable file
88
test/issues/1389/C1389T02.sh
Executable file
@ -0,0 +1,88 @@
|
||||
#!/bin/sh
|
||||
|
||||
ASSIGNED_MEM=`echo '1024 * 1024 * 1024 * 20' | bc`
|
||||
cat /proc/meminfo > ./cur_meminfo.txt
|
||||
|
||||
# Check MemTotal
|
||||
MemTotalTxt=`cat ./cur_meminfo.txt | grep MemTotal | awk '{print $(NF-1)}'`
|
||||
MemTotal=`echo "1024 * ${MemTotalTxt}" | bc`
|
||||
|
||||
lower_limit=`echo "${ASSIGNED_MEM} * 0.95" | bc`
|
||||
lower_limit=${lower_limit%.*}
|
||||
upper_limit=${ASSIGNED_MEM}
|
||||
tgt=${MemTotal}
|
||||
|
||||
if [ ${tgt} -ge ${lower_limit} -a ${tgt} -lt ${upper_limit} ]; then
|
||||
echo "[OK] MemTotal: ${tgt}"
|
||||
else
|
||||
echo "[NG] unexpected MemTotal: ${tgt}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check MemFree
|
||||
MemFreeTxt=`cat ./cur_meminfo.txt | grep MemFree | awk '{print $(NF-1)}'`
|
||||
MemFree=`echo "1024 * ${MemFreeTxt}" | bc`
|
||||
|
||||
lower_limit=`echo "${MemTotal} * 0.95" | bc`
|
||||
lower_limit=${lower_limit%.*}
|
||||
upper_limit=${MemTotal}
|
||||
tgt=${MemFree}
|
||||
|
||||
if [ ${tgt} -ge ${lower_limit} -a ${tgt} -lt ${upper_limit} ]; then
|
||||
echo "[OK] MemFree: ${tgt}"
|
||||
else
|
||||
echo "[NG] unexpected MemFree: ${tgt}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check SwapTotal
|
||||
SwapTotalTxt=`cat ./cur_meminfo.txt | grep SwapTotal | awk '{print $(NF-1)}'`
|
||||
SwapTotal=`echo "1024 * ${SwapTotalTxt}" | bc`
|
||||
|
||||
tgt=${SwapTotal}
|
||||
|
||||
if [ ${tgt} -eq 0 ]; then
|
||||
echo "[OK] SwapTotal: ${tgt}"
|
||||
else
|
||||
echo "[NG] unexpected SwapTotal: ${tgt}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check SwapFree
|
||||
SwapFreeTxt=`cat ./cur_meminfo.txt | grep SwapFree | awk '{print $(NF-1)}'`
|
||||
SwapFree=`echo "1024 * ${SwapFreeTxt}" | bc`
|
||||
|
||||
tgt=${SwapFree}
|
||||
|
||||
if [ ${tgt} -eq 0 ]; then
|
||||
echo "[OK] SwapFree: ${tgt}"
|
||||
else
|
||||
echo "[NG] unexpected SwapFree: ${tgt}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check CommitLimit
|
||||
CommitLimitTxt=`cat ./cur_meminfo.txt | grep CommitLimit | awk '{print $(NF-1)}'`
|
||||
CommitLimit=`echo "1024 * ${CommitLimitTxt}" | bc`
|
||||
|
||||
tgt=${CommitLimit}
|
||||
|
||||
if [ ${tgt} -eq ${MemFree} ]; then
|
||||
echo "[OK] CommitLimit: ${tgt}"
|
||||
else
|
||||
echo "[NG] unexpected CommitLimit: ${tgt}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check Committed_AS
|
||||
Committed_ASTxt=`cat ./cur_meminfo.txt | grep Committed_AS | awk '{print $(NF-1)}'`
|
||||
Committed_AS=`echo "1024 * ${Committed_ASTxt}" | bc`
|
||||
|
||||
tgt=${Committed_AS}
|
||||
|
||||
if [ ${tgt} -eq $((${MemTotal} - ${MemFree})) ]; then
|
||||
echo "[OK] Committed_AS: ${tgt}"
|
||||
else
|
||||
echo "[NG] unexpected Committed_AS: ${tgt}"
|
||||
exit 1
|
||||
fi
|
||||
11
test/issues/1389/Makefile
Normal file
11
test/issues/1389/Makefile
Normal file
@ -0,0 +1,11 @@
|
||||
CFLAGS=-g
|
||||
LDFLAGS=
|
||||
|
||||
TARGET=C1389T01
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
test: all
|
||||
sh ./C1389.sh
|
||||
clean:
|
||||
rm -f $(TARGET) *.o *.txt
|
||||
46
test/issues/1389/README
Normal file
46
test/issues/1389/README
Normal file
@ -0,0 +1,46 @@
|
||||
【Issue#1389 動作確認】
|
||||
□ テスト内容
|
||||
本Issueの対応で、sysinfo()と/proc/meminfo の下記項目においてMcKernelの情報を
|
||||
返すようにした。
|
||||
[sysinfo]
|
||||
totalram : rusage_global の total_memory
|
||||
freeram : rusage_global の total_memory - usage_memory
|
||||
mem_unit : 常に1
|
||||
[/proc/meminfo]
|
||||
MemTotal : rusage_global の total_memory
|
||||
MemFree : rusage_global の total_memory - usage_memory
|
||||
SwapTotal : 常に0
|
||||
SwapFree : 常に0
|
||||
CommitLimit : rusage_global の total_memory - usage_memory
|
||||
Committed_AS : rusage_global の usage_memory
|
||||
|
||||
1. 本Issueで対応したsysinfo() と /proc/meminfo の値が想定どおりとなっていることを確認
|
||||
McKernelへのメモリ割り当てを 10G@0,10G@1 とした状態で下記プログラムを実行
|
||||
C1389T01: sysinfo() で取得される値が下記のとおりであることを確認
|
||||
totalram : 20GiB * 0.95 以上、20GiB 未満であること
|
||||
freeram : totralram * 0.95 以上、totalram 未満であること
|
||||
mem_unit : 1 であること
|
||||
C1389T02: /proc/meminfo から取得される値が下記のとおりであることを確認
|
||||
MemTotal : 20GiB * 0.95 以上、20GiB 未満であること
|
||||
MemFree : MemTotal * 0.95 以上、MemTotal 未満であること
|
||||
SwapTotal : 0 であること
|
||||
SwapFree : 0 であること
|
||||
CommitLimit : MemFreeと同値であること
|
||||
Committed_AS : MemTotal - MemFree と同値であること
|
||||
|
||||
2. 本Issueで対応したsysinfo() の項目を利用する以下のLTPを実行し、PASSすることを確認
|
||||
- mtest01 -p80
|
||||
- mtest01 -p80 -w
|
||||
- mem01
|
||||
|
||||
□ 実行手順
|
||||
$ make test
|
||||
|
||||
McKernelのインストール先や、OSTEST, LTPの配置場所は、
|
||||
$HOME/.mck_test_config を参照している
|
||||
.mck_test_config は、McKernelをビルドした際に生成されるmck_test_config.sample ファイルを
|
||||
$HOMEにコピーし、適宜編集する
|
||||
|
||||
□ 実行結果
|
||||
x86_64_result.log aarch64_result.log 参照。
|
||||
すべての項目をPASSしていることを確認。
|
||||
77
test/issues/1389/aarch64_result.log
Normal file
77
test/issues/1389/aarch64_result.log
Normal file
@ -0,0 +1,77 @@
|
||||
sh ./C1389.sh
|
||||
mcstop+release.sh ... done
|
||||
mcreboot.sh -c 1-7 -m 10G@0,10G@1 -O ... done
|
||||
*** C1389T01 start *******************************
|
||||
[OK] totalram: 21472215040
|
||||
[OK] freeram: 21461794816
|
||||
[OK] mem_unit: 1
|
||||
*** C1389T01 PASSED ******************************
|
||||
|
||||
*** C1389T02 start *******************************
|
||||
[OK] MemTotal: 21472215040
|
||||
[OK] MemFree: 21452750848
|
||||
[OK] SwapTotal: 0
|
||||
[OK] SwapFree: 0
|
||||
[OK] CommitLimit: 21452750848
|
||||
[OK] Committed_AS: 19464192
|
||||
*** C1389T02 PASSED ******************************
|
||||
|
||||
*** C1389T03 start *******************************
|
||||
mtest01 -p80
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
mtest01.c:134: INFO: Filling up 80% of free ram which is 16760729 kbytes
|
||||
mtest01.c:149: INFO: ... child 50935 starting
|
||||
mtest01.c:149: INFO: ... child 50944 starting
|
||||
mtest01.c:149: INFO: ... child 50953 starting
|
||||
mtest01.c:149: INFO: ... child 50962 starting
|
||||
mtest01.c:149: INFO: ... child 50971 starting
|
||||
mtest01.c:149: INFO: ... child 50980 starting
|
||||
mtest01.c:169: INFO: ... [t=300] 1434451968 bytes allocated only in child 50980
|
||||
mtest01.c:169: INFO: ... [t=299] 3145728000 bytes allocated only in child 50935
|
||||
mtest01.c:169: INFO: ... [t=299] 3145728000 bytes allocated only in child 50944
|
||||
mtest01.c:169: INFO: ... [t=299] 3145728000 bytes allocated only in child 50953
|
||||
mtest01.c:169: INFO: ... [t=299] 3145728000 bytes allocated only in child 50962
|
||||
mtest01.c:169: INFO: ... [t=299] 3145728000 bytes allocated only in child 50971
|
||||
mtest01.c:221: PASS: 16760729 kbytes allocated
|
||||
|
||||
Summary:
|
||||
passed 1
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1389T03 PASSED (1)
|
||||
|
||||
*** C1389T04 start *******************************
|
||||
mtest01 -p80 -w
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
mtest01.c:134: INFO: Filling up 80% of free ram which is 16759654 kbytes
|
||||
mtest01.c:149: INFO: ... child 51017 starting
|
||||
mtest01.c:149: INFO: ... child 51026 starting
|
||||
mtest01.c:149: INFO: ... child 51035 starting
|
||||
mtest01.c:149: INFO: ... child 51044 starting
|
||||
mtest01.c:149: INFO: ... child 51053 starting
|
||||
mtest01.c:149: INFO: ... child 51062 starting
|
||||
mtest01.c:166: INFO: ... [t=300] 1433403392 bytes allocated and used in child 51062
|
||||
mtest01.c:166: INFO: ... [t=299] 3145728000 bytes allocated and used in child 51017
|
||||
mtest01.c:166: INFO: ... [t=299] 3145728000 bytes allocated and used in child 51026
|
||||
mtest01.c:166: INFO: ... [t=299] 3145728000 bytes allocated and used in child 51035
|
||||
mtest01.c:166: INFO: ... [t=299] 3145728000 bytes allocated and used in child 51044
|
||||
mtest01.c:166: INFO: ... [t=299] 3145728000 bytes allocated and used in child 51053
|
||||
mtest01.c:221: PASS: 16759654 kbytes allocated (and written to)
|
||||
|
||||
Summary:
|
||||
passed 1
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1389T04 PASSED (1)
|
||||
|
||||
*** C1389T05 start *******************************
|
||||
mem01
|
||||
mem01 0 TINFO : Free Mem: 20465 Mb
|
||||
mem01 0 TINFO : Free Swap: 0 Mb
|
||||
mem01 0 TINFO : Total Free: 20465 Mb
|
||||
mem01 0 TINFO : Total Tested: 3056 Mb
|
||||
mem01 0 TINFO : touching 3056MB of malloc'ed memory (linear)
|
||||
mem01 1 TPASS : malloc - alloc of 3056MB succeeded
|
||||
*** C1389T05 PASSED (1)
|
||||
77
test/issues/1389/x86_64_result.log
Normal file
77
test/issues/1389/x86_64_result.log
Normal file
@ -0,0 +1,77 @@
|
||||
sh ./C1389.sh
|
||||
mcstop+release.sh ... done
|
||||
mcreboot.sh -c 1-7 -m 10G@0,10G@1 -O ... done
|
||||
*** C1389T01 start *******************************
|
||||
[OK] totalram: 21463240704
|
||||
[OK] freeram: 21459673088
|
||||
[OK] mem_unit: 1
|
||||
*** C1389T01 PASSED ******************************
|
||||
|
||||
*** C1389T02 start *******************************
|
||||
[OK] MemTotal: 21463240704
|
||||
[OK] MemFree: 21453983744
|
||||
[OK] SwapTotal: 0
|
||||
[OK] SwapFree: 0
|
||||
[OK] CommitLimit: 21453983744
|
||||
[OK] Committed_AS: 9256960
|
||||
*** C1389T02 PASSED ******************************
|
||||
|
||||
*** C1389T03 start *******************************
|
||||
mtest01 -p80
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
mtest01.c:134: INFO: Filling up 80% of free ram which is 16762396 kbytes
|
||||
mtest01.c:149: INFO: ... child 20718 starting
|
||||
mtest01.c:149: INFO: ... child 20727 starting
|
||||
mtest01.c:149: INFO: ... child 20736 starting
|
||||
mtest01.c:149: INFO: ... child 20745 starting
|
||||
mtest01.c:149: INFO: ... child 20754 starting
|
||||
mtest01.c:149: INFO: ... child 20763 starting
|
||||
mtest01.c:169: INFO: ... [t=300] 1436549120 bytes allocated only in child 20763
|
||||
mtest01.c:169: INFO: ... [t=299] 3145728000 bytes allocated only in child 20718
|
||||
mtest01.c:169: INFO: ... [t=299] 3145728000 bytes allocated only in child 20727
|
||||
mtest01.c:169: INFO: ... [t=299] 3145728000 bytes allocated only in child 20736
|
||||
mtest01.c:169: INFO: ... [t=299] 3145728000 bytes allocated only in child 20745
|
||||
mtest01.c:169: INFO: ... [t=299] 3145728000 bytes allocated only in child 20754
|
||||
mtest01.c:221: PASS: 16762396 kbytes allocated
|
||||
|
||||
Summary:
|
||||
passed 1
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1389T03 PASSED (1)
|
||||
|
||||
*** C1389T04 start *******************************
|
||||
mtest01 -p80 -w
|
||||
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
|
||||
mtest01.c:134: INFO: Filling up 80% of free ram which is 16761132 kbytes
|
||||
mtest01.c:149: INFO: ... child 20802 starting
|
||||
mtest01.c:149: INFO: ... child 20811 starting
|
||||
mtest01.c:149: INFO: ... child 20820 starting
|
||||
mtest01.c:149: INFO: ... child 20829 starting
|
||||
mtest01.c:149: INFO: ... child 20838 starting
|
||||
mtest01.c:149: INFO: ... child 20847 starting
|
||||
mtest01.c:166: INFO: ... [t=300] 1435500544 bytes allocated and used in child 20847
|
||||
mtest01.c:166: INFO: ... [t=299] 3145728000 bytes allocated and used in child 20802
|
||||
mtest01.c:166: INFO: ... [t=299] 3145728000 bytes allocated and used in child 20811
|
||||
mtest01.c:166: INFO: ... [t=299] 3145728000 bytes allocated and used in child 20820
|
||||
mtest01.c:166: INFO: ... [t=299] 3145728000 bytes allocated and used in child 20829
|
||||
mtest01.c:166: INFO: ... [t=299] 3145728000 bytes allocated and used in child 20838
|
||||
mtest01.c:221: PASS: 16761132 kbytes allocated (and written to)
|
||||
|
||||
Summary:
|
||||
passed 1
|
||||
failed 0
|
||||
skipped 0
|
||||
warnings 0
|
||||
*** C1389T04 PASSED (1)
|
||||
|
||||
*** C1389T05 start *******************************
|
||||
mem01
|
||||
mem01 0 TINFO : Free Mem: 20463 Mb
|
||||
mem01 0 TINFO : Free Swap: 0 Mb
|
||||
mem01 0 TINFO : Total Free: 20463 Mb
|
||||
mem01 0 TINFO : Total Tested: 3056 Mb
|
||||
mem01 0 TINFO : touching 3056MB of malloc'ed memory (linear)
|
||||
mem01 1 TPASS : malloc - alloc of 3056MB succeeded
|
||||
*** C1389T05 PASSED (1)
|
||||
41
test/issues/1399/C1399.sh
Executable file
41
test/issues/1399/C1399.sh
Executable file
@ -0,0 +1,41 @@
|
||||
#/bin/sh
|
||||
|
||||
USELTP=1
|
||||
USEOSTEST=0
|
||||
|
||||
. ../../common.sh
|
||||
|
||||
issue="1399"
|
||||
tid=01
|
||||
|
||||
for tno in 01
|
||||
do
|
||||
tname=`printf "C${issue}T%02d" ${tid}`
|
||||
echo "*** ${tname} start *******************************"
|
||||
sudo ${MCEXEC} ./C1399T${tno}
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "*** ${tname} PASSED ******************************"
|
||||
else
|
||||
echo "*** ${tname} FAILED ******************************"
|
||||
fi
|
||||
let tid++
|
||||
echo ""
|
||||
done
|
||||
|
||||
for tp in set_robust_list01 get_robust_list01
|
||||
do
|
||||
tname=`printf "C${issue}T%02d" ${tid}`
|
||||
echo "*** ${tname} start *******************************"
|
||||
sudo $MCEXEC $LTPBIN/$tp 2>&1 | tee $tp.txt
|
||||
ok=`grep PASS $tp.txt | wc -l`
|
||||
ng=`grep FAIL $tp.txt | wc -l`
|
||||
if [ $ng = 0 ]; then
|
||||
echo "*** ${tname} PASSED ($ok)"
|
||||
else
|
||||
echo "*** ${tname} FAILED (ok=$ok ng=$ng)"
|
||||
fi
|
||||
let tid++
|
||||
echo ""
|
||||
done
|
||||
|
||||
36
test/issues/1399/C1399T01.c
Normal file
36
test/issues/1399/C1399T01.c
Normal file
@ -0,0 +1,36 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <linux/futex.h>
|
||||
#include <syscall.h>
|
||||
#include <errno.h>
|
||||
|
||||
int main(int argc, void *argv[])
|
||||
{
|
||||
struct robust_list_head rlh;
|
||||
size_t len = sizeof(struct robust_list_head);
|
||||
int rc = 0, ret = 0;
|
||||
|
||||
errno = 0;
|
||||
rc = syscall(__NR_set_robust_list, &rlh, len + 1);
|
||||
if (rc == -1 && errno == EINVAL) {
|
||||
printf("[OK] invalid len (1 greater than correct): EINVAL\n");
|
||||
} else {
|
||||
printf("[NG] invalid len (1 greater than correct): Succeed\n");
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
rc = syscall(__NR_set_robust_list, &rlh, len - 1);
|
||||
if (rc == -1 && errno == EINVAL) {
|
||||
printf("[OK] invalid len (1 less than correct): EINVAL\n");
|
||||
} else {
|
||||
printf("[NG] invalid len (1 less than correct): Succeed\n");
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
11
test/issues/1399/Makefile
Normal file
11
test/issues/1399/Makefile
Normal file
@ -0,0 +1,11 @@
|
||||
CFLAGS=-g
|
||||
LDFLAGS=
|
||||
|
||||
TARGET=C1399T01
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
test: all
|
||||
./C1399.sh
|
||||
clean:
|
||||
rm -f $(TARGET) *.o *.txt
|
||||
24
test/issues/1399/README
Normal file
24
test/issues/1399/README
Normal file
@ -0,0 +1,24 @@
|
||||
【Issue#1399 動作確認】
|
||||
□ テスト内容
|
||||
1. 下記のテストプログラムを実行し、症状が発生しないことを確認する
|
||||
C1399T01:
|
||||
1. struct robust_list_head のサイズよりも1大きい値をサイズとして指定して
|
||||
set_robsut_list を呼び出し、EINVALで失敗することを確認
|
||||
2. struct robust_list_head のサイズよりも1小さい値をサイズとして指定して
|
||||
set_robsut_list を呼び出し、EINVALで失敗することを確認
|
||||
|
||||
2. 以下のLTPを用いて既存のrobust_list機能に影響が無いことを確認
|
||||
- set_robst_list01
|
||||
- get_robst_list01
|
||||
|
||||
□ 実行手順
|
||||
$ make test
|
||||
|
||||
McKernelのインストール先や、OSTEST, LTPの配置場所は、
|
||||
$HOME/.mck_test_config を参照している
|
||||
.mck_test_config は、McKernelをビルドした際に生成されるmck_test_config.sample ファイルを
|
||||
$HOMEにコピーし、適宜編集する
|
||||
|
||||
□ 実行結果
|
||||
x86_64_result.log aarch64_result.log 参照。
|
||||
すべての項目をPASSしていることを確認。
|
||||
18
test/issues/1399/aarch64_result.log
Normal file
18
test/issues/1399/aarch64_result.log
Normal file
@ -0,0 +1,18 @@
|
||||
*** C1399T01 start *******************************
|
||||
[OK] invalid len (1 greater than correct): EINVAL
|
||||
[OK] invalid len (1 less than correct): EINVAL
|
||||
*** C1399T01 PASSED ******************************
|
||||
|
||||
*** C1399T02 start *******************************
|
||||
set_robust_list01 1 TPASS : set_robust_list: retval = -1 (expected -1), errno = 22 (expected 22)
|
||||
set_robust_list01 2 TPASS : set_robust_list: retval = 0 (expected 0), errno = 0 (expected 0)
|
||||
*** C1399T02 PASSED (2)
|
||||
|
||||
*** C1399T03 start *******************************
|
||||
get_robust_list01 1 TPASS : get_robust_list failed as expected with EFAULT
|
||||
get_robust_list01 2 TPASS : get_robust_list failed as expected with EFAULT
|
||||
get_robust_list01 3 TPASS : get_robust_list failed as expected with ESRCH
|
||||
get_robust_list01 4 TPASS : get_robust_list succeeded
|
||||
get_robust_list01 5 TPASS : get_robust_list failed as expected with EPERM
|
||||
*** C1399T03 PASSED (5)
|
||||
|
||||
18
test/issues/1399/x86_64_result.log
Normal file
18
test/issues/1399/x86_64_result.log
Normal file
@ -0,0 +1,18 @@
|
||||
*** C1399T01 start *******************************
|
||||
[OK] invalid len (1 greater than correct): EINVAL
|
||||
[OK] invalid len (1 less than correct): EINVAL
|
||||
*** C1399T01 PASSED ******************************
|
||||
|
||||
*** C1399T02 start *******************************
|
||||
set_robust_list01 1 TPASS : set_robust_list: retval = -1 (expected -1), errno = 22 (expected 22)
|
||||
set_robust_list01 2 TPASS : set_robust_list: retval = 0 (expected 0), errno = 0 (expected 0)
|
||||
*** C1399T02 PASSED (2)
|
||||
|
||||
*** C1399T03 start *******************************
|
||||
get_robust_list01 1 TPASS : get_robust_list failed as expected with EFAULT
|
||||
get_robust_list01 2 TPASS : get_robust_list failed as expected with EFAULT
|
||||
get_robust_list01 3 TPASS : get_robust_list failed as expected with ESRCH
|
||||
get_robust_list01 4 TPASS : get_robust_list succeeded
|
||||
get_robust_list01 5 TPASS : get_robust_list failed as expected with EPERM
|
||||
*** C1399T03 PASSED (5)
|
||||
|
||||
43
test/issues/1425/C1425.sh
Executable file
43
test/issues/1425/C1425.sh
Executable file
@ -0,0 +1,43 @@
|
||||
#/bin/sh
|
||||
|
||||
USELTP=1
|
||||
USEOSTEST=0
|
||||
|
||||
. ../../common.sh
|
||||
|
||||
issue="1425"
|
||||
tid=01
|
||||
|
||||
STOPSIG_LIST="TSTP TTIN TTOU"
|
||||
|
||||
for signame in ${STOPSIG_LIST}
|
||||
do
|
||||
tname=`printf "C${issue}T%02d" ${tid}`
|
||||
echo "*** ${tname} start *******************************"
|
||||
sh ./check_stopsig.sh ${MCEXEC} ${signame}
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "*** ${tname} PASSED ******************************"
|
||||
else
|
||||
echo "*** ${tname} FAILED ******************************"
|
||||
fi
|
||||
let tid++
|
||||
echo ""
|
||||
done
|
||||
|
||||
for tp in kill01 kill02 kill06 kill07 kill08 kill09 signal01 signal03 signal04 signal05
|
||||
do
|
||||
tname=`printf "C${issue}T%02d" ${tid}`
|
||||
echo "*** ${tname} start *******************************"
|
||||
sudo $MCEXEC $LTPBIN/$tp 2>&1 | tee $tp.txt
|
||||
ok=`grep PASS $tp.txt | wc -l`
|
||||
ng=`grep FAIL $tp.txt | wc -l`
|
||||
if [ $ng = 0 ]; then
|
||||
echo "*** ${tname} PASSED ($ok)"
|
||||
else
|
||||
echo "*** ${tname} FAILED (ok=$ok ng=$ng)"
|
||||
fi
|
||||
let tid++
|
||||
echo ""
|
||||
done
|
||||
|
||||
11
test/issues/1425/Makefile
Normal file
11
test/issues/1425/Makefile
Normal file
@ -0,0 +1,11 @@
|
||||
CFLAGS=-g
|
||||
LDFLAGS=
|
||||
|
||||
TARGET=
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
test: all
|
||||
sh ./C1425.sh
|
||||
clean:
|
||||
rm -f $(TARGET) *.o *.txt
|
||||
37
test/issues/1425/README
Normal file
37
test/issues/1425/README
Normal file
@ -0,0 +1,37 @@
|
||||
【Issue#1425 動作確認】
|
||||
□ テスト内容
|
||||
1. 本修正ではmcexecにてSIGTSTP, SIGTTIN, SIGTTOU を補足しないようにする
|
||||
修正を実施した。
|
||||
上記のシグナルのデフォルト動作はプロセスの停止である。
|
||||
それぞれのシグナルについて、以下を確認する。
|
||||
- 実行中のMcKernelプロセスに通知した際、通知先のプロセスが停止する
|
||||
- 停止されたプロセスに対してSIGCONTを通知することで、プロセスが再開できる
|
||||
|
||||
C1425T01: SIGTSTP の動作を確認
|
||||
C1425T02: SIGTTIN の動作を確認
|
||||
C1425T03: SIGTTOU の動作を確認
|
||||
|
||||
2. 以下のLTPを用いて既存のsignal機能に影響が無いことを確認
|
||||
- kill01
|
||||
- kill02
|
||||
- kill06
|
||||
- kill07
|
||||
- kill08
|
||||
- kill09
|
||||
- signal01
|
||||
- signal03
|
||||
- signal04
|
||||
- signal05
|
||||
|
||||
□ 実行手順
|
||||
・下記の手順でテストを実行する
|
||||
$ make test
|
||||
|
||||
McKernelのインストール先や、OSTEST, LTPの配置場所は、
|
||||
$HOME/.mck_test_config を参照している
|
||||
.mck_test_config は、McKernelをビルドした際に生成されるmck_test_config.sample ファイルを
|
||||
$HOMEにコピーし、適宜編集する
|
||||
|
||||
□ 実行結果
|
||||
x86_64_result.log, aarch64_result.log 参照。
|
||||
すべての項目をPASSしていることを確認。
|
||||
176
test/issues/1425/aarch64_result.log
Normal file
176
test/issues/1425/aarch64_result.log
Normal file
@ -0,0 +1,176 @@
|
||||
*** C1425T01 start *******************************
|
||||
** Exec sleep 3
|
||||
** TargetPID: 52277
|
||||
[OK] 52277 is running : S+
|
||||
** SEND SIGTSTP to 52277
|
||||
[OK] 52277 is stopped : T+
|
||||
** Sleep 3 sec
|
||||
[OK] 52277 is still stopped : T+
|
||||
** SEND SIGCONT to 52277
|
||||
** Wait pid: 52277
|
||||
[OK] pid: 52277 is Done.
|
||||
*** C1425T01 PASSED ******************************
|
||||
|
||||
*** C1425T02 start *******************************
|
||||
** Exec sleep 3
|
||||
** TargetPID: 52330
|
||||
[OK] 52330 is running : SLl+
|
||||
** SEND SIGTTIN to 52330
|
||||
[OK] 52330 is stopped : TLl+
|
||||
** Sleep 3 sec
|
||||
[OK] 52330 is still stopped : TLl+
|
||||
** SEND SIGCONT to 52330
|
||||
** Wait pid: 52330
|
||||
[OK] pid: 52330 is Done.
|
||||
*** C1425T02 PASSED ******************************
|
||||
|
||||
*** C1425T03 start *******************************
|
||||
** Exec sleep 3
|
||||
** TargetPID: 52378
|
||||
[OK] 52378 is running : SLl+
|
||||
** SEND SIGTTOU to 52378
|
||||
[OK] 52378 is stopped : TLl+
|
||||
** Sleep 3 sec
|
||||
[OK] 52378 is still stopped : TLl+
|
||||
** SEND SIGCONT to 52378
|
||||
** Wait pid: 52378
|
||||
[OK] pid: 52378 is Done.
|
||||
*** C1425T03 PASSED ******************************
|
||||
|
||||
*** C1425T04 start *******************************
|
||||
kill01 1 TPASS : received expected signal 9
|
||||
*** C1425T04 PASSED (1)
|
||||
|
||||
*** C1425T05 start *******************************
|
||||
kill02 1 TPASS : The signal was sent to all processes in the process group.
|
||||
kill02 2 TPASS : The signal was not sent to selective processes that were not in the process group.
|
||||
*** C1425T05 PASSED (2)
|
||||
|
||||
*** C1425T06 start *******************************
|
||||
kill06 1 TPASS : received expected signal 9
|
||||
*** C1425T06 PASSED (1)
|
||||
|
||||
*** C1425T07 start *******************************
|
||||
kill07 0 TINFO : received expected signal 9
|
||||
kill07 1 TPASS : Did not catch signal as expected
|
||||
*** C1425T07 PASSED (1)
|
||||
|
||||
*** C1425T08 start *******************************
|
||||
kill08 1 TPASS : received expected signal 9
|
||||
*** C1425T08 PASSED (1)
|
||||
|
||||
*** C1425T09 start *******************************
|
||||
kill09 1 TPASS : kill(52839, SIGKILL) returned 0
|
||||
*** C1425T09 PASSED (1)
|
||||
|
||||
*** C1425T10 start *******************************
|
||||
signal01 1 TPASS : signal(SIGKILL, 0x1(SIG_IGN)) failed with EINVAL
|
||||
signal01 0 TINFO : Child process returned TPASS
|
||||
signal01 1 TPASS : signal(SIGKILL, (nil)(SIG_DFL)) failed with EINVAL
|
||||
signal01 0 TINFO : Child process returned TPASS
|
||||
signal01 1 TPASS : signal(SIGKILL, 0x403b20(catchsig())) failed with EINVAL
|
||||
signal01 0 TINFO : Child process returned TPASS
|
||||
signal01 1 TPASS : Child killed with SIGKILL
|
||||
signal01 2 TPASS : Child killed with SIGKILL
|
||||
signal01 3 TPASS : Child killed with SIGKILL
|
||||
*** C1425T10 PASSED (9)
|
||||
|
||||
*** C1425T11 start *******************************
|
||||
signal03 1 TPASS : signal03 call succeeded
|
||||
signal03 2 TPASS : signal03 call succeeded
|
||||
signal03 3 TPASS : signal03 call succeeded
|
||||
signal03 4 TPASS : signal03 call succeeded
|
||||
signal03 5 TPASS : signal03 call succeeded
|
||||
signal03 6 TPASS : signal03 call succeeded
|
||||
signal03 7 TPASS : signal03 call succeeded
|
||||
signal03 8 TPASS : signal03 call succeeded
|
||||
signal03 9 TPASS : signal03 call succeeded
|
||||
signal03 10 TPASS : signal03 call succeeded
|
||||
signal03 11 TPASS : signal03 call succeeded
|
||||
signal03 12 TPASS : signal03 call succeeded
|
||||
signal03 13 TPASS : signal03 call succeeded
|
||||
signal03 14 TPASS : signal03 call succeeded
|
||||
signal03 15 TPASS : signal03 call succeeded
|
||||
signal03 16 TPASS : signal03 call succeeded
|
||||
signal03 17 TPASS : signal03 call succeeded
|
||||
signal03 18 TPASS : signal03 call succeeded
|
||||
signal03 19 TPASS : signal03 call succeeded
|
||||
signal03 20 TPASS : signal03 call succeeded
|
||||
signal03 21 TPASS : signal03 call succeeded
|
||||
signal03 22 TPASS : signal03 call succeeded
|
||||
signal03 23 TPASS : signal03 call succeeded
|
||||
signal03 24 TPASS : signal03 call succeeded
|
||||
signal03 25 TPASS : signal03 call succeeded
|
||||
signal03 26 TPASS : signal03 call succeeded
|
||||
signal03 27 TPASS : signal03 call succeeded
|
||||
signal03 28 TPASS : signal03 call succeeded
|
||||
signal03 29 TPASS : signal03 call succeeded
|
||||
signal03 30 TPASS : signal03 call succeeded
|
||||
signal03 31 TPASS : signal03 call succeeded
|
||||
*** C1425T11 PASSED (31)
|
||||
|
||||
*** C1425T12 start *******************************
|
||||
signal04 1 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 2 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 3 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 4 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 5 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 6 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 7 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 8 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 9 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 10 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 11 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 12 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 13 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 14 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 15 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 16 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 17 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 18 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 19 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 20 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 21 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 22 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 23 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 24 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 25 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 26 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 27 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 28 TPASS : signal04 call succeeded received (nil).
|
||||
*** C1425T12 PASSED (28)
|
||||
|
||||
*** C1425T13 start *******************************
|
||||
signal05 1 TPASS : signal05 call succeeded
|
||||
signal05 2 TPASS : signal05 call succeeded
|
||||
signal05 3 TPASS : signal05 call succeeded
|
||||
signal05 4 TPASS : signal05 call succeeded
|
||||
signal05 5 TPASS : signal05 call succeeded
|
||||
signal05 6 TPASS : signal05 call succeeded
|
||||
signal05 7 TPASS : signal05 call succeeded
|
||||
signal05 8 TPASS : signal05 call succeeded
|
||||
signal05 9 TPASS : signal05 call succeeded
|
||||
signal05 10 TPASS : signal05 call succeeded
|
||||
signal05 11 TPASS : signal05 call succeeded
|
||||
signal05 12 TPASS : signal05 call succeeded
|
||||
signal05 13 TPASS : signal05 call succeeded
|
||||
signal05 14 TPASS : signal05 call succeeded
|
||||
signal05 15 TPASS : signal05 call succeeded
|
||||
signal05 16 TPASS : signal05 call succeeded
|
||||
signal05 17 TPASS : signal05 call succeeded
|
||||
signal05 18 TPASS : signal05 call succeeded
|
||||
signal05 19 TPASS : signal05 call succeeded
|
||||
signal05 20 TPASS : signal05 call succeeded
|
||||
signal05 21 TPASS : signal05 call succeeded
|
||||
signal05 22 TPASS : signal05 call succeeded
|
||||
signal05 23 TPASS : signal05 call succeeded
|
||||
signal05 24 TPASS : signal05 call succeeded
|
||||
signal05 25 TPASS : signal05 call succeeded
|
||||
signal05 26 TPASS : signal05 call succeeded
|
||||
signal05 27 TPASS : signal05 call succeeded
|
||||
signal05 28 TPASS : signal05 call succeeded
|
||||
signal05 29 TPASS : signal05 call succeeded
|
||||
signal05 30 TPASS : signal05 call succeeded
|
||||
signal05 31 TPASS : signal05 call succeeded
|
||||
*** C1425T13 PASSED (31)
|
||||
|
||||
55
test/issues/1425/check_stopsig.sh
Executable file
55
test/issues/1425/check_stopsig.sh
Executable file
@ -0,0 +1,55 @@
|
||||
#!/bin/sh
|
||||
|
||||
rc=0
|
||||
slptime=3
|
||||
|
||||
mcexec=$1
|
||||
signame=$2
|
||||
|
||||
echo "** Exec sleep ${slptime}"
|
||||
mcexec sleep ${slptime} &
|
||||
tgtpid=$!
|
||||
|
||||
echo "** TargetPID: ${tgtpid}"
|
||||
stat_1=`ps -o stat,pid -p ${tgtpid} | grep ${tgtpid} | cut -f1 -d ' '`
|
||||
|
||||
if [ `echo ${stat_1} | grep -e "^S" | wc -l` -eq 1 ]; then
|
||||
echo "[OK] ${tgtpid} is running : ${stat_1}"
|
||||
else
|
||||
echo "[NG] ${tgtpid} is NOT running : ${stat_1}"
|
||||
rc=1
|
||||
fi
|
||||
|
||||
echo "** SEND SIG${signame} to ${tgtpid}"
|
||||
kill -${signame} ${tgtpid}
|
||||
sleep 1
|
||||
|
||||
stat_2=`ps -o stat,pid -p ${tgtpid} | grep ${tgtpid} | cut -f1 -d ' '`
|
||||
|
||||
if [ `echo ${stat_2} | grep -e "^T" | wc -l` -eq 1 ]; then
|
||||
echo "[OK] ${tgtpid} is stopped : ${stat_2}"
|
||||
else
|
||||
echo "[NG] ${tgtpid} is NOT stopped : ${stat_2}"
|
||||
rc=1
|
||||
fi
|
||||
|
||||
echo "** Sleep ${slptime} sec"
|
||||
sleep ${slptime}
|
||||
|
||||
stat_3=`ps -o stat,pid -p ${tgtpid} | grep ${tgtpid} | cut -f1 -d ' '`
|
||||
|
||||
if [ `echo ${stat_2} | grep -e "^T" | wc -l` -eq 1 ]; then
|
||||
echo "[OK] ${tgtpid} is still stopped : ${stat_3}"
|
||||
else
|
||||
echo "[NG] ${tgtpid} is NOT stopped : ${stat_3}"
|
||||
rc=1
|
||||
fi
|
||||
|
||||
echo "** SEND SIGCONT to ${tgtpid}"
|
||||
kill -CONT ${tgtpid}
|
||||
|
||||
echo "** Wait pid: ${tgtpid}"
|
||||
wait ${tgtpid}
|
||||
|
||||
echo "[OK] pid: ${tgtpid} is Done."
|
||||
exit ${rc}
|
||||
176
test/issues/1425/x86_64_result.log
Normal file
176
test/issues/1425/x86_64_result.log
Normal file
@ -0,0 +1,176 @@
|
||||
*** C1425T01 start *******************************
|
||||
** Exec sleep 3
|
||||
** TargetPID: 5737
|
||||
[OK] 5737 is running : S+
|
||||
** SEND SIGTSTP to 5737
|
||||
[OK] 5737 is stopped : TL+
|
||||
** Sleep 3 sec
|
||||
[OK] 5737 is still stopped : TL+
|
||||
** SEND SIGCONT to 5737
|
||||
** Wait pid: 5737
|
||||
[OK] pid: 5737 is Done.
|
||||
*** C1425T01 PASSED ******************************
|
||||
|
||||
*** C1425T02 start *******************************
|
||||
** Exec sleep 3
|
||||
** TargetPID: 5798
|
||||
[OK] 5798 is running : SLl+
|
||||
** SEND SIGTTIN to 5798
|
||||
[OK] 5798 is stopped : TLl+
|
||||
** Sleep 3 sec
|
||||
[OK] 5798 is still stopped : TLl+
|
||||
** SEND SIGCONT to 5798
|
||||
** Wait pid: 5798
|
||||
[OK] pid: 5798 is Done.
|
||||
*** C1425T02 PASSED ******************************
|
||||
|
||||
*** C1425T03 start *******************************
|
||||
** Exec sleep 3
|
||||
** TargetPID: 5859
|
||||
[OK] 5859 is running : SLl+
|
||||
** SEND SIGTTOU to 5859
|
||||
[OK] 5859 is stopped : TLl+
|
||||
** Sleep 3 sec
|
||||
[OK] 5859 is still stopped : TLl+
|
||||
** SEND SIGCONT to 5859
|
||||
** Wait pid: 5859
|
||||
[OK] pid: 5859 is Done.
|
||||
*** C1425T03 PASSED ******************************
|
||||
|
||||
*** C1425T04 start *******************************
|
||||
kill01 1 TPASS : received expected signal 9
|
||||
*** C1425T04 PASSED (1)
|
||||
|
||||
*** C1425T05 start *******************************
|
||||
kill02 1 TPASS : The signal was sent to all processes in the process group.
|
||||
kill02 2 TPASS : The signal was not sent to selective processes that were not in the process group.
|
||||
*** C1425T05 PASSED (2)
|
||||
|
||||
*** C1425T06 start *******************************
|
||||
kill06 1 TPASS : received expected signal 9
|
||||
*** C1425T06 PASSED (1)
|
||||
|
||||
*** C1425T07 start *******************************
|
||||
kill07 0 TINFO : received expected signal 9
|
||||
kill07 1 TPASS : Did not catch signal as expected
|
||||
*** C1425T07 PASSED (1)
|
||||
|
||||
*** C1425T08 start *******************************
|
||||
kill08 1 TPASS : received expected signal 9
|
||||
*** C1425T08 PASSED (1)
|
||||
|
||||
*** C1425T09 start *******************************
|
||||
kill09 1 TPASS : kill(6713, SIGKILL) returned 0
|
||||
*** C1425T09 PASSED (1)
|
||||
|
||||
*** C1425T10 start *******************************
|
||||
signal01 1 TPASS : signal(SIGKILL, 0x1(SIG_IGN)) failed with EINVAL
|
||||
signal01 0 TINFO : Child process returned TPASS
|
||||
signal01 1 TPASS : signal(SIGKILL, (nil)(SIG_DFL)) failed with EINVAL
|
||||
signal01 0 TINFO : Child process returned TPASS
|
||||
signal01 1 TPASS : signal(SIGKILL, 0x403620(catchsig())) failed with EINVAL
|
||||
signal01 0 TINFO : Child process returned TPASS
|
||||
signal01 1 TPASS : Child killed with SIGKILL
|
||||
signal01 2 TPASS : Child killed with SIGKILL
|
||||
signal01 3 TPASS : Child killed with SIGKILL
|
||||
*** C1425T10 PASSED (9)
|
||||
|
||||
*** C1425T11 start *******************************
|
||||
signal03 1 TPASS : signal03 call succeeded
|
||||
signal03 2 TPASS : signal03 call succeeded
|
||||
signal03 3 TPASS : signal03 call succeeded
|
||||
signal03 4 TPASS : signal03 call succeeded
|
||||
signal03 5 TPASS : signal03 call succeeded
|
||||
signal03 6 TPASS : signal03 call succeeded
|
||||
signal03 7 TPASS : signal03 call succeeded
|
||||
signal03 8 TPASS : signal03 call succeeded
|
||||
signal03 9 TPASS : signal03 call succeeded
|
||||
signal03 10 TPASS : signal03 call succeeded
|
||||
signal03 11 TPASS : signal03 call succeeded
|
||||
signal03 12 TPASS : signal03 call succeeded
|
||||
signal03 13 TPASS : signal03 call succeeded
|
||||
signal03 14 TPASS : signal03 call succeeded
|
||||
signal03 15 TPASS : signal03 call succeeded
|
||||
signal03 16 TPASS : signal03 call succeeded
|
||||
signal03 17 TPASS : signal03 call succeeded
|
||||
signal03 18 TPASS : signal03 call succeeded
|
||||
signal03 19 TPASS : signal03 call succeeded
|
||||
signal03 20 TPASS : signal03 call succeeded
|
||||
signal03 21 TPASS : signal03 call succeeded
|
||||
signal03 22 TPASS : signal03 call succeeded
|
||||
signal03 23 TPASS : signal03 call succeeded
|
||||
signal03 24 TPASS : signal03 call succeeded
|
||||
signal03 25 TPASS : signal03 call succeeded
|
||||
signal03 26 TPASS : signal03 call succeeded
|
||||
signal03 27 TPASS : signal03 call succeeded
|
||||
signal03 28 TPASS : signal03 call succeeded
|
||||
signal03 29 TPASS : signal03 call succeeded
|
||||
signal03 30 TPASS : signal03 call succeeded
|
||||
signal03 31 TPASS : signal03 call succeeded
|
||||
*** C1425T11 PASSED (31)
|
||||
|
||||
*** C1425T12 start *******************************
|
||||
signal04 1 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 2 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 3 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 4 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 5 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 6 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 7 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 8 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 9 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 10 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 11 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 12 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 13 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 14 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 15 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 16 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 17 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 18 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 19 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 20 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 21 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 22 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 23 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 24 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 25 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 26 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 27 TPASS : signal04 call succeeded received (nil).
|
||||
signal04 28 TPASS : signal04 call succeeded received (nil).
|
||||
*** C1425T12 PASSED (28)
|
||||
|
||||
*** C1425T13 start *******************************
|
||||
signal05 1 TPASS : signal05 call succeeded
|
||||
signal05 2 TPASS : signal05 call succeeded
|
||||
signal05 3 TPASS : signal05 call succeeded
|
||||
signal05 4 TPASS : signal05 call succeeded
|
||||
signal05 5 TPASS : signal05 call succeeded
|
||||
signal05 6 TPASS : signal05 call succeeded
|
||||
signal05 7 TPASS : signal05 call succeeded
|
||||
signal05 8 TPASS : signal05 call succeeded
|
||||
signal05 9 TPASS : signal05 call succeeded
|
||||
signal05 10 TPASS : signal05 call succeeded
|
||||
signal05 11 TPASS : signal05 call succeeded
|
||||
signal05 12 TPASS : signal05 call succeeded
|
||||
signal05 13 TPASS : signal05 call succeeded
|
||||
signal05 14 TPASS : signal05 call succeeded
|
||||
signal05 15 TPASS : signal05 call succeeded
|
||||
signal05 16 TPASS : signal05 call succeeded
|
||||
signal05 17 TPASS : signal05 call succeeded
|
||||
signal05 18 TPASS : signal05 call succeeded
|
||||
signal05 19 TPASS : signal05 call succeeded
|
||||
signal05 20 TPASS : signal05 call succeeded
|
||||
signal05 21 TPASS : signal05 call succeeded
|
||||
signal05 22 TPASS : signal05 call succeeded
|
||||
signal05 23 TPASS : signal05 call succeeded
|
||||
signal05 24 TPASS : signal05 call succeeded
|
||||
signal05 25 TPASS : signal05 call succeeded
|
||||
signal05 26 TPASS : signal05 call succeeded
|
||||
signal05 27 TPASS : signal05 call succeeded
|
||||
signal05 28 TPASS : signal05 call succeeded
|
||||
signal05 29 TPASS : signal05 call succeeded
|
||||
signal05 30 TPASS : signal05 call succeeded
|
||||
signal05 31 TPASS : signal05 call succeeded
|
||||
*** C1425T13 PASSED (31)
|
||||
|
||||
63
test/issues/1457/C1457.py
Normal file
63
test/issues/1457/C1457.py
Normal file
@ -0,0 +1,63 @@
|
||||
#
|
||||
# Test script for issue #1439
|
||||
#
|
||||
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
def get_command_result(cmd):
|
||||
results = subprocess.Popen(
|
||||
cmd, stdout=subprocess.PIPE,
|
||||
shell=True).stdout.readlines()
|
||||
return [str(x).rstrip("\n") for x in results]
|
||||
|
||||
def enumerate_cpu(cpu_list):
|
||||
allcpus = []
|
||||
for ranged_cpu in cpu_list.split(','):
|
||||
try:
|
||||
cpu_begin, cpu_end = ranged_cpu.split('-')
|
||||
except ValueError:
|
||||
cpu_begin = cpu_end = ranged_cpu
|
||||
for i in range(int(cpu_begin), int(cpu_end) + 1):
|
||||
allcpus.append(i)
|
||||
allcpus.sort()
|
||||
return allcpus
|
||||
|
||||
def get_online_cpu():
|
||||
online_file = open('/sys/devices/system/cpu/online', 'r')
|
||||
return online_file.readlines()[0].strip()
|
||||
|
||||
def get_cpuinfo_processors():
|
||||
processors = []
|
||||
cpuinfo_file = open('/proc/cpuinfo', 'r')
|
||||
for line in cpuinfo_file.readlines():
|
||||
if line.startswith('processor'):
|
||||
processor = int(line.strip().split()[-1])
|
||||
processors.append(processor)
|
||||
return processors
|
||||
|
||||
def main():
|
||||
onlines = enumerate_cpu(get_online_cpu())
|
||||
processors = get_cpuinfo_processors()
|
||||
|
||||
print '# of online cpus:', len(onlines)
|
||||
print '# of cpuinfo processors:', len(processors)
|
||||
if len(onlines) != len(processors):
|
||||
print 'ERROR: # of processors is not equal to # of cpus'
|
||||
print 'FAIL'
|
||||
exit()
|
||||
|
||||
i = 0
|
||||
for cpu in processors:
|
||||
print i, 'processor:', cpu
|
||||
if i != cpu:
|
||||
print 'ERROR: processor number is not ordered'
|
||||
print 'FAIL'
|
||||
exit()
|
||||
i = i + 1
|
||||
|
||||
print 'SUCCESS'
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
7
test/issues/1457/C1457.sh
Executable file
7
test/issues/1457/C1457.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
. ${HOME}/.mck_test_config
|
||||
export MCK_DIR
|
||||
sudo ${MCK_DIR}/sbin/mcreboot.sh 1,3,5,7,9-12,50-58
|
||||
${MCK_DIR}/bin/mcexec python C1457.py
|
||||
sudo ${MCK_DIR}/sbin/mcstop+release.sh
|
||||
2
test/issues/1457/Makefile
Normal file
2
test/issues/1457/Makefile
Normal file
@ -0,0 +1,2 @@
|
||||
test::
|
||||
./C1457.shy
|
||||
22
test/issues/1457/README
Normal file
22
test/issues/1457/README
Normal file
@ -0,0 +1,22 @@
|
||||
□ テスト内容
|
||||
|
||||
arm64環境における/proc/cpuinfoについて、以下を確かめる。
|
||||
|
||||
(1) "processor" フィールドが/sys/devices/system/cpu/onlineファイルが示す
|
||||
CPUの数だけ存在すること。
|
||||
(2) "processor" フィールドの値が0からはじまる連番であること。
|
||||
|
||||
|
||||
□ 実行手順
|
||||
|
||||
(1) $HOME/.mck_test_configを、MCK_DIRがMcKernelのインストール先を指すように編集する
|
||||
(2) 以下を実行する
|
||||
|
||||
$ make test
|
||||
|
||||
|
||||
□ 確認方法
|
||||
|
||||
標準出力にSUCCESSが出力されること
|
||||
|
||||
|
||||
31
test/issues/1457/aarch64_result.log
Normal file
31
test/issues/1457/aarch64_result.log
Normal file
@ -0,0 +1,31 @@
|
||||
# of online cpus: 28
|
||||
# of cpuinfo processors: 28
|
||||
0 processor: 0
|
||||
1 processor: 1
|
||||
2 processor: 2
|
||||
3 processor: 3
|
||||
4 processor: 4
|
||||
5 processor: 5
|
||||
6 processor: 6
|
||||
7 processor: 7
|
||||
8 processor: 8
|
||||
9 processor: 9
|
||||
10 processor: 10
|
||||
11 processor: 11
|
||||
12 processor: 12
|
||||
13 processor: 13
|
||||
14 processor: 14
|
||||
15 processor: 15
|
||||
16 processor: 16
|
||||
17 processor: 17
|
||||
18 processor: 18
|
||||
19 processor: 19
|
||||
20 processor: 20
|
||||
21 processor: 21
|
||||
22 processor: 22
|
||||
23 processor: 23
|
||||
24 processor: 24
|
||||
25 processor: 25
|
||||
26 processor: 26
|
||||
27 processor: 27
|
||||
SUCCESS
|
||||
@ -1,145 +0,0 @@
|
||||
#/bin/sh
|
||||
|
||||
USELTP=0
|
||||
USEOSTEST=0
|
||||
|
||||
. ../../common.sh
|
||||
|
||||
issue="929"
|
||||
tid=01
|
||||
|
||||
tname=`printf "C${issue}T%02d" ${tid}`
|
||||
echo "*** ${tname} start *******************************"
|
||||
TEST_CMD="mpirun -f ./hostfile -ppn 5 ${MCEXEC} -n 5 ./test_prog.sh"
|
||||
echo ${TEST_CMD}
|
||||
${TEST_CMD} &> ${tname}.txt
|
||||
mpi_ret=$?
|
||||
|
||||
cat ./${tname}.txt
|
||||
started_num=`grep 'test_prog is started' ./${tname}.txt | wc -l`
|
||||
|
||||
if [ ${mpi_ret} -eq 0 -a ${started_num} -eq 5 ]; then
|
||||
echo "*** ${tname} PASSED ******************************"
|
||||
else
|
||||
echo "*** ${tname} FAILED ******************************"
|
||||
fi
|
||||
let tid++
|
||||
echo ""
|
||||
|
||||
tname=`printf "C${issue}T%02d" ${tid}`
|
||||
echo "*** ${tname} start *******************************"
|
||||
TEST_CMD="mpirun -f ./hostfile -ppn 5 ${MCEXEC} -n 3 ./test_prog.sh"
|
||||
echo ${TEST_CMD}
|
||||
${TEST_CMD} &> ${tname}.txt
|
||||
mpi_ret=$?
|
||||
|
||||
cat ./${tname}.txt
|
||||
started_num=`grep 'test_prog is started' ./${tname}.txt | wc -l`
|
||||
|
||||
if [ ${mpi_ret} -ne 0 -a ${started_num} -eq 3 ]; then
|
||||
echo "*** ${tname} PASSED ******************************"
|
||||
else
|
||||
echo "*** ${tname} FAILED ******************************"
|
||||
fi
|
||||
let tid++
|
||||
echo ""
|
||||
|
||||
tname=`printf "C${issue}T%02d" ${tid}`
|
||||
echo "*** ${tname} start *******************************"
|
||||
TEST_CMD="mpirun -f ./hostfile -ppn 3 ${MCEXEC} -n 5 ./test_prog.sh"
|
||||
echo ${TEST_CMD}
|
||||
${TEST_CMD} &> ${tname}.txt
|
||||
mpi_ret=$?
|
||||
|
||||
cat ./${tname}.txt
|
||||
started_num=`grep 'test_prog is started' ./${tname}.txt | wc -l`
|
||||
|
||||
if [ ${mpi_ret} -ne 0 -a ${started_num} -eq 0 ]; then
|
||||
echo "*** ${tname} PASSED ******************************"
|
||||
else
|
||||
echo "*** ${tname} FAILED ******************************"
|
||||
fi
|
||||
let tid++
|
||||
echo ""
|
||||
|
||||
tname=`printf "C${issue}T%02d" ${tid}`
|
||||
echo "*** ${tname} start *******************************"
|
||||
TEST_CMD="mpirun -f ./hostfile -ppn 6 ${MCEXEC} -n 3 ./test_prog.sh"
|
||||
echo ${TEST_CMD}
|
||||
${TEST_CMD} &> ${tname}.txt
|
||||
mpi_ret=$?
|
||||
|
||||
cat ./${tname}.txt
|
||||
started_num=`grep 'test_prog is started' ./${tname}.txt | wc -l`
|
||||
|
||||
if [ ${mpi_ret} -ne 0 -a ${started_num} -eq 3 ]; then
|
||||
echo "*** ${tname} PASSED ******************************"
|
||||
else
|
||||
echo "*** ${tname} FAILED ******************************"
|
||||
fi
|
||||
let tid++
|
||||
echo ""
|
||||
|
||||
tname=`printf "C${issue}T%02d" ${tid}`
|
||||
echo "*** ${tname} start *******************************"
|
||||
TEST_CMD="mpirun -f ./hostfile -ppn 250 ${MCEXEC} -n 250 ./test_prog.sh"
|
||||
echo ${TEST_CMD}
|
||||
${TEST_CMD} &> ${tname}.txt
|
||||
mpi_ret=$?
|
||||
|
||||
head -n 10 ./${tname}.txt
|
||||
echo "..."
|
||||
started_num=`grep 'test_prog is started' ./${tname}.txt | wc -l`
|
||||
|
||||
if [ ${mpi_ret} -ne 0 -a ${started_num} -eq 0 ]; then
|
||||
echo "*** ${tname} PASSED ******************************"
|
||||
else
|
||||
echo "*** ${tname} FAILED ******************************"
|
||||
fi
|
||||
let tid++
|
||||
echo ""
|
||||
|
||||
tname=`printf "C${issue}T%02d" ${tid}`
|
||||
echo "*** ${tname} start *******************************"
|
||||
ng=0
|
||||
TEST_CMD="mpirun -f ./hostfile -ppn 5 ${MCEXEC} -n 5 ./test_prog.sh"
|
||||
echo "** reboot mcrernel for check pe_list_len"
|
||||
mcreboot
|
||||
echo "** enable debug message in mcexec_get_cpuset"
|
||||
sudo sh -c "echo -n 'func mcexec_get_cpuset +p' > /sys/kernel/debug/dynamic_debug/control"
|
||||
echo ${TEST_CMD}
|
||||
for i in `seq 1 20`
|
||||
do
|
||||
${TEST_CMD} &> ${tname}.txt
|
||||
mpi_ret=$?
|
||||
started_num=`grep 'test_prog is started' ./${tname}.txt | wc -l`
|
||||
if [ ${mpi_ret} -eq 0 -a ${started_num} -eq 5 ]; then
|
||||
echo "[OK] exec: $i"
|
||||
else
|
||||
echo "[NG] exec: $i"
|
||||
let ng++
|
||||
fi
|
||||
done
|
||||
echo "** check pe_list_len"
|
||||
dmesg --notime | grep "mcexec_get_cpuset: pe_list" | tail -n 20 | cut -f 2-3 -d ':' > ./pe_list_len.txt
|
||||
cat ./pe_list_len.txt | while read line
|
||||
do
|
||||
len=`echo ${line} | cut -f 2 -d ':'`
|
||||
if [ ${len} -ge 0 -a ${len} -le 5 ]; then
|
||||
echo "[OK] ${line}"
|
||||
else
|
||||
echo "[NG] ${line}"
|
||||
let ng++
|
||||
fi
|
||||
done
|
||||
echo "** disable debug message in mcexec_get_cpuset"
|
||||
sudo sh -c "echo -n 'func mcexec_get_cpuset -p' > /sys/kernel/debug/dynamic_debug/control"
|
||||
|
||||
if [ ${ng} -eq 0 ]; then
|
||||
echo "*** ${tname} PASSED ******************************"
|
||||
else
|
||||
echo "*** ${tname} FAILED ******************************"
|
||||
fi
|
||||
let tid++
|
||||
echo ""
|
||||
|
||||
@ -1,36 +0,0 @@
|
||||
【Issue#929 動作確認】
|
||||
□ テスト内容
|
||||
1. mpirunで指定する-ppnと、mcexecで指定する-n の指定状況ごとに
|
||||
想定どおりの動作となることを確認
|
||||
C929T01:
|
||||
-ppn == -n の場合に、プログラムが実行され、mpirunが成功する
|
||||
|
||||
C929T02:
|
||||
-ppn > -n の場合に、プログラムの一部が実行され、mpirunが失敗する
|
||||
|
||||
C929T03:
|
||||
-ppn < -n の場合に、プログラムが実行されず、mpirunが失敗する
|
||||
|
||||
C929T04:
|
||||
-ppn が -n の整数倍である場合に、プログラムの一部が実行され、mpirunが失敗する
|
||||
|
||||
C929T05:
|
||||
-ppn と -n がMcKernelに割り当てたCPU数よりも大きい場合に、
|
||||
プログラムが実行されず、mpirunが失敗する
|
||||
|
||||
C929T06:
|
||||
-ppn == -n での正常実行を20回連続で行った場合に、
|
||||
プログラムが実行され、mpirunが成功する
|
||||
また、mcctrlで管理しているpart_exec_list の要素数が5を超えない
|
||||
|
||||
□ 実行手順
|
||||
$ make test
|
||||
|
||||
McKernelのインストール先や、OSTEST, LTPの配置場所は、
|
||||
$HOME/.mck_test_config を参照している
|
||||
.mck_test_config は、McKernelをビルドした際に生成されるmck_test_config.sample ファイルを
|
||||
$HOMEにコピーし、適宜編集する
|
||||
|
||||
□ 実行結果
|
||||
x86_64_result.log aarch64_result.log 参照。
|
||||
すべての項目をPASSしていることを確認。
|
||||
@ -1,99 +0,0 @@
|
||||
*** C929T01 start *******************************
|
||||
mpirun -f ./hostfile -ppn 5 /home/satoken/ihk+mckernel/bin/mcexec -n 5 ./test_prog.sh
|
||||
test_prog is started.
|
||||
test_prog is started.
|
||||
test_prog is started.
|
||||
test_prog is started.
|
||||
test_prog is started.
|
||||
*** C929T01 PASSED ******************************
|
||||
|
||||
*** C929T02 start *******************************
|
||||
mpirun -f ./hostfile -ppn 5 /home/satoken/ihk+mckernel/bin/mcexec -n 3 ./test_prog.sh
|
||||
getting CPU set for partitioned execution: Invalid argument
|
||||
getting CPU set for partitioned execution: Invalid argument
|
||||
test_prog is started.
|
||||
test_prog is started.
|
||||
test_prog is started.
|
||||
*** C929T02 PASSED ******************************
|
||||
|
||||
*** C929T03 start *******************************
|
||||
mpirun -f ./hostfile -ppn 3 /home/satoken/ihk+mckernel/bin/mcexec -n 5 ./test_prog.sh
|
||||
getting CPU set for partitioned execution: Connection timed out
|
||||
getting CPU set for partitioned execution: Connection timed out
|
||||
getting CPU set for partitioned execution: Connection timed out
|
||||
*** C929T03 PASSED ******************************
|
||||
|
||||
*** C929T04 start *******************************
|
||||
mpirun -f ./hostfile -ppn 6 /home/satoken/ihk+mckernel/bin/mcexec -n 3 ./test_prog.sh
|
||||
getting CPU set for partitioned execution: Invalid argument
|
||||
getting CPU set for partitioned execution: Invalid argument
|
||||
getting CPU set for partitioned execution: Invalid argument
|
||||
test_prog is started.
|
||||
test_prog is started.
|
||||
test_prog is started.
|
||||
*** C929T04 PASSED ******************************
|
||||
|
||||
*** C929T05 start *******************************
|
||||
mpirun -f ./hostfile -ppn 250 /home/satoken/ihk+mckernel/bin/mcexec -n 250 ./test_prog.sh
|
||||
error: nr_processes can't exceed nr. of CPUs
|
||||
error: nr_processes can't exceed nr. of CPUs
|
||||
error: nr_processes can't exceed nr. of CPUs
|
||||
error: nr_processes can't exceed nr. of CPUs
|
||||
error: nr_processes can't exceed nr. of CPUs
|
||||
error: nr_processes can't exceed nr. of CPUs
|
||||
error: nr_processes can't exceed nr. of CPUs
|
||||
error: nr_processes can't exceed nr. of CPUs
|
||||
error: nr_processes can't exceed nr. of CPUs
|
||||
error: nr_processes can't exceed nr. of CPUs
|
||||
...
|
||||
*** C929T05 PASSED ******************************
|
||||
|
||||
*** C929T06 start *******************************
|
||||
** reboot mcrernel for check pe_list_len
|
||||
mcreboot.sh -c 1-6,29-34 -m 50G@0,50G@1 -r 1-6:0+29-34:28 -O ... done
|
||||
** enable debug message in mcexec_get_cpuset
|
||||
mpirun -f ./hostfile -ppn 5 /home/satoken/ihk+mckernel/bin/mcexec -n 5 ./test_prog.sh
|
||||
[OK] exec: 1
|
||||
[OK] exec: 2
|
||||
[OK] exec: 3
|
||||
[OK] exec: 4
|
||||
[OK] exec: 5
|
||||
[OK] exec: 6
|
||||
[OK] exec: 7
|
||||
[OK] exec: 8
|
||||
[OK] exec: 9
|
||||
[OK] exec: 10
|
||||
[OK] exec: 11
|
||||
[OK] exec: 12
|
||||
[OK] exec: 13
|
||||
[OK] exec: 14
|
||||
[OK] exec: 15
|
||||
[OK] exec: 16
|
||||
[OK] exec: 17
|
||||
[OK] exec: 18
|
||||
[OK] exec: 19
|
||||
[OK] exec: 20
|
||||
** check pe_list_len
|
||||
[OK] pe_list_len:0
|
||||
[OK] pe_list_len:1
|
||||
[OK] pe_list_len:2
|
||||
[OK] pe_list_len:3
|
||||
[OK] pe_list_len:4
|
||||
[OK] pe_list_len:5
|
||||
[OK] pe_list_len:5
|
||||
[OK] pe_list_len:5
|
||||
[OK] pe_list_len:5
|
||||
[OK] pe_list_len:5
|
||||
[OK] pe_list_len:5
|
||||
[OK] pe_list_len:5
|
||||
[OK] pe_list_len:5
|
||||
[OK] pe_list_len:5
|
||||
[OK] pe_list_len:5
|
||||
[OK] pe_list_len:5
|
||||
[OK] pe_list_len:5
|
||||
[OK] pe_list_len:5
|
||||
[OK] pe_list_len:5
|
||||
[OK] pe_list_len:5
|
||||
** disable debug message in mcexec_get_cpuset
|
||||
*** C929T06 PASSED ******************************
|
||||
|
||||
@ -1 +0,0 @@
|
||||
localhost
|
||||
@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "test_prog is started."
|
||||
@ -1,74 +0,0 @@
|
||||
*** C929T01 start *******************************
|
||||
mpirun -f ./hostfile -ppn 5 /home/satoken/ihk+mckernel/bin/mcexec -n 5 ./test_prog.sh
|
||||
test_prog is started.
|
||||
test_prog is started.
|
||||
test_prog is started.
|
||||
test_prog is started.
|
||||
test_prog is started.
|
||||
*** C929T01 PASSED ******************************
|
||||
|
||||
*** C929T02 start *******************************
|
||||
mpirun -f ./hostfile -ppn 5 /home/satoken/ihk+mckernel/bin/mcexec -n 3 ./test_prog.sh
|
||||
getting CPU set for partitioned execution: Invalid argument
|
||||
getting CPU set for partitioned execution: Invalid argument
|
||||
test_prog is started.
|
||||
test_prog is started.
|
||||
test_prog is started.
|
||||
*** C929T02 PASSED ******************************
|
||||
|
||||
*** C929T03 start *******************************
|
||||
mpirun -f ./hostfile -ppn 3 /home/satoken/ihk+mckernel/bin/mcexec -n 5 ./test_prog.sh
|
||||
getting CPU set for partitioned execution: Connection timed out
|
||||
getting CPU set for partitioned execution: Connection timed out
|
||||
getting CPU set for partitioned execution: Connection timed out
|
||||
*** C929T03 PASSED ******************************
|
||||
|
||||
*** C929T04 start *******************************
|
||||
mpirun -f ./hostfile -ppn 6 /home/satoken/ihk+mckernel/bin/mcexec -n 3 ./test_prog.sh
|
||||
getting CPU set for partitioned execution: Invalid argument
|
||||
getting CPU set for partitioned execution: Invalid argument
|
||||
getting CPU set for partitioned execution: Invalid argument
|
||||
test_prog is started.
|
||||
test_prog is started.
|
||||
test_prog is started.
|
||||
*** C929T04 PASSED ******************************
|
||||
|
||||
*** C929T05 start *******************************
|
||||
mpirun -f ./hostfile -ppn 250 /home/satoken/ihk+mckernel/bin/mcexec -n 250 ./test_prog.sh
|
||||
error: nr_processes can't exceed nr. of CPUs
|
||||
error: nr_processes can't exceed nr. of CPUs
|
||||
error: nr_processes can't exceed nr. of CPUs
|
||||
error: nr_processes can't exceed nr. of CPUs
|
||||
error: nr_processes can't exceed nr. of CPUs
|
||||
error: nr_processes can't exceed nr. of CPUs
|
||||
error: nr_processes can't exceed nr. of CPUs
|
||||
error: nr_processes can't exceed nr. of CPUs
|
||||
error: nr_processes can't exceed nr. of CPUs
|
||||
error: nr_processes can't exceed nr. of CPUs
|
||||
...
|
||||
*** C929T05 PASSED ******************************
|
||||
|
||||
*** C929T06 start *******************************
|
||||
mpirun -f ./hostfile -ppn 5 /home/satoken/ihk+mckernel/bin/mcexec -n 5 ./test_prog.sh
|
||||
[OK] exec: 1
|
||||
[OK] exec: 2
|
||||
[OK] exec: 3
|
||||
[OK] exec: 4
|
||||
[OK] exec: 5
|
||||
[OK] exec: 6
|
||||
[OK] exec: 7
|
||||
[OK] exec: 8
|
||||
[OK] exec: 9
|
||||
[OK] exec: 10
|
||||
[OK] exec: 11
|
||||
[OK] exec: 12
|
||||
[OK] exec: 13
|
||||
[OK] exec: 14
|
||||
[OK] exec: 15
|
||||
[OK] exec: 16
|
||||
[OK] exec: 17
|
||||
[OK] exec: 18
|
||||
[OK] exec: 19
|
||||
[OK] exec: 20
|
||||
*** C929T06 PASSED ******************************
|
||||
|
||||
Reference in New Issue
Block a user