From nobody Tue Apr 30 22:52:46 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 155384505289679.15339122293437; Fri, 29 Mar 2019 00:37:32 -0700 (PDT) Received: from localhost ([127.0.0.1]:47953 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9m4o-00054q-Px for importer@patchew.org; Fri, 29 Mar 2019 03:37:22 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34743) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9m2l-0003vr-PY for qemu-devel@nongnu.org; Fri, 29 Mar 2019 03:35:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h9m2k-0002gv-Mq for qemu-devel@nongnu.org; Fri, 29 Mar 2019 03:35:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34316) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h9m2k-0002gR-DB for qemu-devel@nongnu.org; Fri, 29 Mar 2019 03:35:14 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A8D1A30821B5; Fri, 29 Mar 2019 07:35:13 +0000 (UTC) Received: from jason-ThinkPad-T430s.redhat.com (ovpn-12-125.pek2.redhat.com [10.72.12.125]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB01162501; Fri, 29 Mar 2019 07:35:09 +0000 (UTC) From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Fri, 29 Mar 2019 15:35:01 +0800 Message-Id: <1553844904-29959-2-git-send-email-jasowang@redhat.com> In-Reply-To: <1553844904-29959-1-git-send-email-jasowang@redhat.com> References: <1553844904-29959-1-git-send-email-jasowang@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Fri, 29 Mar 2019 07:35:13 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/4] net/socket: learn to talk with a unix dgram socket X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Jason Wang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau -net socket has a fd argument, and may be passed pre-opened sockets. TCP sockets use framing. UDP sockets have datagram boundaries. When given a unix dgram socket, it will be able to read from it, but will attempt to send on the dgram_dst, which is unset. The other end will not receive the data. Let's teach -net socket to recognize a UNIX DGRAM socket, and use the regular send() command (without dgram_dst). This makes running slirp out-of-process possible that way (python pseudo-code): a, b =3D socket.socketpair(socket.AF_UNIX, socket.SOCK_DGRAM) subprocess.Popen('qemu -net socket,fd=3D%d -net user' % a.fileno(), shell= =3DTrue) subprocess.Popen('qemu ... -net nic -net socket,fd=3D%d' % b.fileno(), shel= l=3DTrue) Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Jason Wang --- net/socket.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/net/socket.c b/net/socket.c index 90ef351..c923540 100644 --- a/net/socket.c +++ b/net/socket.c @@ -119,9 +119,13 @@ static ssize_t net_socket_receive_dgram(NetClientState= *nc, const uint8_t *buf, ssize_t ret; =20 do { - ret =3D qemu_sendto(s->fd, buf, size, 0, - (struct sockaddr *)&s->dgram_dst, - sizeof(s->dgram_dst)); + if (s->dgram_dst.sin_family !=3D AF_UNIX) { + ret =3D qemu_sendto(s->fd, buf, size, 0, + (struct sockaddr *)&s->dgram_dst, + sizeof(s->dgram_dst)); + } else { + ret =3D send(s->fd, buf, size, 0); + } } while (ret =3D=3D -1 && errno =3D=3D EINTR); =20 if (ret =3D=3D -1 && errno =3D=3D EAGAIN) { @@ -336,6 +340,15 @@ static NetSocketState *net_socket_fd_init_dgram(NetCli= entState *peer, int newfd; NetClientState *nc; NetSocketState *s; + SocketAddress *sa; + SocketAddressType sa_type; + + sa =3D socket_local_address(fd, errp); + if (!sa) { + return NULL; + } + sa_type =3D sa->type; + qapi_free_SocketAddress(sa); =20 /* fd passed: multicast: "learn" dgram_dst address from bound address = and save it * Because this may be "shared" socket from a "master" process, datagr= ams would be recv() @@ -379,8 +392,12 @@ static NetSocketState *net_socket_fd_init_dgram(NetCli= entState *peer, "socket: fd=3D%d (cloned mcast=3D%s:%d)", fd, inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port)); } else { + if (sa_type =3D=3D SOCKET_ADDRESS_TYPE_UNIX) { + s->dgram_dst.sin_family =3D AF_UNIX; + } + snprintf(nc->info_str, sizeof(nc->info_str), - "socket: fd=3D%d", fd); + "socket: fd=3D%d %s", fd, SocketAddressType_str(sa_type)); } =20 return s; --=20 2.5.0 From nobody Tue Apr 30 22:52:46 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553845055264105.12428687117017; Fri, 29 Mar 2019 00:37:35 -0700 (PDT) Received: from localhost ([127.0.0.1]:47957 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9m4q-00056S-TN for importer@patchew.org; Fri, 29 Mar 2019 03:37:24 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34756) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9m2o-0003wI-Dl for qemu-devel@nongnu.org; Fri, 29 Mar 2019 03:35:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h9m2n-0002jG-15 for qemu-devel@nongnu.org; Fri, 29 Mar 2019 03:35:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48248) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h9m2m-0002hW-NP for qemu-devel@nongnu.org; Fri, 29 Mar 2019 03:35:16 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0DDFBC00E0CE; Fri, 29 Mar 2019 07:35:16 +0000 (UTC) Received: from jason-ThinkPad-T430s.redhat.com (ovpn-12-125.pek2.redhat.com [10.72.12.125]) by smtp.corp.redhat.com (Postfix) with ESMTP id 34A1262502; Fri, 29 Mar 2019 07:35:13 +0000 (UTC) From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Fri, 29 Mar 2019 15:35:02 +0800 Message-Id: <1553844904-29959-3-git-send-email-jasowang@redhat.com> In-Reply-To: <1553844904-29959-1-git-send-email-jasowang@redhat.com> References: <1553844904-29959-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 29 Mar 2019 07:35:16 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/4] e1000: Delay flush queue when receive RCTL X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jason Wang , yuchenlin Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: yuchenlin Due to too early RCT0 interrput, win10x32 may hang on booting. This problem can be reproduced by doing power cycle on win10x32 guest. In our environment, we have 10 win10x32 and stress power cycle. The problem will happen about 20 rounds. Below shows some log with comment: The normal case: 22831@1551928392.984687:e1000x_rx_disabled Received packet dropped because receive is disabled RCTL =3D 0 22831@1551928392.985655:e1000x_rx_disabled Received packet dropped because receive is disabled RCTL =3D 0 22831@1551928392.985801:e1000x_rx_disabled Received packet dropped because receive is disabled RCTL =3D 0 e1000: set_ics 0, ICR 0, IMR 0 e1000: set_ics 0, ICR 0, IMR 0 e1000: set_ics 0, ICR 0, IMR 0 e1000: RCTL: 0, mac_reg[RCTL] =3D 0x0 22831@1551928393.056710:e1000x_rx_disabled Received packet dropped because receive is disabled RCTL =3D 0 e1000: set_ics 0, ICR 0, IMR 0 e1000: ICR read: 0 e1000: set_ics 0, ICR 0, IMR 0 e1000: set_ics 0, ICR 0, IMR 0 e1000: RCTL: 0, mac_reg[RCTL] =3D 0x0 22831@1551928393.077548:e1000x_rx_disabled Received packet dropped because receive is disabled RCTL =3D 0 e1000: set_ics 0, ICR 0, IMR 0 e1000: ICR read: 0 e1000: set_ics 2, ICR 0, IMR 0 e1000: set_ics 2, ICR 2, IMR 0 e1000: RCTL: 0, mac_reg[RCTL] =3D 0x0 22831@1551928393.102974:e1000x_rx_disabled Received packet dropped because receive is disabled RCTL =3D 0 22831@1551928393.103267:e1000x_rx_disabled Received packet dropped because receive is disabled RCTL =3D 0 e1000: RCTL: 255, mac_reg[RCTL] =3D 0x40002 <- win10x32 says it can handle RX now e1000: set_ics 0, ICR 2, IMR 9d <- unmask interrupt e1000: RCTL: 255, mac_reg[RCTL] =3D 0x48002 e1000: set_ics 80, ICR 2, IMR 9d <- interrupt and work! ... The bad case: 27744@1551930483.117766:e1000x_rx_disabled Received packet dropped because receive is disabled RCTL =3D 0 27744@1551930483.118398:e1000x_rx_disabled Received packet dropped because receive is disabled RCTL =3D 0 e1000: set_ics 0, ICR 0, IMR 0 e1000: set_ics 0, ICR 0, IMR 0 e1000: set_ics 0, ICR 0, IMR 0 e1000: RCTL: 0, mac_reg[RCTL] =3D 0x0 27744@1551930483.198063:e1000x_rx_disabled Received packet dropped because receive is disabled RCTL =3D 0 e1000: set_ics 0, ICR 0, IMR 0 e1000: ICR read: 0 e1000: set_ics 0, ICR 0, IMR 0 e1000: set_ics 0, ICR 0, IMR 0 e1000: RCTL: 0, mac_reg[RCTL] =3D 0x0 27744@1551930483.218675:e1000x_rx_disabled Received packet dropped because receive is disabled RCTL =3D 0 e1000: set_ics 0, ICR 0, IMR 0 e1000: ICR read: 0 e1000: set_ics 2, ICR 0, IMR 0 e1000: set_ics 2, ICR 2, IMR 0 e1000: RCTL: 0, mac_reg[RCTL] =3D 0x0 27744@1551930483.241768:e1000x_rx_disabled Received packet dropped because receive is disabled RCTL =3D 0 27744@1551930483.241979:e1000x_rx_disabled Received packet dropped because receive is disabled RCTL =3D 0 e1000: RCTL: 255, mac_reg[RCTL] =3D 0x40002 <- win10x32 says it can handle RX now e1000: set_ics 80, ICR 2, IMR 0 <- flush queue (caused by setting RCTL) e1000: set_ics 0, ICR 82, IMR 9d <- unmask interrupt and because 0x82&0x9d !=3D 0 generate interrupt, hang on here... To workaround this problem, simply delay flush queue. Also stop receiving when timer is going to run. Tested on CentOS, Win7SP1x64 and Win10x32. Signed-off-by: yuchenlin Reviewed-by: Dmitry Fleytman Signed-off-by: Jason Wang --- hw/net/e1000.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/hw/net/e1000.c b/hw/net/e1000.c index 5e144cb..9b39bcc 100644 --- a/hw/net/e1000.c +++ b/hw/net/e1000.c @@ -120,6 +120,8 @@ typedef struct E1000State_st { bool mit_irq_level; /* Tracks interrupt pin level. */ uint32_t mit_ide; /* Tracks E1000_TXD_CMD_IDE bit. */ =20 + QEMUTimer *flush_queue_timer; + /* Compatibility flags for migration to/from qemu 1.3.0 and older */ #define E1000_FLAG_AUTONEG_BIT 0 #define E1000_FLAG_MIT_BIT 1 @@ -366,6 +368,7 @@ static void e1000_reset(void *opaque) =20 timer_del(d->autoneg_timer); timer_del(d->mit_timer); + timer_del(d->flush_queue_timer); d->mit_timer_on =3D 0; d->mit_irq_level =3D 0; d->mit_ide =3D 0; @@ -392,6 +395,14 @@ set_ctrl(E1000State *s, int index, uint32_t val) } =20 static void +e1000_flush_queue_timer(void *opaque) +{ + E1000State *s =3D opaque; + + qemu_flush_queued_packets(qemu_get_queue(s->nic)); +} + +static void set_rx_control(E1000State *s, int index, uint32_t val) { s->mac_reg[RCTL] =3D val; @@ -399,7 +410,8 @@ set_rx_control(E1000State *s, int index, uint32_t val) s->rxbuf_min_shift =3D ((val / E1000_RCTL_RDMTS_QUAT) & 3) + 1; DBGOUT(RX, "RCTL: %d, mac_reg[RCTL] =3D 0x%x\n", s->mac_reg[RDT], s->mac_reg[RCTL]); - qemu_flush_queued_packets(qemu_get_queue(s->nic)); + timer_mod(s->flush_queue_timer, + qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + 1000); } =20 static void @@ -837,7 +849,7 @@ e1000_can_receive(NetClientState *nc) E1000State *s =3D qemu_get_nic_opaque(nc); =20 return e1000x_rx_ready(&s->parent_obj, s->mac_reg) && - e1000_has_rxbufs(s, 1); + e1000_has_rxbufs(s, 1) && !timer_pending(s->flush_queue_timer); } =20 static uint64_t rx_desc_base(E1000State *s) @@ -881,6 +893,10 @@ e1000_receive_iov(NetClientState *nc, const struct iov= ec *iov, int iovcnt) return -1; } =20 + if (timer_pending(s->flush_queue_timer)) { + return 0; + } + /* Pad to minimum Ethernet frame length */ if (size < sizeof(min_buf)) { iov_to_buf(iov, iovcnt, 0, min_buf, size); @@ -1637,6 +1653,8 @@ pci_e1000_uninit(PCIDevice *dev) timer_free(d->autoneg_timer); timer_del(d->mit_timer); timer_free(d->mit_timer); + timer_del(d->flush_queue_timer); + timer_free(d->flush_queue_timer); qemu_del_nic(d->nic); } =20 @@ -1700,6 +1718,8 @@ static void pci_e1000_realize(PCIDevice *pci_dev, Err= or **errp) =20 d->autoneg_timer =3D timer_new_ms(QEMU_CLOCK_VIRTUAL, e1000_autoneg_ti= mer, d); d->mit_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, e1000_mit_timer, d); + d->flush_queue_timer =3D timer_new_ms(QEMU_CLOCK_VIRTUAL, + e1000_flush_queue_timer, d); } =20 static void qdev_e1000_reset(DeviceState *dev) --=20 2.5.0 From nobody Tue Apr 30 22:52:46 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553845051702856.4220734249037; Fri, 29 Mar 2019 00:37:31 -0700 (PDT) Received: from localhost ([127.0.0.1]:47955 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9m4q-000563-BC for importer@patchew.org; Fri, 29 Mar 2019 03:37:24 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34785) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9m2q-0003wp-63 for qemu-devel@nongnu.org; Fri, 29 Mar 2019 03:35:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h9m2p-0002kj-7w for qemu-devel@nongnu.org; Fri, 29 Mar 2019 03:35:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32792) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h9m2p-0002kH-04 for qemu-devel@nongnu.org; Fri, 29 Mar 2019 03:35:19 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4A1F131688E1; Fri, 29 Mar 2019 07:35:18 +0000 (UTC) Received: from jason-ThinkPad-T430s.redhat.com (ovpn-12-125.pek2.redhat.com [10.72.12.125]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8FAD861090; Fri, 29 Mar 2019 07:35:16 +0000 (UTC) From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Fri, 29 Mar 2019 15:35:03 +0800 Message-Id: <1553844904-29959-4-git-send-email-jasowang@redhat.com> In-Reply-To: <1553844904-29959-1-git-send-email-jasowang@redhat.com> References: <1553844904-29959-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Fri, 29 Mar 2019 07:35:18 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 3/4] MAINTAINERS: Update the latest email address X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Zhang Chen , Jason Wang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Zhang Chen Signed-off-by: Zhang Chen Signed-off-by: Jason Wang --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index c2ad506..56139ac 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2179,7 +2179,7 @@ F: include/migration/failover.h F: docs/COLO-FT.txt =20 COLO Proxy -M: Zhang Chen +M: Zhang Chen M: Li Zhijian S: Supported F: docs/colo-proxy.txt --=20 2.5.0 From nobody Tue Apr 30 22:52:46 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553845186084259.77110058383687; Fri, 29 Mar 2019 00:39:46 -0700 (PDT) Received: from localhost ([127.0.0.1]:47983 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9m76-0007Pt-Ry for importer@patchew.org; Fri, 29 Mar 2019 03:39:44 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34800) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9m2s-0003z7-E7 for qemu-devel@nongnu.org; Fri, 29 Mar 2019 03:35:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h9m2r-0002mS-DS for qemu-devel@nongnu.org; Fri, 29 Mar 2019 03:35:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36054) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h9m2r-0002mD-6V for qemu-devel@nongnu.org; Fri, 29 Mar 2019 03:35:21 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7EEBE308338F; Fri, 29 Mar 2019 07:35:20 +0000 (UTC) Received: from jason-ThinkPad-T430s.redhat.com (ovpn-12-125.pek2.redhat.com [10.72.12.125]) by smtp.corp.redhat.com (Postfix) with ESMTP id CB1B361090; Fri, 29 Mar 2019 07:35:18 +0000 (UTC) From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Fri, 29 Mar 2019 15:35:04 +0800 Message-Id: <1553844904-29959-5-git-send-email-jasowang@redhat.com> In-Reply-To: <1553844904-29959-1-git-send-email-jasowang@redhat.com> References: <1553844904-29959-1-git-send-email-jasowang@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Fri, 29 Mar 2019 07:35:20 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 4/4] net: tap: use qemu_set_nonblock X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jason Wang , Li Qiang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Li Qiang The fcntl will change the flags directly, use qemu_set_nonblock() instead. Reviewed-by: Daniel P. Berrang=C3=A9 Acked-by: Michael S. Tsirkin Signed-off-by: Li Qiang Signed-off-by: Jason Wang --- net/tap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/net/tap.c b/net/tap.c index cc8525f..e8aadd8 100644 --- a/net/tap.c +++ b/net/tap.c @@ -592,7 +592,7 @@ int net_init_bridge(const Netdev *netdev, const char *n= ame, return -1; } =20 - fcntl(fd, F_SETFL, O_NONBLOCK); + qemu_set_nonblock(fd); vnet_hdr =3D tap_probe_vnet_hdr(fd); s =3D net_tap_fd_init(peer, "bridge", name, fd, vnet_hdr); =20 @@ -707,7 +707,7 @@ static void net_init_tap_one(const NetdevTapOptions *ta= p, NetClientState *peer, } return; } - fcntl(vhostfd, F_SETFL, O_NONBLOCK); + qemu_set_nonblock(vhostfd); } options.opaque =3D (void *)(uintptr_t)vhostfd; =20 @@ -791,7 +791,7 @@ int net_init_tap(const Netdev *netdev, const char *name, return -1; } =20 - fcntl(fd, F_SETFL, O_NONBLOCK); + qemu_set_nonblock(fd); =20 vnet_hdr =3D tap_probe_vnet_hdr(fd); =20 @@ -839,7 +839,7 @@ int net_init_tap(const Netdev *netdev, const char *name, goto free_fail; } =20 - fcntl(fd, F_SETFL, O_NONBLOCK); + qemu_set_nonblock(fd); =20 if (i =3D=3D 0) { vnet_hdr =3D tap_probe_vnet_hdr(fd); @@ -887,7 +887,7 @@ free_fail: return -1; } =20 - fcntl(fd, F_SETFL, O_NONBLOCK); + qemu_set_nonblock(fd); vnet_hdr =3D tap_probe_vnet_hdr(fd); =20 net_init_tap_one(tap, peer, "bridge", name, ifname, --=20 2.5.0