<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body 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 class="moz-cite-prefix">On 11/19/2014 06:54 AM, Dominic Hung
wrote:<br>
</div>
<blockquote
cite="mid:CA+GbC7-=GWb=4_aAGQ0-u5DZe=J7H7t+Guv5JvO=qs7sC85nbw@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<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 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 moz-do-not-send="true"
href="mailto:domchdh@hku.hk" target="_blank">domchdh@hku.hk</a>
<br>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Barrelfish-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Barrelfish-users@lists.inf.ethz.ch">Barrelfish-users@lists.inf.ethz.ch</a>
<a class="moz-txt-link-freetext" href="https://lists.inf.ethz.ch/mailman/listinfo/barrelfish-users">https://lists.inf.ethz.ch/mailman/listinfo/barrelfish-users</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Stefan
<a class="moz-txt-link-freetext" href="http://people.inf.ethz.ch/skaestle/">http://people.inf.ethz.ch/skaestle/</a></pre>
</body>
</html>