<div dir="ltr">Dear Team Barrelfish,<div><br></div><div>I have worked around the problem. But would like to present the investigation and the workaround to the community. The workaround is clearly not perfect but would do the trick for me.</div><div><br></div><div>After reproduced the deadlock with the micro-test, pingpong. <span style="font-family:arial,sans-serif;font-size:13px">I tried an idc_2to1 test. It does this,</span></div><div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px"><font face="courier new, monospace">Core 0 -- WAKE --> Core 1</font></div><div style="font-family:arial,sans-serif;font-size:13px"><font face="courier new, monospace">Core 0 -- WAKE </font><span style="font-family:'courier new',monospace"> -> Core 2</span></div><div style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:'courier new',monospace"> </span><span style="font-family:'courier new',monospace">Core 1 <</span><span style="font-family:'courier new',monospace">- CRADLE ---</span><span style="font-family:'courier new',monospace"> Core 2</span></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">And that was successful. That means inside a RPC triggering, it can handle event dispatched. But I conjecture that it cannot handle triggering from the same binding from this result and the result of the pingpong test. So I tried a dual channel approach. And build two bindings for each core pair. Say binding_channel_0 and binding_channel_1.</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Upon the action,</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px"><font face="courier new, monospace">Core 0 -- SYN -> Core 1</font></div><div style="font-family:arial,sans-serif;font-size:13px"><font face="courier new, monospace">Core 0 <- SYN/ACK -- Core 1</font></div><div style="font-family:arial,sans-serif;font-size:13px"><font face="courier new, monospace">Core 0 -- ACK -> Core 1</font></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Originally, the ACK message should be sent with the same binding. Now I will use it with the second binding, binding_channel_1. And I realised this in an experiment idc_pingpong_double_channel. All's well.</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">I think Team Barrelfish should not make the system to have such constraint. I think that may be a problem when Team Barrelfish tried to use some primitive data structure to have faster coding in realising the project then using linked list this kind of more complex data structure to handle the communication module. But I cannot prove it's so until I trace the relative code and have some experiments. But that would be till I have time after writing up my thesis.</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Thanks!</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Codes attatched for the two tests.</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Cheers,</div><div style><font face="arial, sans-serif">Dominic Hung</font><br><br><div style><div style="font-size:13px"><font face="arial, sans-serif" style="font-family:arial,sans-serif"><b>idc_2to1.c:</b></font><br><br><div style="font-family:arial,sans-serif"><font face="courier new, monospace">#include "stdio.h"</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">#include "stdbool.h" // FOR BOOL</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">#include "errors/errno.h" // FOR ERRVAL_T</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">#include "arch/x86_32/barrelfish_kpi/eflags_arch.h"</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">#include "arch/x86_32/barrelfish_kpi/paging_arch.h"</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">#include "barrelfish_kpi/syscalls.h" // FOR STRUCT SYSRET</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">#include "barrelfish/capabilities.h"</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">#include "if/idc_2to1_defs.h"</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">#include "barrelfish/domain.h"</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">#include "barrelfish/spawn_client.h"</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">#include "barrelfish/waitset.h"</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">#include "barrelfish/nameservice_client.h"</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">#include "rck_dev.h"</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">struct idc_2to1_binding* binding[3];</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">char* idc_2to1_service_name[] = {</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>"idc_2to1_service_0",</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>"idc_2to1_service_1",</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>"idc_2to1_service_2"</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">};</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">int FLAG_connect = 0;</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">void wake_handler(struct idc_2to1_binding *b){</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>debug_printf("wake\n");</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>if(disp_get_core_id() == 1){</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>debug_printf("wait for cradle\n");</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>event_dispatch(get_default_waitset());</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>}</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>else{</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>binding[1]->tx_vtbl.cradle(binding[1], NOP_CONT);</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>debug_printf("cradle propagated\n");</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>}</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">}</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">void cradle_handler(struct idc_2to1_binding *b){</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>debug_printf("cradle hit\n");</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">}</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">/**</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"> * START OF MESSAGING EXPORT/BINDING SERVICE</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"> */</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">struct idc_2to1_rx_vtbl idc_2to1_rx_vtbl = {</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"> .wake = wake_handler,</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"> .cradle = cradle_handler</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">};</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">static void bind_cb(void *st, errval_t err, struct idc_2to1_binding *b){</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>if(err_is_fail(err)){</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>USER_PANIC_ERR(err, "bind failed");</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>}</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>debug_printf("client bound!\n");</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>// copy my message receive handler vtable to the binding</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>b->rx_vtbl = idc_2to1_rx_vtbl;</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>binding[(int) st] = b;</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">}</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">static void start_client(int host){</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>iref_t iref;</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>errval_t err;</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>debug_printf("client looking up '%s' in name service...\n", idc_2to1_service_name[host]);</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>err = nameservice_blocking_lookup(idc_2to1_service_name[host], &iref);</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>if(err_is_fail(err)){</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>USER_PANIC_ERR(err, "nameservice_blocking_lookup failed");</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>}</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>debug_printf("client binding to %"PRIuIREF"...\n", iref);</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>err = idc_2to1_bind(iref, bind_cb, (void *) host, get_default_waitset(), IDC_BIND_FLAGS_DEFAULT);</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>if(err_is_fail(err)){</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>USER_PANIC_ERR(err, "bind failed");</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>}</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>while(binding[host] == NULL)</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>event_dispatch(get_default_waitset());</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">}</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">/* ------------------------------ SERVER ------------------------------ */</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">static void export_cb(void *st, errval_t err, iref_t iref){</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>if(err_is_fail(err)){</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>USER_PANIC_ERR(err, "export failed");</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>}</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>debug_printf("service exported at iref %"PRIuIREF"\n", iref);</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>// register this iref with the name service</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>err = nameservice_register(idc_2to1_service_name[disp_get_core_id()], iref);</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>debug_printf("service exported at iref %"PRIuIREF"\n", iref);</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>if(err_is_fail(err)){</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>USER_PANIC_ERR(err, "nameservice_register failed");</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>}</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>debug_printf("service exported at iref %"PRIuIREF"\n", iref);</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">}</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">static errval_t connect_cb(void *st, struct idc_2to1_binding *b){</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>debug_printf("service got a connection!\n");</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>// copy my message receive handler vtable to the binding</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>b->rx_vtbl = idc_2to1_rx_vtbl;</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>binding[disp_get_core_id()] = b;</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>FLAG_connect++;</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>// accept the connection (we could return an error to refuse it)</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>return SYS_ERR_OK;</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">}</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">static void start_server(void){</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>errval_t err;</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>err = idc_2to1_export(NULL, export_cb, connect_cb, get_default_waitset(), IDC_EXPORT_FLAGS_DEFAULT);</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"> if(err_is_fail(err)){</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"> <span class="" style="white-space:pre">        </span>USER_PANIC_ERR(err, "export failed");</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"> }</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"> do{</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"> <span class="" style="white-space:pre">        </span>event_dispatch(get_default_waitset());</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"> }while(FLAG_connect != 2);</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">}</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">/**</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"> * END OF MESSAGING EXPORT/BINDING SERVICE</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"> */</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">int main(int argc, char* argv[]){</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>debug_printf("Core ID: %d\n", disp_get_core_id());</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"> if(disp_get_core_id() == 0){</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"> <span class="" style="white-space:pre">        </span>spawn_program(1, "/scc/sbin/idc_2to1", argv, NULL, SPAWN_NEW_DOMAIN, NULL);</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"> <span class="" style="white-space:pre">        </span>spawn_program(2, "/scc/sbin/idc_2to1", argv, NULL, SPAWN_NEW_DOMAIN, NULL);</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"> }</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"> for(int i = 0; i < 3; ++i){</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"> <span class="" style="white-space:pre">        </span>if(i == disp_get_core_id())</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"> start_server();</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"> else start_client(i);</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"> }</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"> if(disp_get_core_id() == 0){</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"> <span class="" style="white-space:pre">        </span>for(int i = 1; i < 3; ++i)</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"> <span class="" style="white-space:pre">                </span>binding[i]->tx_vtbl.wake(binding[i], NOP_CONT);</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"> }</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"> else event_dispatch(get_default_waitset());</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"> return 0;</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace">}</font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div><font face="arial, helvetica, sans-serif"><b>idc_pingpong_double_channel.c</b></font></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div><div style="font-family:arial,sans-serif"><div style="font-family:arial;font-size:small"><font face="courier new, monospace">#include "stdio.h"</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">#include "stdbool.h" // FOR BOOL</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">#include "errors/errno.h" // FOR ERRVAL_T</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">#include "arch/x86_32/barrelfish_kpi/eflags_arch.h"</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">#include "arch/x86_32/barrelfish_kpi/paging_arch.h"</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">#include "barrelfish_kpi/syscalls.h" // FOR STRUCT SYSRET</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">#include "barrelfish/capabilities.h"</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">#include "if/idc_pingpong_defs.h"</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">#include "barrelfish/domain.h"</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">#include "barrelfish/spawn_client.h"</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">#include "barrelfish/waitset.h"</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">#include "barrelfish/nameservice_client.h"</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">#include "rck_dev.h"</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">struct idc_pingpong_binding* binding[2];</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">char* idc_pingpong_service_name[] = {</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>"idc_pingpong_service_channel_0",</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>"idc_pingpong_service_channel_1"</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">};</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">int FLAG_connect = 0;</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">int FLAG_ack = 0;</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">void syn_handler(struct idc_pingpong_binding *b){</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>debug_printf("arrived at syn\n");</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>b->tx_vtbl.syn_ack(b, NOP_CONT);</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>do{</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>debug_printf("wait ack\n");</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>event_dispatch(get_default_waitset());</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>}while(!FLAG_ack);</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">}</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">void syn_ack_handler(struct idc_pingpong_binding *b){</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>debug_printf("arrived at syn_ack\n");</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">}</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">void ack_handler(struct idc_pingpong_binding *b){</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>debug_printf("arrived at ack\n");</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>FLAG_ack = 1;</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">}</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">/**</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"> * START OF MESSAGING EXPORT/BINDING SERVICE</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"> */</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">struct idc_pingpong_rx_vtbl idc_pingpong_rx_vtbl = {</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"> .syn = syn_handler,</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"> .syn_ack = syn_ack_handler,</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"> .ack = ack_handler</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">};</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">static void bind_cb(void *st, errval_t err, struct idc_pingpong_binding *b){</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>if(err_is_fail(err)){</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>USER_PANIC_ERR(err, "bind failed");</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>}</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>debug_printf("client bound!\n");</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>// copy my message receive handler vtable to the binding</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>b->rx_vtbl = idc_pingpong_rx_vtbl;</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>binding[(int) st] = b;</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">}</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">static void start_client(int channel){</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>iref_t iref;</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>errval_t err;</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>debug_printf("client looking up '%s' in name service...\n", idc_pingpong_service_name[channel]);</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>err = nameservice_blocking_lookup(idc_pingpong_service_name[channel], &iref);</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>if(err_is_fail(err)){</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>USER_PANIC_ERR(err, "nameservice_blocking_lookup failed");</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>}</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>debug_printf("client binding to %"PRIuIREF"...\n", iref);</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>err = idc_pingpong_bind(iref, bind_cb, (void *) channel, get_default_waitset(), IDC_BIND_FLAGS_DEFAULT);</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>if(err_is_fail(err)){</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>USER_PANIC_ERR(err, "bind failed");</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>}</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>while(binding[channel] == NULL)</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>event_dispatch(get_default_waitset());</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">}</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">/* ------------------------------ SERVER ------------------------------ */</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">static void export_cb(void *st, errval_t err, iref_t iref){</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>if(err_is_fail(err)){</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>USER_PANIC_ERR(err, "export failed");</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>}</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>debug_printf("service exported at iref %"PRIuIREF"\n", iref);</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>// register this iref with the name service</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>err = nameservice_register(idc_pingpong_service_name[(int) st], iref);</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>debug_printf("service exported at iref %"PRIuIREF"\n", iref);</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>if(err_is_fail(err)){</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>USER_PANIC_ERR(err, "nameservice_register failed");</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>}</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>debug_printf("service exported at iref %"PRIuIREF"\n", iref);</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">}</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">static errval_t connect_cb(void *st, struct idc_pingpong_binding *b){</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>debug_printf("service got a connection!\n");</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>// copy my message receive handler vtable to the binding</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>b->rx_vtbl = idc_pingpong_rx_vtbl;</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>binding[(int) st] = b;</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>FLAG_connect = 1;</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>// accept the connection (we could return an error to refuse it)</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>return SYS_ERR_OK;</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">}</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">static void start_server(int channel){</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>errval_t err;</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>err = idc_pingpong_export((void *) channel, export_cb, connect_cb, get_default_waitset(), IDC_EXPORT_FLAGS_DEFAULT);</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"> if(err_is_fail(err)){</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"> <span class="" style="white-space:pre">        </span>USER_PANIC_ERR(err, "export failed");</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"> }</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"> do{</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"> <span class="" style="white-space:pre">        </span>event_dispatch(get_default_waitset());</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"> }while(!FLAG_connect);</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"> FLAG_connect = 0;</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">}</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">/**</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"> * END OF MESSAGING EXPORT/BINDING SERVICE</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"> */</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">int main(int argc, char* argv[]){</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>debug_printf("Core ID: %d\n", disp_get_core_id());</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"> if(disp_get_core_id() == 0){</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"> <span class="" style="white-space:pre">        </span>spawn_program(1, "/scc/sbin/idc_pingpong_double_channel", argv, NULL, SPAWN_NEW_DOMAIN, NULL);</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"> }</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"> for(int i = 0; i < 2; ++i){</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>if(disp_get_core_id() == 0){</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">                        </span>start_server(i);</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>}</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><span class="" style="white-space:pre">                </span>else start_client(i);</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"> }</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"> if(disp_get_core_id() == 1){</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"> <span class="" style="white-space:pre">        </span>binding[0]->tx_vtbl.syn(binding[0], NOP_CONT);</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"> <span class="" style="white-space:pre">        </span>event_dispatch(get_default_waitset());</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"> <span class="" style="white-space:pre">        </span>binding[1]->tx_vtbl.ack(binding[1], NOP_CONT);</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"> <span class="" style="white-space:pre">        </span>debug_printf("sent ack\n");</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"> }</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"> else event_dispatch(get_default_waitset());</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"><br></font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace"> return 0;</font></div><div style="font-family:arial;font-size:small"><font face="courier new, monospace">}</font></div></div><div style="font-family:arial,sans-serif"><font face="courier new, monospace"><br></font></div></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 19 November 2014 at 20:04, Dominic Hung <span dir="ltr"><<a href="mailto:domchdh@hku.hk" target="_blank">domchdh@hku.hk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Dear Stefan,<div><br></div><div>Thank you for your return of email. I have flounder working here all the while. It's to the advance stage of my project that I need 3-way handshake to accomplish some tasks that I have encountered this first time.</div><div><br></div><div>I have found an earlier email on the same issue I take on a different architecture, the reporter should be using x86_64. <a href="https://lists.inf.ethz.ch/pipermail/barrelfish-users/2011-December/000370.html" target="_blank">https://lists.inf.ethz.ch/pipermail/barrelfish-users/2011-December/000370.html</a>. Although the user talks about binding. But I see it should be a problem of 3-way handshaking as well. So I wonder can you try my short code here on your platform to see if it's some unsolved problem?<br><br></div><div><ol><li><b>menu.lst.scc</b><br><br><font face="courier new, monospace">timeout 0<br>title Barrelfish<br>root (nd)<br>kernel /scc/sbin/cpu loglevel=4<br>module /scc/sbin/cpu<br>module /scc/sbin/init<br><br># Domains spawned by init<br>module /scc/sbin/mem_serv<br>module /scc/sbin/monitor<br><br>module /scc/sbin/ramfsd boot<br>module /scc/sbin/skb boot<br>module /scc/sbin/spawnd boot BOOT_CORE<br>module /scc/sbin/startd boot<br><br>module /scc/sbin/pingpong<br><br># RCK memory map<br># 624MB private RAM<br>mmap map 0x0 0x27000000 1<br>mmap map 0x80000000 0x03000000 1<br># 1GB shared RAM (over all MCs) in the middle of address space<br>mmap map 0x84000000 0x3c000000 1<br># 384MB MPB space<br>mmap mmp 0xc0000000 0x18000000 1<br># 16MB more private RAM (bootup jump is in here, too)<br>mmap map 0xff000000 0x1000000 1</font><br><br></li><li><b>Config.hs</b><br><br>same as shipped<br><br></li><li><b>Output</b><br><br></li><ol><li>Core 0<br><br>1416397472.193425394 spawnd.0: spawning /scc/sbin/pingpong on core 0<br>No bootscript<br>1416397472.207301153 pingpong.0: lmp TX monitor.get_monitor_rpc_iref_request<br>1416397472.210663985 pingpong.0: lmp RX monitor.get_monitor_rpc_iref_reply<br>1416397472.211743348 pingpong.0: lmp TX monitor.bind_lmp_client_request<br>1416397472.219533665 pingpong.0: lmp RX monitor.bind_lmp_reply_client<br>1416397472.220788388 pingpong.0: lmp TX monitor.get_mem_iref_request<br>1416397472.224258136 pingpong.0: lmp RX monitor.get_mem_iref_reply<br>1416397472.225360878 pingpong.0: lmp TX monitor.bind_lmp_client_request<br>1416397472.233636881 pingpong.0: lmp RX monitor.bind_lmp_reply_client<br>1416397472.234784686 pingpong.0: lmp TX monitor.get_name_iref_request<br>1416397472.238262570 pingpong.0: lmp RX monitor.get_name_iref_reply<br>1416397472.239451816 pingpong.0: lmp TX monitor.bind_lmp_client_request<br>1416397472.247847588 pingpong.0: lmp RX monitor.bind_lmp_reply_client<br>1416397472.248999078 pingpong.0: lmp TX octopus.get_call<br>1416397472.252848048 pingpong.0: lmp RX octopus.get_response<br>1416397472.254001968 pingpong.0: lmp TX mem.allocate_call<br>1416397472.257634876 pingpong.0: lmp RX mem.allocate_response<br>1416397472.258915623 pingpong.0: lmp TX mem.allocate_call<br>1416397472.262757649 pingpong.0: lmp RX mem.allocate_response<br>1416397472.263921523 pingpong.0: lmp TX mem.allocate_call<br>1416397472.267189100 pingpong.0: lmp RX mem.allocate_response<br>1416397472.268269091 pingpong.0: lmp TX monitor.alloc_iref_request<br>1416397472.271496468 pingpong.0: lmp RX monitor.alloc_iref_reply<br>1416397472.272688617 pingpong.0: lmp TX mem.allocate_call<br>1416397472.276029060 pingpong.0: lmp RX mem.allocate_response<br>1416397472.277117203 pingpong.0: lmp TX mem.allocate_call<br>1416397472.280418326 pingpong.0: lmp RX mem.allocate_response<br>1416397472.281633837 pingpong.0: lmp TX mem.allocate_call<br>1416397472.285130236 pingpong.0: lmp RX mem.allocate_response<br>1416397472.286213212 pingpong.0: 0<br>1416397472.287393796 pingpong.0: lmp TX octopus.wait_for_call<br>1416397472.290793620 pingpong.0: lmp RX octopus.wait_for_response<br>1416397472.291893357 pingpong.0: lmp TX monitor.bind_lmp_client_request<br>1416397472.295395728 pingpong.0: lmp RX monitor.bind_lmp_reply_client<br>1416397472.296516289 pingpong.0: lmp TX monitor.ipi_alloc_notify_request<br>1416397472.299998660 pingpong.0: lmp RX monitor.ipi_alloc_notify_reply<br>1416397472.301140384 pingpong.0: lmp TX mem.allocate_call<br>1416397472.304751910 pingpong.0: lmp RX mem.allocate_response<br>1416397472.307013834 pingpong.0: lmp TX monitor.bind_ump_client_request<br>1416397472.312573193 pingpong.0: lmp RX monitor.bind_ump_reply_client<br>1416397472.313715186 pingpong.0: ump_ipi TX spawn.spawn_domain_call<br>1416397472.820466055 pingpong.0: ump_ipi RX spawn.spawn_domain_response<br>1416397472.821805616 pingpong.0: lmp TX monitor.alloc_iref_request<br>1416397472.825324473 pingpong.0: lmp RX monitor.alloc_iref_reply<br>1416397472.827624590 pingpong.0: lmp TX octopus.set_call<br>1416397472.831331441 pingpong.0: lmp RX octopus.set_response<br>1416397472.926158789 pingpong.0: lmp RX monitor.bind_ump_service_request<br>1416397472.928521575 pingpong.0: lmp TX monitor.ipi_alloc_notify_request<br>1416397472.932083642 pingpong.0: lmp RX monitor.ipi_alloc_notify_reply<br>1416397472.933496293 pingpong.0: lmp TX monitor.bind_ump_reply_monitor<br>1416397472.936907411 pingpong.0: ump_ipi RX pingpong.syn<br>1416397472.938218913 pingpong.0: arrived at syn<br>1416397472.939364776 pingpong.0: ump_ipi TX pingpong.syn_ack<br><br></li><li>Core 1<br><br>1416397473.055278067 spawnd.1: spawning /scc/sbin/pingpong on core 1<br>1416397473.057542275 pingpong.1: lmp TX monitor.get_monitor_rpc_iref_request<br>1416397473.060972745 pingpong.1: lmp RX monitor.get_monitor_rpc_iref_reply<br>1416397473.062117234 pingpong.1: lmp TX monitor.bind_lmp_client_request<br>1416397473.065639868 pingpong.1: lmp RX monitor.bind_lmp_reply_client<br>1416397473.066753919 pingpong.1: lmp TX monitor.get_mem_iref_request<br>1416397473.070126286 pingpong.1: lmp RX monitor.get_mem_iref_reply<br>1416397473.071468210 pingpong.1: lmp TX monitor.bind_lmp_client_request<br>1416397473.079999095 pingpong.1: lmp RX monitor.bind_lmp_reply_client<br>1416397473.081153001 pingpong.1: lmp TX monitor.get_name_iref_request<br>1416397473.084712518 pingpong.1: lmp RX monitor.get_name_iref_reply<br>1416397473.085904866 pingpong.1: lmp TX monitor.bind_lmp_client_request<br>1416397473.089447048 pingpong.1: lmp RX monitor.bind_lmp_reply_client<br>1416397473.090610244 pingpong.1: lmp TX monitor.new_monitor_binding_request<br>1416397473.098959528 pingpong.1: lmp RX monitor.new_monitor_binding_reply<br>1416397473.100127046 pingpong.1: lmp TX monitor.ipi_alloc_notify_request<br>1416397473.103623312 pingpong.1: lmp RX monitor.ipi_alloc_notify_reply<br>1416397473.105002543 pingpong.1: lmp TX mem.allocate_call<br>1416397473.108475480 pingpong.1: lmp RX mem.allocate_response<br>1416397473.110991463 pingpong.1: lmp TX mem.allocate_call<br>1416397473.114494759 pingpong.1: lmp RX mem.allocate_response<br>1416397473.115673400 pingpong.1: lmp TX mem.allocate_call<br>1416397473.119207638 pingpong.1: lmp RX mem.allocate_response<br>1416397473.120409815 pingpong.1: lmp TX mem.allocate_call<br>1416397473.124131980 pingpong.1: lmp RX mem.allocate_response<br>1416397473.125277184 pingpong.1: lmp TX monitor.bind_ump_client_request<br>1416397473.130996583 pingpong.1: lmp RX monitor.bind_ump_reply_client<br>1416397473.132187371 pingpong.1: lmp TX mem.allocate_call<br>1416397473.135670285 pingpong.1: lmp RX mem.allocate_response<br>1416397473.136812122 pingpong.1: ump_ipi TX octopus.get_call<br>1416397473.137962422 pingpong.1: ump_ipi RX octopus.get_response<br>1416397473.139079514 pingpong.1: lmp TX monitor.alloc_iref_request<br>1416397473.142567382 pingpong.1: lmp RX monitor.alloc_iref_reply<br>1416397473.143769336 pingpong.1: lmp TX mem.allocate_call<br>1416397473.147360865 pingpong.1: lmp RX mem.allocate_response<br>1416397473.148610171 pingpong.1: lmp TX mem.allocate_call<br>1416397473.152200655 pingpong.1: lmp RX mem.allocate_response<br>1416397473.153391079 pingpong.1: 1<br>1416397473.154578550 client looking up 'pingpong_service' in name service...<br>1416397473.155664528 pingpong.1: ump_ipi TX octopus.wait_for_call<br>1416397473.156914538 pingpong.1: ump_ipi RX octopus.wait_for_response<br>1416397473.159217255 pingpong.1: lmp TX monitor.bind_lmp_client_request<br>1416397473.162567186 pingpong.1: lmp RX monitor.bind_lmp_reply_client<br>1416397473.163670711 pingpong.1: lmp TX monitor.ipi_alloc_notify_request<br>1416397473.167537080 pingpong.1: lmp RX monitor.ipi_alloc_notify_reply<br>1416397473.168660700 pingpong.1: lmp TX mem.allocate_call<br>1416397473.172058267 pingpong.1: lmp RX mem.allocate_response<br>1416397473.174202081 pingpong.1: lmp TX monitor.bind_ump_client_request<br>1416397473.180213583 pingpong.1: lmp RX monitor.bind_ump_reply_client<br>1416397473.182740446 pingpong.1: ump_ipi TX pingpong.syn<br>1416397473.183944994 pingpong.1: ump_ipi RX pingpong.syn_ack<br>1416397473.185028655 pingpong.1: arrived at syn_ack<br>1416397473.186160651 pingpong.1: ump_ipi TX pingpong.ack<br>1416397473.188393049 pingpong.1: ump_ipi TX octopus.get_call<br>1416397473.189509675 pingpong.1: ump_ipi RX octopus.get_response<br>1416397473.190729439 pingpong.1: lmp TX monitor.bind_lmp_client_request<br>1416397473.199032249 pingpong.1: lmp RX monitor.bind_lmp_reply_client<br>1416397473.375037500 pingpong.1: lmp TX spawn.exit_call<br><br></li></ol><li><div>The <b>versions</b> of bf, gcc, ghc used by me,</div><div><br>barrelfish: release2012-06-06</div><div>gcc version: 4.4.3</div><div>ghc version: 6.10.4</div></li></ol></div><div><br></div><div>I am sorry and thanks!</div><div><br></div><div>Cheers,</div><div>Dominic Hung<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 19 November 2014 18:33, Stefan Kaestle <span dir="ltr"><<a href="mailto:stefan.kaestle@inf.ethz.ch" target="_blank">stefan.kaestle@inf.ethz.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
Hi Dominic,<br>
<br>
Unfortunately, we do not have access to SCC hardware any more so it
is hard for us to reproduce SCC related problems.<br>
<br>
One thing to keep in mind is that the x86-default flounder backend
for cross-core message passing (UMP) does not work on the SCC. This
is due to a lack of cache coherence. Instead, we use UMP-IPI, an
extension to UMP that sends a notification (i.e. an inter-processor
interrupt) to indicate message availability to the receiver. The
receiver can then invalidate its cache to make sure that the next
read is done from memory (and not the outdated cache). <br>
<br>
From looking at your code, I am a bit suspicious about the way you
send messages (although I might be wrong and that is actually not
the problem). I am assuming that export and connect work? <br>
In general, a good starting point for developing IPC applications is
to look at some of our examples in usr/examples.<br>
<br>
I suggest the following:<br>
<br>
1. Can you please try to run usr/examples/xmpl-call-response on
your SCC and tell me if that works?<br>
2. Convert xmpl-call-response to do the 3-way handshake<br>
3. Test on x86_32 in qemu<br>
4. Test on SCC<br>
<br>
Let me know if this helps!<br>
<br>
Also, can you please attach the following additional information to
your next email:<br>
<br>
1. Your menu.lst<br>
2. A list of changes to hake/Config.hs<br>
3. Output when you run the program (e.g. does connect/export work)<br>
4. Your Barrelfish release, gcc and ghc version<br>
<br>
<br>
Hope this helps,<br>
Stefan<br>
<br>
<div>On 11/19/2014 06:54 AM, Dominic Hung
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Dear Team Barrelfish,
<div><br>
</div>
<div>I am currently having a trouble with doing a 3-way
handshake like IDC. What I would like to achieve is</div>
<div><br>
</div>
<div>Core 0 -- Send Syn -> Core 1</div>
<div>Core 0 <- Send Syn/Ack -- Core 1</div>
<div>Core 0 -- Send Ack --> Core 1</div>
<div><br>
</div>
<div>I got no luck doing this on my original system, the message
can be sent from core 0 with no error code but core 1 keep
looping waiting for event. Having troubleshooting for quite
some time, then I turned to wrote a smaller scale testing
program to verify that 3-way handshake can be done. And I
still got the same result, i.e., core 0 sent ack with no error
code while core 1 spin waiting for event with no arrival and
delivery.</div>
<div><br>
</div>
<div>My platform is again... I am sorry, Intel SCC. The latest
tag I can compile with Intel SCC is release2012-11-03 and the
real tag I am now using is release2012-06-06. Hope you may
help.</div>
<div><br>
</div>
<div>The micro program is as attached.</div>
<div><br>
</div>
<div>
<div><font face="courier new, monospace">#include "stdio.h"</font></div>
<div><font face="courier new, monospace">#include "stdbool.h"
// FOR BOOL</font></div>
<div><font face="courier new, monospace">#include
<errors/errno.h> // FOR ERRVAL_T</font></div>
<div><span style="font-family:'courier new',monospace">#include
"arch/x86_32/barrelfish_kpi/eflags_arch.h"</span><br>
</div>
<div><font face="courier new, monospace">#include
"arch/x86_32/barrelfish_kpi/paging_arch.h"</font></div>
<div><font face="courier new, monospace">#include
"barrelfish_kpi/syscalls.h" // FOR STRUCT SYSRET</font></div>
<div><font face="courier new, monospace">#include
"barrelfish/capabilities.h"</font></div>
<div><font face="courier new, monospace">#include
"if/pingpong_defs.h"</font></div>
<div><span style="font-family:'courier new',monospace">#include
"barrelfish/domain.h"</span><br>
</div>
<div><font face="courier new, monospace">#include
"barrelfish/spawn_client.h"</font></div>
<div><font face="courier new, monospace">#include
"barrelfish/waitset.h"</font></div>
<div><font face="courier new, monospace">#include
"barrelfish/nameservice_client.h"</font></div>
<div><font face="courier new, monospace">#include "rck_dev.h"</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace">struct
pingpong_binding* binding;</font></div>
<div><font face="courier new, monospace">int flag_connect = 0;</font></div>
<div><font face="courier new, monospace">int flag_ack = 0;</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace">void
syn_handler(struct pingpong_binding *b){</font></div>
<div><font face="courier new, monospace">
debug_printf("arrived at syn\n");</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace">
b->tx_vtbl.syn_ack(b, NOP_CONT);</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace"> do{</font></div>
<div><font face="courier new, monospace"> printf("wait
ack\n");</font></div>
<div><font face="courier new, monospace">
event_dispatch(get_default_waitset());</font></div>
<div><font face="courier new, monospace"> }
while(!flag_ack);</font></div>
<div><font face="courier new, monospace">}</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace">void
syn_ack_handler(struct pingpong_binding *b){</font></div>
<div><font face="courier new, monospace">
debug_printf("arrived at syn_ack\n");</font></div>
<div><font face="courier new, monospace">}</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace">void
ack_handler(struct pingpong_binding *b){</font></div>
<div><font face="courier new, monospace">
debug_printf("arrived at ack\n");</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace"> flag_ack = 1;</font></div>
<div><font face="courier new, monospace">}</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><span style="font-family:'courier new',monospace">struct
pingpong_rx_vtbl pingpong_rx_vtbl = {</span><br>
</div>
<div><font face="courier new, monospace"> .syn =
syn_handler,</font></div>
<div><font face="courier new, monospace"> .syn_ack =
syn_ack_handler,</font></div>
<div><font face="courier new, monospace"> .ack =
ack_handler,</font></div>
<div><font face="courier new, monospace">};</font></div>
<div><br>
</div>
<div><font face="courier new, monospace">static void
bind_cb(void *st, errval_t err, struct pingpong_binding
*b)</font></div>
<div><font face="courier new, monospace">{</font></div>
<div><font face="courier new, monospace"> if
(err_is_fail(err)) {</font></div>
<div><font face="courier new, monospace">
USER_PANIC_ERR(err, "bind failed");</font></div>
<div><font face="courier new, monospace"> }</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace"> printf("client
bound!\n");</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace"> // copy my
message receive handler vtable to the binding</font></div>
<div><font face="courier new, monospace"> b->rx_vtbl =
pingpong_rx_vtbl;</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace"> binding = b;</font></div>
<div><font face="courier new, monospace">}</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace">static void
start_client(void)</font></div>
<div><font face="courier new, monospace">{</font></div>
<div><font face="courier new, monospace"> iref_t iref;</font></div>
<div><font face="courier new, monospace"> errval_t err;</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace"> printf("client
looking up '%s' in name service...\n",
"pingpong_service");</font></div>
<div><font face="courier new, monospace"> err =
nameservice_blocking_lookup("pingpong_service",
&iref);</font></div>
<div><font face="courier new, monospace"> if
(err_is_fail(err)) {</font></div>
<div><font face="courier new, monospace">
USER_PANIC_ERR(err, "nameservice_blocking_lookup failed");</font></div>
<div><font face="courier new, monospace"> }</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace"> printf("client
binding to %"PRIuIREF"...\n", iref);</font></div>
<div><font face="courier new, monospace"> err =
pingpong_bind(iref, bind_cb, NULL, get_default_waitset(),
IDC_BIND_FLAGS_DEFAULT);</font></div>
<div><font face="courier new, monospace"> if
(err_is_fail(err)) {</font></div>
<div><font face="courier new, monospace">
USER_PANIC_ERR(err, "bind failed");</font></div>
<div><font face="courier new, monospace"> }</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace"> while(binding ==
NULL)</font></div>
<div><font face="courier new, monospace">
event_dispatch(get_default_waitset());</font></div>
<div><font face="courier new, monospace">}</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace">/*
------------------------------ SERVER
------------------------------ */</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace">static void
export_cb(void *st, errval_t err, iref_t iref)</font></div>
<div><font face="courier new, monospace">{</font></div>
<div><font face="courier new, monospace"> if
(err_is_fail(err)) {</font></div>
<div><font face="courier new, monospace">
USER_PANIC_ERR(err, "export failed");</font></div>
<div><font face="courier new, monospace"> }</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace"> printf("service
exported at iref %"PRIuIREF"\n", iref);</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace"> // register this
iref with the name service</font></div>
<div><font face="courier new, monospace"> err =
nameservice_register("pingpong_service", iref);</font></div>
<div><font face="courier new, monospace"> printf("service
exported at iref %"PRIuIREF"\n", iref);</font></div>
<div><font face="courier new, monospace"> if
(err_is_fail(err)) {</font></div>
<div><font face="courier new, monospace">
USER_PANIC_ERR(err, "nameservice_register failed");</font></div>
<div><font face="courier new, monospace"> }</font></div>
<div><font face="courier new, monospace"> printf("service
exported at iref %"PRIuIREF"\n", iref);</font></div>
<div><font face="courier new, monospace">}</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace">static errval_t
connect_cb(void *st, struct pingpong_binding *b)</font></div>
<div><font face="courier new, monospace">{</font></div>
<div><font face="courier new, monospace"> printf("service
got a connection!\n");</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace"> // copy my
message receive handler vtable to the binding</font></div>
<div><font face="courier new, monospace"> b->rx_vtbl =
pingpong_rx_vtbl;</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace"> flag_connect = 1;</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace"> // accept the
connection (we could return an error to refuse it)</font></div>
<div><font face="courier new, monospace"> return
SYS_ERR_OK;</font></div>
<div><font face="courier new, monospace">}</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace">static void
start_server(void)</font></div>
<div><font face="courier new, monospace">{</font></div>
<div><font face="courier new, monospace"> errval_t err;</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace"> err =
pingpong_export(NULL, export_cb, connect_cb,
get_default_waitset(), IDC_EXPORT_FLAGS_DEFAULT);</font></div>
<div><font face="courier new, monospace"> if
(err_is_fail(err)) {</font></div>
<div><font face="courier new, monospace">
USER_PANIC_ERR(err, "export failed");</font></div>
<div><font face="courier new, monospace"> }</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace"> do{</font></div>
<div><font face="courier new, monospace">
event_dispatch(get_default_waitset());</font></div>
<div><font face="courier new, monospace"> }
while(!flag_connect);</font></div>
<div><font face="courier new, monospace">}</font></div>
<div><br>
</div>
<div><font face="courier new, monospace">int main(int argc,
char* argv[]){</font></div>
<div><font face="courier new, monospace">
debug_printf("%d\n", disp_get_core_id());</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace">
if(disp_get_core_id() == 0){</font></div>
<div><font face="courier new, monospace">
spawn_program(1, "/scc/sbin/pingpong", argv, NULL,
SPAWN_NEW_DOMAIN, NULL);</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace">
start_server();</font></div>
<div><font face="courier new, monospace"> }</font></div>
<div><font face="courier new, monospace"> else
start_client();</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace">
if(disp_get_core_id() == 1){</font></div>
<div><font face="courier new, monospace">
binding->tx_vtbl.syn(binding, NOP_CONT);</font></div>
<div><font face="courier new, monospace">
event_dispatch(get_default_waitset());</font></div>
<div><font face="courier new, monospace">
binding->tx_vtbl.ack(binding, NOP_CONT);</font></div>
<div><font face="courier new, monospace">
printf("sent ack\n");</font></div>
<div><font face="courier new, monospace"> }</font></div>
<div><font face="courier new, monospace"> else{</font></div>
<div><font face="courier new, monospace">
event_dispatch(get_default_waitset());</font></div>
<div><font face="courier new, monospace"> }</font></div>
<div><font face="courier new, monospace"><br>
</font></div>
<div><font face="courier new, monospace"> return 0;</font></div>
<div><font face="courier new, monospace">}</font></div>
</div>
<div><br>
</div>
<div>
<div>Thanks again!</div>
<div><br>
</div>
Cheers,<br>
<div>
Dominic Hung<br>
<br>
--------------------------------------------------<br>
<div>C H Dominic Hung, B.Eng. (CE) HK<br>
</div>
<div>M. Phil. Student, Dept. of CS., Faculty of Engg.</div>
<br>
Mobile: <a href="tel:%2B852-9819-9360" value="+85298199360" target="_blank">+852-9819-9360</a><br>
Email: <a href="mailto:domchdh@hku.hk" target="_blank">domchdh@hku.hk</a>
<br>
</div>
</div>
</div>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
Barrelfish-users mailing list
<a href="mailto:Barrelfish-users@lists.inf.ethz.ch" target="_blank">Barrelfish-users@lists.inf.ethz.ch</a>
<a href="https://lists.inf.ethz.ch/mailman/listinfo/barrelfish-users" target="_blank">https://lists.inf.ethz.ch/mailman/listinfo/barrelfish-users</a><span><font color="#888888">
</font></span></pre><span><font color="#888888">
</font></span></blockquote><span><font color="#888888">
<br><span class="HOEnZb"><font color="#888888">
<pre cols="72">--
Stefan
<a href="http://people.inf.ethz.ch/skaestle/" target="_blank">http://people.inf.ethz.ch/skaestle/</a></pre>
</font></span></font></span></div><span class="HOEnZb"><font color="#888888">
</font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div>
Dominic Hung<br><br>--------------------------------------------------<br><div>C H Dominic Hung, B.Eng. (CE) HK<br></div><div>M. Phil. Student, Dept. of CS., Faculty of Engg.</div><br>Mobile: <a href="tel:%2B852-9819-9360" value="+85298199360" target="_blank">+852-9819-9360</a><br>Email: <a href="mailto:domchdh@hku.hk" target="_blank">domchdh@hku.hk</a>
<br></div>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">
Dominic Hung<br><br>--------------------------------------------------<br><div>C H Dominic Hung, B.Eng. (CE) HK<br></div><div>M. Phil. Student, Dept. of CS., Faculty of Engg.</div><br>Mobile: +852-9819-9360<br>Email: <a href="mailto:domchdh@hku.hk" target="_blank">domchdh@hku.hk</a>
<br></div>
</div>