From patchwork Mon Jan 13 17:08:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Jackson X-Patchwork-Id: 11330625 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 548F814B4 for ; Mon, 13 Jan 2020 17:10:01 +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 2E71D2084D for ; Mon, 13 Jan 2020 17:10:01 +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="g+m0TFJp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2E71D2084D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=eu.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 1ir3Cx-0008E0-3F; Mon, 13 Jan 2020 17:08:55 +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 1ir3Cw-0008Dv-0U for xen-devel@lists.xenproject.org; Mon, 13 Jan 2020 17:08:54 +0000 X-Inumbo-ID: 5cb7a0bb-3627-11ea-82b0-12813bfff9fa Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 5cb7a0bb-3627-11ea-82b0-12813bfff9fa; Mon, 13 Jan 2020 17:08:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1578935329; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=nz0uEznrsUjKsRIHJXu4bZ82O1eb9Hd8Ns9bcPj8spQ=; b=g+m0TFJpEZs4cYrzcywBItRGsR9YCxnLM3a/G05i+3xyiDzes8XTGptO JRb4ZC3RTQwQCYs/ZdZ3EDGGFTmCqKELoJ/y4M4sW5SpmVa5SQksm17wG SwPOqh8X72u+nI3q7eBhirAVOPS9diUkByP7LB6YQRzEqhpTzklK7dTCa A=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=ian.jackson@eu.citrix.com; spf=Pass smtp.mailfrom=Ian.Jackson@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of ian.jackson@eu.citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="ian.jackson@eu.citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.hc3370-68.iphmx.com: domain of Ian.Jackson@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="Ian.Jackson@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 (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: wQhkiBW0GpXCP44SpTvUjTYdSRn0X6dlStCZFJ5kmqrWQ5qxjzkG+Sr7CTFtP0fYGkWZXDDGTn +o+mPqt9RbxYjgZhog6mLCIb3U1TH+q2I+625uVt5DZSZTq90iWXn9CFIKzDezHEeXtJqpPMT9 Yr80no8QH17nzN2FUgeqFMvPtAIVvhPRxa+WeQDs+OvB3TKSPvpScOzJ4WnYsQ9Pe10Cwa+Lyw Sp/NCU66AwcK06UKQxaJ6eNjcoLNqoAMq5tTBctttw9b8XxSM5g1k+nvJpOXYIYkYytEo5pbKB tZI= X-SBRS: 2.7 X-MesageID: 11009471 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,429,1571716800"; d="scan'208";a="11009471" From: Ian Jackson To: Date: Mon, 13 Jan 2020 17:08:38 +0000 Message-ID: <20200113170843.21332-6-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200113170843.21332-1-ian.jackson@eu.citrix.com> References: <20200113170843.21332-1-ian.jackson@eu.citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2 05/10] libxl: event: Make libxl__poller_wakeup take a gc, not an egc 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: Ian Jackson , George Dunlap Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" We are going to want to call this in the following situation: * We have just set up an ao, which is to call back - so a non-synchronous one. It ought not to call the application back right away, so no egc. * There is a libxl thread blocking somewhere but it is using using an out of date fd or timeout set, which does not take into account the ao we have just started. * We try to wake that thread up, but libxl__poller_wakeup fails. Signed-off-by: Ian Jackson Reviewed-by: George Dunlap --- v2: New patch --- tools/libxl/libxl_event.c | 7 +++---- tools/libxl/libxl_internal.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/libxl/libxl_event.c b/tools/libxl/libxl_event.c index 16e6786889..268a5da120 100644 --- a/tools/libxl/libxl_event.c +++ b/tools/libxl/libxl_event.c @@ -1477,7 +1477,7 @@ void libxl__event_occurred(libxl__egc *egc, libxl_event *event) libxl__poller *poller; LIBXL_TAILQ_INSERT_TAIL(&CTX->occurred, event, link); LIBXL_LIST_FOREACH(poller, &CTX->pollers_event, entry) - libxl__poller_wakeup(egc, poller); + libxl__poller_wakeup(gc, poller); } } @@ -1668,9 +1668,8 @@ void libxl__poller_put(libxl_ctx *ctx, libxl__poller *p) LIBXL_LIST_INSERT_HEAD(&ctx->pollers_idle, p, entry); } -void libxl__poller_wakeup(libxl__egc *egc, libxl__poller *p) +void libxl__poller_wakeup(libxl__gc *gc, libxl__poller *p) { - EGC_GC; int e = libxl__self_pipe_wakeup(p->wakeup_pipe[1]); if (e) LIBXL__EVENT_DISASTER(gc, "cannot poke watch pipe", e, 0); } @@ -1924,7 +1923,7 @@ void libxl__ao_complete_check_progress_reports(libxl__egc *egc, libxl__ao *ao) assert(ao->in_initiator); if (!ao->constructing) /* don't bother with this if we're not in the event loop */ - libxl__poller_wakeup(egc, ao->poller); + libxl__poller_wakeup(gc, ao->poller); } else if (ao->how.callback) { LOG(DEBUG, "ao %p: complete for callback", ao); LIBXL_TAILQ_INSERT_TAIL(&egc->aos_for_callback, ao, entry_for_callback); diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 328ecf3e1e..b68ab218b6 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1311,7 +1311,7 @@ _hidden void libxl__poller_put(libxl_ctx*, libxl__poller *p /* may be NULL */); /* Notifies whoever is polling using p that they should wake up. * ctx must be locked. */ -_hidden void libxl__poller_wakeup(libxl__egc *egc, libxl__poller *p); +_hidden void libxl__poller_wakeup(libxl__gc *egc, libxl__poller *p); /* Internal to fork and child reaping machinery */ extern const libxl_childproc_hooks libxl__childproc_default_hooks;