Hi all,<div><br></div><div>I&#39;m trying the Barrelfish&#39; ability of sending large buffers (now 64kb) between cores using flounder. And I&#39;m experiencing a strange behaviour. After sending some messages, and running it for about 1 min in QEMU, the program segfaults or simply hangs. I&#39;m not sure if I am doing something wrong... I&#39;m trying it with the latest version of Barrelfish.<br clear="all">
<div><br></div><div>The program is inspired in &quot;usr/tests/idctest/idctest.c&quot;. It&#39;s spawning another instance on core 1 and setting the binding. After that it creates another thread to &quot;dispatch events&quot;. The main loop in core 0 is sending messages, while the main loop in core 1 is just waiting for a reply queue to have some messages and send them back. It&#39;s using the same &quot;test.if&quot; interface that idctest.c is using. I send it as an attachment. You can simply try it by copying it over the existing idctest.c.</div>
<div><br></div><div>So, core 0 is sending a message to core 1:</div><div><br></div><div><b>a = malloc(65536);</b></div><div><b>test_buf__tx(b, MKCONT(end, 0), a, 65536);</b></div><div><br></div><div>before sending it, it obtains a lock to ensure that next message is not sent before the previous one has been  already sent:</div>
<div><br></div><div><div><b>  while (__sync_lock_test_and_set(&amp;busy, true))</b></div><div><b>    thread_yield();</b></div><div>  </div></div><div>The continuation closure is releasing the lock:</div><div><br></div><div>
<div><b>static void end(void *r)</b></div><div><b>{</b></div><div><b>  free (a);</b></div><div><b>  busy = false;</b></div><div><b>}</b></div><div><br></div></div><div>This function is being called always by the second thread, which is always dispatching messages. I know this is not very efficient to use this spinlock... Is there any other way to block the thread and wake it up by the other thread?</div>
<div><br></div><div>Core 1 when receives the message:</div><div><div><br></div><div><b>static void buf1(struct test_binding *b, uint8_t *p, size_t buflen)</b></div><div><b>{</b></div><div><b>  debug_printf(&quot;buf1 %u\n&quot;, p[65535]);</b></div>
<div><b>  ambf_buff_send(p);</b></div><div><b>}</b></div><div><br></div></div><div>Simply prints the last position and sends it back to core 0: queuing it to the other thread in order not to block the event dispatcher.</div>
<div><br></div><div>The program segfaults when accessing to buffer p, in the previous function, as sometimes p is null. In any case, there is no error reported...</div><div><br></div><div>I would like to know if you see something wrong here ...</div>
<div><br></div><div><br></div><div>Many thanks!!</div><div><br></div>-- <br>Zeus Gómez Marmolejo<br>Barcelona Supercomputing Center<br>PhD student<br><a href="http://www.bsc.es" target="_blank">http://www.bsc.es</a><br><br>
<br>
</div>