From patchwork Wed Oct 30 18:06:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 11219897 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 8C4BE1390 for ; Wed, 30 Oct 2019 18:08:24 +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 672C82087E for ; Wed, 30 Oct 2019 18:08:24 +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="J6HKRJAn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 672C82087E 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 1iPsNB-0003SB-L8; Wed, 30 Oct 2019 18:07:09 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iPsN9-0003S1-UI for xen-devel@lists.xenproject.org; Wed, 30 Oct 2019 18:07:07 +0000 X-Inumbo-ID: 1543ecfc-fb40-11e9-beca-bc764e2007e4 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 1543ecfc-fb40-11e9-beca-bc764e2007e4; Wed, 30 Oct 2019 18:07:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1572458826; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=N07H2kf7HSsjLSG1K+6RK9CpIu5/XYoeTgQRDCHj4As=; b=J6HKRJAnFok7F1AmC+REJsB9MF3HI9zDKCond5LGdyCklOfNk0IFua5x zIGHzhPEBmu8zMf9lqChj7/iw+NtNf4GF/Ty/e0AnBgpg9GofSPzP4SDk f0vKTQvvioZ43ka371riqGnN+8UYbQ6nT4rL7U9HED1dzoNjXVc0D4/OO 8=; Authentication-Results: esa4.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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.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=esa4.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 (esa4.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=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: BKFVP8IklADFpELRwXIjyobjsXFG6sX66kC4Gxt1irSpUQ2OUEdCX5Xe+lBdku8RCdNiiF314N PafnUS1rjKkzPJRiplqnkiN55alfCFu7a7ITGoPO1m6hyFGScFsIq3H3uWflU75MmDX2TPXKIK hbEjqofoQGG3+rVj/FDxf++AKDzsiQP/gZhaRO/pjw/iqgyFQOzSlPREbJ9L5NrY6BUZ7yOv8O qsVRe+u5KsOMabDSg4nr026npX7D220J5Y0l2fFcqrwW5H7drE8pAnbD6951gL2LrHfdHXd1EQ O/M= X-SBRS: 2.7 X-MesageID: 8109820 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.68,248,1569297600"; d="scan'208";a="8109820" From: Anthony PERARD To: Date: Wed, 30 Oct 2019 18:06:58 +0000 Message-ID: <20191030180704.261320-1-anthony.perard@citrix.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Subject: [Xen-devel] [XEN PATCH for-4.13 v2 0/6] 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 , =?utf-8?b?SsO8cmdlbiBHcm8=?= =?utf-8?b?w58=?= , 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-v2 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. See thread[1] for discussed alternative. [1] https://lists.xenproject.org/archives/html/xen-devel/2019-10/msg01815.html Cheers, Anthony PERARD (6): libxl: Introduce libxl__ev_child_kill_deregister libxl: Move libxl__ev_devlock declaration libxl: Rename ev_devlock to ev_slowlock libxl: Introduce libxl__ev_slowlock_dispose libxl: libxl__ev_qmp_send now takes an egc libxl_qmp: Have a lock for QMP socket access tools/libxl/libxl_disk.c | 16 ++-- 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 | 18 ++--- tools/libxl/libxl_event.c | 6 +- tools/libxl/libxl_fork.c | 48 ++++++++++++ tools/libxl/libxl_internal.c | 41 +++++++--- tools/libxl/libxl_internal.h | 130 +++++++++++++++++++------------- tools/libxl/libxl_pci.c | 8 +- tools/libxl/libxl_qmp.c | 119 ++++++++++++++++++++++++----- tools/libxl/libxl_usb.c | 28 ++++--- 12 files changed, 301 insertions(+), 125 deletions(-)