From patchwork Fri Oct 25 17:05:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 11212725 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7EF6613BD for ; Fri, 25 Oct 2019 17:06:31 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5A7EB2084C for ; Fri, 25 Oct 2019 17:06:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="a3COAQpE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5A7EB2084C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iO31c-0000IG-Af; Fri, 25 Oct 2019 17:05:20 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iO31a-0000H4-BP for xen-devel@lists.xenproject.org; Fri, 25 Oct 2019 17:05:18 +0000 X-Inumbo-ID: 9bd2a9b6-f749-11e9-94ca-12813bfff9fa Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 9bd2a9b6-f749-11e9-94ca-12813bfff9fa; Fri, 25 Oct 2019 17:05:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1572023113; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=4prpr1vdO3/rdacU8WvgCbL7QJ8W2tBd9fxhR0L2XDY=; b=a3COAQpEcula7SSbi4CMwmpnYsNiSkj+3rDakJazi69ysCgEWQiccDuZ cjiJb7oMgeDM5GJscQ1bdbzQLPz+jBo0FF6l48+V3pG3Kwi8udKmjQfXD 6N12R39ZMwXcJIURF+E6DauJDiAc2UUaPaJJI4kjn2IYmPFG0uI7393ri E=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=anthony.perard@citrix.com; spf=Pass smtp.mailfrom=anthony.perard@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of anthony.perard@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.hc3370-68.iphmx.com: domain of anthony.perard@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: AwGxBRauepDPLSO6KYPRrw7s1f5YDHqs/tYAktT9+uQstI/dgJLL7WU0+3gyc2zPxoDkHk+vzT zjDXG0zPHXSAONS2k79JINOfFVRtKFT8RYNjAyllDken9UnEPxKYHwnagZ/VZ2m6jqHdG3A0/q 1MEBhVIycFuuenJ1OoDVLulnwHdspZyii2VmNfruEFqU3KA+vaoCR8ZtPPnyKCg3lpw3PJnund qyWN1v9ntKazuA0mNgqWScmOYb5uepm08//jhSvR7P/1hf01Llw+BIQlnY2FTKxn1HZqpWcWV5 mPI= X-SBRS: 2.7 X-MesageID: 7801966 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.68,229,1569297600"; d="scan'208";a="7801966" From: Anthony PERARD To: Date: Fri, 25 Oct 2019 18:05:01 +0100 Message-ID: <20191025170505.2834957-1-anthony.perard@citrix.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Subject: [Xen-devel] [RFC XEN PATCH for-4.13 0/4] Fix: libxl workaround, multiple connection to single QMP socket X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony PERARD , Ian Jackson , Wei Liu Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Patch series available in this git branch: https://xenbits.xen.org/git-http/people/aperard/xen-unstable.git br.fix-ev_qmp-multi-connect-v1 Hi, QEMU's QMP socket doesn't allow multiple concurrent connection. Also, it listen() on the socket with a `backlog' of only 1. On Linux at least, once that backlog is filled connect() will return EAGAIN if the socket fd is non-blocking. libxl may attempt many concurrent connect() attempt if for example a guest is started with several PCI passthrough devices, and a connect() failure lead to a failure to start the guest. Since we can't change the listen()'s `backlog' that QEMU use, we need other ways to workaround the issue. This patch series introduce a lock to acquire before attempting to connect() to the QMP socket. Since the lock might be held for to long, the series also introduce a way to cancel the acquisition of the lock, this means killing the process that tries to get the lock. Alternatively to this craziness, it might be possible to increase the `backlog' value by having libxl opening the QMP socket on behalf of QEMU. But this is only possible with a recent version of QEMU (2.12 or newer, released in Apr 2018, or qemu-xen-4.12 or newer). It would involve to discover QEMU's capability before we start the DM, which libxl isn't capable yet. Cheers, Anthony PERARD (4): libxl: Introduce libxl__ev_child_kill libxl: Introduce libxl__ev_qmplock libxl: libxl__ev_qmp_send now takes an egc libxl_qmp: Have a lock for QMP socket access tools/libxl/libxl_disk.c | 6 +-- tools/libxl/libxl_dm.c | 8 ++-- tools/libxl/libxl_dom_save.c | 2 +- tools/libxl/libxl_dom_suspend.c | 2 +- tools/libxl/libxl_domain.c | 8 ++-- tools/libxl/libxl_event.c | 3 +- tools/libxl/libxl_fork.c | 55 ++++++++++++++++++++++++ tools/libxl/libxl_internal.c | 31 +++++++++++++- tools/libxl/libxl_internal.h | 53 +++++++++++++++++------ tools/libxl/libxl_pci.c | 8 ++-- tools/libxl/libxl_qmp.c | 75 +++++++++++++++++++++++++-------- tools/libxl/libxl_usb.c | 28 ++++++------ 12 files changed, 219 insertions(+), 60 deletions(-)