From nobody Mon Feb 9 11:33:23 2026 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=1568891155; cv=none; d=zoho.com; s=zohoarc; b=SJz9xQJ/K/E2RGW6U2On4CZLzF0zMfdKAwSh+fpPs/wvyRC6xsfdJtE8elFnhVf8+vYuuYv8/Rc6sWD+EHbj76559N+09iltoAF4vSt7g0kHsUmy6QYPgLoEKY2vGAbxWKcL9M9KbmWgBPQM9AqwHeiDauI07+EMT+F3hxgUD3Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568891155; 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=6c5B5P7gnd+Giwmmh/r78bdxWYs5zr82vgWgjinC948=; b=E/8BkSyfX60+MksWhhgt3DRFKnXCUVNyVzBiT/Vz6E1rWz5Wpr0VmGNrxCZ/+prVVrPvqQamC8zQkrOTcike9kbEOIb1ySPZ0Hp597C5JLyjUlWFBZHTmxbFuK+hORDJxPev4rTtMd1dptZJbQA+JzRGPdGlbHUt3WeekY7ga38= 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 1568891155464536.4010943077487; Thu, 19 Sep 2019 04:05:55 -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 1iAuEy-00036Z-W0; Thu, 19 Sep 2019 11:04:48 +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 1iAuEx-000363-Qa for xen-devel@lists.xenproject.org; Thu, 19 Sep 2019 11:04:47 +0000 Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 4a8b99e8-dacd-11e9-9656-12813bfff9fa; Thu, 19 Sep 2019 11:04:47 +0000 (UTC) X-Inumbo-ID: 4a8b99e8-dacd-11e9-9656-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1568891087; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mfUZwIzuuuh/8WmQvMze2vYPiSlJtD/slSslvGjSweM=; b=SMBHNn37t/rpggUBx8K7wbHIpXIKNIeNoIS60YUqqvbY69M1vqierRAV TjXqdPdSGIVIXrwLZzCNmAK8y00tqaOTnRqYNqNm8HZdok95kPMLhjzOz ATD47zWkY8O0hrRDrp5DDyaODLP5GTi8J4c5qx0zfNLPZbECnJp4hC++Q U=; Authentication-Results: esa2.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 (esa2.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=esa2.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa2.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=esa2.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 (esa2.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=esa2.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: oZGbtYrxfOMH/DQrRI8r+nhGdBJo4BpUFeg83EMa7GMgJR9EmtOk1l7AZg0Wl3RmMsAWBtaLFj weWuPRLcmmtPIKUL2YSJX9MQMfwP5HSOPuDw72x/PYt8/XwwYh1eHKslpMUf8femkFE5jrjqye Prtj975t0iyXe4JFWl9xjIfeJdNLYsOmvjOnX+pOIxMTfGmiLzqrDwZ0OZSGiCEUn7nBzLS2k5 C9ZRazGRetfolDsW4pg52zQ/03cjDKvXc64E93BEj5qm2y7ZHT7qqUD+fIw/Wm/0IPllcO7dVP IyU= X-SBRS: 2.7 X-MesageID: 5777957 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,523,1559534400"; d="scan'208";a="5777957" From: Anthony PERARD To: Date: Thu, 19 Sep 2019 12:04:41 +0100 Message-ID: <20190919110443.817594-8-anthony.perard@citrix.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919110443.817594-1-anthony.perard@citrix.com> References: <20190919110443.817594-1-anthony.perard@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v3 7/9] libxl_disk: Implement missing timeout for libxl_cdrom_insert 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) After the patch "libxl_disk: Use ev_qmp in libxl_cdrom_insert" there will not be any kind of timeout, add one back. Signed-off-by: Anthony PERARD Acked-by: Ian Jackson --- Notes: Ian, in this patch, the timeout is setup after we have aquired the lock. Should we change that to also have a timeout waiting for the lock to be released? =20 v2: - patch move earlier in the series to keep bisectability. tools/libxl/libxl_disk.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tools/libxl/libxl_disk.c b/tools/libxl/libxl_disk.c index 98023f169ce6..5cc215906fcc 100644 --- a/tools/libxl/libxl_disk.c +++ b/tools/libxl/libxl_disk.c @@ -649,6 +649,7 @@ typedef struct { libxl_device_disk disk_saved; libxl__ev_devlock qmp_lock; int dm_ver; + libxl__ev_time time; } libxl__cdrom_insert_state; =20 static void cdrom_insert_lock_acquired(libxl__egc *, libxl__ev_devlock *, @@ -657,6 +658,9 @@ static void cdrom_insert_ejected(libxl__egc *egc, libxl__cdrom_insert_state *cis); static void cdrom_insert_inserted(libxl__egc *egc, libxl__cdrom_insert_state *cis); +static void cdrom_insert_timout(libxl__egc *egc, libxl__ev_time *ev, + const struct timeval *requested_abs, + int rc); static void cdrom_insert_done(libxl__egc *egc, libxl__cdrom_insert_state *cis, int rc); @@ -679,6 +683,7 @@ int libxl_cdrom_insert(libxl_ctx *ctx, uint32_t domid, = libxl_device_disk *disk, libxl__ev_devlock_init(&cis->qmp_lock); cis->qmp_lock.ao =3D ao; cis->qmp_lock.domid =3D domid; + libxl__ev_time_init(&cis->time); =20 libxl_domain_type type =3D libxl__domain_type(gc, domid); if (type =3D=3D LIBXL_DOMAIN_TYPE_INVALID) { @@ -747,6 +752,11 @@ static void cdrom_insert_lock_acquired(libxl__egc *egc, =20 if (rc) goto out; =20 + rc =3D libxl__ev_time_register_rel(ao, &cis->time, + cdrom_insert_timout, + LIBXL_HOTPLUG_TIMEOUT * 1000); + if (rc) goto out; + /* We need to eject the original image first. This is implemented * by inserting empty media. JSON is not updated. */ @@ -950,12 +960,23 @@ static void cdrom_insert_inserted(libxl__egc *egc, cdrom_insert_done(egc, cis, rc); /* must be last */ } =20 +static void cdrom_insert_timout(libxl__egc *egc, libxl__ev_time *ev, + const struct timeval *requested_abs, + int rc) +{ + EGC_GC; + libxl__cdrom_insert_state *cis =3D CONTAINER_OF(ev, *cis, time); + LOGD(ERROR, cis->domid, "cdrom insertion timed out"); + cdrom_insert_done(egc, cis, rc); +} + static void cdrom_insert_done(libxl__egc *egc, libxl__cdrom_insert_state *cis, int rc) { EGC_GC; =20 + libxl__ev_time_deregister(gc, &cis->time); libxl__ev_devlock_unlock(gc, &cis->qmp_lock); libxl_device_disk_dispose(&cis->disk_saved); libxl__ao_complete(egc, cis->ao, rc); --=20 Anthony PERARD _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel