From nobody Mon May 20 06:12:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1569864277; cv=none; d=zoho.com; s=zohoarc; b=i8aKZQuhMReNRfIycPQanew8z99FSdmb05GjLHkKWyPFH7DrHEYYiLg6gUB58vc+NMzVqjW12YjwBbTOM2HiL/J6icmsi+4vYjIZ8Jh8pK4/yP4Oeu4Gw5Y6AU8OEFItPI7FThbjXGHt95L0PQr//bDhKfDgNgWwZWnA3+pr1J0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569864277; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=u2CX79LPOtRdWhqMHof/H+pTfxmxenKcok4kNUhQSr8=; b=kw9f3kJQooYMD/g7aZzklEtgtjUwnPNop3mi4QaAqtbRio/TVY0bfTh4yxFc4W0Yzq37Jz20OgZNvt1shw0gcYWKy4/ghz1iN/pfHdlLALu+ZeC2e/DDkm56v9oItyl8oa13DoFuLRI+dXj+/y5XbPLlBynBJES1JB0w/h+gAIk= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1569864277701904.094998450233; Mon, 30 Sep 2019 10:24:37 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iEzOc-0003Yf-Gt; Mon, 30 Sep 2019 17:23:38 +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 1iEzOa-0003Y0-Jz for xen-devel@lists.xenproject.org; Mon, 30 Sep 2019 17:23:36 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by localhost (Halon) with ESMTPS id 057e4e31-e3a7-11e9-96dc-12813bfff9fa; Mon, 30 Sep 2019 17:23:31 +0000 (UTC) X-Inumbo-ID: 057e4e31-e3a7-11e9-96dc-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1569864211; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zLHf0N5g07gf3v+LADDfsr271XMgxzViM0IfNRfvjDs=; b=ErJDP6vBnzKYDuUY/CpX5Whzc0Dxqv42pVgWJ76l20+sUbBwbYGKqyOo 3TJDeNDGDCy0NFAZ6D4LF48L3tCYv4qP4EvUXrBq3ujZ4m0joEsDnKBSX APd6OBR480PXwonjWTrtl4uJjyDdcim83hLh59amceNMoIJtdQVvNmLo7 U=; 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 (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; 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 ~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: UjmQutIHUIjmQwW5w9CRnxjoLpeU63CPlvP4O++07Rup9hE8ufxnympU/oKGiBpIbh6d+/HNpD xC9OAic37pRmnBetXqKm5yOPYNAbCDTeSyFV2NDo4Bn6jKhLmHljU1BRe0yUy7FOXg0QVl5i/g yUncOB+4K33QwXrIIxfBtBmHNCMEs4ZAeNS28xIQB1VCNYjCxzSRke/z0bslsXWVqdB3VtlfMh y3+13SXEBPeQYLoQtcbfumIH3WizcJRhyNzDOKfR+ZVFbkGyDxyXTjrtfnGA8IFhZUwEULk34L gEY= X-SBRS: 2.7 X-MesageID: 6617645 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.64,568,1559534400"; d="scan'208";a="6617645" From: Anthony PERARD To: Date: Mon, 30 Sep 2019 18:23:26 +0100 Message-ID: <20190930172327.784520-2-anthony.perard@citrix.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190930172327.784520-1-anthony.perard@citrix.com> References: <20190930172327.784520-1-anthony.perard@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 1/2] libxl_pci: Don't ignore PCI PT error at guest creation 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Fixes: 11db56f9a6291 Signed-off-by: Anthony PERARD --- tools/libxl/libxl_pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c index 47258177bc71..3b31cfd417be 100644 --- a/tools/libxl/libxl_pci.c +++ b/tools/libxl/libxl_pci.c @@ -1694,6 +1694,8 @@ static void add_pcidevs_done(libxl__egc *egc, libxl__= multidev *multidev, libxl_domid domid =3D apds->domid; libxl__ao_device *aodev =3D apds->outer_aodev; =20 + if (rc) goto out; + if (d_config->num_pcidevs > 0) { rc =3D libxl__create_pci_backend(gc, domid, d_config->pcidevs, d_config->num_pcidevs); --=20 Anthony PERARD _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Mon May 20 06:12:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1569864279; cv=none; d=zoho.com; s=zohoarc; b=BxOz9c2lz39LD/msqx0Y7pwX9THZKGrPWG4Jg2AqnEn1aUx+KcUZoas98V6uCwLU6UMs8Fl1NcKX7te990KS8oO+PZ4HOp4bqrpVPujee2P3+At5XsyzlGBzej+gKtUnrWOXCpBI72IsmzVTS2j+9O3T3yBzUOeCKEb4mfhnDS8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569864279; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=UsqD3fY9gNyn3Gi+DofCOB0jhQ7H9Kbw0VtxXquQ2tY=; b=B01CN4TOk/LekIX1LOX43aOGfUXkA21cXJ/hqzY1xUGe3mc8tzaIWCMs2X92MxQJxaMeh6pRxtZ/XVwMrlnEDVxaSpwomu4tp7vm58FfiE9g7okbUyOS1Pk+E22/5wsEXsU+S9kmbGNC43/zLBy50KAOR5izaI/5R8tYsc6AXvg= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 156986427974060.66266073748989; Mon, 30 Sep 2019 10:24:39 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iEzOY-0003Xo-75; Mon, 30 Sep 2019 17:23:34 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iEzOW-0003Xd-Q8 for xen-devel@lists.xenproject.org; Mon, 30 Sep 2019 17:23:32 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by localhost (Halon) with ESMTPS id 0636ae44-e3a7-11e9-bf31-bc764e2007e4; Mon, 30 Sep 2019 17:23:32 +0000 (UTC) X-Inumbo-ID: 0636ae44-e3a7-11e9-bf31-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1569864211; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Xt9hht4e5fVZxPcxIxA92BvC2YoAjbfNAkRIVNiHM44=; b=WrenzRk4/OKExc4wviSiP2cXeqbgB/RKimn3tYWCpiKrcwWt14HTpN6L jlm/Gqozx2Libf53vQjCOkwbfZji2fWf7ADvYTfN9l62Y/hWhg7xoSHLT AzayLNFFPVTyEotIreF0YCaCFBE4diZrk3VjJ+LcWy2HTfWPZmzFIERd0 k=; 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 (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; 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 ~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: 8YMcYFT3B1oeQyYVgehzoN8Ft3FGR7RT57bo3Hmx6OahDvzhVHiXEiIe85KhbiMgI18xclfVRp CcoEa5wcaDcqni7H2m2UUcJ26E01jTZAP9EOfns5b5cYcvEvYUVVap2VGp3Nf4zi53MdssP7WM tt6HOH3Co5jxzkgcAxFTBs8spmyDLai1wKDe6Rjdu4/Qqk3yJfHRxQKJLyg+oQJVNGfO3us6aI 2HeI1eWUZmk72/aa0whXN2y2grxGd1XsmEFEJ14AaN+jhpFhl2/SjwE+F3MnbygE6/VAliE+Ga 8/s= X-SBRS: 2.7 X-MesageID: 6617646 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.64,568,1559534400"; d="scan'208";a="6617646" From: Anthony PERARD To: Date: Mon, 30 Sep 2019 18:23:27 +0100 Message-ID: <20190930172327.784520-3-anthony.perard@citrix.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190930172327.784520-1-anthony.perard@citrix.com> References: <20190930172327.784520-1-anthony.perard@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 2/2] libxl_pci: Fix guest shutdown with PCI PT attached 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 , Sander Eikelenboom , Ian Jackson , Wei Liu Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Before the problematic commit, libxl used to ignore error when destroying (force =3D=3D true) a passthrough device. If the DM failed to detach the pci device within the allowed time, the timed out error raised skip part of pci_remove_*, but also raise the error up to the caller of libxl__device_pci_destroy_all, libxl__destroy_domid, and thus the destruction of the domain fails. When a *pci_destroy* function is called (so we have force=3Dtrue), error should mostly be ignored. If the DM didn't confirmed that the device is removed, we will print a warning and keep going if force=3Dtrue. The patch reorder the functions so that pci_remove_timeout() calls pci_remove_detatched() like it's done when DM calls are successful. We also clean the QMP states and associated timeouts earlier, as soon as they are not needed anymore. Reported-by: Sander Eikelenboom Fixes: fae4880c45fe015e567afa223f78bf17a6d98e1b Signed-off-by: Anthony PERARD --- tools/libxl/libxl_pci.c | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c index 3b31cfd417be..cb849b241581 100644 --- a/tools/libxl/libxl_pci.c +++ b/tools/libxl/libxl_pci.c @@ -1778,12 +1778,12 @@ static void pci_remove_qmp_retry_timer_cb(libxl__eg= c *egc, libxl__ev_time *ev, const struct timeval *requested_abs, int rc); static void pci_remove_qmp_query_cb(libxl__egc *egc, libxl__ev_qmp *qmp, const libxl__json_object *response, int rc); +static void pci_remove_timeout(libxl__egc *egc, + libxl__ev_time *ev, const struct timeval *requested_abs, int rc); static void pci_remove_detatched(libxl__egc *egc, pci_remove_state *prs, int rc); static void pci_remove_stubdom_done(libxl__egc *egc, libxl__ao_device *aodev); -static void pci_remove_timeout(libxl__egc *egc, - libxl__ev_time *ev, const struct timeval *requested_abs, int rc); static void pci_remove_done(libxl__egc *egc, pci_remove_state *prs, int rc); =20 @@ -2044,6 +2044,25 @@ static void pci_remove_qmp_query_cb(libxl__egc *egc, pci_remove_detatched(egc, prs, rc); /* must be last */ } =20 +static void pci_remove_timeout(libxl__egc *egc, libxl__ev_time *ev, + const struct timeval *requested_abs, + int rc) +{ + EGC_GC; + pci_remove_state *prs =3D CONTAINER_OF(ev, *prs, timeout); + + /* Convenience aliases */ + libxl_device_pci *const pcidev =3D prs->pcidev; + + LOGD(WARN, prs->domid, "timed out waiting for DM to remove " + PCI_PT_QDEV_ID, pcidev->bus, pcidev->dev, pcidev->func); + + /* If we timed out, we might still want to keep destroying the device + * (when force=3D=3Dtrue), so let the next function decide what to do = on + * error */ + pci_remove_detatched(egc, prs, rc); +} + static void pci_remove_detatched(libxl__egc *egc, pci_remove_state *prs, int rc) @@ -2057,6 +2076,11 @@ static void pci_remove_detatched(libxl__egc *egc, libxl_device_pci *const pcidev =3D prs->pcidev; libxl_domid domid =3D prs->domid; =20 + /* Cleaning QMP states ASAP */ + libxl__ev_qmp_dispose(gc, &prs->qmp); + libxl__ev_time_deregister(gc, &prs->timeout); + libxl__ev_time_deregister(gc, &prs->retry_timer); + if (rc && !prs->force) goto out; =20 @@ -2104,15 +2128,6 @@ static void pci_remove_stubdom_done(libxl__egc *egc, pci_remove_done(egc, prs, 0); } =20 -static void pci_remove_timeout(libxl__egc *egc, libxl__ev_time *ev, - const struct timeval *requested_abs, - int rc) -{ - pci_remove_state *prs =3D CONTAINER_OF(ev, *prs, timeout); - - pci_remove_done(egc, prs, rc); -} - static void pci_remove_done(libxl__egc *egc, pci_remove_state *prs, int rc) @@ -2121,10 +2136,6 @@ static void pci_remove_done(libxl__egc *egc, =20 if (rc) goto out; =20 - libxl__ev_qmp_dispose(gc, &prs->qmp); - libxl__ev_time_deregister(gc, &prs->timeout); - libxl__ev_time_deregister(gc, &prs->retry_timer); - libxl__device_pci_remove_xenstore(gc, prs->domid, prs->pcidev); out: device_pci_remove_common_next(egc, prs, rc); --=20 Anthony PERARD _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel