From nobody Sun May 19 15:05:13 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1603262522; cv=none; d=zohomail.com; s=zohoarc; b=mumoS3xxFMQdtWYNi1yO1EuAQ8BTO3U4mTO5qriTsBBRd3gZU6rgqLjGfTAkyYW2XoJHeH6wfulM9VUWtkF/aJjreGP1WAtPzlveHFhVsuDnVFnosQVqPyQ2pmNBQzXMQsO5AOTK9Ngh8PHh4JTECdKgdwB8VcTdxYo1rp6nWkY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603262522; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=duVsg4xSRWqAzJZVFlncIcHV2odwn42SdRQkvtZBE40=; b=D5bZN43SXrX/MBqdVNajb4bFG7unX8YcT7hwoYs9KTmZuwAl21S41ucxnPotbt72ed2wk3gPJzUQWdK/eE2LyUbuUyS/aIu8EDOhtGhw8pptQHrTXQQBadn4K09kpXD7Q4D8OqXMW+n87l2hFuszB4d+kF0p7daN4gtzULF6Z7s= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1603262522039431.5814813664517; Tue, 20 Oct 2020 23:42:02 -0700 (PDT) Received: from localhost ([::1]:40522 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kV7ou-0003lT-DX for importer@patchew.org; Wed, 21 Oct 2020 02:42:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47294) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kV7np-0003KU-IN; Wed, 21 Oct 2020 02:40:53 -0400 Received: from mailout10.t-online.de ([194.25.134.21]:46790) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kV7nn-0001v0-Kq; Wed, 21 Oct 2020 02:40:53 -0400 Received: from fwd35.aul.t-online.de (fwd35.aul.t-online.de [172.20.27.145]) by mailout10.t-online.de (Postfix) with SMTP id 65923414DBB7; Wed, 21 Oct 2020 08:40:46 +0200 (CEST) Received: from linpower.localnet (XHw1aZZ6oh2gJB+91i7GCs4lxVJ7uxY8FMt0yJpnXP4ALUndL-a-8sdoCB3MTV2Z4m@[79.208.17.62]) by fwd35.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1kV7nW-1qc5rc0; Wed, 21 Oct 2020 08:40:34 +0200 Received: by linpower.localnet (Postfix, from userid 1000) id BA9622006DD; Wed, 21 Oct 2020 08:40:33 +0200 (CEST) From: =?UTF-8?q?Volker=20R=C3=BCmelin?= To: Kevin Wolf , Markus Armbruster , Stefan Hajnoczi , Fam Zheng , Stefan Weil Subject: [PATCH] qmp: fix aio_poll() assertion failure on Windows Date: Wed, 21 Oct 2020 08:40:33 +0200 Message-Id: <20201021064033.8600-1-vr_qemu@t-online.de> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ID: XHw1aZZ6oh2gJB+91i7GCs4lxVJ7uxY8FMt0yJpnXP4ALUndL-a-8sdoCB3MTV2Z4m X-TOI-EXPURGATEID: 150726::1603262434-0000E07B-282709CF/0/0 CLEAN NORMAL X-TOI-MSGID: 2ed298dc-7241-4475-90c3-52dec2575cea Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=194.25.134.21; envelope-from=volker.ruemelin@t-online.de; helo=mailout10.t-online.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/21 02:40:46 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: 1 X-Spam_score: 0.1 X-Spam_bar: / X-Spam_report: (0.1 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, SPOOFED_FREEMAIL=1.987 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Commit 9ce44e2ce2 "qmp: Move dispatcher to a coroutine" modified aio_poll() in util/aio-posix.c to avoid an assertion failure. This change is missing in util/aio-win32.c. Apply the changes to util/aio-posix.c to util/aio-win32.c too. This fixes an assertion failure on Windows whenever QEMU exits. $ ./qemu-system-x86_64.exe -machine pc,accel=3Dtcg -display gtk ** ERROR:../qemu/util/aio-win32.c:337:aio_poll: assertion failed: (in_aio_context_home_thread(ctx)) Bail out! ERROR:../qemu/util/aio-win32.c:337:aio_poll: assertion failed: (in_aio_context_home_thread(ctx)) Fixes: 9ce44e2ce2 ("qmp: Move dispatcher to a coroutine") Signed-off-by: Volker R=C3=BCmelin Tested-by: Mark Cave-Ayland --- util/aio-win32.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/util/aio-win32.c b/util/aio-win32.c index e7b1d649e9..168717b51b 100644 --- a/util/aio-win32.c +++ b/util/aio-win32.c @@ -18,6 +18,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "block/block.h" +#include "qemu/main-loop.h" #include "qemu/queue.h" #include "qemu/sockets.h" #include "qapi/error.h" @@ -333,8 +334,13 @@ bool aio_poll(AioContext *ctx, bool blocking) * There cannot be two concurrent aio_poll calls for the same AioConte= xt (or * an aio_poll concurrent with a GSource prepare/check/dispatch callba= ck). * We rely on this below to avoid slow locked accesses to ctx->notify_= me. + * + * aio_poll() may only be called in the AioContext's thread. iohandler= _ctx + * is special in that it runs in the main thread, but that thread's co= ntext + * is qemu_aio_context. */ - assert(in_aio_context_home_thread(ctx)); + assert(in_aio_context_home_thread(ctx =3D=3D iohandler_get_aio_context= () ? + qemu_get_aio_context() : ctx)); progress =3D false; =20 /* aio_notify can avoid the expensive event_notifier_set if --=20 2.26.2