[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PULL 00/14] Net patches

From: Li Zhijian
Subject: Re: [Qemu-devel] [PULL 00/14] Net patches
Date: Tue, 15 Mar 2016 11:25:49 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

On 03/15/2016 11:07 AM, Jason Wang wrote:

On 03/10/2016 11:51 AM, Li Zhijian wrote:

On 03/10/2016 10:28 AM, Jason Wang wrote:

On 03/08/2016 05:54 PM, Peter Maydell wrote:
On 8 March 2016 at 16:06, Zhang Chen <address@hidden>
I found the reason for this problem is that
unix_connect() have not connect to sock_path before iov_send().
It need time to establish connection. so can we fix it with usleep()
like this:

      recv_sock = unix_connect(sock_path, NULL);
      g_assert_cmpint(recv_sock, !=, -1);
+    usleep(1000);

      ret = iov_send(send_sock[0], iov, 2, 0, sizeof(size) +
      g_assert_cmpint(ret, ==, sizeof(send_buf) + sizeof(size));

      ret = qemu_recv(recv_sock, &len, sizeof(len), 0);
I would prefer it if we could find a way to fix this race
reliably rather than just inserting a delay and hoping it
is sufficient. Otherwise the test is likely to be unreliable
if run on a heavily loaded or slow machine.

-- PMM


To make sure the connected socket to be proceeded before iov_send(), you
could use some like  qmp("{ 'execute' : 'query-status'}") before
iov_send(). With this we are guaranteed that connected is setting to
true before iov_send().

it seem works, but i don't know.
Is this because that both qemu accepting the connection and qmp
command are working under *iothread*,
so that when the qemu command returns, we can guaranteed the
connection is accepted ?

I think the problem is the race in main loop between the two handlers.
If the socket netdev read handler was proceed before chardev read
handler, since connected was false the packet will be dropped silently.
After we place whateve a qmp command in the middled, it's guaranteed
that all handlers were proceed after qmp command was executed, so we are
sure the connected is true when doing iov_send().

Got it, thank for your explain.

we will send V9 with '-chardev socket' and add an qmp sync point soon.

Li Zhijian

Li Zhijian


reply via email to

[Prev in Thread] Current Thread [Next in Thread]