From nobody Sat May 4 13:59:06 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 ARC-Seal: i=1; a=rsa-sha256; t=1569936490; cv=none; d=zoho.com; s=zohoarc; b=abQvNA/zryyNuC1gVQ53ZmmJpM7b9QXqm4SiPtqdn77kZ0SZygHOlcl2x+XUcYuY5xyPdtiaF9VFD+B/5N0aTKwckFlAR04zME8E2lbmcp5SVzkWQt0LU2i9adzW3cxngosacQUzgOmyVpN/ih6c9aVap8JmxD/rE/E7jHL8efI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569936490; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=csciNcEXcI3hpLhcSqLHQHj5jUzFV3pXOsiTWy5H8tQ=; b=hdwkBSerH/ifk41wu2MJeMELugyuvBKmNMfJWxRNdtCC3sKZsTm+IL+RytPsCbk76on2zdqsLgbpIMkIkyeb2u2FHthnnd2hfzVN/xJ7phvv4k622tcoWeNEHlPbu1jLlRi9jYDphu9tsTZDMWaFx18HuQfJtsISWjG4KaHrJq0= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569936490413872.6843163721676; Tue, 1 Oct 2019 06:28:10 -0700 (PDT) Received: from localhost ([::1]:42130 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFICH-0001Yr-AF for importer@patchew.org; Tue, 01 Oct 2019 09:28:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56367) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFIAe-0008LM-F7 for qemu-devel@nongnu.org; Tue, 01 Oct 2019 09:26:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iFIAd-0000En-B7 for qemu-devel@nongnu.org; Tue, 01 Oct 2019 09:26:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52640) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iFIAd-0000E8-5h for qemu-devel@nongnu.org; Tue, 01 Oct 2019 09:26:27 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6885E12E5; Tue, 1 Oct 2019 13:26:26 +0000 (UTC) Received: from localhost (ovpn-112-22.ams2.redhat.com [10.36.112.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 661F35D9CC; Tue, 1 Oct 2019 13:26:23 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH 1/3] util: WSAEWOULDBLOCK on connect should map to EINPROGRESS Date: Tue, 1 Oct 2019 17:26:07 +0400 Message-Id: <20191001132609.23184-2-marcandre.lureau@redhat.com> In-Reply-To: <20191001132609.23184-1-marcandre.lureau@redhat.com> References: <20191001132609.23184-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 01 Oct 2019 13:26:26 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, berrange@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , sw@weilnetz.de Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" In general, WSAEWOULDBLOCK can be mapped to EAGAIN as done by socket_error() (or EWOULDBLOCK). But for connect() with non-blocking sockets, it actually means the operation is in progress: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-con= nect "The socket is marked as nonblocking and the connection cannot be completed= immediately." (this is also the behaviour implemented by GLib GSocket) This fixes socket_can_bind_connect() test on win32. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- util/oslib-win32.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/util/oslib-win32.c b/util/oslib-win32.c index c62cd4328c..886e400d6a 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -585,7 +585,11 @@ int qemu_connect_wrap(int sockfd, const struct sockadd= r *addr, int ret; ret =3D connect(sockfd, addr, addrlen); if (ret < 0) { - errno =3D socket_error(); + if (WSAGetLastError() =3D=3D WSAEWOULDBLOCK) { + errno =3D EINPROGRESS; + } else { + errno =3D socket_error(); + } } return ret; } --=20 2.23.0 From nobody Sat May 4 13:59:06 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 ARC-Seal: i=1; a=rsa-sha256; t=1569936581; cv=none; d=zoho.com; s=zohoarc; b=QbptxuwnYeemfXYA9VKn2mVpl28uQ843MUdY7XtfcDQC5mNcVYlxOPuGRkH81/1iaugw8DG0KKz4KZ/kIWT8Vjx5iqBaMoHc3ObRo9PO2y0TFFvV/LhSSV1M74zmNaUUXgZs5+WAS06ruMFMYXefisa1rq3vsxs5dAnwayav4DA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569936581; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=vEEfmyGG0ap3Vdr1amSg5j/ADKRHDRwtOf9jMMq+Qh8=; b=L8zxAhebnB5Q//1TBBicx4FSs7o3scF0F8BJypLr2/buT8eWjle94F9+kLTvSAM5Q8xDPVtSKey2ZQaPL32glI4wFL8qAC6Q04iah8m85K/QfSwFI4Ckz6teOYQ9r3MBW6M0//NvDtB1+oWxb8L5pNkhszB2o6aqFovkTZ/KhLU= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569936581185110.44497522767028; Tue, 1 Oct 2019 06:29:41 -0700 (PDT) Received: from localhost ([::1]:42150 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFIDj-0002aZ-QO for importer@patchew.org; Tue, 01 Oct 2019 09:29:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56412) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFIAm-00005s-Id for qemu-devel@nongnu.org; Tue, 01 Oct 2019 09:26:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iFIAl-0000NO-L4 for qemu-devel@nongnu.org; Tue, 01 Oct 2019 09:26:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45700) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iFIAl-0000Mj-Fj for qemu-devel@nongnu.org; Tue, 01 Oct 2019 09:26:35 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B5CA320FD; Tue, 1 Oct 2019 13:26:34 +0000 (UTC) Received: from localhost (ovpn-112-22.ams2.redhat.com [10.36.112.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 664B560619; Tue, 1 Oct 2019 13:26:30 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH 2/3] tests: skip serial test on windows Date: Tue, 1 Oct 2019 17:26:08 +0400 Message-Id: <20191001132609.23184-3-marcandre.lureau@redhat.com> In-Reply-To: <20191001132609.23184-1-marcandre.lureau@redhat.com> References: <20191001132609.23184-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.71]); Tue, 01 Oct 2019 13:26:34 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, berrange@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , sw@weilnetz.de Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Serial test is currently hard-coded to /dev/null. On Windows, serial chardev expect a COM: device, which may not be availble. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tests/test-char.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test-char.c b/tests/test-char.c index d62de1b088..45e42af290 100644 --- a/tests/test-char.c +++ b/tests/test-char.c @@ -1103,7 +1103,7 @@ static void char_socket_server_two_clients_test(gcons= tpointer opaque) } =20 =20 -#ifdef HAVE_CHARDEV_SERIAL +#if defined(HAVE_CHARDEV_SERIAL) && !defined(WIN32) static void char_serial_test(void) { QemuOpts *opts; @@ -1460,7 +1460,7 @@ int main(int argc, char **argv) #endif =20 g_test_add_func("/char/udp", char_udp_test); -#ifdef HAVE_CHARDEV_SERIAL +#if defined(HAVE_CHARDEV_SERIAL) && !defined(WIN32) g_test_add_func("/char/serial", char_serial_test); #endif g_test_add_func("/char/hotswap", char_hotswap_test); --=20 2.23.0 From nobody Sat May 4 13:59:06 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 ARC-Seal: i=1; a=rsa-sha256; t=1569936679; cv=none; d=zoho.com; s=zohoarc; b=mSyNE6LBNTGi8q3gS/UH/UiGs5f09aRZ1AXMI/YBKOw80yOTorWbzmktwU3y/mG+LmxULiE4+zDTOxJxIQu6DAmDp/6EB9DmiD0EGK3CL8saykxk16P3Y8UG8ONMMbZRvQjNs57eTplhQ261pYKKDfV/yREQKdEQ5sg5PPuRFLo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569936679; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Di20N4WiiQuN41mTOrqPklFmpfUdXoQiZPcRPdzsRMg=; b=AOLr2ipwerydjh/Ry7H9ZZGzpq4BYeMKL1nIhwmE1pa9EWw6Ro4Upe1oiAo/f84B64ZTmZ5ZIpDo54565FGIRxhmiuQH+o6DpE0vehIOMAflCv/Xj5NFEFhJ7ftET5EP9c3wgsmXsX797wtm14uRppD8C2mXNR3H1L/017M9c4E= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569936679135503.64378498830695; Tue, 1 Oct 2019 06:31:19 -0700 (PDT) Received: from localhost ([::1]:42176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFIFF-0003cY-3e for importer@patchew.org; Tue, 01 Oct 2019 09:31:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56456) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFIAy-0000Nd-J2 for qemu-devel@nongnu.org; Tue, 01 Oct 2019 09:26:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iFIAx-0000ZA-G7 for qemu-devel@nongnu.org; Tue, 01 Oct 2019 09:26:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50650) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iFIAx-0000YR-4L for qemu-devel@nongnu.org; Tue, 01 Oct 2019 09:26:47 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 60CCE30715F9; Tue, 1 Oct 2019 13:26:46 +0000 (UTC) Received: from localhost (ovpn-112-22.ams2.redhat.com [10.36.112.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 01FFE60BDF; Tue, 1 Oct 2019 13:26:38 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Subject: [PATCH 3/3] win32: fix main-loop busy loop on socket/fd event Date: Tue, 1 Oct 2019 17:26:09 +0400 Message-Id: <20191001132609.23184-4-marcandre.lureau@redhat.com> In-Reply-To: <20191001132609.23184-1-marcandre.lureau@redhat.com> References: <20191001132609.23184-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 01 Oct 2019 13:26:46 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, James Le Cuirot , berrange@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , sw@weilnetz.de Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Commit 05e514b1d4d5bd4209e2c8bbc76ff05c85a235f3 introduced an AIO context optimization to avoid calling event_notifier_test_and_clear() on ctx->notifier. On Windows, the same notifier is being used to wakeup the wait on socket events (see commit d3385eb448e38f828c78f8f68ec5d79c66a58b5d). The ctx->notifier event is added to the gpoll sources in aio_set_event_notifier(), aio_ctx_check() should clear the event regardless of ctx->notified, since Windows sets the event by itself, bypassing the aio->notified. This fixes qemu not clearing the event resulting in a busy loop. Paolo suggested to me on irc to call event_notifier_test_and_clear() after select() >0 from aio-win32.c's aio_prepare. Unfortunately, not all fds associated with ctx->notifiers are in AIO fd handlers set. (qemu_set_nonblock() in util/oslib-win32.c calls qemu_fd_register()). This is essentially a v2 of a patch that was sent earlier: https://lists.gnu.org/archive/html/qemu-devel/2017-01/msg00420.html that resurfaced when James investigated Spice performance issues on Windows: https://gitlab.freedesktop.org/spice/spice/issues/36 In order to test that patch, I simply tried running test-char on win32, and it hangs. Applying that patch solves it. QIO idle sources are not dispatched. I haven't investigated much further, I suspect source priorities and busy looping still come into play. This version keeps the "notified" field, so event_notifier_poll() should still work as expected. Cc: James Le Cuirot Signed-off-by: Marc-Andr=C3=A9 Lureau --- util/async.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/util/async.c b/util/async.c index 4e4c7af51e..ca83e32c7f 100644 --- a/util/async.c +++ b/util/async.c @@ -354,7 +354,11 @@ void aio_notify(AioContext *ctx) =20 void aio_notify_accept(AioContext *ctx) { - if (atomic_xchg(&ctx->notified, false)) { + if (atomic_xchg(&ctx->notified, false) +#ifdef WIN32 + || true +#endif + ) { event_notifier_test_and_clear(&ctx->notifier); } } --=20 2.23.0