Commit 3a029e34 authored by Charles Jacobsen's avatar Charles Jacobsen
Browse files

lcd: rpc example working with numbers that jive with old2 code.

Not inlining function calls right now though.
parent 6bbedfea
......@@ -82,7 +82,6 @@ static inline int check_rx_slot_msg_waiting(struct fipc_message *slot)
return slot->msg_status == FIPC_MSG_STATUS_SENT;
}
static inline int check_tx_slot_available(struct fipc_message *slot)
{
return slot->msg_status == FIPC_MSG_STATUS_AVAILABLE;
......
......@@ -16,7 +16,7 @@
* happen.
*/
static unsigned long noinline
static unsigned long noinline
null_invocation(void)
{
return 9;
......@@ -28,13 +28,13 @@ add_constant(unsigned long trans)
return trans + 50;
}
static unsigned long noinline
static unsigned long noinline
add_nums(unsigned long trans, unsigned long res1)
{
return trans+res1;
}
static unsigned long noinline
static unsigned long noinline
add_3_nums(unsigned long trans, unsigned long res1, unsigned long res2)
{
return add_nums(trans, res1) + res2;
......@@ -104,6 +104,10 @@ int callee(void *_callee_channel_header)
struct fipc_message *recvd_msg;
unsigned long transaction_id = 0;
enum fn_type type;
/*
* Disable interrupts so we truly take over the core
*/
local_irq_disable();
for (transaction_id = 0;
transaction_id < TRANSACTIONS;
......@@ -171,6 +175,10 @@ int callee(void *_callee_channel_header)
goto out;
}
}
/*
* Re-enable interrupts
*/
local_irq_enable();
out:
return ret;
......
......@@ -394,6 +394,10 @@ int caller(void *_caller_channel_header)
unsigned long res1, res2, res3, res4, res5;
unsigned long start, end;
int ret = 0;
/*
* Turn off interrupts so that we truly take over the core
*/
local_irq_disable();
get_random_bytes(&res1, sizeof(res1));
res2 = res1 + res1;
......@@ -445,6 +449,10 @@ int caller(void *_caller_channel_header)
}
pr_err("Complete\n");
/*
* Re-enable interrupts
*/
local_irq_enable();
out:
return ret;
......
......@@ -13,7 +13,8 @@
#define CALLER_CPU 1
#define CALLEE_CPU 3
#define CHANNEL_ORDER 2 /* channel is 2^CHANNEL_ORDER pages */
/* channel buffers contain just one message slot */
#define CHANNEL_ORDER ilog2(sizeof(struct fipc_message))
MODULE_LICENSE("GPL");
......@@ -61,7 +62,8 @@ static int setup_and_run_test(void)
*/
wake_up_process(caller_thread);
wake_up_process(callee_thread);
msleep(1000);
/* wait for a second so we don't prematurely kill caller/callee */
msleep(1000);
/*
* Wait for them to complete, so we can tear things down
*/
......
......@@ -20,7 +20,7 @@ enum fn_type {
ADD_6_NUMS
};
/* must be divisible by 6... because I call 6 functions in the callee.c */
/* Must be even */
#define TRANSACTIONS 60
/* thread main functions */
......
......@@ -75,14 +75,16 @@ test_fipc_wait_for_thread(struct task_struct *thread)
static inline
int
test_fipc_create_channel(unsigned int buf_nr_pages_order, /* in pages */
test_fipc_create_channel(unsigned int buf_order, /* in bytes */
struct fipc_ring_channel **header_1,
struct fipc_ring_channel **header_2)
{
int ret;
void *buf1, *buf2;
unsigned int buf_nr_pages_order = (
buf_order < PAGE_SHIFT ? 0 : buf_order - PAGE_SHIFT
);
struct fipc_ring_channel *h1, *h2;
unsigned int buf_order = buf_nr_pages_order + PAGE_SHIFT;
/*
* Allocate buffer pages
*/
......@@ -143,10 +145,13 @@ fail1:
static inline
void
test_fipc_free_channel(unsigned int buf_nr_pages_order, /* in pages */
test_fipc_free_channel(unsigned int buf_order, /* in bytes */
struct fipc_ring_channel *header_1,
struct fipc_ring_channel *header_2)
{
unsigned int buf_nr_pages_order = (
buf_order < PAGE_SHIFT ? 0 : buf_order - PAGE_SHIFT
);
/*
* Free buffers
*/
......
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