From patchwork Thu Aug 23 14:31:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 10574243 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8774513B6 for ; Thu, 23 Aug 2018 15:12:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 634B62C138 for ; Thu, 23 Aug 2018 15:12:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 613562C2E3; Thu, 23 Aug 2018 15:12:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B522F2C3B8 for ; Thu, 23 Aug 2018 15:12:00 +0000 (UTC) Received: from localhost ([::1]:37122 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsrHD-0001U4-Sr for patchwork-qemu-devel@patchwork.kernel.org; Thu, 23 Aug 2018 11:11:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39440) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsqeE-000128-Rn for qemu-devel@nongnu.org; Thu, 23 Aug 2018 10:31:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsqeB-00045a-G0 for qemu-devel@nongnu.org; Thu, 23 Aug 2018 10:31:42 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:51586 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fsqeB-00041j-AP for qemu-devel@nongnu.org; Thu, 23 Aug 2018 10:31:39 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 12AE04023827 for ; Thu, 23 Aug 2018 14:31:33 +0000 (UTC) Received: from localhost (ovpn-112-25.ams2.redhat.com [10.36.112.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4CD011C73B; Thu, 23 Aug 2018 14:31:27 +0000 (UTC) From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= To: qemu-devel@nongnu.org Date: Thu, 23 Aug 2018 16:31:20 +0200 Message-Id: <20180823143125.16767-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 23 Aug 2018 14:31:33 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 23 Aug 2018 14:31:33 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'marcandre.lureau@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v2 0/5] Fix socket chardev regression 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: Paolo Bonzini , peterx@redhat.com, =?utf-8?q?Marc-A?= =?utf-8?q?ndr=C3=A9_Lureau?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Hi, In commit 25679e5d58e "chardev: tcp: postpone async connection setup" (and its follow up 99f2f54174a59), Peter moved chardev socket connection to machine_done event. However, chardev created later will no longer attempt to connect, and chardev created in tests do not have machine_done event (breaking some of vhost-user-test). The goal was to move the "connect" source to the chardev frontend context (the monitor thread context in his case). chr->gcontext is set with qemu_chr_fe_set_handlers(). But there is no guarantee that the function will be called in general, so we can't delay connection until then: the chardev should still attempt to connect during open(), using the main context. An alternative would be to specify the iothread during chardev creation. Setting up monitor OOB would be quite different too, it would take the same iothread as argument. 99f2f54174a595e is also a bit problematic, since it will behave differently before and after machine_done (the first case gives a chance to use a different context reliably, the second looks racy) In the end, I am not sure this is all necessary, as chardev callbacks are called after qemu_chr_fe_set_handlers(), at which point the context of sources are updated. In "char-socket: update all ioc handlers when changing context", I moved also the hup handler to the updated context. So unless the main thread is already stuck, we can setup a different context for the chardev at that time. Or not? v2: - fix a random socket chardev test failure Marc-André Lureau (5): Revert "chardev: tcp: postpone TLS work until machine done" Revert "chardev: tcp: postpone async connection setup" char-socket: update all ioc handlers when changing context test-char: fix random socket test failure test-char: add socket reconnect test chardev/char-socket.c | 86 ++++++++++++++++++------------------------- tests/test-char.c | 25 +++++++++++-- 2 files changed, 57 insertions(+), 54 deletions(-)