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

Fix return address in dispatch loop tests. Tests work now. Larger numbers of messages untesed.

parent 58432a52
Subproject commit 255e1b8cbdba34386bacaac425792d91478675e2
Subproject commit 2cef3d068d3ed2da556d775f8571f5c2c6b67d63
......@@ -11,7 +11,7 @@
#define THREAD1_CPU 1
#define THREAD2_CPU 2
#define THREAD3_CPU 3
#define THREAD3_CPU 0
#define CHANNEL_ORDER 2
......@@ -33,15 +33,6 @@ static int setup_and_run_test(void)
*/
thc_channel_group_init(&group2);
thc_channel_group_init(&group3);
item2to1.channel = thread_2_to_1_header;
thc_channel_group_item_add(&group2, &item2to1);
item2to3.channel = thread_2_to_3_header;
thc_channel_group_item_add(&group2, &item2to3);
item3.channel = thread3_header;
thc_channel_group_item_add(&group3, &item3);
/*
* Initialize fipc
......@@ -71,7 +62,14 @@ static int setup_and_run_test(void)
goto fail2;
}
item2to1.channel = thread_2_to_1_header;
thc_channel_group_item_add(&group2, &item2to1);
item2to3.channel = thread_2_to_3_header;
thc_channel_group_item_add(&group2, &item2to3);
item3.channel = thread3_header;
thc_channel_group_item_add(&group3, &item3);
/*
......
......@@ -10,23 +10,6 @@
#include <libfipc.h>
enum fn_type {
NULL_INVOCATION,
ADD_CONSTANT,
ADD_NUMS,
ADD_3_NUMS,
ADD_4_NUMS,
ADD_5_NUMS,
ADD_6_NUMS
};
/* must be divisible by 6... because I call 6 functions in the callee.c */
#define TRANSACTIONS 60
/* thread main functions */
int callee(void *_callee_channel_header);
int caller(void *_caller_channel_header);
static inline
int
get_fn_type(struct fipc_message *msg)
......@@ -36,7 +19,7 @@ get_fn_type(struct fipc_message *msg)
static inline
void
set_fn_type(struct fipc_message *msg, enum fn_type type)
set_fn_type(struct fipc_message *msg, uint32_t type)
{
fipc_set_flags(msg, type);
}
......
......@@ -11,11 +11,8 @@
//max_recv_ct just for testing
int thc_dispatch_loop_test(struct thc_channel_group* rx_group, int max_recv_ct)
{
volatile void ** frame = (volatile void**)__builtin_frame_address(0);
volatile void *ret_addr = *(frame + 1);
int recv_ct = 0;
*(frame + 1) = NULL;
//NOTE:max_recv_ct is just for testing
DO_FINISH_(ipc_dispatch,{
int curr_ind = 0;
......@@ -45,8 +42,6 @@ int thc_dispatch_loop_test(struct thc_channel_group* rx_group, int max_recv_ct)
}
});
*(frame + 1) = ret_addr;
return 0;
}
EXPORT_SYMBOL(thc_dispatch_loop_test);
......@@ -37,14 +37,10 @@ static unsigned long add_nums_async(unsigned long lhs, unsigned long rhs, unsign
}
int thread1_fn(void* chan)
static int run_thread1(void* chan)
{
volatile void ** frame = (volatile void**)__builtin_frame_address(0);
volatile void *ret_addr = *(frame + 1);
int num_transactions = 0;
uint32_t id_num;
*(frame + 1) = NULL;
channel = chan;
thc_init();
......@@ -76,17 +72,24 @@ int thread1_fn(void* chan)
num_transactions++;
add_nums_async(num_transactions, 3,(unsigned long) id_num, ADD_2_FN);
);
//msleep(20);
msleep(10);
}
printk(KERN_ERR "done with transactions\n");
});
printk(KERN_ERR "lcd async exiting module and deleting ptstate");
thc_done();
*(frame + 1) = ret_addr;
return 1;
}
int thread1_fn(void* chan)
{
int result;
LCD_MAIN({result = run_thread1(chan);});
return result;
}
......@@ -112,7 +112,7 @@ int thread2_fn(void* group)
rx_group = (struct thc_channel_group*)group;
thc_channel_group_item_get(rx_group, 0, &thrd1_item);
thrd1_item->dispatch_fn = thread1_dispatch_fn;
thc_dispatch_loop_test(rx_group, TRANSACTIONS);
LCD_MAIN(thc_dispatch_loop_test(rx_group, TRANSACTIONS););
thc_done();
return 1;
......
......@@ -10,8 +10,6 @@
#include <awe_mapper.h>
#include <linux/delay.h>
#define THREAD3_FNS_LENGTH 1
static struct thc_channel_group* rx_group;
......@@ -64,7 +62,7 @@ int thread3_fn(void* group)
rx_group = (struct thc_channel_group*)group;
thc_channel_group_item_get(rx_group, 0, &thrd2_item);
thrd2_item->dispatch_fn = thread2_dispatch_fn;
thc_dispatch_loop_test(rx_group, TRANSACTIONS / THD3_INTERVAL);
LCD_MAIN(thc_dispatch_loop_test(rx_group, TRANSACTIONS / THD3_INTERVAL););
thc_done();
return 1;
......
......@@ -6,7 +6,7 @@
#define ADD_2_FN 1
#define ADD_10_FN 2
#define TRANSACTIONS 60
#define THD3_INTERVAL 10
#define THD3_INTERVAL 11
int thread1_fn(void* data);
int thread2_fn(void* data);
......
......@@ -16,6 +16,29 @@
#include <linux/kernel.h>
#include <libfipc.h>
#define LCD_MAIN(_CODE) do { \
\
/* NULL out return address on stack so that libasync */ \
/* will stop stack walk here. */ \
/* */ \
/* XXX: A touch of arch-dependent code here, but */ \
/* no biggie. When I used gcc's */ \
/* __builtin_frame_address it broke (gcc null'd out */ \
/* the return address, but didn't restore it ... ?) */ \
/* */ \
volatile void **__frame_ptr; \
volatile void *__saved_ret_addr; \
asm ("movq %%rbp, %0" : "=g"(__frame_ptr) ::); \
__saved_ret_addr = *(__frame_ptr + 1); \
*(__frame_ptr + 1) = NULL; \
\
do { _CODE } while(0); \
\
/* Restore old return address to stack. */ \
*(__frame_ptr + 1) = __saved_ret_addr; \
\
} while (0);
static inline
struct task_struct *
test_fipc_spawn_thread_with_channel(struct fipc_ring_channel *channel,
......
Supports Markdown
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