From nobody Mon Feb 9 16:12:45 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; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1574097282; cv=none; d=zoho.com; s=zohoarc; b=lTIHSxT+MWYEJa1CqdiNDKtv8kIE13HQYsR4aN0xwfDwjWV3LLNN4pBJPZcw/BGjaHLTtYICySqShaiusLv8utSowgO+GFKhi2XLwbHk3uRjd58CUlieONekqpl0TFF3YCfAorwemY4COO2yNm4TBzI8eY8+sJpH7ON5SbYPDtY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574097282; 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; bh=qFIm/y2jvpzQZLg/el9Jd6neHjqThDf7IKSbZE9qqXI=; b=KfGNGyKh3TwX9Z8/q8lZ1ZewXvyXc0VRrz1sDd80Pmx1Cc3Gqu4FerVoJl6U4F65Kd5gkXO39tgTP8QMaNJjsMY175EcZ5j+ZCV98vn2cC63k7I6N7ioCw4bWlEyQKspYK4GNFntQv02sDLekKCr4uwWXypgr7bs0d+8ekaa7CA= 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; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1574097282127258.6019041842162; Mon, 18 Nov 2019 09:14:42 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iWkav-0006Cu-3I; Mon, 18 Nov 2019 17:13:45 +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 1iWkat-0006Bj-EL for xen-devel@lists.xenproject.org; Mon, 18 Nov 2019 17:13:43 +0000 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id b5ab0ba5-0a26-11ea-a2db-12813bfff9fa; Mon, 18 Nov 2019 17:13:17 +0000 (UTC) X-Inumbo-ID: b5ab0ba5-0a26-11ea-a2db-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1574097197; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Rew1fL2ZdPHuVA+KWJcp9mwcRFPGnMJ7PLoGwDkSx0g=; b=I4wW6oDVt4h7o84rAh7afF58uZC7rUTuWcBhGLgtpSkDbpJz4wkH5bPn bx587IdD/RIqNQpZhPVWGJsXHVAUcx72quhEqjpVkEGOR63Ayfp4Yyi9v g+SAdd13mE3Xufo97nqOG96YMjYrZiLfsymCRz8LQZ4FYkC15FOVuYYG6 Y=; Authentication-Results: esa5.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 (esa5.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=esa5.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa5.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=esa5.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 (esa5.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=esa5.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: MNQ4lAN1AbRHEc8R9Ao9LGhFcyU4pIiVtqkFu1z93HTfbKJM8pBZTgE2i2NtgCTxfk/LA8wq48 PIh5lNWfgju/1iT/o1qZatmd88UOE6NI3Q0yaMI1GPMvOTK3FJ5vG5vbRkNPbWmTMdwJZ9shov /YXDIQkxtCd0t2hUr5kANvkqHerf1St/LujNMJEspFmsxaTsu19Ba7VpDllywfj3PqMg0KD32c 6HeC6suwQ2Cr/1JcjFcSkp34xkaiG8XiXavH/myYA+He5iEP/6ve+aDB7EuKEccWnJcouOiOLH ty8= X-SBRS: 2.7 X-MesageID: 8833209 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.68,320,1569297600"; d="scan'208";a="8833209" From: Anthony PERARD To: Date: Mon, 18 Nov 2019 17:13:07 +0000 Message-ID: <20191118171309.1459302-7-anthony.perard@citrix.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191118171309.1459302-1-anthony.perard@citrix.com> References: <20191118171309.1459302-1-anthony.perard@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [XEN PATCH for-4.13 v3 6/7] libxl: Introduce libxl__ev_immediate 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) This new ev allows to arrange a non-reentrant callback to be called. This happen immediately after the current event is processed and after other ev_immediates that would have already been registered. Signed-off-by: Anthony PERARD --- Notes: v3: - new patch tools/libxl/libxl_event.c | 19 +++++++++++++++++++ tools/libxl/libxl_internal.h | 17 +++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/tools/libxl/libxl_event.c b/tools/libxl/libxl_event.c index 43155368de76..ceb775d8ca3f 100644 --- a/tools/libxl/libxl_event.c +++ b/tools/libxl/libxl_event.c @@ -914,6 +914,15 @@ int libxl__ev_devstate_wait(libxl__ao *ao, libxl__ev_d= evstate *ds, return rc; } =20 +/* + * immediate non-reentrant callback + */ + +void libxl__ev_immediate_register(libxl__egc *egc, libxl__ev_immediate *ei) +{ + LIBXL_TAILQ_INSERT_TAIL(&egc->ev_immediates, ei, entry); +} + /* * domain death/destruction */ @@ -1395,6 +1404,16 @@ static void egc_run_callbacks(libxl__egc *egc) EGC_GC; libxl_event *ev, *ev_tmp; libxl__aop_occurred *aop, *aop_tmp; + libxl__ev_immediate *ei, *ei_tmp; + + LIBXL_TAILQ_FOREACH_SAFE(ei, &egc->ev_immediates, entry, ei_tmp) { + LIBXL_TAILQ_REMOVE(&egc->ev_immediates, ei, entry); + CTX_LOCK; + /* This callback is internal to libxl and expects CTX to be + * locked. */ + ei->callback(egc, ei); + CTX_UNLOCK; + } =20 LIBXL_TAILQ_FOREACH_SAFE(ev, &egc->occurred_for_callback, link, ev_tmp= ) { LIBXL_TAILQ_REMOVE(&egc->occurred_for_callback, ev, link); diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index f95895eae17d..400752a7f8fe 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -200,6 +200,7 @@ typedef struct libxl__ev_slowlock libxl__ev_slowlock; typedef struct libxl__dm_resume_state libxl__dm_resume_state; typedef struct libxl__ao_device libxl__ao_device; typedef struct libxl__multidev libxl__multidev; +typedef struct libxl__ev_immediate libxl__ev_immediate; =20 typedef struct libxl__domain_create_state libxl__domain_create_state; typedef void libxl__domain_create_cb(struct libxl__egc *egc, @@ -363,6 +364,20 @@ struct libxl__ev_child { LIBXL_LIST_ENTRY(struct libxl__ev_child) entry; }; =20 +/* libxl__ev_immediate + * + * Allow to call a non-reentrant callback. + * + * `callback' will be called immediately as a new event. + */ +struct libxl__ev_immediate { + /* filled by user */ + void (*callback)(libxl__egc *, libxl__ev_immediate *); + /* private to libxl__ev_immediate */ + LIBXL_TAILQ_ENTRY(libxl__ev_immediate) entry; +}; +void libxl__ev_immediate_register(libxl__egc *, libxl__ev_immediate *); + /* * Lock for device hotplug, qmp_lock. * @@ -733,6 +748,7 @@ struct libxl__egc { struct libxl__event_list occurred_for_callback; LIBXL_TAILQ_HEAD(, libxl__ao) aos_for_callback; LIBXL_TAILQ_HEAD(, libxl__aop_occurred) aops_for_callback; + LIBXL_TAILQ_HEAD(, libxl__ev_immediate) ev_immediates; }; =20 struct libxl__aop_occurred { @@ -2322,6 +2338,7 @@ _hidden libxl_device_model_version libxl__default_dev= ice_model(libxl__gc *gc); LIBXL_TAILQ_INIT(&(egc).occurred_for_callback); \ LIBXL_TAILQ_INIT(&(egc).aos_for_callback); \ LIBXL_TAILQ_INIT(&(egc).aops_for_callback); \ + LIBXL_TAILQ_INIT(&(egc).ev_immediates); \ } while(0) =20 _hidden void libxl__egc_cleanup(libxl__egc *egc); --=20 Anthony PERARD _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel