From: Jason Wang <jasowang@redhat.com>
To: Li Zhijian <lizhijian@cn.fujitsu.com>,
Peter Maydell <peter.maydell@linaro.org>,
Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PULL 00/14] Net patches
Date: Tue, 15 Mar 2016 11:07:01 +0800 [thread overview]
Message-ID: <56E77C55.8060805@redhat.com> (raw)
In-Reply-To: <56E0EF3D.8070404@cn.fujitsu.com>
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 <zhangchen.fnst@cn.fujitsu.com>
>>> wrote:
>>>> 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) +
>>>> sizeof(send_buf));
>>>> g_assert_cmpint(ret, ==, sizeof(send_buf) + sizeof(size));
>>>> close(send_sock[0]);
>>>>
>>>> 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.
>>>
>>> thanks
>>> -- PMM
>>>
>>
>> +1
>>
>> 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().
>
> Thanks
> Li Zhijian
>>
>>
>>
>
>
>
next prev parent reply other threads:[~2016-03-15 3:07 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-07 3:12 [Qemu-devel] [PULL 00/14] Net patches Jason Wang
2016-03-07 3:12 ` [Qemu-devel] [PULL 01/14] net: ne2000: check ring buffer control registers Jason Wang
2016-03-07 3:12 ` [Qemu-devel] [PULL 02/14] net: filter: correctly remove filter from the list during finalization Jason Wang
2016-03-07 3:12 ` [Qemu-devel] [PULL 03/14] MAINTAINERS: Add entries for include/net/ files Jason Wang
2016-03-07 3:12 ` [Qemu-devel] [PULL 04/14] net: simplify net_init_tap_one logic Jason Wang
2016-03-07 3:12 ` [Qemu-devel] [PULL 05/14] net/filter-mirror:Add filter-mirror Jason Wang
2016-03-07 3:12 ` [Qemu-devel] [PULL 06/14] tests/test-filter-mirror:add filter-mirror unit test Jason Wang
2016-03-07 3:12 ` [Qemu-devel] [PULL 07/14] net: netmap: probe netmap interface for virtio-net header Jason Wang
2016-03-07 3:12 ` [Qemu-devel] [PULL 08/14] rocker: forbid to change world type Jason Wang
2016-03-07 3:12 ` [Qemu-devel] [PULL 09/14] rocker: return -ENOMEM in case of some world alloc fails Jason Wang
2016-03-07 3:12 ` [Qemu-devel] [PULL 10/14] rocker: add name field into WorldOps ale let world specify its name Jason Wang
2016-03-07 3:12 ` [Qemu-devel] [PULL 11/14] rocker: allow user to specify rocker world by property Jason Wang
2016-03-07 3:12 ` [Qemu-devel] [PULL 12/14] filter: Add 'status' property for filter object Jason Wang
2016-03-07 3:12 ` [Qemu-devel] [PULL 13/14] filter-buffer: Add status_changed callback processing Jason Wang
2016-03-07 3:13 ` [Qemu-devel] [PULL 14/14] net: check packet payload length Jason Wang
2016-03-08 4:51 ` [Qemu-devel] [PULL 00/14] Net patches Peter Maydell
2016-03-08 7:33 ` Jason Wang
2016-03-08 7:50 ` Wen Congyang
2016-03-08 7:56 ` Jason Wang
2016-03-08 9:06 ` Zhang Chen
2016-03-08 9:13 ` Wen Congyang
2016-03-08 9:54 ` Peter Maydell
2016-03-09 1:36 ` Wen Congyang
2016-03-09 4:26 ` Li Zhijian
2016-03-09 5:24 ` Wen Congyang
2016-03-15 3:15 ` Jason Wang
2016-03-10 2:28 ` Jason Wang
2016-03-10 3:51 ` Li Zhijian
2016-03-15 3:07 ` Jason Wang [this message]
2016-03-15 3:25 ` Li Zhijian
-- strict thread matches above, loose matches on Subject: below --
2017-07-17 12:21 Jason Wang
2017-07-18 9:34 ` Peter Maydell
2015-10-12 8:17 Jason Wang
2015-10-12 14:52 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56E77C55.8060805@redhat.com \
--to=jasowang@redhat.com \
--cc=lizhijian@cn.fujitsu.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=zhangchen.fnst@cn.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.