Fixed time processing.

- arm64: Get TSC corresponding to boot time from IHK.

- x86_64: Calculate the current time using vdso.

Refs: #1186
Fujitsu: POSTK_DEBUG_ARCH_DEP_52
Change-Id: I293ba4bbe5390d50dea44b8a5b7471f59237daff
This commit is contained in:
Tomoki Shirasawa
2019-02-17 16:37:29 +09:00
committed by Masamichi Takagi
parent 07aa96ef95
commit 5bc54a3bbe
15 changed files with 471 additions and 88 deletions

View File

@ -2699,4 +2699,40 @@ SYSCALL_DECLARE(time)
return time();
}
void calculate_time_from_tsc(struct timespec *ts)
{
long ver;
unsigned long current_tsc;
time_t sec_delta;
long ns_delta;
for (;;) {
while ((ver = ihk_atomic64_read(&tod_data.version)) & 1) {
/* settimeofday() is in progress */
cpu_pause();
}
rmb(); /* fetch version before time */
*ts = tod_data.origin;
rmb(); /* fetch time before checking version */
if (ver == ihk_atomic64_read(&tod_data.version)) {
break;
}
/* settimeofday() has intervened */
cpu_pause();
}
current_tsc = rdtsc();
sec_delta = current_tsc / tod_data.clocks_per_sec;
ns_delta = NS_PER_SEC * (current_tsc % tod_data.clocks_per_sec)
/ tod_data.clocks_per_sec;
/* calc. of ns_delta overflows if clocks_per_sec exceeds 18.44 GHz */
ts->tv_sec += sec_delta;
ts->tv_nsec += ns_delta;
if (ts->tv_nsec >= NS_PER_SEC) {
ts->tv_nsec -= NS_PER_SEC;
++ts->tv_sec;
}
}
/*** End of File ***/

View File

@ -23,7 +23,6 @@
#define DDEBUG_DEFAULT DDEBUG_PRINT
#endif
#ifdef POSTK_DEBUG_ARCH_DEP_52
#define VDSO_MAXPAGES 1
struct vdso {
long busy;
@ -34,7 +33,6 @@ struct vdso {
long lbase;
long offset_sigtramp;
};
#endif /*POSTK_DEBUG_ARCH_DEP_52*/
extern char vdso_start, vdso_end;
static struct vdso vdso;

View File

@ -64,7 +64,6 @@ uintptr_t debug_constants[] = {
-1,
};
#ifdef POSTK_DEBUG_ARCH_DEP_52
#define VDSO_MAXPAGES 2
struct vdso {
long busy;
@ -80,8 +79,24 @@ struct vdso {
long hpet_phys;
void *pvti_virt;
long pvti_phys;
void *vgtod_virt;
};
struct vsyscall_gtod_data {
int seq;
struct {
int vclock_mode;
unsigned long cycle_last;
unsigned long mask;
unsigned int mult;
unsigned int shift;
} clock;
/* open coded 'struct timespec' */
time_t wall_time_sec;
unsigned long wall_time_snsec;
};
#endif /*POSTK_DEBUG_ARCH_DEP_52*/
static struct vdso vdso;
static size_t container_size = 0;
@ -2811,4 +2826,37 @@ time_t time(void) {
return ret;
}
void calculate_time_from_tsc(struct timespec *ts)
{
unsigned long seq;
unsigned long seq2;
unsigned long ns;
unsigned long delta;
struct vsyscall_gtod_data *gtod = vdso.vgtod_virt;
do {
for (;;) {
seq = ACCESS_ONCE(gtod->seq);
if (unlikely(seq & 1)) {
cpu_pause();
continue;
}
break;
}
rmb(); /* fetch sequence before time */
ts->tv_sec = gtod->wall_time_sec;
ns = gtod->wall_time_snsec;
delta = rdtsc() - gtod->clock.cycle_last;
ns += delta * gtod->clock.mult;
ns >>= gtod->clock.shift;
seq2 = ACCESS_ONCE(gtod->seq);
rmb(); /* fetch time before checking sequence */
} while (seq != seq2);
ts->tv_nsec = ns;
if (ts->tv_nsec >= NS_PER_SEC) {
ts->tv_nsec -= NS_PER_SEC;
++ts->tv_sec;
}
}
/*** End of File ***/

View File

@ -42,7 +42,6 @@ int arch_symbols_init(void)
}
#ifdef POSTK_DEBUG_ARCH_DEP_52
#define VDSO_MAXPAGES 1
struct vdso {
long busy;
@ -53,7 +52,6 @@ struct vdso {
long lbase;
long offset_sigtramp;
};
#endif /*POSTK_DEBUG_ARCH_DEP_52*/
unsigned long
reserve_user_space_common(struct mcctrl_usrdata *usrdata, unsigned long start, unsigned long end);

View File

@ -2,9 +2,13 @@
#include <linux/version.h>
#include <linux/kallsyms.h>
#include <linux/uaccess.h>
#include <asm/vsyscall.h>
#include <asm/vgtod.h>
#include "config.h"
#include "../../mcctrl.h"
#define gtod (&VVAR(vsyscall_gtod_data))
//#define SC_DEBUG
#ifdef SC_DEBUG
@ -54,7 +58,6 @@ int arch_symbols_init(void)
}
#ifdef POSTK_DEBUG_ARCH_DEP_52
#define VDSO_MAXPAGES 2
struct vdso {
long busy;
@ -70,8 +73,8 @@ struct vdso {
long hpet_phys;
void *pvti_virt;
long pvti_phys;
void *vgtod_virt;
};
#endif /*POSTK_DEBUG_ARCH_DEP_52*/
unsigned long
reserve_user_space_common(struct mcctrl_usrdata *usrdata, unsigned long start, unsigned long end);
@ -207,6 +210,7 @@ void get_vdso_info(ihk_os_t os, long vdso_rpa)
#endif
}
vdso->vgtod_virt = (void *)gtod;
out:
wmb();
vdso->busy = 0;

View File

@ -526,24 +526,6 @@ void reply_get_cpu_mapping(long req_pa);
void free_topology_info(ihk_os_t os);
/* archdep.c */
#ifndef POSTK_DEBUG_ARCH_DEP_52
#define VDSO_MAXPAGES 2
struct vdso {
long busy;
int vdso_npages;
char vvar_is_global;
char hpet_is_global;
char pvti_is_global;
char padding;
long vdso_physlist[VDSO_MAXPAGES];
void *vvar_virt;
long vvar_phys;
void *hpet_virt;
long hpet_phys;
void *pvti_virt;
long pvti_phys;
};
#endif /*POSTK_DEBUG_ARCH_DEP_52*/
int reserve_user_space(struct mcctrl_usrdata *usrdata, unsigned long *startp,
unsigned long *endp);

2
ihk

Submodule ihk updated: f4c2dbbb0f...58ed04c571

View File

@ -498,25 +498,6 @@ long do_futex(int n, unsigned long arg0, unsigned long arg1,
void *_linux_printk,
void *_linux_clock_gettime);
#ifndef POSTK_DEBUG_ARCH_DEP_52
#define VDSO_MAXPAGES 2
struct vdso {
long busy;
int vdso_npages;
char vvar_is_global;
char hpet_is_global;
char pvti_is_global;
char padding;
long vdso_physlist[VDSO_MAXPAGES];
void *vvar_virt;
long vvar_phys;
void *hpet_virt;
long hpet_phys;
void *pvti_virt;
long pvti_phys;
};
#endif /*POSTK_DEBUG_ARCH_DEP_52*/
struct cpu_mapping {
int cpu_number;
int hw_id;

View File

@ -170,7 +170,8 @@ static void parse_kargs(void)
}
}
extern void ihk_mc_get_boot_time(unsigned long *tv_sec, unsigned long *tv_nsec);
extern void ihk_mc_get_boot_time(unsigned long *tv_sec, unsigned long *tv_nsec,
unsigned long *tsc);
extern unsigned long ihk_mc_get_ns_per_tsc(void);
static void time_init(void)
@ -179,7 +180,7 @@ static void time_init(void)
unsigned long ns_per_kclock;
unsigned long tsc;
ihk_mc_get_boot_time(&tv_sec, &tv_nsec);
ihk_mc_get_boot_time(&tv_sec, &tv_nsec, &tsc);
ns_per_kclock = ihk_mc_get_ns_per_tsc();
tod_data.origin.tv_sec = tv_sec;
@ -188,7 +189,6 @@ static void time_init(void)
if (ns_per_kclock) {
tod_data.clocks_per_sec = (1000L * NS_PER_SEC) / ns_per_kclock;
tsc = rdtsc();
tod_data.origin.tv_sec -= tsc / tod_data.clocks_per_sec;
tod_data.origin.tv_nsec -= NS_PER_SEC * (tsc % tod_data.clocks_per_sec)
/ tod_data.clocks_per_sec;

View File

@ -7107,45 +7107,6 @@ SYSCALL_DECLARE(get_cpu_id)
return ihk_mc_get_processor_id();
}
void calculate_time_from_tsc(struct timespec *ts)
{
long ver;
unsigned long current_tsc;
time_t sec_delta;
long ns_delta;
for (;;) {
while ((ver = ihk_atomic64_read(&tod_data.version)) & 1) {
/* settimeofday() is in progress */
cpu_pause();
}
rmb();
*ts = tod_data.origin;
rmb();
if (ver == ihk_atomic64_read(&tod_data.version)) {
break;
}
/* settimeofday() has intervened */
cpu_pause();
}
current_tsc = rdtsc();
sec_delta = current_tsc / tod_data.clocks_per_sec;
ns_delta = NS_PER_SEC * (current_tsc % tod_data.clocks_per_sec)
/ tod_data.clocks_per_sec;
/* calc. of ns_delta overflows if clocks_per_sec exceeds 18.44 GHz */
ts->tv_sec += sec_delta;
ts->tv_nsec += ns_delta;
if (ts->tv_nsec >= NS_PER_SEC) {
ts->tv_nsec -= NS_PER_SEC;
++ts->tv_sec;
}
return;
}
SYSCALL_DECLARE(setitimer)
{
int which = (int)ihk_mc_syscall_arg0(ctx);

43
test/issues/1186/C1186.c Normal file
View File

@ -0,0 +1,43 @@
#include <stdlib.h>
#include <stdio.h>
#define _GNU_SOURCE
#include <unistd.h>
#include <sys/syscall.h>
#include <time.h>
long
ts_delta(struct timespec *t1, struct timespec *t2)
{
long delta = (t2->tv_sec - t1->tv_sec) * 1000000000L;
delta += (t2->tv_nsec - t1->tv_nsec);
return delta;
}
int
main(int argc, char **argv)
{
struct timespec d1;
struct timespec d2;
struct timespec d3;
long delta1;
long delta2;
printf("*** C1186T02: test start\n");
clock_gettime(CLOCK_REALTIME, &d1);
syscall(SYS_clock_gettime, CLOCK_REALTIME, &d2);
clock_gettime(CLOCK_REALTIME, &d3);
delta1 = ts_delta(&d1, &d2);
delta2 = ts_delta(&d2, &d3);
printf("%ld.%09ld\n", d1.tv_sec, d1.tv_nsec);
printf("%ld.%09ld %ld\n", d2.tv_sec, d2.tv_nsec, delta1);
printf("%ld.%09ld %ld\n", d3.tv_sec, d3.tv_nsec, delta2);
if (delta1 <= 0 || delta2 <= 0) {
printf("*** C1186T02: NG\n");
exit(1);
}
else {
printf("*** C1186T02: OK\n");
}
exit(0);
}

41
test/issues/1186/C1186.sh Normal file
View File

@ -0,0 +1,41 @@
#!/bin/sh
USELTP=1
USEOSTEST=0
USESTRESSTEST=1
MCREBOOT=0
MCSTOP=0
. ../../common.sh
################################################################################
ng=0
for i in {1..60}; do
if ! $MCEXEC $LTPBIN/futex_wait_bitset02; then
ng=1
break
fi
if [ $i != 60 ]; then
sleep 60
fi
done
if [ $ng = 0 ]; then
echo "*** C1186T01: OK"
else
echo "*** C1186T01: NG"
fi
$MCEXEC ./C1186
for i in gettimeofday01:03 gettimeofday02:04 time01:05 time02:06 \
clock_nanosleep01:07 clock_nanosleep2_01:08 sigtimedwait01:09; do
tp=`echo $i|sed 's/:.*//'`
id=`echo $i|sed 's/.*://'`
sudo $MCEXEC $LTPBIN/$tp 2>&1 | tee $tp.txt
ok=`grep TPASS $tp.txt | wc -l`
ng=`grep TFAIL $tp.txt | wc -l`
if [ $ng = 0 ]; then
echo "*** C1186T$id: $tp OK ($ok)"
else
echo "*** C1186T$id: $tp NG (ok=$ok ng=%ng)"
fi
done

248
test/issues/1186/C1186.txt Normal file
View File

@ -0,0 +1,248 @@
Script started on Thu Feb 14 13:01:04 2019
bash-4.2$ make test
gcc -o C1186 C1186.c
sh ./C1186.sh
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154224us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154556us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154355us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154266us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154555us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154176us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154357us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154358us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154256us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154558us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154367us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154355us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154553us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154557us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154358us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154363us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154360us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154558us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154165us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154266us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 187528us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154360us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154269us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154357us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154164us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154555us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154354us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154179us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154557us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154157us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154265us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154355us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154163us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154559us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154359us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154338us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154157us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154263us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154422us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154361us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154155us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154170us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154359us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154456us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154355us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154559us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154362us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154063us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154554us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154356us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154555us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154256us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154355us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154356us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154174us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154363us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154263us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154554us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154359us, expected 100010us
futex_wait_bitset02 0 TINFO : testing futex_wait_bitset() timeout with CLOCK_REALTIME
futex_wait_bitset02 1 TPASS : futex_wait_bitset() waited 154154us, expected 100010us
*** C1186T01: OK
*** C1186T02: test start
1550120419.311221475
1550120419.311231835 10360
1550120419.311233201 1366
*** C1186T02: OK
gettimeofday01 1 TPASS : gettimeofday(2) set the errno EFAULT correctly
*** C1186T03: gettimeofday01 OK (1)
gettimeofday02 0 TINFO : checking if gettimeofday is monotonous, takes 30s
gettimeofday02 1 TPASS : gettimeofday monotonous in 30 seconds
*** C1186T04: gettimeofday02 OK (1)
time01 1 TPASS : time(0) returned 1550120449
*** C1186T05: time01 OK (1)
time02 1 TPASS : time() returned value 1550120449, stored value 1550120449 are same
*** C1186T06: time02 OK (1)
clock_nanosleep01 0 TINFO : (case00) START
clock_nanosleep01 0 TINFO : check sleep time: (min:480) < 500 < (max:520) (msec)
clock_nanosleep01 0 TINFO : remain time: 1 4216909
EXPECT: return value(ret)=0 errno=0 (Success)
RESULT: return value(ret)=0 errno=0 (Success)
clock_nanosleep01 0 TINFO : (case00) END => OK
clock_nanosleep01 0 TINFO : (case01) START
clock_nanosleep01 0 TINFO : check sleep time: (min:480) < 500 < (max:520) (msec)
clock_nanosleep01 0 TINFO : remain time: 1 4216909
EXPECT: return value(ret)=0 errno=0 (Success)
RESULT: return value(ret)=0 errno=0 (Success)
clock_nanosleep01 0 TINFO : (case01) END => OK
clock_nanosleep01 0 TINFO : (case02) START
clock_nanosleep01 0 TINFO : remain time: 1 4216909
EXPECT: return value(ret)=22 errno=0 (Success)
RESULT: return value(ret)=22 errno=0 (Success)
clock_nanosleep01 0 TINFO : (case02) END => OK
clock_nanosleep01 0 TINFO : (case03) START
clock_nanosleep01 0 TINFO : remain time: 1 4216909
EXPECT: return value(ret)=22 errno=0 (Success)
RESULT: return value(ret)=22 errno=0 (Success)
clock_nanosleep01 0 TINFO : (case03) END => OK
clock_nanosleep01 0 TINFO : (case04) START
clock_nanosleep01 0 TINFO : remain time: 1 4216909
EXPECT: return value(ret)=22 errno=0 (Success)
RESULT: return value(ret)=22 errno=0 (Success)
clock_nanosleep01 0 TINFO : (case04) END => OK
clock_nanosleep01 0 TINFO : (case05) START
clock_nanosleep01 0 TINFO : remain time: 9 498905577
EXPECT: return value(ret)=4 errno=0 (Success)
RESULT: return value(ret)=4 errno=0 (Success)
clock_nanosleep01 0 TINFO : (case05) END => OK
clock_nanosleep01 1 TPASS : clock_nanosleep call succeeded
*** C1186T07: clock_nanosleep01 OK (1)
clock_nanosleep2_01 0 TINFO : Iteration = 0
clock_nanosleep2_01 0 TINFO : Iteration = 1
clock_nanosleep2_01 0 TINFO : Iteration = 2
clock_nanosleep2_01 0 TINFO : Iteration = 3
clock_nanosleep2_01 0 TINFO : Iteration = 4
clock_nanosleep2_01 0 TINFO : Iteration = 5
clock_nanosleep2_01 0 TINFO : Iteration = 6
clock_nanosleep2_01 0 TINFO : Iteration = 7
clock_nanosleep2_01 0 TINFO : Iteration = 8
clock_nanosleep2_01 0 TINFO : Iteration = 9
clock_nanosleep2_01 0 TINFO : Iteration = 10
clock_nanosleep2_01 0 TINFO : Iteration = 11
clock_nanosleep2_01 0 TINFO : Iteration = 12
clock_nanosleep2_01 0 TINFO : Iteration = 13
clock_nanosleep2_01 0 TINFO : Iteration = 14
clock_nanosleep2_01 0 TINFO : Iteration = 15
clock_nanosleep2_01 0 TINFO : Iteration = 16
clock_nanosleep2_01 0 TINFO : Iteration = 17
clock_nanosleep2_01 0 TINFO : Iteration = 18
clock_nanosleep2_01 0 TINFO : Iteration = 19
clock_nanosleep2_01 0 TINFO : Iteration = 20
clock_nanosleep2_01 0 TINFO : Iteration = 21
clock_nanosleep2_01 0 TINFO : Iteration = 22
clock_nanosleep2_01 0 TINFO : Iteration = 23
clock_nanosleep2_01 0 TINFO : Iteration = 24
clock_nanosleep2_01 0 TINFO : Iteration = 25
clock_nanosleep2_01 0 TINFO : Iteration = 26
clock_nanosleep2_01 0 TINFO : Iteration = 27
clock_nanosleep2_01 0 TINFO : Iteration = 28
clock_nanosleep2_01 0 TINFO : Iteration = 29
clock_nanosleep2_01 0 TINFO : Iteration = 30
clock_nanosleep2_01 0 TINFO : Iteration = 31
clock_nanosleep2_01 0 TINFO : Iteration = 32
clock_nanosleep2_01 0 TINFO : Iteration = 33
clock_nanosleep2_01 0 TINFO : Iteration = 34
clock_nanosleep2_01 0 TINFO : Iteration = 35
clock_nanosleep2_01 0 TINFO : Iteration = 36
clock_nanosleep2_01 0 TINFO : Iteration = 37
clock_nanosleep2_01 0 TINFO : Iteration = 38
clock_nanosleep2_01 0 TINFO : Iteration = 39
clock_nanosleep2_01 0 TINFO : Iteration = 40
clock_nanosleep2_01 0 TINFO : Iteration = 41
clock_nanosleep2_01 0 TINFO : Iteration = 42
clock_nanosleep2_01 0 TINFO : Iteration = 43
clock_nanosleep2_01 0 TINFO : Iteration = 44
clock_nanosleep2_01 0 TINFO : Iteration = 45
clock_nanosleep2_01 0 TINFO : Iteration = 46
clock_nanosleep2_01 0 TINFO : Iteration = 47
clock_nanosleep2_01 0 TINFO : Iteration = 48
clock_nanosleep2_01 0 TINFO : Iteration = 49
clock_nanosleep2_01 0 TINFO : Iteration = 50
clock_nanosleep2_01 1 TPASS : clock_nanosleep2() passed
*** C1186T08: clock_nanosleep2_01 OK (1)
sigtimedwait01 0 TINFO : 0x401be0, 10
sigtimedwait01 1 TPASS : Test passed
sigtimedwait01 0 TINFO : 0x401be0, 10
sigtimedwait01 2 TPASS : Test passed
sigtimedwait01 0 TINFO : 0x401be0, 10
sigtimedwait01 3 TPASS : Test passed
sigtimedwait01 3 TPASS : sigwaitinfo restored the original mask
sigtimedwait01 0 TINFO : 0x401be0, 10
sigtimedwait01 4 TPASS : Test passed
sigtimedwait01 0 TINFO : 0x401be0, 10
sigtimedwait01 5 TPASS : Test passed
sigtimedwait01 5 TPASS : sigwaitinfo restored the original mask
sigtimedwait01 0 TINFO : 0x401be0, 10
sigtimedwait01 6 TPASS : Test passed
sigtimedwait01 0 TINFO : 0x401be0, 10
sigtimedwait01 7 TBROK : tst_sig.c:233: unexpected signal SIGSEGV(11) received (pid = 1534).
sigtimedwait01 8 TBROK : tst_sig.c:233: Remaining cases broken
*** C1186T09: sigtimedwait01 OK (8)
bash-4.2$ exit
exit
Script done on Thu Feb 14 14:02:24 2019

13
test/issues/1186/Makefile Normal file
View File

@ -0,0 +1,13 @@
TARGET=C1186
CC=gcc
all:: $(TARGET)
C1186: C1186.c
$(CC) -o C1186 C1186.c
test:: $(TARGET)
sh ./C1186.sh
clean::
rm -f *.o $(TARGET)

30
test/issues/1186/README Normal file
View File

@ -0,0 +1,30 @@
【Issue#1186 動作確認】
□ テスト内容
1. Issue 指摘事項の再現確認
C1186T01 futex_wait_bitset02 を 1 分間隔で 60 回実行し、全て PASS することを
確認する。
2. 時計の妥当性確認
C1186T02 VDSOのclock_gettimeとシステムコールのclock_gettimeを交互に呼び出し、
時刻経過の妥当性を確認する。
3. LTP を用いて既存処理に影響しないことを確認
時刻関連処理を変更したため、関連するシステムコールのテストを選定した。
C1186T03 gettimeofday01 が PASS すること
C1186T04 gettimeofday02 が PASS すること
C1186T05 time01 が PASS すること
C1186T06 time02 が PASS すること
C1186T07 clock_nanosleep01 が PASS すること
C1186T08 clock_nanosleep2_01 が PASS すること
C1186T09 sigtimedwait01 が PASS すること
□ 実行手順
$ make test
McKernelのインストール先や LTP の配置場所は、$HOME/.mck_test_config を
参照する。.mck_test_config は、McKernel を ビルドした際に生成される
mck_test_config.sample ファイルを $HOME に コピーし、適宜編集すること。
□ 実行結果
C1186.txt 参照。
すべての項目をPASSしていることを確認。