Commit e5ef903e authored by Michael Quigley's avatar Michael Quigley
Browse files

updated tests, switched to eager thc. Have not run yet with eager.

parent 12bdeb4f
Pipeline #587 skipped
Subproject commit a32bdbe46c0306dd89643292ffa843e633f88f20
Subproject commit 2cef3d068d3ed2da556d775f8571f5c2c6b67d63
......@@ -15,7 +15,8 @@ AM_CPPFLAGS = \
-I$(abs_top_builddir)/src/include \
-I$(LIBFIPC_DIR)/include
AM_CFLAGS = -DLINUX_KERNEL -DCONFIG_LAZY_THC
AM_CFLAGS = -DLINUX_KERNEL
#-DCONFIG_LAZY_THC
COMMON_SRCS= \
common/thc.c \
......
......@@ -27,6 +27,12 @@ typedef int errval_t;
#define THC_CANCELED 1
#endif
#if (defined(linux) || defined(BARRELFISH))
#ifndef noinline
#define noinline __attribute__((noinline))
#endif
#endif
// The implementation of do..finish relies on shadowing so that
// _fb_info always refers to the closest enclosing do..finish block.
#pragma GCC diagnostic ignored "-Wshadow"
......@@ -195,10 +201,9 @@ typedef int errval_t;
do { \
awe_t _awe; \
void *_new_stack = _thc_allocstack(); \
_awe.current_fb = _fb_info; \
/* Define nested function containing the body */ \
auto void _thc_nested_async(void) __asm__(NESTED_FN_STRING(_C)); \
__attribute__((noinline,used)) void _thc_nested_async(void) { \
__attribute__((used)) void noinline _thc_nested_async(void) { \
void *_my_fb = _fb_info; \
void *_my_stack = _new_stack; \
_thc_startasync(_my_fb, _my_stack); \
......@@ -210,6 +215,7 @@ typedef int errval_t;
/* Define function to enter _nested on a new stack */ \
auto void _swizzle(void) __asm__(SWIZZLE_FN_STRING(_C)); \
SWIZZLE_DEF(_swizzle, _new_stack, NESTED_FN_STRING(_C)); \
_awe.current_fb = _fb_info; \
\
/* Add AWE for our continuation, then run "_nested" on new stack */ \
if (!SCHEDULE_CONT(&_awe)) { \
......
......@@ -415,9 +415,9 @@ extern int _end_text_nx;
// - _NS: new stack, address just above top of commited region
// - _FN: (nested) function to call: void _FN(void)
#if (defined(__x86_64__) && (defined(linux) || defined(BARRELFISH)))
#if (defined(__x86_64__) && (defined(linux) || defined(BARRELFISH) || defined(LINUX_KERNEL)))
#define SWIZZLE_DEF_(_NAME,_NS,_FN) \
__attribute__((noinline)) void _NAME(void) { \
noinline void _NAME(void) { \
__asm__ volatile("movq %0, %%rdi \n\t" /* put NS to %rdi */ \
"subq $8, %%rdi \n\t" /* fix NS address */ \
"movq %%rsp, (%%rdi) \n\t" /* store sp to NS */ \
......@@ -429,7 +429,7 @@ extern int _end_text_nx;
: "memory", "cc", "rsi", "rdi"); \
}
#define SWIZZLE_DEF(_NAME,_NS,_FN) SWIZZLE_DEF_(_NAME,_NS,_FN)
#elif (defined(__i386__) && (defined(linux) || defined(BARRELFISH)))
#elif (defined(__i386__) && (defined(linux) || defined(BARRELFISH) || defined(LINUX_KERNEL)))
#define SWIZZLE_DEF(_NAME,_NS,_FN) \
__attribute__((noinline)) void _NAME(void) { \
__asm__ volatile("movl %0, %%edx \n\t" \
......@@ -442,7 +442,7 @@ extern int _end_text_nx;
: "m" (_NS) \
: "memory", "cc", "eax", "edx"); \
}
#elif defined(__arm__) && (defined(linux) || defined(BARRELFISH))
#elif defined(__arm__) && (defined(linux) || defined(BARRELFISH) || defined(LINUX_KERNEL))
// Notes:
// - ARM Architecutre Reference Manual ARMv7-A and ARMv7-R:
......@@ -487,6 +487,16 @@ extern int _end_text_nx;
// no lazy CALL_CONT in the eager version
#define CALL_CONT_LAZY CALL_CONT
#define CALL_CONT_AND_SAVE(_FN,_IDNUM,_ARG) \
do { \
awe_t _awe; \
awe_mapper_set_id((_IDNUM), &_awe); \
KILL_CALLEE_SAVES(); \
_thc_callcont(&_awe, (THCContFn_t)(_FN), (_ARG)); \
} while (0)
#define CALL_CONT_LAZY_AND_SAVE CALL_CONT_AND_SAVE
#endif // LAZY / EAGER THC
#endif // _THC_INTERNAL_H_
......@@ -28,28 +28,26 @@ static int test_ctx_switch(void)
{
unsigned long start_time, end_time;
uint32_t msg_id;
int i;
for( i = 0; i < NUM_SWITCH_MEASUREMENTS; i++ )
{
thc_init();
thc_init();
for( i = 0; i < NUM_SWITCH_MEASUREMENTS; i++ )
{
DO_FINISH_(ctx_switch,{
ASYNC({
msg_id = awe_mapper_create_id();
THCYieldAndSave(msg_id);
end_time = test_fipc_stop_stopwatch();
});
ASYNC({
start_time = test_fipc_start_stopwatch();
THCYieldToId(msg_id);
awe_mapper_remove_id(msg_id);
ASYNC({
msg_id = awe_mapper_create_id();
THCYieldAndSave(msg_id);
end_time = test_fipc_stop_stopwatch();
awe_mapper_remove_id(msg_id);
});
ASYNC({
start_time = test_fipc_start_stopwatch();
THCYieldToId(msg_id);
});
});
thc_done();
measurements_arr[i] = end_time - start_time;
}
measurements_arr[i] = end_time - start_time;
}
thc_done();
return 0;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment