From nobody Mon Feb 9 18:18:12 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=1560508766; cv=none; d=zoho.com; s=zohoarc; b=Scyb/+kC2v7ajsE0MWRuom+jTR46ljA35SnpUPYYAmz/nEEubil8RfLUvRcqiqwM6p7TtOyztUfoIDZBj0ajeZ5UVeZF1s5Ktygj7BDs4iMcMjEdUfdbKpvHtQWeNM3qINqI+jhAbOM0T6TlCd/Xw1IF0/ZOXUZCuQYXtCE42fc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560508766; 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=yOT0xETUtHfhkcbc4niSgtAfXftY8U4eS1Y5EFRJjaI=; b=dwnhVw7cRqgEc4cR2bnOX3pLjE+l7Vmh/j7bplF6OFjm0mCL3+U+Mepnhvvm3L0xaa+XttkmCktGm0hC8U64PjoNLcLBKoBJt1tzZOBcri1cGRi1qaKw3adg128D1+HGGe3zol1FgQxhD5E5mjdGFbnqXsx4gOGeYT/3QVZZ5Lc= ARC-Authentication-Results: i=1; mx.zoho.com; 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 1560508766087176.42823881512095; Fri, 14 Jun 2019 03:39:26 -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 1hbjax-0002jJ-P8; Fri, 14 Jun 2019 10:38:07 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hbjaw-0002j5-LO for xen-devel@lists.xenproject.org; Fri, 14 Jun 2019 10:38:06 +0000 Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 7dff395f-8e90-11e9-8980-bc764e045a96; Fri, 14 Jun 2019 10:38:05 +0000 (UTC) X-Inumbo-ID: 7dff395f-8e90-11e9-8980-bc764e045a96 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: 5gtorxkl8LYECn1Ov2NnvxxUI8ASWkI7WAs/qOhio6tJEYHT287iy7rhRr/LWIwaUSoDZQwvg9 Fns3B8LV8jbDApbXU8AkVaJtgLR03jS5LmfNWWUzBNDRQJxcX6fzxEetDYQFbrcH4Rso1eqwDC wY+HDaNXSbZF+9BI7d3rX4D3+4YuuJ0ZVt27kow9WbBK8Am/wmRDCAcwsN8Y9Lm8CcYKpbgmLx 87axoCjgxSWc8SIY3AlIE8H+dIDOmJiNov2SPDUudckY4zLbMStFeNH4zEJ0dKbSBxfaMFCDhc kUQ= X-SBRS: 2.7 X-MesageID: 1736049 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.63,373,1557201600"; d="scan'208";a="1736049" From: Anthony PERARD To: Date: Fri, 14 Jun 2019 11:37:59 +0100 Message-ID: <20190614103801.22619-8-anthony.perard@citrix.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190614103801.22619-1-anthony.perard@citrix.com> References: <20190614103801.22619-1-anthony.perard@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2 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" 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 5f13a622f9..7328a03e8a 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_lock qmp_lock; int dm_ver; + libxl__ev_time time; } libxl__cdrom_insert_state; =20 static void cdrom_insert_lock_acquired(libxl__egc *, libxl__ev_lock *, @@ -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_lock_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_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