All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Gaohaifeng (A)" <gaohaifeng.gao@huawei.com>
To: "berrange@redhat.com" <berrange@redhat.com>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"Lilijun (Jerry)" <jerry.lilijun@huawei.com>,
	zangchuanqiang <zangchuanqiang@huawei.com>,
	qemu devel <qemu-devel@nongnu.org>
Subject: [Qemu-devel] A question about this commit 9894dc0cdcc397ee5b26370bc53da6d360a363c2
Date: Tue, 23 Aug 2016 08:57:44 +0000	[thread overview]
Message-ID: <47CEA9C0E570484FBF22EF0D7EBCE5B5357D7C69@szxema505-mbx.china.huawei.com> (raw)

Hi Daniel & Paolo,

Commit 9894dc0c "char: convert from GIOChannel to QIOChannel", about

the below code segment:

-static gboolean tcp_chr_read(GIOChannel *chan, GIOCondition cond, void *opaque)
+static gboolean tcp_chr_read(QIOChannel *chan, GIOCondition cond, void *opaque)
{
     CharDriverState *chr = opaque;
     TCPCharDriver *s = chr->opaque;
@@ -2938,9 +2801,7 @@ static gboolean tcp_chr_read(GIOChannel *chan, GIOCondition cond, void *opaque)
     if (len > s->max_size)
         len = s->max_size;
     size = tcp_chr_recv(chr, (void *)buf, len);
-    if (size == 0 ||
-        (size < 0 &&
-         socket_error() != EAGAIN && socket_error() != EWOULDBLOCK)) {
+    if (size == 0 || size == -1) {
         /* connection closed */
         tcp_chr_disconnect(chr);
     } else if (size > 0) {

The old version will not call tcp_chr_disconnect when error is not EAGAIN.
The new version will call tcp_chr_disconnect when size==-1. From the tcp_chr_recv function we see EAGIN will return -1, so EAGIN will call tcp_chr_disconnect.

We meet an issue when Guest VM use DPDK(1.6.0) l2fwd, it may exit since link status is not up. The link is down because tcp_chr_disconnect will set it.

Can you explain it why EAGIN here changes the behavior ?

Thanks,
Haifeng Gao

             reply	other threads:[~2016-08-23  8:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-23  8:57 Gaohaifeng (A) [this message]
2016-08-25  1:33 ` [Qemu-devel] A question about this commit 9894dc0cdcc397ee5b26370bc53da6d360a363c2 Daniel P. Berrange
2016-08-25 13:21   ` Gaohaifeng (A)
2016-08-25 15:52     ` Daniel P. Berrange

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=47CEA9C0E570484FBF22EF0D7EBCE5B5357D7C69@szxema505-mbx.china.huawei.com \
    --to=gaohaifeng.gao@huawei.com \
    --cc=berrange@redhat.com \
    --cc=jerry.lilijun@huawei.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=zangchuanqiang@huawei.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.